Class DockingManager
- java.lang.Object
-
- org.flexdock.docking.DockingManager
-
- All Implemented Interfaces:
DockingConstants
public class DockingManager extends java.lang.Object implements DockingConstants
This class is used as a public facade into the framework docking system. It provides a straightforward public API for managing and manipulating the various different subcomponents that make up the docking framework through a single class.DockingManagercannot be instantiated. Rather, its methods are accessed statically from within application code and it generally defers processing to a set of abstract handlers hidden from the application layer. AmongDockingManager'sresponsibilities are as follows:- Maintaining a component repository.
- All
DockablesandDockingPortsare cached within an and accessible through and internal registry. - Maintaining framework state.
DockingManagerprovides APIs for managing various different global framework settings, including application-key, floating support, auto-persistence,LayoutManagers, andMinimizationManagers.- Behavioral auto-configuration.
-
DockingManagerautomatically adds and removes necessary event listeners to enable/disable drag-to-dock behavior as components are registered and unregistered. - Programmatic access to docking operations.
-
DockingManagerprovides public APIs for programmatically dock, undock, minimize, persist, and loadDockablesfrom storage.
- Author:
- Christopher Butler
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringLAYOUT_MANAGERstatic java.lang.StringMINIMIZE_MANAGER-
Fields inherited from interface org.flexdock.docking.DockingConstants
ACTIVE_WINDOW, BOTTOM, CENTER, CENTER_REGION, CLOSE_ACTION, DEFAULT_PERSISTENCE_KEY, DOCKING_ID, EAST_REGION, HEAVYWEIGHT_DOCKABLES, HORIZONTAL, LEFT, MOUSE_PRESSED, NORTH_REGION, PERMANENT_FOCUS_OWNER, PIN_ACTION, REGION, RIGHT, SOUTH_REGION, TOP, UNINITIALIZED, UNINITIALIZED_RATIO, UNKNOWN_REGION, UNSPECIFIED_SIBLING_PREF, VERTICAL, WEST_REGION
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddDragSource(Dockable dockable, java.awt.Component dragSrc)static voidclose(Dockable dockable)Convenience method that removes the specifiedDockablefrom the layout.static booleandisplay(java.lang.String dockable)Displays theDockablewith the specified ID within the application's docking layout.static booleandisplay(Dockable dockable)Displays the specifiedDockablein the application's docking layout.static booleandock(java.awt.Component dockable, java.awt.Component parent)Docks the specifiedComponentrelative to another already-dockedComponentin the CENTER region.static booleandock(java.awt.Component dockable, java.awt.Component parent, java.lang.String region)Docks the specifiedComponentrelative to another already-dockedComponentin the specified region.static booleandock(java.awt.Component dockable, java.awt.Component parent, java.lang.String region, float proportion)Docks the specifiedComponentrelative to another already-dockedComponentin the specified region with the specified split proportion.static booleandock(java.awt.Component dockable, DockingPort port)Docks the specifiedComponentinto the CENTER region of the specifiedDockingPort.static booleandock(java.awt.Component dockable, DockingPort port, java.lang.String region)Docks the specifiedComponentinto the supplied region of the specifiedDockingPort.static booleandock(Dockable dockable, Dockable parent)Docks the specifiedDockablerelative to another already-dockedDockablein the CENTER region.static booleandock(Dockable dockable, Dockable parent, java.lang.String region)Docks the specifiedDockablerelative to another already-dockedDockablein the specified region.static booleandock(Dockable dockable, Dockable parent, java.lang.String region, float proportion)Docks the specifiedDockablerelative to another already-dockedDockablein the specified region with the specified split proportion.static booleandock(Dockable dockable, DockingPort port, java.lang.String region)Docks the specifiedDockableinto the supplied region of the specifiedDockingPort.static java.lang.StringgetDefaultPersistenceKey()static floatgetDefaultSiblingSize()static DockablegetDockable(java.awt.Component comp)Returns theDockableinstance that models the specifiedComponent.static DockablegetDockable(java.lang.String id)Returns theDockableinstance with the specified ID.static DockableFactorygetDockableFactory()Returns the currently installedDockableFactory.static java.util.SetgetDockableIds()Returns aSetofStringIDs for allDockablesregistered with the framework.static DockingPortgetDockingPort(java.awt.Component dockable)Returns theDockingPortthat contains the specifiedComponent.static DockingPortgetDockingPort(java.lang.String portId)Returns theDockingPortwith the specified ID.static DockingPortgetDockingPort(Dockable dockable)Returns theDockingPortthat contains the specifiedDockable.static DockingStategetDockingState(java.lang.String dockableId)Returns theDockingStatefor theDockablewith the specified ID.static DockingStategetDockingState(Dockable dockable)Returns theDockingStatefor the specifiedDockable.static DockingStrategygetDockingStrategy(java.lang.Class classKey)Returns theDockingStrategyassociated with specifiedClass.static DockingStrategygetDockingStrategy(java.lang.Object obj)Returns theDockingStrategyassociated with theClassof theObjectparameter.static RootWindow[]getDockingWindows()Returns an array ofRootWindowsknown to the docking framework that containDockingPorts.static DragManagergetDragListener(Dockable dockable)Returns the listener object responsible for managing drag-to-dock mouse events for the specifiedDockable.static FloatManagergetFloatManager()Returns the currently installedFloatManager.static LayoutManagergetLayoutManager()Returns the currently installedLayoutManager.static DockingPortgetMainDockingPort(java.awt.Component comp)Returns the "main"DockingPortwithin the application window containing the specifiedComponent.static MinimizationManagergetMinimizeManager()Returns the currently installedMinimizationManager.static DockingPortgetRootDockingPort(java.awt.Component comp)Returns the first rootDockingPortfound within the application window containing the specifiedComponent.static RootDockingPortInfogetRootDockingPortInfo(java.awt.Component comp)Returns theRootDockingPortInfoinstance associated with the root window containing the specifiedComponent.static booleanisDocked(java.awt.Component component)Indicates whether the specifiedComponentis currently docked.static booleanisDocked(Dockable dockable)Indicates whether the specifiedDockableis currently docked.static booleanisDocked(DockingPort dockingPort, Dockable dockable)Checks whether a suppliedDockableis docked within a suppliedDockingPortinstance.static booleanisFloatingEnabled()Indicates whether global floating support is currently enabled.static booleanisMaximized(Dockable dockable)static booleanisSingleTabsAllowed()Indicates whether tabbed layouts are supported by default forDockingPortswith a singleDockablein the CENTER region.static booleanisValidDockingRegion(java.lang.String region)Indicates whether the supplied parameter is considered a valid docking region.static booleanloadLayoutModel()Loads a previously stored layout model into the currently installedLayoutManager.static booleanloadLayoutModel(boolean restore)Loads a previously stored layout model into the currently installedLayoutManagerand attempts to synchronize the application view with the newly loaded layout model if therestoreparameter istrue.static DockableregisterDockable(java.awt.Component comp)Creates, registers, and returns aDockablefor the specifiedComponent.static DockableregisterDockable(java.awt.Component comp, java.lang.String tabText)Creates aDockablefor the specifiedComponentand dispatches toregisterDockable(Dockable init).static DockableregisterDockable(Dockable dockable)Registers and initializes the specifiedDockable.static voidremoveDragListeners(java.awt.Component comp)Removes the event listeners that manage drag-n-drop docking operations from the specifiedComponent.static booleanrestoreLayout()Synchronizes the application view with the current in-memory layout model.static booleanrestoreLayout(boolean loadFromStorage)Synchronizes the application view with the current in-memory layout model.static voidsetAutoPersist(boolean enabled)Enables and disables auto-persistence of the current docking layout model when the application exits.static voidsetDefaultPersistenceKey(java.lang.String key)static voidsetDefaultSiblingSize(float size)static voidsetDockableFactory(DockableFactory factory)Sets the currently installedDockableFactory.static voidsetDockingStrategy(java.lang.Class classKey, DockingStrategy strategy)Sets theDockingStrategyassociated with specifiedClass.static voidsetDragPreview(DragPreview dragPreview)static voidsetFloatingEnabled(boolean enabled)Sets whether global floating support should be enabled.static voidsetLayoutManager(java.lang.String mgrClass)Sets the currently installedLayoutManagerusing the specified class name.static voidsetLayoutManager(LayoutManager mgr)Sets the currently installedLayoutManager.static voidsetMainDockingPort(java.awt.Component window, java.lang.String portId)Sets the "main"DockingPortwithin the application window containing the specifiedComponent.static voidsetMinimized(Dockable dockable, boolean minimized)Sets the minimized state for the specifiedDockable.static voidsetMinimized(Dockable dockable, boolean minimizing, int constraint)Sets the minimized state for the specifiedDockable.static voidsetMinimized(Dockable dockable, boolean minimized, java.awt.Component window)Sets the minimized state for the specifiedDockable.static voidsetMinimized(Dockable dockable, boolean minimizing, java.awt.Component window, int constraint)Sets the minimized state for the specifiedDockable.static voidsetMinimizeManager(java.lang.String mgrClass)Sets the currently installedMinimizationManagerusing the specfied class name.static voidsetMinimizeManager(MinimizationManager mgr)Sets the currently installedMinimizationManager.static voidsetRubberBand(RubberBand rubberBand)static voidsetSingleTabsAllowed(boolean allowed)Sets whether tabbed layouts are supported by default forDockingPortswith a singleDockablein the CENTER region.static voidsetSplitProportion(java.awt.Component dockable, float proportion)Sets the divider location of the split layout containing the specified dockableComponent.static voidsetSplitProportion(Dockable dockable, float proportion)Sets the divider location of the split layout containing the specified dockableComponent.static voidsetSplitProportion(DockingPort port, float proportion)Sets the divider location of the split layout embedded within the specifiedDockingPort.static booleanstoreLayoutModel()Sends the application's current layout model to external storage.static voidtoggleMaximized(java.awt.Component comp)Maximizes theDockableassociated with the specified component or restores theDockableif it is currently maximized.static voidtoggleMaximized(Dockable dockable)Maximizes the specifiedDockableor restores the specifiedDockableif it is already maximized.static booleanundock(java.awt.Component dockable)static booleanundock(Dockable dockable)Undocks the specifiedDockablefrom its parentDockingPort.static voidunregisterDockable(java.awt.Component comp)static voidunregisterDockable(java.lang.String dockingId)static voidunregisterDockable(Dockable dockable)static voidupdateDragListeners(Dockable dockable)Ensures that a validDragManagerhas been installed as a listener for all of the specifiedDockable'sdrag sourceComponents.
-
-
-
Field Detail
-
MINIMIZE_MANAGER
public static final java.lang.String MINIMIZE_MANAGER
- See Also:
- Constant Field Values
-
LAYOUT_MANAGER
public static final java.lang.String LAYOUT_MANAGER
- See Also:
- Constant Field Values
-
-
Method Detail
-
addDragSource
public static void addDragSource(Dockable dockable, java.awt.Component dragSrc)
-
close
public static void close(Dockable dockable)
Convenience method that removes the specifiedDockablefrom the layout. If theDockableis embedded within the main application frame or a floating dialog, it is removed from the container hierarchy. If theDockableis presently minimized, it is removed from the current minimization manager. If theDockableis already "closed" or isnull, no operation is performed. "Closing" aDockableonly removes it from the visual layout. It does not remove it from the internalDockableregistry and all underlyingDockingStateinformation remains consistent so that theDockablemay later be restored to its original location within the application.- Parameters:
dockable- theDockableto be closed.
-
dock
public static boolean dock(java.awt.Component dockable, DockingPort port)Docks the specifiedComponentinto the CENTER region of the specifiedDockingPort. If theDockingManagerfinds a validDockableinstance mapped to the specifiedComponent, theDockablewill be docked into theDockingPort. If theComponentorDockingPortisnull, or a validDockablecannot be found for the specifiedComponent, this method returnsfalse. Otherwise, this method returnstrueif the docking operation was successful andfalseif the docking operation cannot be completed. This method defers processing todock(Component dockable , DockingPort port, String region).- Parameters:
dockable- theComponentto be docked.port- theDockingPortinto which the specifiedComponentwill be docked.- Returns:
trueif the docking operation was successful,falseotherwise.- See Also:
dock(Component, DockingPort, String)
-
dock
public static boolean dock(java.awt.Component dockable, DockingPort port, java.lang.String region)Docks the specifiedComponentinto the supplied region of the specifiedDockingPort. If theDockingManagerfinds a validDockableinstance mapped to the specifiedComponent, theDockablewill be docked into theDockingPort. If theComponentorDockingPortisnull, or a validDockablecannot be found for the specifiedComponent, this method returnsfalse. Otherwise, this method returnstrueif the docking operation was successful andfalseif the docking operation cannot be completed. This method defers processing todock(Dockable dockable, DockingPort port, String region).- Parameters:
dockable- theComponentto be docked.port- theDockingPortinto which the specifiedComponentwill be docked.region- the region into which to dock the specifiedComponent- Returns:
trueif the docking operation was successful,falseif the docking operation cannot be completed.- See Also:
dock(Dockable, DockingPort, String)
-
dock
public static boolean dock(Dockable dockable, DockingPort port, java.lang.String region)
Docks the specifiedDockableinto the supplied region of the specifiedDockingPort. If theDockableorDockingPortisnull, this method returnsfalse. Otherwise, this method returnstrueif the docking operation was successful andfalseif the docking operation cannot be completed. This method determines theDockingStrategyto be used for the specifiedDockingPortand defers processing to theDockingStrategy. This method's return value will be based upon theDockingStrategyimplementation and is subject to conditions such as whether the supplied region is deemed valid, whether theDockingStrategyallows this particularDockableto be docked into the supplied region of the specifiedDockingPort, and so on. TheDockingStrategyused is obtained by a call togetDockingStrategy(Object obj)and may be controlled viasetDockingStrategy(Class c, DockingStrategy strategy), supplying aDockingPortimplementation class and a customizedDockingStrategy.- Parameters:
dockable- theDockableto be docked.port- theDockingPortinto which the specifiedComponentwill be docked.region- the region into which to dock the specifiedDockable- Returns:
trueif the docking operation was successful,falseotherwise.- See Also:
DockingStrategy.dock(Dockable, DockingPort, String),getDockingStrategy(Object),setDockingStrategy(Class, DockingStrategy)
-
dock
public static boolean dock(java.awt.Component dockable, java.awt.Component parent)Docks the specifiedComponentrelative to another already-dockedComponentin the CENTER region. ValidDockableinstances are looked up for bothComponentparameters and processing is deferred todock(Dockable dockable, Dockable parent). If a validDockablecannot be resolved for eitherComponent, then this method returnsfalse. The "parent"Dockablemust currently be docked. If not, this method will returnfalse. Otherwise, its parentDockingPortwill be resolved and the newDockablewill be docked into theDockingPortrelative to the "parent"Dockable.- Parameters:
dockable- theComponentto be dockedparent- theComponentused as a reference point for docking- Returns:
trueif the docking operation was successful;falseotherwise.- See Also:
dock(Dockable, Dockable)
-
dock
public static boolean dock(Dockable dockable, Dockable parent)
Docks the specifiedDockablerelative to another already-dockedDockablein the CENTER region. The "parent"Dockablemust currently be docked. If not, this method will returnfalse. Otherwise, its parentDockingPortwill be resolved and the newDockablewill be docked into theDockingPortrelative to the "parent"Dockable. This method defers processing todock(Dockable dockable, Dockable parent, String region)and returnsfalseif any of the input parameters arenull.- Parameters:
dockable- theDockableto be dockedparent- theDockableused as a reference point for docking- Returns:
trueif the docking operation was successful;falseotherwise.- See Also:
dock(Dockable, Dockable, String)
-
dock
public static boolean dock(java.awt.Component dockable, java.awt.Component parent, java.lang.String region)Docks the specifiedComponentrelative to another already-dockedComponentin the specified region. ValidDockableinstances will be looked up for each of theComponentparameters. If a validDockableis not found for eitherComponent, then this method returnsfalse. The "parent"Dockablemust currently be docked. If not, this method will returnfalse. Otherwise, its parentDockingPortwill be resolved and the newDockablewill be docked into theDockingPortrelative to the "parent"Dockable. This method defers processing todock(Component dockable, Component parent, String region, float proportion)and returnsfalseif any of the input parameters arenull. If the specified region is other than CENTER, then a split layout should result. This method supplies a split proportion of 0.5F, resulting in equal distribution of space between the dockable and parent parameters if docking is successful.- Parameters:
dockable- theComponentto be dockedparent- theComponentused as a reference point for dockingregion- the relative docking region into whichdockablewill be docked- Returns:
trueif the docking operation was successful;falseotherwise.- See Also:
dock(Component, Component, String, float)
-
dock
public static boolean dock(Dockable dockable, Dockable parent, java.lang.String region)
Docks the specifiedDockablerelative to another already-dockedDockablein the specified region. The "parent"Dockablemust currently be docked. If not, this method will returnfalse. Otherwise, its parentDockingPortwill be resolved and the newDockablewill be docked into theDockingPortrelative to the "parent"Dockable. This method defers processing todock(Dockable dockable, Dockable parent, String region, float proportion)and returnsfalseif any of the input parameters arenull. If the specified region is other than CENTER, then a split layout should result. This method supplies a split proportion of 0.5F, resulting in equal distribution of space between the dockable and parent parameters if docking is successful.- Parameters:
dockable- theDockableto be dockedparent- theDockableused as a reference point for dockingregion- the docking region into whichdockablewill be docked- Returns:
trueif the docking operation was successful;falseotherwise.- See Also:
dock(Dockable, Dockable, String, float)
-
dock
public static boolean dock(java.awt.Component dockable, java.awt.Component parent, java.lang.String region, float proportion)Docks the specifiedComponentrelative to another already-dockedComponentin the specified region with the specified split proportion. ValidDockableinstances will be looked up for each of theComponentparameters. If a validDockableis not found for eitherComponent, then this method returnsfalse. The "parent"Dockablemust currently be docked. If not, this method will returnfalse. Otherwise, its parentDockingPortwill be resolved and the newDockablewill be docked into theDockingPortrelative to the "parent"Dockable. If the specified region is CENTER, then theproportionparameter is ignored. Otherwise, a split layout should result with the proportional space specified in theproportionparameter allotted to thedockableargument. This method defers processing todock(Dockable dockable, Dockable parent, String region, float proportion).- Parameters:
dockable- theComponentto be dockedparent- theComponentused as a reference point for dockingregion- the relative docking region into whichdockablewill be dockedproportion- the proportional space to allot thedockableargument if the docking operation results in a split layout.- Returns:
trueif the docking operation was successful;falseotherwise.
-
dock
public static boolean dock(Dockable dockable, Dockable parent, java.lang.String region, float proportion)
Docks the specifiedDockablerelative to another already-dockedDockablein the specified region with the specified split proportion. The "parent"Dockablemust currently be docked. If not, this method will returnfalse. Otherwise, its parentDockingPortwill be resolved and the newDockablewill be docked into theDockingPortrelative to the "parent"Dockable. If the specified region is CENTER, then theproportionparameter is ignored. Otherwise, a split layout should result with the proportional space specified in theproportionparameter allotted to thedockableargument.- Parameters:
dockable- theDockableto be dockedparent- theDockableused as a reference point for dockingregion- the docking region into whichdockablewill be dockedproportion- the proportional space to allot thedockableargument if the docking operation results in a split layout.- Returns:
trueif the docking operation was successful;falseotherwise.
-
isDocked
public static boolean isDocked(java.awt.Component component)
Indicates whether the specifiedComponentis currently docked. This method looks up a parentDockingPortfor the specifiedComponentvia a call togetDockingPort(Component dockable). This method returnstrueif a parentDockingPortis found andfalseif no parentDockingPortis present. This method returnsfalseif theComponentparameter isnull.- Parameters:
component- theComponentwhose docking status is to be examined- Returns:
trueif theComponentis currently docked; otherwisefalse.
-
isDocked
public static boolean isDocked(Dockable dockable)
Indicates whether the specifiedDockableis currently docked. This method looks up a parentDockingPortfor the specifiedDockablevia a call togetDockingPort(Dockable dockable). This method returnstrueif a parentDockingPortis found andfalseif no parentDockingPortis present. This method returnsfalseif theDockableparameter isnull.- Parameters:
dockable- theDockablewhose docking status is to be examined- Returns:
trueif theDockableis currently docked; otherwisefalse.
-
isDocked
public static boolean isDocked(DockingPort dockingPort, Dockable dockable)
Checks whether a suppliedDockableis docked within a suppliedDockingPortinstance. Returnstrueif theDockingPortcontains the specifiedDockable;falseotherwise. This method returnsfalseif either of the input parameters arenull.- Parameters:
dockingPort- theDockingPortto be testeddockable- theDockableinstance to be examined- Returns:
trueif the suppliedDockingPortcontains the specifiedDockable;falseotherwise.
-
isFloatingEnabled
public static boolean isFloatingEnabled()
Indicates whether global floating support is currently enabled. Defers processing toFloatPolicyManager.isGlobalFloatingEnabled().- Returns:
trueif global floating support is enabled,falseotherwise.- See Also:
FloatPolicyManager.isGlobalFloatingEnabled()
-
isSingleTabsAllowed
public static boolean isSingleTabsAllowed()
Indicates whether tabbed layouts are supported by default forDockingPortswith a singleDockablein the CENTER region. This is a global default setting and applies to anyDockingPort} that does not have a specific contradictory local setting. This method defers processing to
org.flexdock.docking.props.PropertyManager.getDockingPortRoot(). As such, there are multiple "scopes" at which this property may be overridden.- Returns:
trueif the default setting forDockingPortsallows a tabbed layout for a singleDockablein the CENTER region;falseotherwise.- See Also:
PropertyManager.getDockingPortRoot(),DockingPortPropertySet.isSingleTabsAllowed()
-
isValidDockingRegion
public static boolean isValidDockingRegion(java.lang.String region)
Indicates whether the supplied parameter is considered a valid docking region. Valid values are those defined inDockingConstantsand includeNORTH_REGION,SOUTH_REGION,EAST_REGION,WEST_REGION, andCENTER_REGION. This method returnstrueif the supplied parameter is equal to one of these values.- Parameters:
region- the region value to be tested- Returns:
trueif the supplied parameter is a valid docking region;falseotherwise.
-
registerDockable
public static Dockable registerDockable(java.awt.Component comp)
Creates, registers, and returns aDockablefor the specifiedComponent. If the specifiedComponentimplements theDockableinterface, then this method dispatches toregisterDockable(Dockable dockable). Otherwise, this method dispatches toregisterDockable(Component comp, String tabText).This method attempts to resolve an appropriate value for
tabTextby callinggetName()on the specifiedComponent. If the resolved value isnullor empty, then the value"null"is used.If
compisnull, no exception is thrown and no action is performed.- Parameters:
comp- the target component for theDockable.- Returns:
- the
Dockablethat has been registered for the suppliedComponent - See Also:
registerDockable(Dockable),registerDockable(Component, String)
-
registerDockable
public static Dockable registerDockable(java.awt.Component comp, java.lang.String tabText)
Creates aDockablefor the specifiedComponentand dispatches toregisterDockable(Dockable init). Ifcompisnull, no exception is thrown and no action is performed.- Parameters:
comp- the target component for the Dockable, both drag-starter and docking sourcetabText- the description of the docking source. Used as the tab-title of docked in a tabbed pane- Returns:
- the
Dockablethat has been registered for the suppliedComponent - See Also:
registerDockable(Dockable)
-
registerDockable
public static Dockable registerDockable(Dockable dockable)
Registers and initializes the specifiedDockable. AllDockablesmanaged by the framework must, at some point, be registered via this method. This method adds theDockableto the internal registry, allowing querying by ID andComponent. Drag listeners are added to theDockableto enable drag-n-drop docking support. Docking properties are also initialized for theDockable. This method fires aRegistrationEventonce theDockablehas been registered. If theDockableisnull, noExceptionis thrown and no action is taken. TheDockablereturned by this method will be the same object passed in as an argument.- Parameters:
dockable- the Dockable that is being registered.- Returns:
- the
Dockablethat has been registered. - See Also:
RegistrationEvent
-
unregisterDockable
public static void unregisterDockable(java.awt.Component comp)
-
unregisterDockable
public static void unregisterDockable(java.lang.String dockingId)
-
unregisterDockable
public static void unregisterDockable(Dockable dockable)
-
removeDragListeners
public static void removeDragListeners(java.awt.Component comp)
Removes the event listeners that manage drag-n-drop docking operations from the specifiedComponent. If the specific listeners are not present, then no action is taken. Drag listeners used by the docking system are of typeorg.flexdock.docking.drag.DragManager.- Parameters:
comp- theComponentfrom which to remove drag listeners.- See Also:
DragManager
-
display
public static boolean display(Dockable dockable)
Displays the specifiedDockablein the application's docking layout. If theDockablehas not previously been docked, a suitable location is determined within the layout and theDockableis docked to that location. If theDockablehas previously been docked within the layout and subsequently removed, as with a call toDockingManager.close(), theDockablewill be restored to its prior state within the layout. This method defers processing to thedisplay(Dockable dockable)method for the currently installedorg.flexdock.docking.state.LayoutManager. TheLayoutManagerimplementation is responsible for handling the semantics of determining an initial docking location or restoring aDockableto its previous layout state. If theDockableparameter isnull, noExceptionis thrown and no action is taken.- Parameters:
dockable- theDockableto be displayed.- Returns:
trueif theDockablewas successfully displayed;falseotherwise.- See Also:
getLayoutManager(),LayoutManager.display(Dockable)
-
display
public static boolean display(java.lang.String dockable)
Displays theDockablewith the specified ID within the application's docking layout. A validDockableis looked up for the supplied ID. If none is found, this method returnsfalse. Otherwise, processing is dispatched todisplay(Dockable dockable). If theDockablehas not previously been docked, a suitable location is determined within the layout and theDockableis docked to that location. If theDockablehas previously been docked within the layout and subsequently removed, as with a call toDockingManager.close(), theDockablewill be restored to its prior state within the layout. This method defers processing to thedisplay(Dockable dockable)method for the currently installedorg.flexdock.docking.state.LayoutManager. TheLayoutManagerimplementation is responsible for handling the semantics of determining an initial docking location or restoring aDockableto its previous layout state. If theDockableparameter isnull, noExceptionis thrown and no action is taken.- Parameters:
dockable- the ID of theDockableto be displayed.- Returns:
trueif theDockablewas successfully displayed;falseotherwise.- See Also:
display(Dockable),getLayoutManager(),LayoutManager.display(Dockable)
-
getDockingStrategy
public static DockingStrategy getDockingStrategy(java.lang.Object obj)
Returns theDockingStrategyassociated with theClassof theObjectparameter. This method returnsnullif the parameter isnull. Otherwise, the method retrieves theObject'sClassand dispatches togetDockingStrategy(Class classKey).DockingStrategyassociation follows a strict inheritance chain usingorg.flexdock.util.ClassMapping. If a mapping forobj.getClass()is not found, then the superclass is tested, and so on untiljava.lang.Objectis reached. Thus, if aDockingStrategymapping ofFooexists for classBar, and classBazextendsBar, then calling this method for an instance ofBazwill return an instance ofFoo. The inheritance chain is strict in the sense that only superclasses are checked. Implemented interfaces are ignored.If a class association is never found, then an instance of
DefaultDockingStrategyis returned.- Parameters:
obj- the object whoseDockingStrategyassociation we wish to test- Returns:
- the
DockingStrategyassociated with theClasstype of theObjectparameter. - See Also:
getDockingStrategy(Class),setDockingStrategy(Class, DockingStrategy),ClassMapping.getClassInstance(Class)
-
getDockingStrategy
public static DockingStrategy getDockingStrategy(java.lang.Class classKey)
Returns theDockingStrategyassociated with specifiedClass. This method returnsnullif the parameter isnull.DockingStrategyassociation follows a strict inheritance chain usingorg.flexdock.util.ClassMapping. If a mapping forclassKeyis not found, then the superclass is tested, and so on untiljava.lang.Objectis reached. Thus, if aDockingStrategymapping ofFooexists for classBar, and classBazextendsBar, then calling this method for classBazwill return an instance ofFoo. The inheritance chain is strict in the sense that only superclasses are checked. Implemented interfaces are ignored.If a class association is never found, then an instance of
DefaultDockingStrategyis returned.- Parameters:
classKey- theClasswhoseDockingStrategyassociation we wish to test- Returns:
- the
DockingStrategyassociated with the specifiedClass. - See Also:
setDockingStrategy(Class, DockingStrategy),ClassMapping.getClassInstance(Class)
-
getDockingWindows
public static RootWindow[] getDockingWindows()
Returns an array ofRootWindowsknown to the docking framework that containDockingPorts. AnyFrame,Applet,Dialog, orWindowthat has aDockingPortadded as a descendentComponentwill automatically have anorg.flexdock.util.RootWindowwrapper instance associated with it. This method will return an array of all known RootWindows that containDockingPorts. Ordering of the array may be based off of ajava.util.Setand is not guaranteed.- Returns:
- an array of all known
RootWindowsthat containDockingPorts - See Also:
RootWindow,DockingPortTracker.getDockingWindows()
-
getDockingPort
public static DockingPort getDockingPort(java.lang.String portId)
Returns theDockingPortwith the specified ID. If theportIdparameter isnull, or aDockingPortwith the specified ID is not found, anullreference is returned. This method internally dispatches toorg.flexdock.docking.event.hierarchy.DockingPortTracker.findById(String portId).portIdshould match the value returned by aDockingPort'sgetPersistentId()method.- Parameters:
portId- the ID of theDockingPortto be looked up- Returns:
- the
DockingPortwith the specified ID - See Also:
DockingPort.getPersistentId(),DockingPortTracker.findById(String)
-
getMainDockingPort
public static DockingPort getMainDockingPort(java.awt.Component comp)
Returns the "main"DockingPortwithin the application window containing the specifiedComponent. Just as desktop applications will tend to have a "main" application window, perhaps surrounded with satellite windows or dialogs, the "main"DockingPortwithin a given window will be considered by the application developer to contain the primary docking layout used by the enclosing window.The
Componentparameter may or may not be a root window container. If not, the ancestor window ofcompis determined and a set of docking ports encapsulated by aRootDockingPortInfoinstance is returned by a call togetRootDockingPortInfo(Component comp). The resolvedRootDockingPortInfoinstance's mainDockingPortis returned via its methodgetMainPort().By default, the "main"
DockingPortassigned to anyRootDockingPortInfoinstance associated with a window will happen to be the first rootDockingPortdetected for that window. In essence, the default settings make this method identical togetRootDockingPort(Component comp). This, however, may be altered byRootDockingPortInfo'ssetMainPort(String portId)method based upon the needs of the application developer. In contrast,getMainDockingPort(Component comp)will always return the first rootDockingPortfound within a window.If
compisnullor the root window cannot be resolved, then this method returns anullreference. Anullreference is also returned if the root window does not contain anyDockingPorts.- Parameters:
comp- theComponentwhose root window will be checked for a mainDockingPort- Returns:
- the main
DockingPortwithin the root window that containscomp - See Also:
getRootDockingPortInfo(Component),getRootDockingPort(Component),DockingPortTracker.getRootDockingPortInfo(Component),RootDockingPortInfo.getMainPort(),RootDockingPortInfo.setMainPort(String)
-
getRootDockingPort
public static DockingPort getRootDockingPort(java.awt.Component comp)
Returns the first rootDockingPortfound within the application window containing the specifiedComponent. A "root"DockingPortis aDockingPortembedded within a window/frame/applet/dialog that is not nested within any other parentDockingPorts. TheComponentparameter may or may not be a root window container itself. If not, the root window containingcompis resolved and the first rootDockingPortfound within it is returned. This method defers actual processing toorg.flexdock.docking.event.hierarchy.DockingPortTracker.findByWindow(Component comp).If
compisnullor the root window cannot be resolved, then this method returns anullreference. Anullreference is also returned if the root window does not contain anyDockingPorts.This method differs from
getMainDockingPort(Component comp)in that the "main"DockingPortfor a given window is configurable by the application developer, whereas this method will always return the "first"DockingPortfound within the window. However, if the "main"DockingPorthas not been manually configured by the application developer, then this method andgetMainDockingPort(Component comp)will exhibit identical behavior.- Parameters:
comp- theComponentwhose root window will be checked for a rootDockingPort- Returns:
- the first root
DockingPortfound within the root window that containscomp - See Also:
getMainDockingPort(Component),DockingPortTracker.findByWindow(Component),RootDockingPortInfo
-
getRootDockingPortInfo
public static RootDockingPortInfo getRootDockingPortInfo(java.awt.Component comp)
Returns theRootDockingPortInfoinstance associated with the root window containing the specifiedComponent. TheComponentparameter may or may not be a root window container itself. If not, the root window containingcompis resolved and theRootDockingPortInfoinstance associated with the window is returned.RootDockingPortInfowill contain information regarding all of the "root"DockingPortsembedded within a root window where a "root"DockingPortis anyDockingPortembedded within the window that does not have any otherDockingPortancestors in it's container hierarchy.If
compisnullor the root window cannot be resolved, then this method returns anullreference. Anullreference is also returned if the root window does not contain anyDockingPorts.This method dispatches internally to
org.flexdock.docking.event.hierarchy.DockingPortTracker.getRootDockingPortInfo(Component comp).- Parameters:
comp- theComponentwhose root window will be checked for an associatedRootDockingPortInfo.- Returns:
- the
RootDockingPortInfoinstance associated with the root window containingcomp. - See Also:
RootDockingPortInfo,DockingPortTracker.getRootDockingPortInfo(Component)
-
storeLayoutModel
public static boolean storeLayoutModel() throws java.io.IOException, PersistenceExceptionSends the application's current layout model to external storage. This method defers processing to the currently installedorg.flexdock.docking.state.LayoutManagerby invoking itsstore()method. If there is noLayoutManagerinstalled, then this method returnsfalse.The layout model itself, along with storage mechanism, is abstract and dependent upon the particular
LayoutManagerimplementation. As such, it may be possible that theLayoutManageris unable to persist the current layout state for non-Exceptional reasons. This method returnstrueif the layout model was successfully stored andfalseif the layout model could not be stored under circumstances that do not generate anException(for instance, if there is no persistence implementation currently installed). If a problem occurs during the persistence process, anIOExceptionis thrown.- Returns:
trueif the current layout model was succesfully stored,falseotherwise.- Throws:
java.io.IOExceptionPersisterExceptionPersistenceException- See Also:
getLayoutManager(),setLayoutManager(LayoutManager),LayoutManager.store()
-
loadLayoutModel
public static boolean loadLayoutModel() throws java.io.IOException, PersistenceExceptionLoads a previously stored layout model into the currently installedLayoutManager. This method defers processing toloadLayoutModel(boolean restore)with an argument offalseto indicate that the stored data model should merely be loaded into memory and theLayoutManagershould not attempt to subsequently restore the application view by synchronizing it against the newly loaded data model.The layout model itself, along with storage mechanism, is abstract and dependent upon the particular
LayoutManagerimplementation. As such, it may be possible that theLayoutManageris unable to load the previous layout state for non-Exceptional reasons. This method returnstrueif the layout model was successfully loaded andfalseif the layout model could not be loaded under circumstances that do not generate anException(for instance, if there was no previous layout model found in storage). If a problem occurs during the loading process, anIOExceptionis thrown.- Returns:
trueif the current layout model was succesfully loaded,falseotherwise.- Throws:
java.io.IOExceptionPersisterExceptionPersistenceException- See Also:
loadLayoutModel(boolean),LayoutManager.load()
-
loadLayoutModel
public static boolean loadLayoutModel(boolean restore) throws java.io.IOException, PersistenceExceptionLoads a previously stored layout model into the currently installedLayoutManagerand attempts to synchronize the application view with the newly loaded layout model if therestoreparameter istrue. If there is no currently installedLayoutManager, then this method returnsfalse. If therestoreparameter istrue, then this method defers processing torestoreLayout(boolean loadFromStorage)with an argument oftrue. Otherwise, this method defers processing to the currently installedorg.flexdock.docking.state.LayoutManagerby invoking itsload()method.The layout model itself, along with storage mechanism, is abstract and dependent upon the particular
LayoutManagerimplementation. As such, it may be possible that theLayoutManageris unable to load the previous layout state for non-Exceptional reasons. This method returnstrueif the layout model was successfully loaded andfalseif the layout model could not be loaded under circumstances that do not generate anException(for instance, if there was no previous layout model found in storage). If a problem occurs during the loading process, anIOExceptionis thrown.- Returns:
trueif the current layout model was succesfully loaded,falseotherwise.- Throws:
java.io.IOExceptionPersisterExceptionPersistenceException- See Also:
getLayoutManager(),setLayoutManager(LayoutManager),restoreLayout(boolean),LayoutManager.load()
-
restoreLayout
public static boolean restoreLayout()
Synchronizes the application view with the current in-memory layout model. This method defers processing torestoreLayout(boolean loadFromStorage)with an argument offalse. This instructs the currently installedLayoutManagerto restore the application view to match the current in-memory layout model without reloading from storage prior to restoration. This method is useful for developers who choose to construct a layout model programmatically and wish to "commit" it to the application view, restoring their own in-memory layout model rather than a model persisted in external storage.If there is no
LayoutManagercurrently installed, then this method returnsfalse.- Returns:
trueif the in-memory layout model was properly restored to the application view,falseotherwise.- Throws:
PersisterException- See Also:
restoreLayout(boolean),getLayoutManager(),setLayoutManager(LayoutManager),LayoutManager.restore(boolean)
-
restoreLayout
public static boolean restoreLayout(boolean loadFromStorage) throws java.io.IOException, PersistenceExceptionSynchronizes the application view with the current in-memory layout model. This method defers processing to the currently installedorg.flexdock.docking.state.LayoutManagerby invoking itsrestore(boolean loadFromStorage)method. If there is noLayoutManagercurrently installed, then this method returnsfalse.If the
loadFromStorageparameter istrue, then theLayoutManageris instructed to load any persisted layout model from external storage into memory before synchronizing the application view. If a problem occurs while loading from exernal storage, this method throws anIOException.- Parameters:
loadFromStorage- instructs whether to load any layout model from external storage into memory before synchronizing the application view.- Returns:
trueif the in-memory layout model was properly restored to the application view,falseotherwise.- Throws:
PersisterExceptionjava.io.IOExceptionPersistenceException- See Also:
getLayoutManager(),setLayoutManager(LayoutManager),LayoutManager.restore(boolean)
-
getDockingPort
public static DockingPort getDockingPort(java.awt.Component dockable)
Returns theDockingPortthat contains the specifiedComponent. If theComponentisnull, then anullreference is returned.This method will only return the immediate parent
DockingPortof the specifiedComponentThis means that theDockingPortreturned by this method will not only be an ancestorContainerof the specifiedComponent, but invoking itsisParentDockingPort(Component comp)with the specifiedComponentwill also returntrue. If both of these conditions cannot be satisfied, then this method returns anullreference.- Parameters:
dockable- theComponentwhose parentDockingPortis to be returned.- Returns:
- the imediate parent
DockingPortthat contains the specifiedComponent.
-
getDockingPort
public static DockingPort getDockingPort(Dockable dockable)
Returns theDockingPortthat contains the specifiedDockable. If theDockableisnull, then anullreference is returned.This method will only return the immediate parent
DockingPortof the specifiedDockableThis means that a check is performed for theComponentreturned by theDockable'sgetComponent()method. TheDockingPortreturned by this method will not only be an ancestorContainerof thisComponent, but invoking theDockingPort'sisParentDockingPort(Component comp)with the thisComponentwill also returntrue. If both of these conditions cannot be satisfied, then this method returns anullreference.- Parameters:
dockable- theDockablewhose parentDockingPortis to be returned.- Returns:
- the imediate parent
DockingPortthat contains the specifiedDockable.
-
getDockable
public static Dockable getDockable(java.awt.Component comp)
Returns theDockableinstance that models the specifiedComponent. TheDockablereturned by this method will return a reference tocompwhen itsgetComponent()method is called. Ifcompisnull, then this method will return anullreference.The association between
DockableandComponentis established internally duringregisterDockable(Dockable dockable). Thus,registerDockable(Dockable dockable)must have been called previously for a mapping to be found and aDockableto be returned by this method. If no mapping is found for the specifiedComponent, then this method returns anullreference.- Parameters:
comp- theComponentwhoseDockableinstance is to be returned.- Returns:
- the
Dockablethat models the specifiedComponent - See Also:
registerDockable(Dockable),Dockable.getComponent()
-
getDockable
public static Dockable getDockable(java.lang.String id)
Returns theDockableinstance with the specified ID. TheDockablereturned by this method will return a String equalidwhen itsgetPersistentId()method is called. Ifidisnull, then this method will return anullreference.The association between
Dockableandidis established internally duringregisterDockable(Dockable dockable). Thus,registerDockable(Dockable dockable)must have been called previously for a mapping to be found and aDockableto be returned by this method. If no mapping is found for the specifiedid, then this method returns anullreference.- Parameters:
id- the persistent ID of theDockableinstance is to be returned.- Returns:
- the
Dockablethat has the specified perstent ID. - See Also:
registerDockable(Dockable),Dockable.getPersistentId()
-
getDockableIds
public static java.util.Set getDockableIds()
Returns aSetofStringIDs for allDockablesregistered with the framework. The IDs returned by this method will correspond to the values returned for thegetPersistentId()method for eachDockableregistered with the framework.DockableIDs are cached duringregisterDockable(Dockable dockable). Thus, for an ID to appear within theSetreturned by this method, the correspondingDockablemust have first been registered viaregisterDockable(Dockable dockable). If noDockableshave been registered with the framework, then an emptySetis returned. This method will never return anullreference.- Returns:
- a
SetofStringIDs for allDockablesregistered with the framework. - See Also:
registerDockable(Dockable),Dockable.getPersistentId()
-
getDragListener
public static DragManager getDragListener(Dockable dockable)
Returns the listener object responsible for managing drag-to-dock mouse events for the specifiedDockable. During registration, the listener is added to each of theComponentswithin theDockable'sgetDragSources()List. Thus, for this method to return a validDragManagerinstance, theDockablemust first have been registered viaregisterDockable(Dockable dockable). If the specifiedDockableisnullor itsgetDragSources()method returns anull, or if theDockablehas not previously been registered, this method will return anullreference.- Parameters:
dockable- theDockablewhose drag listener is to be returned.- Returns:
- the
DragManagerresponsible for listening to an managing drag-related mouse events for the specifiedDockable. - See Also:
DragManager,Dockable.getDragSources(),registerDockable(Dockable)
-
getLayoutManager
public static LayoutManager getLayoutManager()
Returns the currently installedLayoutManager. TheLayoutManageris responsible for managing docking layout state. This includes tracking the state for allDockablesas they are embedded, minimized, floated, or hidden. If aDockableis embedded, theLayoutManageris responsible for tracking its position and size relative to other embeddedDockables. If floating, theLayoutManageris responsible for supplying aFloatManagerto maintainDockablegroupings within dialogs as well as dialog size and positioning.The
LayoutManageris responsible for providing a persistence mechanism to save and restore layout states. Depending on theLayoutManagerimplementation, it may or may not support multiple layout models that may be loaded and switched between at runtime.Because the
LayoutManageris a critical piece of the docking infrastructure, it is not possible to install anullLayoutManager. Therefore, this method will always return a validLayoutManagerand never anullreference.- Returns:
- the currently installed
LayoutManager - See Also:
LayoutManager,setLayoutManager(LayoutManager),setLayoutManager(String)
-
getMinimizeManager
public static MinimizationManager getMinimizeManager()
Returns the currently installedMinimizationManager. TheMinimizationManageris responsible for minimizing and unminimizingDockables, removing from and restoring to the embedded docking layout through the currently installedLayoutManager.The visual representation of a "minimized"
Dockableis somewhat abstract, although it is commonly expressed in user interfaces with the disappearance of theDockablefrom the layout and the addition of a tab or label on one or more edges of the application window. TheMinimizationManagerimplementation itself is responsible for interpreting the visual characteristics and behavior of a minimizedDockable, but it must provide a "preview" feature to allow viewing of minimizedDockables, on demand without actually restoring them to the embedded docking layout.Dockablesmay or may not have limited docking functionality while in minimized and/or preview state, depending upon theMinimizationManagerimplementation.Because the
MinimizationManageris a critical piece of the docking infrastructure, it cannot be set tonull. Therefore, this method will always return a validMinimizationManagerand never anullreference.- Returns:
- the currently installed
MinimizationManager. - See Also:
MinimizationManager,setMinimizeManager(MinimizationManager),setMinimizeManager(String)
-
getFloatManager
public static FloatManager getFloatManager()
Returns the currently installedFloatManager. TheFloatManageris actually provided by the currently installedLayoutManager. As such, this method is merely for convenience. It internally obtains the installedLayoutManagerviagetLayoutManager()and invokes itsgetFloatManager()method.The
FloatManagermaintains information relevant to floatingDockablesincluding grouping them together within dialogs and tracking dialog size and position. TheFloatManageris responsible for generating new dialogs, parenting on the proper application window(s), and sendingDockablesto the proper dialogs. It may be used by theLayoutManagerto restore hiddenDockablesto proper floating state as needed.Since the
FloatManageris provided by the currently installedLayoutManager, it cannot be set from within theDockingManager. To change the installedFloatManager, one must work directly with the installedLayoutManagerimplementation per its particular custom API.Since the
FloatManageris a critical piece of the docking insfrastructure, this method will never return anullreference.- Returns:
- the
FloatManagerprovided by the currently installedLayoutManager - See Also:
getLayoutManager(),setLayoutManager(LayoutManager),LayoutManager.getFloatManager()
-
getDockingState
public static DockingState getDockingState(java.lang.String dockableId)
Returns theDockingStatefor theDockablewith the specified ID. TheDockingStateis used by the currently installedLayoutManagerto track information regarding aDockable'scurrent state in the docking layout. This includes relative size and positioning to otherDockables, minimization status, floating status, and any other information used to track and potentially restore a theDockableto the layout if it is currently hidden.The
Dockablewhose currentDockingStateis resolved will map to the specifieddockableIdvia itsgetPersistentId()method. The semantics of this mapping relationship are the same asDockingManager.getDockable(String id). If a validDockablecannot be found for the specified ID, then this method returns anullreference.The
DockingStatefor any givenDockableis ultimately managed by the currently installedLayoutManager. Therefore, this method resolves theLayoutManagerviagetLayoutManager()and defers processing to itsgetDockingState(String dockableId)method.The underlying
LayoutManagerdoes not provide any guarantees that the sameDockingStatereference always will be returned for a givenDockable; only that the returnedDockingStatewill accurately reflect the current state maintained by theLayoutManagerfor thatDockable. For instance, if theLayoutManageris capable of maintaining multiple layouts for an application (as Eclipse does between perspectives), then theLayoutManagermay or may not maintain multipleDockingStateinstances for a singleDockable, one within each layout context. Therefore, it is not a good idea to cache references to theDockingStateinstance returned by this method for future use as the reference itself may possibly become stale over time depending on theLayoutManagerimplementation.- Parameters:
dockableId- the persistent ID of theDockablewhose currentDockingStateis to be returned- Returns:
- the current
DockingStatemaintained by theLayoutManagerfor the specifiedDockable - See Also:
DockingState,getLayoutManager(),LayoutManager.getDockingState(String),getDockable(String),Dockable.getPersistentId()
-
getDockingState
public static DockingState getDockingState(Dockable dockable)
Returns theDockingStatefor the specifiedDockable. TheDockingStateis used by the currently installedLayoutManagerto track information regarding aDockable'scurrent state in the docking layout. This includes relative size and positioning to otherDockables, minimization status, floating status, and any other information used to track and potentially restore a theDockableto the layout if it is currently hidden.If the
dockableparameter isnull, then this method returns anullreference.The
DockingStatefor any givenDockableis ultimately managed by the currently installedLayoutManager. Therefore, this method resolves theLayoutManagerviagetLayoutManager()and defers processing to itsgetDockingState(String dockableId)method.The underlying
LayoutManagerdoes not provide any guarantees that the sameDockingStatereference always will be returned for a givenDockable; only that the returnedDockingStatewill accurately reflect the current state maintained by theLayoutManagerfor thatDockable. For instance, if theLayoutManageris capable of maintaining multiple layouts for an application (as Eclipse does between perspectives), then theLayoutManagermay or may not maintain multipleDockingStateinstances for a singleDockable, one within each layout context. Therefore, it is not a good idea to cache references to theDockingStateinstance returned by this method for future use as the reference itself may possibly become stale over time depending on theLayoutManagerimplementation.- Parameters:
dockable- theDockablewhose currentDockingStateis to be returned- Returns:
- the current
DockingStatemaintained by theLayoutManagerfor the specifiedDockable - See Also:
getLayoutManager(),LayoutManager.getDockingState(String)
-
getDockableFactory
public static DockableFactory getDockableFactory()
Returns the currently installedDockableFactory. TheDockableFactoryinstalled by default isnull. Therefore, this method will return anullreference until the application developer explicitly provides aDockableFactoryimplementation viasetDockableFactory(DockableFactory factory).Installing a
DockableFactoryallows FlexDock to seamlessly create and registerDockableswithingetDockable(String id). Generally,getDockable(String id)will lookup the requestedDockablewithin the internal registry. If not found, and there is noDockableFactoryinstalled,getDockable(String id)returns anullreference. When aDockableFactoryis installed, however, failure to lookup a validDockablewill causegetDockable(String id)to invoke the installedDockableFactory'sgetDockable(String dockableId)method, transparently registering and returning the newly createdDockablefromgetDockable(String id).- Returns:
- the currently installed
DockableFactory - See Also:
getDockable(String),DockableFactory.getDockable(String)
-
setAutoPersist
public static void setAutoPersist(boolean enabled)
Enables and disables auto-persistence of the current docking layout model when the application exits. Auto-persistence is disabled by default.The
storeLayoutModel()provides a means of manually sending the docking layout model to some type of external storage. When theDockingManagerclass loads, a shutdown hook is added to theRuntime. If auto-persist is enabled when the JVM exits, the shutdown hook automatically callsstoreLayoutModel(), catching and reporting anyIOExceptionsthat may occur.- Parameters:
enabled-trueif automatic persistence is desired;falseotherwise.- See Also:
storeLayoutModel(),Runtime.addShutdownHook(java.lang.Thread)
-
setSplitProportion
public static void setSplitProportion(java.awt.Component dockable, float proportion)Sets the divider location of the split layout containing the specified dockableComponent. TheDockableinstance associated with the specifiedComponentis resolved viagetDockable(Component comp)and processing is dispatched tosetSplitProportion(Dockable dockable, float proportion).The resulting divider location will be a percentage of the split layout size based upon the
proportionparameter. Valid values forproportionrange from0.0F{@code to {@code 1.0F}. For example, a {@code proportion} of {@code 0.3F} will move the divider to 30% of the "size" (<i>width</i> for horizontal split, <i>height</i> for vertical split) of the split container that contains the specified {@code Component}. If a {@code proportion} of less than {@code 0.0F} is supplied, the value }0.0Fis used. If aproportiongreater than1.0Fis supplied, the value }1.0F} is used.It is important to note that the split divider location is only a percentage of the container size from left to right or top to bottom. A
proportionof0.3Fdoes not imply thatdockableitself will be allotted 30% of the available space. The split divider will be moved to the 30% position of the split container regardless of the region in which the specifiedComponentresides (which may possibly result indockablebeing allotted 70% of the available space).This method should be effective regardless of whether the split layout in question has been fully realized and is currently visible on the screen. This should alleviate common problems associated with setting percentages of unrealized
Componentdimensions, which are initially0x0before theComponenthas been rendered to the screen.If the specified
Componentisnull, then noExceptionis thrown and no action is taken. Identical behavior occurs if a validDockablecannot be resolved for the specifiedComponent, or theDockabledoes not reside within a split layout.If the
Dockableresides within a tabbed layout, a check is done to see if the tabbed layout resides within a parent split layout. If so, the resolved split layout is resized. Otherwise no action is taken.- Parameters:
dockable- theComponentwhose containing split layout is to be resized.proportion- the percentage of containing split layout size to which the split divider should be set.- See Also:
setSplitProportion(Dockable, float),getDockable(Component)
-
setSplitProportion
public static void setSplitProportion(Dockable dockable, float proportion)
Sets the divider location of the split layout containing the specified dockableComponent.The resulting divider location will be a percentage of the split layout size based upon the
proportionparameter. Valid values forproportionrange from0.0F{@code to {@code 1.0F}. For example, a {@code proportion} of {@code 0.3F} will move the divider to 30% of the "size" (<i>width</i> for horizontal split, <i>height</i> for vertical split) of the split container that contains the specified {@code Dockable}. If a {@code proportion} of less than {@code 0.0F} is supplied, the value }0.0Fis used. If aproportiongreater than1.0Fis supplied, the value }1.0F} is used.It is important to note that the split divider location is only a percentage of the container size from left to right or top to bottom. A
proportionof0.3Fdoes not imply thatdockableitself will be allotted 30% of the available space. The split divider will be moved to the 30% position of the split container regardless of the region in which the specifiedDockableresides (which may possibly result indockablebeing allotted 70% of the available space).This method should be effective regardless of whether the split layout in question has been fully realized and is currently visible on the screen. This should alleviate common problems associated with setting percentages of unrealized
Componentdimensions, which are initially0x0before theComponenthas been rendered to the screen.If the specified
Dockableisnull, then noExceptionis thrown and no action is taken. Identical behavior occurs if theDockabledoes not reside within a split layout.If the
Dockableresides within a tabbed layout, a check is done to see if the tabbed layout resides within a parent split layout. If so, the resolved split layout is resized. Otherwise no action is taken.- Parameters:
dockable- theDockablewhose containing split layout is to be resized.proportion- the percentage of containing split layout size to which the split divider should be set.- See Also:
getDockable(Component)
-
setSplitProportion
public static void setSplitProportion(DockingPort port, float proportion)
Sets the divider location of the split layout embedded within the specifiedDockingPort. This method differs from bothsetSplitProportion(Component dockable, float proportion)andsetSplitProportion(Dockable dockable, float proportion)in that this method resolves the split layout embedded within the specifiedDockingPort, whereas the other methods modify the split layout containing their respectiveDockableparameters.The resulting divider location will be a percentage of the split layout size based upon the
proportionparameter. Valid values forproportionrange from0.0F{@code to {@code 1.0F}. For example, a {@code proportion} of {@code 0.3F} will move the divider to 30% of the "size" (<i>width</i> for horizontal split, <i>height</i> for vertical split) of the split container embedded within the specified {@code DockingPort}. If a {@code proportion} of less than {@code 0.0F} is supplied, the value }0.0Fis used. If aproportiongreater than1.0Fis supplied, the value }1.0F} is used.This method should be effective regardless of whether the split layout in question has been fully realized and is currently visible on the screen. This should alleviate common problems associated with setting percentages of unrealized
Componentdimensions, which are initially0x0before theComponenthas been rendered to the screen.If the specified
DockingPortisnull, then noExceptionis thrown and no action is taken. Identical behavior occurs if theDockingPortdoes not contain split layout.- Parameters:
port- theDockingPortcontaining the split layout is to be resized.proportion- the percentage of split layout size to which the split divider should be set.
-
setDockableFactory
public static void setDockableFactory(DockableFactory factory)
Sets the currently installedDockableFactory.nullvalues for thefactoryparameter are acceptable.Installing a
DockableFactoryallows FlexDock to seamlessly create and registerDockableswithingetDockable(String id). Generally,getDockable(String id)will lookup the requestedDockablewithin the internal registry. If not found, and there is noDockableFactoryinstalled,getDockable(String id)returns anullreference. When aDockableFactoryis installed, however, failure to lookup a validDockablewill causegetDockable(String id)to invoke the installedDockableFactory'sgetDockable(String dockableId)method, transparently registering and returning the newly createdDockablefromgetDockable(String id).- Parameters:
factory- theDockableFactoryto install- See Also:
getDockableFactory(),getDockable(String),DockableFactory.getDockable(String)
-
setMinimized
public static void setMinimized(Dockable dockable, boolean minimized)
Sets the minimized state for the specifiedDockable. This method defers processing tosetMinimized(Dockable dockable, boolean minimized, Component window), passing the currentWindowancestor of the specifiedDockableas thewindowparameter. Minimization processessing is ultimately deferred to the currently installedMinimizationManagerwith a constraint ofMinimizationManager.UNSPECIFIED_LAYOUT_CONSTRAINT.The current
MinimizationManageris responsible for updating the underlyingDockingStatemodel for the specifiedDockableas well as rendering its own interpretation of the corresponding visual state on the screen. If the suppliedminimizedparameter matches the currentDockingState, theMinimizationManageris responsible for providing the appropriate visual indications, or lack thereof. If the specifiedDockableisnull, noExceptionis thrown and no action is taken.- Parameters:
dockable- theDockablewhose minimzed state is to be modifiedminimized-trueif the specifiedDockableshould be minimized,falseotherwise.- See Also:
setMinimized(Dockable, boolean, Component),getMinimizeManager(),MinimizationManager.setMinimized(Dockable, boolean, Component, int),DockingState.getMinimizedConstraint()
-
setMinimized
public static void setMinimized(Dockable dockable, boolean minimized, java.awt.Component window)
Sets the minimized state for the specifiedDockable. This method defers processing tosetMinimized(Dockable dockable, boolean minimizing, Component window, int constraint), passingMinimizationManager.UNSPECIFIED_LAYOUT_CONSTRAINTfor theconstraintparameter. Minimization processessing is ultimately deferred to the currently installedMinimizationManager.The
windowparameter is passed to theMinimizationManagerto indicate that minimization should be handled with respect to the specified root window, or the root window containing the specifiedComponent.nullvalues are acceptable for this parameter.The current
MinimizationManageris responsible for updating the underlyingDockingStatemodel for the specifiedDockableas well as rendering its own interpretation of the corresponding visual state on the screen. If the suppliedminimizedparameter matches the currentDockingState, theMinimizationManageris responsible for providing the appropriate visual indications, or lack thereof. If the specifiedDockableisnull, noExceptionis thrown and no action is taken.- Parameters:
dockable- theDockablewhose minimzed state is to be modifiedminimized-trueif the specifiedDockableshould be minimized,falseotherwise.window- theComponentwhose root window will be used by the underlyingMinimizationManagerfor rendering theDockablein its new minimized state.- See Also:
setMinimized(Dockable, boolean, Component, int),getMinimizeManager(),MinimizationManager.setMinimized(Dockable, boolean, Component, int),DockingState.getMinimizedConstraint()
-
setMinimized
public static void setMinimized(Dockable dockable, boolean minimizing, int constraint)
Sets the minimized state for the specifiedDockable. This method defers processing tosetMinimized(Dockable dockable, boolean minimizing, Component window, int constraint), passingnullfor thewindowparameter. Minimization processessing is ultimately deferred to the currently installedMinimizationManager.Valid values for the
constraintparameter may be found on theMinimizationManagerinterface and include UNSPECIFIED_LAYOUT_CONSTRAINT, TOP, LEFT, BOTTOM, RIGHT, and CENTER. However, constraint values must ultimately be interpreted by the currentMinimizationManagerimplementation and, thus any integer value may theoretically be valid forconstraint.The current
MinimizationManageris responsible for updating the underlyingDockingStatemodel for the specifiedDockableas well as rendering its own interpretation of the corresponding visual state on the screen. If the suppliedminimizedparameter matches the currentDockingState, theMinimizationManageris responsible for providing the appropriate visual indications, or lack thereof. If the specifiedDockableisnull, noExceptionis thrown and no action is taken.- Parameters:
dockable- theDockablewhose minimzed state is to be modifiedminimizing-trueif the specifiedDockableshould be minimized,falseotherwise.constraint- a value to indicate to theMinimizationManagerdesired rendering of the minimizedDockable- See Also:
setMinimized(Dockable, boolean, Component, int),getMinimizeManager(),MinimizationManager.setMinimized(Dockable, boolean, Component, int),DockingState.getMinimizedConstraint()
-
setMinimized
public static void setMinimized(Dockable dockable, boolean minimizing, java.awt.Component window, int constraint)
Sets the minimized state for the specifiedDockable. This method defers processing to the currently installedMinimizationManager.The
windowparameter is passed to theMinimizationManagerto indicate that minimization should be handled with respect to the specified root window, or the root window containing the specifiedComponent. If anullvalues is supplied for this parameter, the currently active window is used. If no currently active window can be determined, then this method exits with no action taken.The current
MinimizationManageris responsible for updating the underlyingDockingStatemodel for the specifiedDockableas well as rendering its own interpretation of the corresponding visual state on the screen. If the suppliedminimizedparameter matches the currentDockingState, theMinimizationManageris responsible for providing the appropriate visual indications, or lack thereof. If the specifiedDockableisnull, noExceptionis thrown and no action is taken.Valid values for the
constraintparameter may be found on theMinimizationManagerinterface and include UNSPECIFIED_LAYOUT_CONSTRAINT, TOP, LEFT, BOTTOM, RIGHT, and CENTER. However, constraint values must ultimately be interpreted by the currentMinimizationManagerimplementation and, thus any integer value may theoretically be valid forconstraint.- Parameters:
dockable- theDockablewhose minimzed state is to be modifiedminimizing-trueif the specifiedDockableshould be minimized,falseotherwise.window- theComponentwhose root window will be used by the underlyingMinimizationManagerfor rendering theDockablein its new minimized state.constraint- a value to indicate to theMinimizationManagerdesired rendering of the minimizedDockable- See Also:
getMinimizeManager(),MinimizationManager.setMinimized(Dockable, boolean, Component, int),DockingState.getMinimizedConstraint()
-
setMainDockingPort
public static void setMainDockingPort(java.awt.Component window, java.lang.String portId)Sets the "main"DockingPortwithin the application window containing the specifiedComponent. Just as desktop applications will tend to have a "main" application window, perhaps surrounded with satellite windows or dialogs, the "main"DockingPortwithin a given window will be considered by the application developer to contain the primary docking layout used by the enclosing window.The
Componentparameter may or may not be a root window container. If not, the ancestor window ofcompis determined and a set of docking ports encapsulated by aRootDockingPortInfoinstance is returned by a call togetRootDockingPortInfo(Component comp). The resolvedRootDockingPortInfoinstance's mainDockingPortis set via its methodsetMainPort(String portId).By default, the "main"
DockingPortassigned to anyRootDockingPortInfoinstance associated with a window will happen to be the first rootDockingPortdetected for that window. This method is used to alter that setting.If
compisnullor the root window cannot be resolved, then this method returns with no action taken.- Parameters:
window- theComponentwhose root window will be checked for a mainDockingPortportId- the persistent ID of theDockingPortto use as the mainDockingPortfor the specified window.- See Also:
getRootDockingPortInfo(Component),getRootDockingPort(Component),DockingPortTracker.getRootDockingPortInfo(Component),RootDockingPortInfo.getMainPort(),RootDockingPortInfo.setMainPort(String)
-
setMinimizeManager
public static void setMinimizeManager(MinimizationManager mgr)
Sets the currently installedMinimizationManager. TheMinimizationManageris responsible for minimizing and unminimizingDockables, removing from and restoring to the embedded docking layout through the currently installedLayoutManager.The visual representation of a "minimized"
Dockableis somewhat abstract, although it is commonly expressed in user interfaces with the disappearance of theDockablefrom the layout and the addition of a tab or label on one or more edges of the application window. TheMinimizationManagerimplementation itself is responsible for interpreting the visual characteristics and behavior of a minimizedDockable, but it must provide a "preview" feature to allow viewing of minimizedDockables, on demand without actually restoring them to the embedded docking layout.Dockablesmay or may not have limited docking functionality while in minimized and/or preview state, depending upon theMinimizationManagerimplementation.Because the
MinimizationManageris a critical piece of the docking infrastructure, it cannot be set tonull. If anullvalue is passed into this method, the defaultMinimizationManagerprovided by the framework is used instead.- Parameters:
mgr- theMinimizationManagerto be installed- See Also:
MinimizationManager,getMinimizeManager(),setMinimizeManager(String)
-
setMinimizeManager
public static void setMinimizeManager(java.lang.String mgrClass)
Sets the currently installedMinimizationManagerusing the specfied class name. An attempt is make to instantiate aMinimizationManagerbased upon the supplied class nameString. If the class cannot be instaniated, a stacktrace is reported to the System.err and the defaultMinimizationManagersupplied by the framework is used. If theStringparameter isnull, no error occurs and the defaultMinimizationManageris used. If the instantiated class is not a valid instance ofMinimizationManager, then aClassCastExceptionis thrown.The
MinimizationManageris responsible for minimizing and unminimizingDockables, removing from and restoring to the embedded docking layout through the currently installedLayoutManager.The visual representation of a "minimized"
Dockableis somewhat abstract, although it is commonly expressed in user interfaces with the disappearance of theDockablefrom the layout and the addition of a tab or label on one or more edges of the application window. TheMinimizationManagerimplementation itself is responsible for interpreting the visual characteristics and behavior of a minimizedDockable, but it must provide a "preview" feature to allow viewing of minimizedDockables, on demand without actually restoring them to the embedded docking layout.Dockablesmay or may not have limited docking functionality while in minimized and/or preview state, depending upon theMinimizationManagerimplementation.Because the
MinimizationManageris a critical piece of the docking infrastructure, it cannot be set tonull. If anullvalue is passed into this method, the defaultMinimizationManagerprovided by the framework is used instead.- Parameters:
mgrClass- the class name of theMinimizationManagerto be installed- See Also:
MinimizationManager,getMinimizeManager(),setMinimizeManager(String)
-
setFloatingEnabled
public static void setFloatingEnabled(boolean enabled)
Sets whether global floating support should be enabled. Defers processing toFloatPolicyManager.setGlobalFloatingEnabled(boolean globalFloatingEnabled).- Parameters:
enabled-trueif global floating support should be enabled,falseotherwise.- See Also:
FloatPolicyManager.setGlobalFloatingEnabled(boolean),FloatPolicyManager.isGlobalFloatingEnabled()
-
setDefaultPersistenceKey
public static void setDefaultPersistenceKey(java.lang.String key)
-
getDefaultPersistenceKey
public static java.lang.String getDefaultPersistenceKey()
-
setSingleTabsAllowed
public static void setSingleTabsAllowed(boolean allowed)
Sets whether tabbed layouts are supported by default forDockingPortswith a singleDockablein the CENTER region. This is a global default setting and applies to anyDockingPortthat does not have a specific contradictory local setting.This method defers processing to
org.flexdock.docking.props.PropertyManager.getDockingPortRoot(). As such, there are multiple "scopes" at which this property may be overridden.- Parameters:
allowed-trueif the default setting forDockingPortsshould allow a tabbed layout for a singleDockablein the CENTER region;falseotherwise.- See Also:
PropertyManager.getDockingPortRoot(),DockingPortPropertySet.setSingleTabsAllowed(boolean)
-
setLayoutManager
public static void setLayoutManager(LayoutManager mgr)
Sets the currently installedLayoutManager. TheLayoutManageris responsible for managing docking layout state. This includes tracking the state for allDockablesas they are embedded, minimized, floated, or hidden. If aDockableis embedded, theLayoutManageris responsible for tracking its position and size relative to other embeddedDockables. If floating, theLayoutManageris responsible for supplying aFloatManagerto maintainDockablegroupings within dialogs as well as dialog size and positioning.The
LayoutManageris responsible for providing a persistence mechanism to save and restore layout states. Depending on theLayoutManagerimplementation, it may or may not support multiple layout models that may be loaded and switched between at runtime.Because the
LayoutManageris a critical piece of the docking infrastructure, it is not possible to install anullLayoutManager. FlexDock provides a defaultLayoutManagerimplementation. If this method is passed anullargument, the defaultLayoutManageris used instead.- Parameters:
mgr- theLayoutManagerto install.- See Also:
LayoutManager,setLayoutManager(String),getLayoutManager()
-
setLayoutManager
public static void setLayoutManager(java.lang.String mgrClass)
Sets the currently installedLayoutManagerusing the specified class name. An attempt is make to instantiate aLayoutManagerbased upon the supplied class nameString. If the class cannot be instaniated, a stacktrace is reported to the System.err and the defaultLayoutManagersupplied by the framework is used. If theStringparameter isnull, no error occurs and the defaultLayoutManageris used. If the instantiated class is not a valid instance ofLayoutManager, then aClassCastExceptionis thrown.The
LayoutManageris responsible for managing docking layout state. This includes tracking the state for allDockablesas they are embedded, minimized, floated, or hidden. If aDockableis embedded, theLayoutManageris responsible for tracking its position and size relative to other embeddedDockables. If floating, theLayoutManageris responsible for supplying aFloatManagerto maintainDockablegroupings within dialogs as well as dialog size and positioning.The
LayoutManageris responsible for providing a persistence mechanism to save and restore layout states. Depending on theLayoutManagerimplementation, it may or may not support multiple layout models that may be loaded and switched between at runtime.Because the
LayoutManageris a critical piece of the docking infrastructure, it is not possible to install anullLayoutManager. FlexDock provides a defaultLayoutManagerimplementation. If this method is passed anullargument, the defaultLayoutManageris used instead.- Parameters:
mgrClass- the class name of theLayoutManagerto install.- See Also:
LayoutManager,setLayoutManager(LayoutManager),getLayoutManager()
-
setDockingStrategy
public static void setDockingStrategy(java.lang.Class classKey, DockingStrategy strategy)Sets theDockingStrategyassociated with specifiedClass. This method returns with no action taken if the specifiedClassparamter isnull. If thestrategyparameter isnullthen any existingDockingStrategyassociation with the specified }Class} is removed. Otherwise, a newDockingStrategyassociation is added for the specifiedClass.DockingStrategyassociation follows a strict inheritance chain usingorg.flexdock.util.ClassMapping. This means that the association created by this method applies for the specifiedClassand all direct subclasses, but associations for interfaces are ignored. Associations also do not apply for subclasses that have their own specificDockingStrategymapping.- Parameters:
classKey- theClasswhoseDockingStrategyassociation we wish to setstrategy- theDockingStrategyto be associated with the specifiedClass.- See Also:
getDockingStrategy(Class),getDockingStrategy(Object),ClassMapping.addClassMapping(Class, Class, Object),ClassMapping.removeClassMapping(Class)
-
undock
public static boolean undock(Dockable dockable)
Undocks the specifiedDockablefrom its parentDockingPort. If theDockableisnull, or it does not currently reside within aDockingPort, then this method returnsfalsewith no action taken. Otherwise, this method returnstrueif the undocking operation was successful andfalseif the undocking operation could not be completed. This method determines theDockingStrategyto be used forDockingPortcontaining the specifiedDockableand defers processing to theundock(Dockable dockable)method on theDockingStrategy. This method's return value will be based upon theDockingStrategyimplementation returned by a call togetDockingStrategy(Object obj). TheDockingStrategyused may be controlled viasetDockingStrategy(Class c, DockingStrategy strategy), supplying aDockingPortimplementation class and a customizedDockingStrategy.- Parameters:
dockable- theDockableto be undocked.- Returns:
trueif the undocking operation was successful,falseotherwise.- See Also:
DockingStrategy.undock(Dockable),getDockingStrategy(Object),setDockingStrategy(Class, DockingStrategy)
-
undock
public static boolean undock(java.awt.Component dockable)
-
updateDragListeners
public static void updateDragListeners(Dockable dockable)
Ensures that a validDragManagerhas been installed as a listener for all of the specifiedDockable'sdrag sourceComponents. This method invokes thegetDragSources()method on the specifiedDockableand iterates over eachComponentin the returnedList. If anyComponentdoes not have a validDragManagerlistener installed, an appropriate listener is added to enable drag-to-dock functionality.This method is useful to application developers who manually attempt to add new
Componentsto aDockable'sdrag sourceList. However, it is not necessary to call this method unless the drag source list has been updated after callingregisterDockable(Dockable dockable), sinceregisterDockable(Dockable dockable)will automatically initialize each drag source for the specifiedDockable.If the specified
Dockableisnull, then noExceptionis thrown and no action is taken.- Parameters:
dockable- theDockablewhose drag sources are to be checked forDragManagersand updated accordingly.- See Also:
registerDockable(Dockable),Dockable.getDragSources(),DragManager
-
getDefaultSiblingSize
public static float getDefaultSiblingSize()
-
setDefaultSiblingSize
public static void setDefaultSiblingSize(float size)
-
setRubberBand
public static void setRubberBand(RubberBand rubberBand)
-
setDragPreview
public static void setDragPreview(DragPreview dragPreview)
-
toggleMaximized
public static void toggleMaximized(java.awt.Component comp)
Maximizes theDockableassociated with the specified component or restores theDockableif it is currently maximized. This method forwards the request totoggleMaximized(Dockable)after obtaining theDockableassociated to the component viagetDockable(Component).- Parameters:
comp-- See Also:
toggleMaximized(Dockable)
-
toggleMaximized
public static void toggleMaximized(Dockable dockable)
Maximizes the specifiedDockableor restores the specifiedDockableif it is already maximized.The scope of maximization is the root
DockingPort. The specifiedDockable's currentDockingPortis asked to temporarily lend theDockablefor maximization and the rootDockingPortis asked to temorarily host theDockableand display it such that it occupies all (or the majority) of its screen resources. If theDockableis already maximized, the rootDockingPortis asked to return to its original state and theDockableis returned to its originalDockingPort.- Parameters:
dockable-
-
isMaximized
public static boolean isMaximized(Dockable dockable)
-
-