net.sf.doolin.gui.docking
Class DockingWindowDescriptor<B>

java.lang.Object
  extended by net.sf.doolin.gui.window.descriptor.AbstractGUIWindowDescriptor<B>
      extended by net.sf.doolin.gui.window.descriptor.AbstractCompositeGUIWindowDescriptor<B,DockingConstraint>
          extended by net.sf.doolin.gui.docking.DockingWindowDescriptor<B>
Type Parameters:
B - Type of bean for the window
All Implemented Interfaces:
GUIWindowDescriptor<B>, org.springframework.beans.factory.BeanNameAware

public class DockingWindowDescriptor<B>
extends AbstractCompositeGUIWindowDescriptor<B,DockingConstraint>

Window descriptor based on Javadocking API.

Author:
Damien Coraboeuf

Nested Class Summary
protected static class DockingWindowDescriptor.CloseAction
          Decorator for the close action that controls if the view can be closed
 
Field Summary
protected static String CLIENT_PROPERTY_DOCK_MODEL
          Client property that stores in the window the DockModel.
protected static String VIEW_PROPERTY_DOCKING_CLOSE_ACTION
          View property that stores the Javadocking close action
 
Constructor Summary
DockingWindowDescriptor()
           
 
Method Summary
 void activateView(GUIWindow<B> window, GUIView<?> view)
          Does nothing.
protected
<V> void
arrangeViewInWindow(GUIWindow<B> window, GUIView<V> view, JComponent viewDecoratedComponent, DockingConstraint constraint)
          Arrange view.
protected  void arrangeViews(GUIWindow<B> window)
          Arranges the views inside the window.
protected  void arrangeWindow(GUIWindow<B> window)
          Arranges the window.
protected
<V> com.javadocking.dockable.Dockable
createViewDockable(GUIWindow<B> window, GUIView<V> view, JComponent viewDecoratedComponent, DockingConstraint constraint)
          Creates a Dockable for a view.
protected  void fillDockDescription(DockDescription dockDescription, com.javadocking.dock.CompositeDock parentDock)
          Fills the dock description for a dock.
protected
<V> ViewReference<V,DockingConstraint>
findViewReference(GUIWindow<B> parentWindow, GUIViewDescriptor<V> viewDescriptor, V viewModel)
          Finds a view reference for the given view descriptor and view model.
protected  com.javadocking.dock.Dock getDock(com.javadocking.dock.Dock dock, String dockingPath)
          Gets the dock from a root dock using a docking path
protected  com.javadocking.dockable.Dockable getDockable(GUIView<?> view)
          Gets the Dockable for a view.
protected  com.javadocking.dock.Dock getDockAt(com.javadocking.dock.CompositeDock compositeDock, com.javadocking.dock.Position position)
          Gets the dock at a given position
protected  String getDockingPath(com.javadocking.dock.Dock dock)
          Gets the docking path for a given dock, starting from the root.
protected  String getDockingPath(com.javadocking.dockable.Dockable dockable)
          Gets the docking path for a Dockable from the root.
protected  com.javadocking.model.DockModel getDockModel(GUIWindow<B> window)
          Gets the DockModel that is associated to a window using its client property CLIENT_PROPERTY_DOCK_MODEL.
 void hideView(GUIWindow<B> window, GUIView<?> view)
          Does nothing.
 void init()
          General initialisation of the DockingManager
 boolean isSaveWorkspace()
          Checks if the docking must be saved when the window is closed.
protected  com.javadocking.dock.Position normalizePosition(com.javadocking.dock.Position p)
          Normalises a Position by converting to horizontal instead of vertical positions.
 void onClosingWindow(GUIWindow<B> window)
          Saves the docking paths
protected  void restore(GUIWindow<B> window, com.javadocking.dock.CompositeDock parentDock, DockDescription dockDescription)
          Restores the docking description for a window.
protected  void restore(GUIWindow<B> window, DockDescription dockDescription)
          Restores the docking for a window
protected
<V> void
restoreView(GUIWindow<B> window, ViewReference<V,DockingConstraint> viewReference, com.javadocking.dock.Dock dock)
          Restores the docking for a view
 void setDockingStorage(DockingStorage dockingStorage)
          Sets the storage used to store the docking information.
 void setSaveWorkspace(boolean saveWorkspace)
          Sets if the docking must be saved when the window is closed.
