Class DockingManager
- All Implemented Interfaces:
DockingConstants
DockingManager
cannot 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.
Among DockingManager's
responsibilities are as follows:
- Maintaining a component repository.
- All
Dockables
andDockingPorts
are cached within an and accessible through and internal registry. - Maintaining framework state.
DockingManager
provides APIs for managing various different global framework settings, including application-key, floating support, auto-persistence,LayoutManagers
, andMinimizationManagers
.- Behavioral auto-configuration.
-
DockingManager
automatically adds and removes necessary event listeners to enable/disable drag-to-dock behavior as components are registered and unregistered. - Programmatic access to docking operations.
-
DockingManager
provides public APIs for programmatically dock, undock, minimize, persist, and loadDockables
from storage.
- Author:
- Christopher Butler
-
Field Summary
FieldsFields 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
Modifier and TypeMethodDescriptionstatic void
addDragSource
(Dockable dockable, Component dragSrc) static void
Convenience method that removes the specifiedDockable
from the layout.static boolean
Displays theDockable
with the specified ID within the application's docking layout.static boolean
Displays the specifiedDockable
in the application's docking layout.static boolean
Docks the specifiedComponent
relative to another already-dockedComponent
in the CENTER region.static boolean
Docks the specifiedComponent
relative to another already-dockedComponent
in the specified region.static boolean
Docks the specifiedComponent
relative to another already-dockedComponent
in the specified region with the specified split proportion.static boolean
dock
(Component dockable, DockingPort port) Docks the specifiedComponent
into the CENTER region of the specifiedDockingPort
.static boolean
dock
(Component dockable, DockingPort port, String region) Docks the specifiedComponent
into the supplied region of the specifiedDockingPort
.static boolean
Docks the specifiedDockable
relative to another already-dockedDockable
in the CENTER region.static boolean
Docks the specifiedDockable
relative to another already-dockedDockable
in the specified region.static boolean
Docks the specifiedDockable
relative to another already-dockedDockable
in the specified region with the specified split proportion.static boolean
dock
(Dockable dockable, DockingPort port, String region) Docks the specifiedDockable
into the supplied region of the specifiedDockingPort
.static String
static float
static Dockable
getDockable
(Component comp) Returns theDockable
instance that models the specifiedComponent
.static Dockable
getDockable
(String id) Returns theDockable
instance with the specified ID.static DockableFactory
Returns the currently installedDockableFactory
.static Set
Returns aSet
ofString
IDs for allDockables
registered with the framework.static DockingPort
getDockingPort
(Component dockable) Returns theDockingPort
that contains the specifiedComponent
.static DockingPort
getDockingPort
(String portId) Returns theDockingPort
with the specified ID.static DockingPort
getDockingPort
(Dockable dockable) Returns theDockingPort
that contains the specifiedDockable
.static DockingState
getDockingState
(String dockableId) Returns theDockingState
for theDockable
with the specified ID.static DockingState
getDockingState
(Dockable dockable) Returns theDockingState
for the specifiedDockable
.static DockingStrategy
getDockingStrategy
(Class classKey) Returns theDockingStrategy
associated with specifiedClass
.static DockingStrategy
getDockingStrategy
(Object obj) Returns theDockingStrategy
associated with theClass
of theObject
parameter.static RootWindow[]
Returns an array ofRootWindows
known to the docking framework that containDockingPorts
.static DragManager
getDragListener
(Dockable dockable) Returns the listener object responsible for managing drag-to-dock mouse events for the specifiedDockable
.static FloatManager
Returns the currently installedFloatManager
.static LayoutManager
Returns the currently installedLayoutManager
.static DockingPort
getMainDockingPort
(Component comp) Returns the "main"DockingPort
within the application window containing the specifiedComponent
.static MinimizationManager
Returns the currently installedMinimizationManager
.static DockingPort
getRootDockingPort
(Component comp) Returns the first rootDockingPort
found within the application window containing the specifiedComponent
.static RootDockingPortInfo
Returns theRootDockingPortInfo
instance associated with the root window containing the specifiedComponent
.static boolean
Indicates whether the specifiedComponent
is currently docked.static boolean
Indicates whether the specifiedDockable
is currently docked.static boolean
isDocked
(DockingPort dockingPort, Dockable dockable) Checks whether a suppliedDockable
is docked within a suppliedDockingPort
instance.static boolean
Indicates whether global floating support is currently enabled.static boolean
isMaximized
(Dockable dockable) static boolean
Indicates whether tabbed layouts are supported by default forDockingPorts
with a singleDockable
in the CENTER region.static boolean
isValidDockingRegion
(String region) Indicates whether the supplied parameter is considered a valid docking region.static boolean
Loads a previously stored layout model into the currently installedLayoutManager
.static boolean
loadLayoutModel
(boolean restore) Loads a previously stored layout model into the currently installedLayoutManager
and attempts to synchronize the application view with the newly loaded layout model if therestore
parameter istrue
.static Dockable
registerDockable
(Component comp) Creates, registers, and returns aDockable
for the specifiedComponent
.static Dockable
registerDockable
(Component comp, String tabText) Creates aDockable
for the specifiedComponent
and dispatches toregisterDockable(Dockable init)
.static Dockable
registerDockable
(Dockable dockable) Registers and initializes the specifiedDockable
.static void
removeDragListeners
(Component comp) Removes the event listeners that manage drag-n-drop docking operations from the specifiedComponent
.static boolean
Synchronizes the application view with the current in-memory layout model.static boolean
restoreLayout
(boolean loadFromStorage) Synchronizes the application view with the current in-memory layout model.static void
setAutoPersist
(boolean enabled) Enables and disables auto-persistence of the current docking layout model when the application exits.static void
static void
setDefaultSiblingSize
(float size) static void
setDockableFactory
(DockableFactory factory) Sets the currently installedDockableFactory
.static void
setDockingStrategy
(Class classKey, DockingStrategy strategy) Sets theDockingStrategy
associated with specifiedClass
.static void
setDragPreview
(DragPreview dragPreview) static void
setFloatingEnabled
(boolean enabled) Sets whether global floating support should be enabled.static void
setLayoutManager
(String mgrClass) Sets the currently installedLayoutManager
using the specified class name.static void
Sets the currently installedLayoutManager
.static void
setMainDockingPort
(Component window, String portId) Sets the "main"DockingPort
within the application window containing the specifiedComponent
.static void
setMinimized
(Dockable dockable, boolean minimized) Sets the minimized state for the specifiedDockable
.static void
setMinimized
(Dockable dockable, boolean minimizing, int constraint) Sets the minimized state for the specifiedDockable
.static void
setMinimized
(Dockable dockable, boolean minimized, Component window) Sets the minimized state for the specifiedDockable
.static void
setMinimized
(Dockable dockable, boolean minimizing, Component window, int constraint) Sets the minimized state for the specifiedDockable
.static void
setMinimizeManager
(String mgrClass) Sets the currently installedMinimizationManager
using the specfied class name.static void
Sets the currently installedMinimizationManager
.static void
setRubberBand
(RubberBand rubberBand) static void
setSingleTabsAllowed
(boolean allowed) Sets whether tabbed layouts are supported by default forDockingPorts
with a singleDockable
in the CENTER region.static void
setSplitProportion
(Component dockable, float proportion) Sets the divider location of the split layout containing the specified dockableComponent
.static void
setSplitProportion
(Dockable dockable, float proportion) Sets the divider location of the split layout containing the specified dockableComponent
.static void
setSplitProportion
(DockingPort port, float proportion) Sets the divider location of the split layout embedded within the specifiedDockingPort
.static boolean
Sends the application's current layout model to external storage.static void
toggleMaximized
(Component comp) Maximizes theDockable
associated with the specified component or restores theDockable
if it is currently maximized.static void
toggleMaximized
(Dockable dockable) Maximizes the specifiedDockable
or restores the specifiedDockable
if it is already maximized.static boolean
static boolean
Undocks the specifiedDockable
from its parentDockingPort
.static void
unregisterDockable
(Component comp) static void
unregisterDockable
(String dockingId) static void
unregisterDockable
(Dockable dockable) static void
updateDragListeners
(Dockable dockable) Ensures that a validDragManager
has been installed as a listener for all of the specifiedDockable's
drag sourceComponents
.
-
Field Details
-
MINIMIZE_MANAGER
- See Also:
-
LAYOUT_MANAGER
- See Also:
-
-
Method Details
-
addDragSource
-
close
Convenience method that removes the specifiedDockable
from the layout. If theDockable
is embedded within the main application frame or a floating dialog, it is removed from the container hierarchy. If theDockable
is presently minimized, it is removed from the current minimization manager. If theDockable
is already "closed" or isnull
, no operation is performed. "Closing" aDockable
only removes it from the visual layout. It does not remove it from the internalDockable
registry and all underlyingDockingState
information remains consistent so that theDockable
may later be restored to its original location within the application.- Parameters:
dockable
- theDockable
to be closed.
-
dock
Docks the specifiedComponent
into the CENTER region of the specifiedDockingPort
. If theDockingManager
finds a validDockable
instance mapped to the specifiedComponent
, theDockable
will be docked into theDockingPort
. If theComponent
orDockingPort
isnull
, or a validDockable
cannot be found for the specifiedComponent
, this method returnsfalse
. Otherwise, this method returnstrue
if the docking operation was successful andfalse
if the docking operation cannot be completed. This method defers processing todock(Component dockable , DockingPort port, String region)
.- Parameters:
dockable
- theComponent
to be docked.port
- theDockingPort
into which the specifiedComponent
will be docked.- Returns:
true
if the docking operation was successful,false
otherwise.- See Also:
-
dock
Docks the specifiedComponent
into the supplied region of the specifiedDockingPort
. If theDockingManager
finds a validDockable
instance mapped to the specifiedComponent
, theDockable
will be docked into theDockingPort
. If theComponent
orDockingPort
isnull
, or a validDockable
cannot be found for the specifiedComponent
, this method returnsfalse
. Otherwise, this method returnstrue
if the docking operation was successful andfalse
if the docking operation cannot be completed. This method defers processing todock(Dockable dockable, DockingPort port, String region)
.- Parameters:
dockable
- theComponent
to be docked.port
- theDockingPort
into which the specifiedComponent
will be docked.region
- the region into which to dock the specifiedComponent
- Returns:
true
if the docking operation was successful,false
if the docking operation cannot be completed.- See Also:
-
dock
Docks the specifiedDockable
into the supplied region of the specifiedDockingPort
. If theDockable
orDockingPort
isnull
, this method returnsfalse
. Otherwise, this method returnstrue
if the docking operation was successful andfalse
if the docking operation cannot be completed. This method determines theDockingStrategy
to be used for the specifiedDockingPort
and defers processing to theDockingStrategy
. This method's return value will be based upon theDockingStrategy
implementation and is subject to conditions such as whether the supplied region is deemed valid, whether theDockingStrategy
allows this particularDockable
to be docked into the supplied region of the specifiedDockingPort
, and so on. TheDockingStrategy
used is obtained by a call togetDockingStrategy(Object obj)
and may be controlled viasetDockingStrategy(Class c, DockingStrategy strategy)
, supplying aDockingPort
implementation class and a customizedDockingStrategy
.- Parameters:
dockable
- theDockable
to be docked.port
- theDockingPort
into which the specifiedComponent
will be docked.region
- the region into which to dock the specifiedDockable
- Returns:
true
if the docking operation was successful,false
otherwise.- See Also:
-
dock
Docks the specifiedComponent
relative to another already-dockedComponent
in the CENTER region. ValidDockable
instances are looked up for bothComponent
parameters and processing is deferred todock(Dockable dockable, Dockable parent)
. If a validDockable
cannot be resolved for eitherComponent
, then this method returnsfalse
. The "parent"Dockable
must currently be docked. If not, this method will returnfalse
. Otherwise, its parentDockingPort
will be resolved and the newDockable
will be docked into theDockingPort
relative to the "parent"Dockable
.- Parameters:
dockable
- theComponent
to be dockedparent
- theComponent
used as a reference point for docking- Returns:
true
if the docking operation was successful;false
otherwise.- See Also:
-
dock
Docks the specifiedDockable
relative to another already-dockedDockable
in the CENTER region. The "parent"Dockable
must currently be docked. If not, this method will returnfalse
. Otherwise, its parentDockingPort
will be resolved and the newDockable
will be docked into theDockingPort
relative to the "parent"Dockable
. This method defers processing todock(Dockable dockable, Dockable parent, String region)
and returnsfalse
if any of the input parameters arenull
.- Parameters:
dockable
- theDockable
to be dockedparent
- theDockable
used as a reference point for docking- Returns:
true
if the docking operation was successful;false
otherwise.- See Also:
-
dock
Docks the specifiedComponent
relative to another already-dockedComponent
in the specified region. ValidDockable
instances will be looked up for each of theComponent
parameters. If a validDockable
is not found for eitherComponent
, then this method returnsfalse
. The "parent"Dockable
must currently be docked. If not, this method will returnfalse
. Otherwise, its parentDockingPort
will be resolved and the newDockable
will be docked into theDockingPort
relative to the "parent"Dockable
. This method defers processing todock(Component dockable, Component parent, String region, float proportion)
and returnsfalse
if 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
- theComponent
to be dockedparent
- theComponent
used as a reference point for dockingregion
- the relative docking region into whichdockable
will be docked- Returns:
true
if the docking operation was successful;false
otherwise.- See Also:
-
dock
Docks the specifiedDockable
relative to another already-dockedDockable
in the specified region. The "parent"Dockable
must currently be docked. If not, this method will returnfalse
. Otherwise, its parentDockingPort
will be resolved and the newDockable
will be docked into theDockingPort
relative to the "parent"Dockable
. This method defers processing todock(Dockable dockable, Dockable parent, String region, float proportion)
and returnsfalse
if 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
- theDockable
to be dockedparent
- theDockable
used as a reference point for dockingregion
- the docking region into whichdockable
will be docked- Returns:
true
if the docking operation was successful;false
otherwise.- See Also:
-
dock
Docks the specifiedComponent
relative to another already-dockedComponent
in the specified region with the specified split proportion. ValidDockable
instances will be looked up for each of theComponent
parameters. If a validDockable
is not found for eitherComponent
, then this method returnsfalse
. The "parent"Dockable
must currently be docked. If not, this method will returnfalse
. Otherwise, its parentDockingPort
will be resolved and the newDockable
will be docked into theDockingPort
relative to the "parent"Dockable
. If the specified region is CENTER, then theproportion
parameter is ignored. Otherwise, a split layout should result with the proportional space specified in theproportion
parameter allotted to thedockable
argument. This method defers processing todock(Dockable dockable, Dockable parent, String region, float proportion)
.- Parameters:
dockable
- theComponent
to be dockedparent
- theComponent
used as a reference point for dockingregion
- the relative docking region into whichdockable
will be dockedproportion
- the proportional space to allot thedockable
argument if the docking operation results in a split layout.- Returns:
true
if the docking operation was successful;false
otherwise.
-
dock
Docks the specifiedDockable
relative to another already-dockedDockable
in the specified region with the specified split proportion. The "parent"Dockable
must currently be docked. If not, this method will returnfalse
. Otherwise, its parentDockingPort
will be resolved and the newDockable
will be docked into theDockingPort
relative to the "parent"Dockable
. If the specified region is CENTER, then theproportion
parameter is ignored. Otherwise, a split layout should result with the proportional space specified in theproportion
parameter allotted to thedockable
argument.- Parameters:
dockable
- theDockable
to be dockedparent
- theDockable
used as a reference point for dockingregion
- the docking region into whichdockable
will be dockedproportion
- the proportional space to allot thedockable
argument if the docking operation results in a split layout.- Returns:
true
if the docking operation was successful;false
otherwise.
-
isDocked
Indicates whether the specifiedComponent
is currently docked. This method looks up a parentDockingPort
for the specifiedComponent
via a call togetDockingPort(Component dockable)
. This method returnstrue
if a parentDockingPort
is found andfalse
if no parentDockingPort
is present. This method returnsfalse
if theComponent
parameter isnull
.- Parameters:
component
- theComponent
whose docking status is to be examined- Returns:
true
if theComponent
is currently docked; otherwisefalse
.
-
isDocked
Indicates whether the specifiedDockable
is currently docked. This method looks up a parentDockingPort
for the specifiedDockable
via a call togetDockingPort(Dockable dockable)
. This method returnstrue
if a parentDockingPort
is found andfalse
if no parentDockingPort
is present. This method returnsfalse
if theDockable
parameter isnull
.- Parameters:
dockable
- theDockable
whose docking status is to be examined- Returns:
true
if theDockable
is currently docked; otherwisefalse
.
-
isDocked
Checks whether a suppliedDockable
is docked within a suppliedDockingPort
instance. Returnstrue
if theDockingPort
contains the specifiedDockable
;false
otherwise. This method returnsfalse
if either of the input parameters arenull
.- Parameters:
dockingPort
- theDockingPort
to be testeddockable
- theDockable
instance to be examined- Returns:
true
if the suppliedDockingPort
contains the specifiedDockable
;false
otherwise.
-
isFloatingEnabled
public static boolean isFloatingEnabled()Indicates whether global floating support is currently enabled. Defers processing toFloatPolicyManager.isGlobalFloatingEnabled()
.- Returns:
true
if global floating support is enabled,false
otherwise.- See Also:
-
isSingleTabsAllowed
public static boolean isSingleTabsAllowed()Indicates whether tabbed layouts are supported by default forDockingPorts
with a singleDockable
in 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:
true
if the default setting forDockingPorts
allows a tabbed layout for a singleDockable
in the CENTER region;false
otherwise.- See Also:
-
isValidDockingRegion
Indicates whether the supplied parameter is considered a valid docking region. Valid values are those defined inDockingConstants
and includeNORTH_REGION
,SOUTH_REGION
,EAST_REGION
,WEST_REGION
, andCENTER_REGION
. This method returnstrue
if the supplied parameter is equal to one of these values.- Parameters:
region
- the region value to be tested- Returns:
true
if the supplied parameter is a valid docking region;false
otherwise.
-
registerDockable
Creates, registers, and returns aDockable
for the specifiedComponent
. If the specifiedComponent
implements theDockable
interface, 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
tabText
by callinggetName()
on the specifiedComponent
. If the resolved value isnull
or empty, then the value"null"
is used.If
comp
isnull
, no exception is thrown and no action is performed.- Parameters:
comp
- the target component for theDockable
.- Returns:
- the
Dockable
that has been registered for the suppliedComponent
- See Also:
-
registerDockable
Creates aDockable
for the specifiedComponent
and dispatches toregisterDockable(Dockable init)
. Ifcomp
isnull
, 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
Dockable
that has been registered for the suppliedComponent
- See Also:
-
registerDockable
Registers and initializes the specifiedDockable
. AllDockables
managed by the framework must, at some point, be registered via this method. This method adds theDockable
to the internal registry, allowing querying by ID andComponent
. Drag listeners are added to theDockable
to enable drag-n-drop docking support. Docking properties are also initialized for theDockable
. This method fires aRegistrationEvent
once theDockable
has been registered. If theDockable
isnull
, noException
is thrown and no action is taken. TheDockable
returned by this method will be the same object passed in as an argument.- Parameters:
dockable
- the Dockable that is being registered.- Returns:
- the
Dockable
that has been registered. - See Also:
-
unregisterDockable
-
unregisterDockable
-
unregisterDockable
-
removeDragListeners
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
- theComponent
from which to remove drag listeners.- See Also:
-
display
Displays the specifiedDockable
in the application's docking layout. If theDockable
has not previously been docked, a suitable location is determined within the layout and theDockable
is docked to that location. If theDockable
has previously been docked within the layout and subsequently removed, as with a call toDockingManager.close()
, theDockable
will 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
. TheLayoutManager
implementation is responsible for handling the semantics of determining an initial docking location or restoring aDockable
to its previous layout state. If theDockable
parameter isnull
, noException
is thrown and no action is taken.- Parameters:
dockable
- theDockable
to be displayed.- Returns:
true
if theDockable
was successfully displayed;false
otherwise.- See Also:
-
display
Displays theDockable
with the specified ID within the application's docking layout. A validDockable
is looked up for the supplied ID. If none is found, this method returnsfalse
. Otherwise, processing is dispatched todisplay(Dockable dockable)
. If theDockable
has not previously been docked, a suitable location is determined within the layout and theDockable
is docked to that location. If theDockable
has previously been docked within the layout and subsequently removed, as with a call toDockingManager.close()
, theDockable
will 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
. TheLayoutManager
implementation is responsible for handling the semantics of determining an initial docking location or restoring aDockable
to its previous layout state. If theDockable
parameter isnull
, noException
is thrown and no action is taken.- Parameters:
dockable
- the ID of theDockable
to be displayed.- Returns:
true
if theDockable
was successfully displayed;false
otherwise.- See Also:
-
getDockingStrategy
Returns theDockingStrategy
associated with theClass
of theObject
parameter. This method returnsnull
if the parameter isnull
. Otherwise, the method retrieves theObject's
Class
and dispatches togetDockingStrategy(Class classKey)
.DockingStrategy
association 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.Object
is reached. Thus, if aDockingStrategy
mapping ofFoo
exists for classBar
, and classBaz
extendsBar
, then calling this method for an instance ofBaz
will 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
DefaultDockingStrategy
is returned.- Parameters:
obj
- the object whoseDockingStrategy
association we wish to test- Returns:
- the
DockingStrategy
associated with theClass
type of theObject
parameter. - See Also:
-
getDockingStrategy
Returns theDockingStrategy
associated with specifiedClass
. This method returnsnull
if the parameter isnull
.DockingStrategy
association follows a strict inheritance chain usingorg.flexdock.util.ClassMapping
. If a mapping forclassKey
is not found, then the superclass is tested, and so on untiljava.lang.Object
is reached. Thus, if aDockingStrategy
mapping ofFoo
exists for classBar
, and classBaz
extendsBar
, then calling this method for classBaz
will 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
DefaultDockingStrategy
is returned.- Parameters:
classKey
- theClass
whoseDockingStrategy
association we wish to test- Returns:
- the
DockingStrategy
associated with the specifiedClass
. - See Also:
-
getDockingWindows
Returns an array ofRootWindows
known to the docking framework that containDockingPorts
. AnyFrame
,Applet
,Dialog
, orWindow
that has aDockingPort
added as a descendentComponent
will automatically have anorg.flexdock.util.RootWindow
wrapper 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.Set
and is not guaranteed.- Returns:
- an array of all known
RootWindows
that containDockingPorts
- See Also:
-
getDockingPort
Returns theDockingPort
with the specified ID. If theportId
parameter isnull
, or aDockingPort
with the specified ID is not found, anull
reference is returned. This method internally dispatches toorg.flexdock.docking.event.hierarchy.DockingPortTracker.findById(String portId)
.portId
should match the value returned by aDockingPort's
getPersistentId()
method.- Parameters:
portId
- the ID of theDockingPort
to be looked up- Returns:
- the
DockingPort
with the specified ID - See Also:
-
getMainDockingPort
Returns the "main"DockingPort
within 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"DockingPort
within a given window will be considered by the application developer to contain the primary docking layout used by the enclosing window.The
Component
parameter may or may not be a root window container. If not, the ancestor window ofcomp
is determined and a set of docking ports encapsulated by aRootDockingPortInfo
instance is returned by a call togetRootDockingPortInfo(Component comp)
. The resolvedRootDockingPortInfo
instance's mainDockingPort
is returned via its methodgetMainPort()
.By default, the "main"
DockingPort
assigned to anyRootDockingPortInfo
instance associated with a window will happen to be the first rootDockingPort
detected for that window. In essence, the default settings make this method identical togetRootDockingPort(Component comp)
. This, however, may be altered byRootDockingPortInfo's
setMainPort(String portId)
method based upon the needs of the application developer. In contrast,getMainDockingPort(Component comp)
will always return the first rootDockingPort
found within a window.If
comp
isnull
or the root window cannot be resolved, then this method returns anull
reference. Anull
reference is also returned if the root window does not contain anyDockingPorts
.- Parameters:
comp
- theComponent
whose root window will be checked for a mainDockingPort
- Returns:
- the main
DockingPort
within the root window that containscomp
- See Also:
-
getRootDockingPort
Returns the first rootDockingPort
found within the application window containing the specifiedComponent
. A "root"DockingPort
is aDockingPort
embedded within a window/frame/applet/dialog that is not nested within any other parentDockingPorts
. TheComponent
parameter may or may not be a root window container itself. If not, the root window containingcomp
is resolved and the first rootDockingPort
found within it is returned. This method defers actual processing toorg.flexdock.docking.event.hierarchy.DockingPortTracker.findByWindow(Component comp)
.If
comp
isnull
or the root window cannot be resolved, then this method returns anull
reference. Anull
reference is also returned if the root window does not contain anyDockingPorts
.This method differs from
getMainDockingPort(Component comp)
in that the "main"DockingPort
for a given window is configurable by the application developer, whereas this method will always return the "first"DockingPort
found within the window. However, if the "main"DockingPort
has not been manually configured by the application developer, then this method andgetMainDockingPort(Component comp)
will exhibit identical behavior.- Parameters:
comp
- theComponent
whose root window will be checked for a rootDockingPort
- Returns:
- the first root
DockingPort
found within the root window that containscomp
- See Also:
-
getRootDockingPortInfo
Returns theRootDockingPortInfo
instance associated with the root window containing the specifiedComponent
. TheComponent
parameter may or may not be a root window container itself. If not, the root window containingcomp
is resolved and theRootDockingPortInfo
instance associated with the window is returned.RootDockingPortInfo
will contain information regarding all of the "root"DockingPorts
embedded within a root window where a "root"DockingPort
is anyDockingPort
embedded within the window that does not have any otherDockingPort
ancestors in it's container hierarchy.If
comp
isnull
or the root window cannot be resolved, then this method returns anull
reference. Anull
reference 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
- theComponent
whose root window will be checked for an associatedRootDockingPortInfo
.- Returns:
- the
RootDockingPortInfo
instance associated with the root window containingcomp
. - See Also:
-
storeLayoutModel
Sends the application's current layout model to external storage. This method defers processing to the currently installedorg.flexdock.docking.state.LayoutManager
by invoking itsstore()
method. If there is noLayoutManager
installed, then this method returnsfalse
.The layout model itself, along with storage mechanism, is abstract and dependent upon the particular
LayoutManager
implementation. As such, it may be possible that theLayoutManager
is unable to persist the current layout state for non-Exceptional reasons. This method returnstrue
if the layout model was successfully stored andfalse
if 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, anIOException
is thrown.- Returns:
true
if the current layout model was succesfully stored,false
otherwise.- See Also:
-
loadLayoutModel
Loads a previously stored layout model into the currently installedLayoutManager
. This method defers processing toloadLayoutModel(boolean restore)
with an argument offalse
to indicate that the stored data model should merely be loaded into memory and theLayoutManager
should 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
LayoutManager
implementation. As such, it may be possible that theLayoutManager
is unable to load the previous layout state for non-Exceptional reasons. This method returnstrue
if the layout model was successfully loaded andfalse
if 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, anIOException
is thrown.- Returns:
true
if the current layout model was succesfully loaded,false
otherwise.- See Also:
-
loadLayoutModel
Loads a previously stored layout model into the currently installedLayoutManager
and attempts to synchronize the application view with the newly loaded layout model if therestore
parameter istrue
. If there is no currently installedLayoutManager
, then this method returnsfalse
. If therestore
parameter 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.LayoutManager
by invoking itsload()
method.The layout model itself, along with storage mechanism, is abstract and dependent upon the particular
LayoutManager
implementation. As such, it may be possible that theLayoutManager
is unable to load the previous layout state for non-Exceptional reasons. This method returnstrue
if the layout model was successfully loaded andfalse
if 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, anIOException
is thrown.- Returns:
true
if the current layout model was succesfully loaded,false
otherwise.- See Also:
-
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 installedLayoutManager
to 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
LayoutManager
currently installed, then this method returnsfalse
.- Returns:
true
if the in-memory layout model was properly restored to the application view,false
otherwise.- See Also:
-
restoreLayout
public static boolean restoreLayout(boolean loadFromStorage) throws IOException, PersistenceException Synchronizes the application view with the current in-memory layout model. This method defers processing to the currently installedorg.flexdock.docking.state.LayoutManager
by invoking itsrestore(boolean loadFromStorage)
method. If there is noLayoutManager
currently installed, then this method returnsfalse
.If the
loadFromStorage
parameter istrue
, then theLayoutManager
is 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:
true
if the in-memory layout model was properly restored to the application view,false
otherwise.- See Also:
-
getDockingPort
Returns theDockingPort
that contains the specifiedComponent
. If theComponent
isnull
, then anull
reference is returned.This method will only return the immediate parent
DockingPort
of the specifiedComponent
This means that theDockingPort
returned by this method will not only be an ancestorContainer
of the specifiedComponent
, but invoking itsisParentDockingPort(Component comp)
with the specifiedComponent
will also returntrue
. If both of these conditions cannot be satisfied, then this method returns anull
reference.- Parameters:
dockable
- theComponent
whose parentDockingPort
is to be returned.- Returns:
- the imediate parent
DockingPort
that contains the specifiedComponent
.
-
getDockingPort
Returns theDockingPort
that contains the specifiedDockable
. If theDockable
isnull
, then anull
reference is returned.This method will only return the immediate parent
DockingPort
of the specifiedDockable
This means that a check is performed for theComponent
returned by theDockable's
getComponent()
method. TheDockingPort
returned by this method will not only be an ancestorContainer
of thisComponent
, but invoking theDockingPort's
isParentDockingPort(Component comp)
with the thisComponent
will also returntrue
. If both of these conditions cannot be satisfied, then this method returns anull
reference.- Parameters:
dockable
- theDockable
whose parentDockingPort
is to be returned.- Returns:
- the imediate parent
DockingPort
that contains the specifiedDockable
.
-
getDockable
Returns theDockable
instance that models the specifiedComponent
. TheDockable
returned by this method will return a reference tocomp
when itsgetComponent()
method is called. Ifcomp
isnull
, then this method will return anull
reference.The association between
Dockable
andComponent
is established internally duringregisterDockable(Dockable dockable)
. Thus,registerDockable(Dockable dockable)
must have been called previously for a mapping to be found and aDockable
to be returned by this method. If no mapping is found for the specifiedComponent
, then this method returns anull
reference.- Parameters:
comp
- theComponent
whoseDockable
instance is to be returned.- Returns:
- the
Dockable
that models the specifiedComponent
- See Also:
-
getDockable
Returns theDockable
instance with the specified ID. TheDockable
returned by this method will return a String equalid
when itsgetPersistentId()
method is called. Ifid
isnull
, then this method will return anull
reference.The association between
Dockable
andid
is established internally duringregisterDockable(Dockable dockable)
. Thus,registerDockable(Dockable dockable)
must have been called previously for a mapping to be found and aDockable
to be returned by this method. If no mapping is found for the specifiedid
, then this method returns anull
reference.- Parameters:
id
- the persistent ID of theDockable
instance is to be returned.- Returns:
- the
Dockable
that has the specified perstent ID. - See Also:
-
getDockableIds
Returns aSet
ofString
IDs for allDockables
registered with the framework. The IDs returned by this method will correspond to the values returned for thegetPersistentId()
method for eachDockable
registered with the framework.Dockable
IDs are cached duringregisterDockable(Dockable dockable)
. Thus, for an ID to appear within theSet
returned by this method, the correspondingDockable
must have first been registered viaregisterDockable(Dockable dockable)
. If noDockables
have been registered with the framework, then an emptySet
is returned. This method will never return anull
reference.- Returns:
- a
Set
ofString
IDs for allDockables
registered with the framework. - See Also:
-
getDragListener
Returns the listener object responsible for managing drag-to-dock mouse events for the specifiedDockable
. During registration, the listener is added to each of theComponents
within theDockable's
getDragSources()
List
. Thus, for this method to return a validDragManager
instance, theDockable
must first have been registered viaregisterDockable(Dockable dockable)
. If the specifiedDockable
isnull
or itsgetDragSources()
method returns anull
, or if theDockable
has not previously been registered, this method will return anull
reference.- Parameters:
dockable
- theDockable
whose drag listener is to be returned.- Returns:
- the
DragManager
responsible for listening to an managing drag-related mouse events for the specifiedDockable
. - See Also:
-
getLayoutManager
Returns the currently installedLayoutManager
. TheLayoutManager
is responsible for managing docking layout state. This includes tracking the state for allDockables
as they are embedded, minimized, floated, or hidden. If aDockable
is embedded, theLayoutManager
is responsible for tracking its position and size relative to other embeddedDockables
. If floating, theLayoutManager
is responsible for supplying aFloatManager
to maintainDockable
groupings within dialogs as well as dialog size and positioning.The
LayoutManager
is responsible for providing a persistence mechanism to save and restore layout states. Depending on theLayoutManager
implementation, it may or may not support multiple layout models that may be loaded and switched between at runtime.Because the
LayoutManager
is a critical piece of the docking infrastructure, it is not possible to install anull
LayoutManager
. Therefore, this method will always return a validLayoutManager
and never anull
reference.- Returns:
- the currently installed
LayoutManager
- See Also:
-
getMinimizeManager
Returns the currently installedMinimizationManager
. TheMinimizationManager
is responsible for minimizing and unminimizingDockables
, removing from and restoring to the embedded docking layout through the currently installedLayoutManager
.The visual representation of a "minimized"
Dockable
is somewhat abstract, although it is commonly expressed in user interfaces with the disappearance of theDockable
from the layout and the addition of a tab or label on one or more edges of the application window. TheMinimizationManager
implementation 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.Dockables
may or may not have limited docking functionality while in minimized and/or preview state, depending upon theMinimizationManager
implementation.Because the
MinimizationManager
is a critical piece of the docking infrastructure, it cannot be set tonull
. Therefore, this method will always return a validMinimizationManager
and never anull
reference.- Returns:
- the currently installed
MinimizationManager
. - See Also:
-
getFloatManager
Returns the currently installedFloatManager
. TheFloatManager
is actually provided by the currently installedLayoutManager
. As such, this method is merely for convenience. It internally obtains the installedLayoutManager
viagetLayoutManager()
and invokes itsgetFloatManager()
method.The
FloatManager
maintains information relevant to floatingDockables
including grouping them together within dialogs and tracking dialog size and position. TheFloatManager
is responsible for generating new dialogs, parenting on the proper application window(s), and sendingDockables
to the proper dialogs. It may be used by theLayoutManager
to restore hiddenDockables
to proper floating state as needed.Since the
FloatManager
is provided by the currently installedLayoutManager
, it cannot be set from within theDockingManager
. To change the installedFloatManager
, one must work directly with the installedLayoutManager
implementation per its particular custom API.Since the
FloatManager
is a critical piece of the docking insfrastructure, this method will never return anull
reference.- Returns:
- the
FloatManager
provided by the currently installedLayoutManager
- See Also:
-
getDockingState
Returns theDockingState
for theDockable
with the specified ID. TheDockingState
is used by the currently installedLayoutManager
to track information regarding aDockable's
current 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 theDockable
to the layout if it is currently hidden.The
Dockable
whose currentDockingState
is resolved will map to the specifieddockableId
via itsgetPersistentId()
method. The semantics of this mapping relationship are the same asDockingManager.getDockable(String id)
. If a validDockable
cannot be found for the specified ID, then this method returns anull
reference.The
DockingState
for any givenDockable
is ultimately managed by the currently installedLayoutManager
. Therefore, this method resolves theLayoutManager
viagetLayoutManager()
and defers processing to itsgetDockingState(String dockableId)
method.The underlying
LayoutManager
does not provide any guarantees that the sameDockingState
reference always will be returned for a givenDockable
; only that the returnedDockingState
will accurately reflect the current state maintained by theLayoutManager
for thatDockable
. For instance, if theLayoutManager
is capable of maintaining multiple layouts for an application (as Eclipse does between perspectives), then theLayoutManager
may or may not maintain multipleDockingState
instances for a singleDockable
, one within each layout context. Therefore, it is not a good idea to cache references to theDockingState
instance returned by this method for future use as the reference itself may possibly become stale over time depending on theLayoutManager
implementation.- Parameters:
dockableId
- the persistent ID of theDockable
whose currentDockingState
is to be returned- Returns:
- the current
DockingState
maintained by theLayoutManager
for the specifiedDockable
- See Also:
-
getDockingState
Returns theDockingState
for the specifiedDockable
. TheDockingState
is used by the currently installedLayoutManager
to track information regarding aDockable's
current 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 theDockable
to the layout if it is currently hidden.If the
dockable
parameter isnull
, then this method returns anull
reference.The
DockingState
for any givenDockable
is ultimately managed by the currently installedLayoutManager
. Therefore, this method resolves theLayoutManager
viagetLayoutManager()
and defers processing to itsgetDockingState(String dockableId)
method.The underlying
LayoutManager
does not provide any guarantees that the sameDockingState
reference always will be returned for a givenDockable
; only that the returnedDockingState
will accurately reflect the current state maintained by theLayoutManager
for thatDockable
. For instance, if theLayoutManager
is capable of maintaining multiple layouts for an application (as Eclipse does between perspectives), then theLayoutManager
may or may not maintain multipleDockingState
instances for a singleDockable
, one within each layout context. Therefore, it is not a good idea to cache references to theDockingState
instance returned by this method for future use as the reference itself may possibly become stale over time depending on theLayoutManager
implementation.- Parameters:
dockable
- theDockable
whose currentDockingState
is to be returned- Returns:
- the current
DockingState
maintained by theLayoutManager
for the specifiedDockable
- See Also:
-
getDockableFactory
Returns the currently installedDockableFactory
. TheDockableFactory
installed by default isnull
. Therefore, this method will return anull
reference until the application developer explicitly provides aDockableFactory
implementation viasetDockableFactory(DockableFactory factory)
.Installing a
DockableFactory
allows FlexDock to seamlessly create and registerDockables
withingetDockable(String id)
. Generally,getDockable(String id)
will lookup the requestedDockable
within the internal registry. If not found, and there is noDockableFactory
installed,getDockable(String id)
returns anull
reference. When aDockableFactory
is installed, however, failure to lookup a validDockable
will causegetDockable(String id)
to invoke the installedDockableFactory's
getDockable(String dockableId)
method, transparently registering and returning the newly createdDockable
fromgetDockable(String id)
.- Returns:
- the currently installed
DockableFactory
- See Also:
-
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 theDockingManager
class 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 anyIOExceptions
that may occur.- Parameters:
enabled
-true
if automatic persistence is desired;false
otherwise.- See Also:
-
setSplitProportion
Sets the divider location of the split layout containing the specified dockableComponent
. TheDockable
instance associated with the specifiedComponent
is 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
proportion
parameter. Valid values forproportion
range 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.0F
is used. If aproportion
greater than1.0F
is 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
proportion
of0.3F
does not imply thatdockable
itself 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 specifiedComponent
resides (which may possibly result indockable
being 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
Component
dimensions, which are initially0x0
before theComponent
has been rendered to the screen.If the specified
Component
isnull
, then noException
is thrown and no action is taken. Identical behavior occurs if a validDockable
cannot be resolved for the specifiedComponent
, or theDockable
does not reside within a split layout.If the
Dockable
resides 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
- theComponent
whose 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
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
proportion
parameter. Valid values forproportion
range 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.0F
is used. If aproportion
greater than1.0F
is 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
proportion
of0.3F
does not imply thatdockable
itself 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 specifiedDockable
resides (which may possibly result indockable
being 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
Component
dimensions, which are initially0x0
before theComponent
has been rendered to the screen.If the specified
Dockable
isnull
, then noException
is thrown and no action is taken. Identical behavior occurs if theDockable
does not reside within a split layout.If the
Dockable
resides 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
- theDockable
whose 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
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 respectiveDockable
parameters.The resulting divider location will be a percentage of the split layout size based upon the
proportion
parameter. Valid values forproportion
range 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.0F
is used. If aproportion
greater than1.0F
is 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
Component
dimensions, which are initially0x0
before theComponent
has been rendered to the screen.If the specified
DockingPort
isnull
, then noException
is thrown and no action is taken. Identical behavior occurs if theDockingPort
does not contain split layout.- Parameters:
port
- theDockingPort
containing the split layout is to be resized.proportion
- the percentage of split layout size to which the split divider should be set.
-
setDockableFactory
Sets the currently installedDockableFactory
.null
values for thefactory
parameter are acceptable.Installing a
DockableFactory
allows FlexDock to seamlessly create and registerDockables
withingetDockable(String id)
. Generally,getDockable(String id)
will lookup the requestedDockable
within the internal registry. If not found, and there is noDockableFactory
installed,getDockable(String id)
returns anull
reference. When aDockableFactory
is installed, however, failure to lookup a validDockable
will causegetDockable(String id)
to invoke the installedDockableFactory's
getDockable(String dockableId)
method, transparently registering and returning the newly createdDockable
fromgetDockable(String id)
.- Parameters:
factory
- theDockableFactory
to install- See Also:
-
setMinimized
Sets the minimized state for the specifiedDockable
. This method defers processing tosetMinimized(Dockable dockable, boolean minimized, Component window)
, passing the currentWindow
ancestor of the specifiedDockable
as thewindow
parameter. Minimization processessing is ultimately deferred to the currently installedMinimizationManager
with a constraint ofMinimizationManager.UNSPECIFIED_LAYOUT_CONSTRAINT
.The current
MinimizationManager
is responsible for updating the underlyingDockingState
model for the specifiedDockable
as well as rendering its own interpretation of the corresponding visual state on the screen. If the suppliedminimized
parameter matches the currentDockingState
, theMinimizationManager
is responsible for providing the appropriate visual indications, or lack thereof. If the specifiedDockable
isnull
, noException
is thrown and no action is taken.- Parameters:
dockable
- theDockable
whose minimzed state is to be modifiedminimized
-true
if the specifiedDockable
should be minimized,false
otherwise.- See Also:
-
setMinimized
Sets the minimized state for the specifiedDockable
. This method defers processing tosetMinimized(Dockable dockable, boolean minimizing, Component window, int constraint)
, passingMinimizationManager.UNSPECIFIED_LAYOUT_CONSTRAINT
for theconstraint
parameter. Minimization processessing is ultimately deferred to the currently installedMinimizationManager
.The
window
parameter is passed to theMinimizationManager
to indicate that minimization should be handled with respect to the specified root window, or the root window containing the specifiedComponent
.null
values are acceptable for this parameter.The current
MinimizationManager
is responsible for updating the underlyingDockingState
model for the specifiedDockable
as well as rendering its own interpretation of the corresponding visual state on the screen. If the suppliedminimized
parameter matches the currentDockingState
, theMinimizationManager
is responsible for providing the appropriate visual indications, or lack thereof. If the specifiedDockable
isnull
, noException
is thrown and no action is taken.- Parameters:
dockable
- theDockable
whose minimzed state is to be modifiedminimized
-true
if the specifiedDockable
should be minimized,false
otherwise.window
- theComponent
whose root window will be used by the underlyingMinimizationManager
for rendering theDockable
in its new minimized state.- See Also:
-
setMinimized
Sets the minimized state for the specifiedDockable
. This method defers processing tosetMinimized(Dockable dockable, boolean minimizing, Component window, int constraint)
, passingnull
for thewindow
parameter. Minimization processessing is ultimately deferred to the currently installedMinimizationManager
.Valid values for the
constraint
parameter may be found on theMinimizationManager
interface and include UNSPECIFIED_LAYOUT_CONSTRAINT, TOP, LEFT, BOTTOM, RIGHT, and CENTER. However, constraint values must ultimately be interpreted by the currentMinimizationManager
implementation and, thus any integer value may theoretically be valid forconstraint
.The current
MinimizationManager
is responsible for updating the underlyingDockingState
model for the specifiedDockable
as well as rendering its own interpretation of the corresponding visual state on the screen. If the suppliedminimized
parameter matches the currentDockingState
, theMinimizationManager
is responsible for providing the appropriate visual indications, or lack thereof. If the specifiedDockable
isnull
, noException
is thrown and no action is taken.- Parameters:
dockable
- theDockable
whose minimzed state is to be modifiedminimizing
-true
if the specifiedDockable
should be minimized,false
otherwise.constraint
- a value to indicate to theMinimizationManager
desired rendering of the minimizedDockable
- See Also:
-
setMinimized
public static void setMinimized(Dockable dockable, boolean minimizing, Component window, int constraint) Sets the minimized state for the specifiedDockable
. This method defers processing to the currently installedMinimizationManager
.The
window
parameter is passed to theMinimizationManager
to indicate that minimization should be handled with respect to the specified root window, or the root window containing the specifiedComponent
. If anull
values 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
MinimizationManager
is responsible for updating the underlyingDockingState
model for the specifiedDockable
as well as rendering its own interpretation of the corresponding visual state on the screen. If the suppliedminimized
parameter matches the currentDockingState
, theMinimizationManager
is responsible for providing the appropriate visual indications, or lack thereof. If the specifiedDockable
isnull
, noException
is thrown and no action is taken.Valid values for the
constraint
parameter may be found on theMinimizationManager
interface and include UNSPECIFIED_LAYOUT_CONSTRAINT, TOP, LEFT, BOTTOM, RIGHT, and CENTER. However, constraint values must ultimately be interpreted by the currentMinimizationManager
implementation and, thus any integer value may theoretically be valid forconstraint
.- Parameters:
dockable
- theDockable
whose minimzed state is to be modifiedminimizing
-true
if the specifiedDockable
should be minimized,false
otherwise.window
- theComponent
whose root window will be used by the underlyingMinimizationManager
for rendering theDockable
in its new minimized state.constraint
- a value to indicate to theMinimizationManager
desired rendering of the minimizedDockable
- See Also:
-
setMainDockingPort
Sets the "main"DockingPort
within 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"DockingPort
within a given window will be considered by the application developer to contain the primary docking layout used by the enclosing window.The
Component
parameter may or may not be a root window container. If not, the ancestor window ofcomp
is determined and a set of docking ports encapsulated by aRootDockingPortInfo
instance is returned by a call togetRootDockingPortInfo(Component comp)
. The resolvedRootDockingPortInfo
instance's mainDockingPort
is set via its methodsetMainPort(String portId)
.By default, the "main"
DockingPort
assigned to anyRootDockingPortInfo
instance associated with a window will happen to be the first rootDockingPort
detected for that window. This method is used to alter that setting.If
comp
isnull
or the root window cannot be resolved, then this method returns with no action taken.- Parameters:
window
- theComponent
whose root window will be checked for a mainDockingPort
portId
- the persistent ID of theDockingPort
to use as the mainDockingPort
for the specified window.- See Also:
-
setMinimizeManager
Sets the currently installedMinimizationManager
. TheMinimizationManager
is responsible for minimizing and unminimizingDockables
, removing from and restoring to the embedded docking layout through the currently installedLayoutManager
.The visual representation of a "minimized"
Dockable
is somewhat abstract, although it is commonly expressed in user interfaces with the disappearance of theDockable
from the layout and the addition of a tab or label on one or more edges of the application window. TheMinimizationManager
implementation 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.Dockables
may or may not have limited docking functionality while in minimized and/or preview state, depending upon theMinimizationManager
implementation.Because the
MinimizationManager
is a critical piece of the docking infrastructure, it cannot be set tonull
. If anull
value is passed into this method, the defaultMinimizationManager
provided by the framework is used instead.- Parameters:
mgr
- theMinimizationManager
to be installed- See Also:
-
setMinimizeManager
Sets the currently installedMinimizationManager
using the specfied class name. An attempt is make to instantiate aMinimizationManager
based upon the supplied class nameString
. If the class cannot be instaniated, a stacktrace is reported to the System.err and the defaultMinimizationManager
supplied by the framework is used. If theString
parameter isnull
, no error occurs and the defaultMinimizationManager
is used. If the instantiated class is not a valid instance ofMinimizationManager
, then aClassCastException
is thrown.The
MinimizationManager
is responsible for minimizing and unminimizingDockables
, removing from and restoring to the embedded docking layout through the currently installedLayoutManager
.The visual representation of a "minimized"
Dockable
is somewhat abstract, although it is commonly expressed in user interfaces with the disappearance of theDockable
from the layout and the addition of a tab or label on one or more edges of the application window. TheMinimizationManager
implementation 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.Dockables
may or may not have limited docking functionality while in minimized and/or preview state, depending upon theMinimizationManager
implementation.Because the
MinimizationManager
is a critical piece of the docking infrastructure, it cannot be set tonull
. If anull
value is passed into this method, the defaultMinimizationManager
provided by the framework is used instead.- Parameters:
mgrClass
- the class name of theMinimizationManager
to be installed- See Also:
-
setFloatingEnabled
public static void setFloatingEnabled(boolean enabled) Sets whether global floating support should be enabled. Defers processing toFloatPolicyManager.setGlobalFloatingEnabled(boolean globalFloatingEnabled)
.- Parameters:
enabled
-true
if global floating support should be enabled,false
otherwise.- See Also:
-
setDefaultPersistenceKey
-
getDefaultPersistenceKey
-
setSingleTabsAllowed
public static void setSingleTabsAllowed(boolean allowed) Sets whether tabbed layouts are supported by default forDockingPorts
with a singleDockable
in 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.- Parameters:
allowed
-true
if the default setting forDockingPorts
should allow a tabbed layout for a singleDockable
in the CENTER region;false
otherwise.- See Also:
-
setLayoutManager
Sets the currently installedLayoutManager
. TheLayoutManager
is responsible for managing docking layout state. This includes tracking the state for allDockables
as they are embedded, minimized, floated, or hidden. If aDockable
is embedded, theLayoutManager
is responsible for tracking its position and size relative to other embeddedDockables
. If floating, theLayoutManager
is responsible for supplying aFloatManager
to maintainDockable
groupings within dialogs as well as dialog size and positioning.The
LayoutManager
is responsible for providing a persistence mechanism to save and restore layout states. Depending on theLayoutManager
implementation, it may or may not support multiple layout models that may be loaded and switched between at runtime.Because the
LayoutManager
is a critical piece of the docking infrastructure, it is not possible to install anull
LayoutManager
. FlexDock provides a defaultLayoutManager
implementation. If this method is passed anull
argument, the defaultLayoutManager
is used instead.- Parameters:
mgr
- theLayoutManager
to install.- See Also:
-
setLayoutManager
Sets the currently installedLayoutManager
using the specified class name. An attempt is make to instantiate aLayoutManager
based upon the supplied class nameString
. If the class cannot be instaniated, a stacktrace is reported to the System.err and the defaultLayoutManager
supplied by the framework is used. If theString
parameter isnull
, no error occurs and the defaultLayoutManager
is used. If the instantiated class is not a valid instance ofLayoutManager
, then aClassCastException
is thrown.The
LayoutManager
is responsible for managing docking layout state. This includes tracking the state for allDockables
as they are embedded, minimized, floated, or hidden. If aDockable
is embedded, theLayoutManager
is responsible for tracking its position and size relative to other embeddedDockables
. If floating, theLayoutManager
is responsible for supplying aFloatManager
to maintainDockable
groupings within dialogs as well as dialog size and positioning.The
LayoutManager
is responsible for providing a persistence mechanism to save and restore layout states. Depending on theLayoutManager
implementation, it may or may not support multiple layout models that may be loaded and switched between at runtime.Because the
LayoutManager
is a critical piece of the docking infrastructure, it is not possible to install anull
LayoutManager
. FlexDock provides a defaultLayoutManager
implementation. If this method is passed anull
argument, the defaultLayoutManager
is used instead.- Parameters:
mgrClass
- the class name of theLayoutManager
to install.- See Also:
-
setDockingStrategy
Sets theDockingStrategy
associated with specifiedClass
. This method returns with no action taken if the specifiedClass
paramter isnull
. If thestrategy
parameter isnull
then any existingDockingStrategy
association with the specified }Class} is removed. Otherwise, a newDockingStrategy
association is added for the specifiedClass
.DockingStrategy
association follows a strict inheritance chain usingorg.flexdock.util.ClassMapping
. This means that the association created by this method applies for the specifiedClass
and all direct subclasses, but associations for interfaces are ignored. Associations also do not apply for subclasses that have their own specificDockingStrategy
mapping.- Parameters:
classKey
- theClass
whoseDockingStrategy
association we wish to setstrategy
- theDockingStrategy
to be associated with the specifiedClass
.- See Also:
-
undock
Undocks the specifiedDockable
from its parentDockingPort
. If theDockable
isnull
, or it does not currently reside within aDockingPort
, then this method returnsfalse
with no action taken. Otherwise, this method returnstrue
if the undocking operation was successful andfalse
if the undocking operation could not be completed. This method determines theDockingStrategy
to be used forDockingPort
containing the specifiedDockable
and defers processing to theundock(Dockable dockable)
method on theDockingStrategy
. This method's return value will be based upon theDockingStrategy
implementation returned by a call togetDockingStrategy(Object obj)
. TheDockingStrategy
used may be controlled viasetDockingStrategy(Class c, DockingStrategy strategy)
, supplying aDockingPort
implementation class and a customizedDockingStrategy
.- Parameters:
dockable
- theDockable
to be undocked.- Returns:
true
if the undocking operation was successful,false
otherwise.- See Also:
-
undock
-
updateDragListeners
Ensures that a validDragManager
has been installed as a listener for all of the specifiedDockable's
drag sourceComponents
. This method invokes thegetDragSources()
method on the specifiedDockable
and iterates over eachComponent
in the returnedList
. If anyComponent
does not have a validDragManager
listener 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
Components
to aDockable's
drag 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
Dockable
isnull
, then noException
is thrown and no action is taken.- Parameters:
dockable
- theDockable
whose drag sources are to be checked forDragManagers
and updated accordingly.- See Also:
-
getDefaultSiblingSize
public static float getDefaultSiblingSize() -
setDefaultSiblingSize
public static void setDefaultSiblingSize(float size) -
setRubberBand
-
setDragPreview
-
toggleMaximized
Maximizes theDockable
associated with the specified component or restores theDockable
if it is currently maximized. This method forwards the request totoggleMaximized(Dockable)
after obtaining theDockable
associated to the component viagetDockable(Component)
.- Parameters:
comp
-- See Also:
-
toggleMaximized
Maximizes the specifiedDockable
or restores the specifiedDockable
if it is already maximized.The scope of maximization is the root
DockingPort
. The specifiedDockable
's currentDockingPort
is asked to temporarily lend theDockable
for maximization and the rootDockingPort
is asked to temorarily host theDockable
and display it such that it occupies all (or the majority) of its screen resources. If theDockable
is already maximized, the rootDockingPort
is asked to return to its original state and theDockable
is returned to its originalDockingPort
.- Parameters:
dockable
-
-
isMaximized
-