protected  String toString(com.javadocking.dock.Position position)
          Converts a position to a string.
 
Methods inherited from class net.sf.doolin.gui.window.descriptor.AbstractCompositeGUIWindowDescriptor
arrangeView, arrangeViewReference, arrangeViewWithReference, getViewDecorator, getViewReferences, openView, setViewDecorator, setViewReferences
 
Methods inherited from class net.sf.doolin.gui.window.descriptor.AbstractGUIWindowDescriptor
arrange, arrangeActionBars, createWindow, getActionFactory, getCloseAction, getIconId, getIconService, getMenuBar, getSize, getTitleExpression, getToolBars, getWindow, getWindowId, getWindowId, getWindowListeners, initViewComponent, onCloseWindow, onOpenedWindow, setActionFactory, setBeanName, setCloseAction, setIconId, setIconService, setMenuBar, setSize, setTitleExpression, setToolBars, setWindowFactory, setWindowId, setWindowListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.beans.factory.BeanNameAware
setBeanName
 

Field Detail

VIEW_PROPERTY_DOCKING_CLOSE_ACTION

protected static final String VIEW_PROPERTY_DOCKING_CLOSE_ACTION
View property that stores the Javadocking close action

See Also:
PropertyContainer.getProperty(Object), PropertyContainer.setProperty(Object, Object), Constant Field Values

CLIENT_PROPERTY_DOCK_MODEL

protected static final String CLIENT_PROPERTY_DOCK_MODEL
Client property that stores in the window the DockModel.

See Also:
Constant Field Values
Constructor Detail

DockingWindowDescriptor

public DockingWindowDescriptor()
Method Detail

activateView

public void activateView(GUIWindow<B> window,
                         GUIView<?> view)
Description copied from class: AbstractGUIWindowDescriptor
Does nothing.

Specified by:
activateView in interface GUIWindowDescriptor<B>
Overrides:
activateView in class AbstractGUIWindowDescriptor<B>
Parameters:
window - the window
view - the view
See Also:
GUIView.show()

hideView

public void hideView(GUIWindow<B> window,
                     GUIView<?> view)
Description copied from class: AbstractGUIWindowDescriptor
Does nothing.

Specified by:
hideView in interface GUIWindowDescriptor<B>
Overrides:
hideView in class AbstractGUIWindowDescriptor<B>
Parameters:
window - the window
view - the view

init

@PostConstruct
public void init()
General initialisation of the DockingManager


isSaveWorkspace

public boolean isSaveWorkspace()
Checks if the docking must be saved when the window is closed.

Returns:
true if the docking must be saved when the window is closed.

onClosingWindow

public void onClosingWindow(GUIWindow<B> window)
Saves the docking paths

Specified by:
onClosingWindow in interface GUIWindowDescriptor<B>
Overrides:
onClosingWindow in class AbstractGUIWindowDescriptor<B>
Parameters:
window - Window to close

setDockingStorage

public void setDockingStorage(DockingStorage dockingStorage)
Sets the storage used to store the docking information.

Parameters:
dockingStorage - Storage to use

setSaveWorkspace

public void setSaveWorkspace(boolean saveWorkspace)
Sets if the docking must be saved when the window is closed.

Parameters:
saveWorkspace - true if the docking must be saved when the window is closed.

arrangeViewInWindow

protected <V> void arrangeViewInWindow(GUIWindow<B> window,
                                       GUIView<V> view,
                                       JComponent viewDecoratedComponent,
                                       DockingConstraint constraint)
Description copied from class: AbstractCompositeGUIWindowDescriptor
Arrange view.

Specified by:
arrangeViewInWindow in class AbstractCompositeGUIWindowDescriptor<B,DockingConstraint>
Type Parameters:
V - Type of data for the view
Parameters:
window - the window
view - the view
viewDecoratedComponent - the view decorated component
constraint - the constraint

arrangeViews

protected void arrangeViews(GUIWindow<B> window)
Description copied from class: AbstractCompositeGUIWindowDescriptor
Arranges the views inside the window.

Overrides:
arrangeViews in class AbstractCompositeGUIWindowDescriptor<B,DockingConstraint>
Parameters:
window - Window to arrange

arrangeWindow

protected void arrangeWindow(GUIWindow<B> window)
Description copied from class: AbstractCompositeGUIWindowDescriptor
Arranges the window.

Specified by:
arrangeWindow in class AbstractCompositeGUIWindowDescriptor<B,DockingConstraint>
Parameters:
window - Window

createViewDockable

protected <V> com.javadocking.dockable.Dockable createViewDockable(GUIWindow<B> window,
                                                                   GUIView<V> view,
                                                                   JComponent viewDecoratedComponent,
                                                                   DockingConstraint constraint)
Creates a Dockable for a view.

Type Parameters:
V - Type of bean for the view
Parameters:
window - Hosting docking window
view - View to dock
viewDecoratedComponent - Decorated component for the view
constraint - Docking constraints
Returns:
Dockable

fillDockDescription

protected void fillDockDescription(DockDescription dockDescription,
                                   com.javadocking.dock.CompositeDock parentDock)
Fills the dock description for a dock.

Parameters:
dockDescription - Dock description to fill
parentDock - Parent dock

findViewReference

protected <V> ViewReference<V,DockingConstraint> findViewReference(GUIWindow<B> parentWindow,
                                                                   GUIViewDescriptor<V> viewDescriptor,
                                                                   V viewModel)
Description copied from class: AbstractCompositeGUIWindowDescriptor
Finds a view reference for the given view descriptor and view model.

Overrides:
findViewReference in class AbstractCompositeGUIWindowDescriptor<B,DockingConstraint>
Type Parameters:
V - Type of data for the view
Parameters:
parentWindow - Parent window
viewDescriptor - View descriptor
viewModel - Data for the view
Returns:
View reference

getDock

protected com.javadocking.dock.Dock getDock(com.javadocking.dock.Dock dock,
                                            String dockingPath)
Gets the dock from a root dock using a docking path

Parameters:
dock - Root dock
dockingPath - Docking path
Returns:
Dock to use (can have been created)

getDockable

protected com.javadocking.dockable.Dockable getDockable(GUIView<?> view)
Gets the Dockable for a view.

Parameters:
view - View
Returns:
Dockable or null if not found.

getDockAt

protected com.javadocking.dock.Dock getDockAt(com.javadocking.dock.CompositeDock compositeDock,
                                              com.javadocking.dock.Position position)
Gets the dock at a given position

Parameters:
compositeDock - Parent dock
position - Position
Returns:
Dock at this position or null if none is defined

getDockingPath

protected String getDockingPath(com.javadocking.dock.Dock dock)
Gets the docking path for a given dock, starting from the root.

Parameters:
dock - Dock to retrieve the path for
Returns:
Docking path

getDockingPath

protected String getDockingPath(com.javadocking.dockable.Dockable dockable)
Gets the docking path for a Dockable from the root.

Parameters:
dockable - Dockable to retrieve the path for
Returns:
Docking path

getDockModel

protected com.javadocking.model.DockModel getDockModel(GUIWindow<B> window)
Gets the DockModel that is associated to a window using its client property CLIENT_PROPERTY_DOCK_MODEL.

Parameters:
window - Window
Returns:
DockModel instance

normalizePosition

protected com.javadocking.dock.Position normalizePosition(com.javadocking.dock.Position p)
Normalises a Position by converting to horizontal instead of vertical positions. null stays null.

Parameters:
p - Initial position
Returns:
Converted position

restore

protected void restore(GUIWindow<B> window,
                       com.javadocking.dock.CompositeDock parentDock,
                       DockDescription dockDescription)
Restores the docking description for a window.

Parameters:
window - Docking window
parentDock - Root dock
dockDescription - Description for this dock

restore

protected void restore(GUIWindow<B> window,
                       DockDescription dockDescription)
Restores the docking for a window

Parameters:
window - Window
dockDescription - Description for the root dock

restoreView

protected <V> void restoreView(GUIWindow<B> window,
                               ViewReference<V,DockingConstraint> viewReference,
                               com.javadocking.dock.Dock dock)
Restores the docking for a view

Type Parameters:
V - Type of bean for the view
Parameters:
window - Hosting window
viewReference - View reference for the view
dock - Root dock

toString

protected String toString(com.javadocking.dock.Position position)
Converts a position to a string.

Parameters:
position - Position
Returns:
String


Copyright © 2011. All Rights Reserved.