org.flexdock.docking
public class DockingManager extends Object implements 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:
Dockables
and DockingPorts
are cached within an and
accessible through and internal registry. DockingManager
provides APIs for managing various different
global framework settings, including application-key, floating support,
auto-persistence, LayoutManagers
, and MinimizationManagers
.
DockingManager
automatically adds and removes necessary event
listeners to enable/disable drag-to-dock behavior as components are
registered and unregistered. DockingManager
provides public APIs for programmatically dock,
undock, minimize, persist, and load Dockables
from storage. Modifier and Type | Field and Description |
---|---|
static String |
LAYOUT_MANAGER |
static String |
MINIMIZE_MANAGER |
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
Modifier and Type | Method and Description |
---|---|
static void |
addDragSource(Dockable dockable,
Component dragSrc) |
static void |
close(Dockable dockable)
Convenience method that removes the specified
Dockable from the
layout. |
static boolean |
display(Dockable dockable)
Displays the specified
Dockable in the application's docking
layout. |
static boolean |
display(String dockable)
Displays the
Dockable with the specified ID within the
application's docking layout. |
static boolean |
dock(Component dockable,
Component parent)
Docks the specified
Component relative to another already-docked
Component in the CENTER region. |
static boolean |
dock(Component dockable,
Component parent,
String region)
Docks the specified
Component relative to another already-docked
Component in the specified region. |
static boolean |
dock(Component dockable,
Component parent,
String region,
float proportion)
Docks the specified
Component relative to another already-docked
Component in the specified region with the specified split
proportion. |
static boolean |
dock(Component dockable,
DockingPort port)
Docks the specified
Component into the CENTER region of the
specified DockingPort . |
static boolean |
dock(Component dockable,
DockingPort port,
String region)
Docks the specified
Component into the supplied region of the
specified DockingPort . |
static boolean |
dock(Dockable dockable,
Dockable parent)
Docks the specified
Dockable relative to another already-docked
Dockable in the CENTER region. |
static boolean |
dock(Dockable dockable,
Dockable parent,
String region)
Docks the specified
Dockable relative to another already-docked
Dockable in the specified region. |
static boolean |
dock(Dockable dockable,
Dockable parent,
String region,
float proportion)
Docks the specified
Dockable relative to another already-docked
Dockable in the specified region with the specified split
proportion. |
static boolean |
dock(Dockable dockable,
DockingPort port,
String region)
Docks the specified
Dockable into the supplied region of the
specified DockingPort . |
static String |
getDefaultPersistenceKey() |
static float |
getDefaultSiblingSize() |
static Dockable |
getDockable(Component comp)
Returns the
Dockable instance that models the specified
Component . |
static Dockable |
getDockable(String id)
Returns the
Dockable instance with the specified ID. |
static DockableFactory |
getDockableFactory()
Returns the currently installed
DockableFactory . |
static Set |
getDockableIds()
Returns a
Set of String IDs for all Dockables
registered with the framework. |
static DockingPort |
getDockingPort(Component dockable)
Returns the
DockingPort that contains the specified
Component . |
static DockingPort |
getDockingPort(Dockable dockable)
Returns the
DockingPort that contains the specified
Dockable . |
static DockingPort |
getDockingPort(String portId)
Returns the
DockingPort with the specified ID. |
static DockingState |
getDockingState(Dockable dockable)
Returns the
DockingState for the specified Dockable . |
static DockingState |
getDockingState(String dockableId)
Returns the
DockingState for the Dockable with the
specified ID. |
static DockingStrategy |
getDockingStrategy(Class classKey)
Returns the
DockingStrategy associated with specified
Class . |
static DockingStrategy |
getDockingStrategy(Object obj)
Returns the
DockingStrategy associated with the Class of
the Object parameter. |
static RootWindow[] |
getDockingWindows()
Returns an array of
RootWindows known to the docking framework
that contain DockingPorts . |
static DragManager |
getDragListener(Dockable dockable)
Returns the listener object responsible for managing drag-to-dock mouse
events for the specified
Dockable . |
static FloatManager |
getFloatManager()
Returns the currently installed
FloatManager . |
static LayoutManager |
getLayoutManager()
Returns the currently installed
LayoutManager . |
static DockingPort |
getMainDockingPort(Component comp)
Returns the "main"
DockingPort within the application window
containing the specified Component . |
static MinimizationManager |
getMinimizeManager()
Returns the currently installed
MinimizationManager . |
static DockingPort |
getRootDockingPort(Component comp)
Returns the first root
DockingPort found within the application
window containing the specified Component . |
static RootDockingPortInfo |
getRootDockingPortInfo(Component comp)
Returns the
RootDockingPortInfo instance associated with the root
window containing the specified Component . |
static boolean |
isDocked(Component component)
Indicates whether the specified
Component is currently docked. |
static boolean |
isDocked(Dockable dockable)
Indicates whether the specified
Dockable is currently docked. |
static boolean |
isDocked(DockingPort dockingPort,
Dockable dockable)
Checks whether a supplied
Dockable is docked within a supplied
DockingPort instance. |
static boolean |
isFloatingEnabled()
Indicates whether global floating support is currently enabled.
|
static boolean |
isMaximized(Dockable dockable) |
static boolean |
isSingleTabsAllowed()
Indicates whether tabbed layouts are supported by default for
DockingPorts with a single Dockable in the CENTER region. |
static boolean |
isValidDockingRegion(String region)
Indicates whether the supplied parameter is considered a valid docking
region.
|
static boolean |
loadLayoutModel()
Loads a previously stored layout model into the currently installed
LayoutManager . |
static boolean |
loadLayoutModel(boolean restore)
Loads a previously stored layout model into the currently installed
LayoutManager and attempts to synchronize the application view
with the newly loaded layout model if the restore parameter is
true . |
static Dockable |
registerDockable(Component comp)
Creates, registers, and returns a
Dockable for the specified
Component . |
static Dockable |
registerDockable(Component comp,
String tabText)
Creates a
Dockable for the specified Component and
dispatches to registerDockable(Dockable init) . |
static Dockable |
registerDockable(Dockable dockable)
Registers and initializes the specified
Dockable . |
static void |
removeDragListeners(Component comp)
Removes the event listeners that manage drag-n-drop docking operations
from the specified
Component . |
static boolean |
restoreLayout()
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 |
setDefaultPersistenceKey(String key) |
static void |
setDefaultSiblingSize(float size) |
static void |
setDockableFactory(DockableFactory factory)
Sets the currently installed
DockableFactory . |
static void |
setDockingStrategy(Class classKey,
DockingStrategy strategy)
Sets the
DockingStrategy associated with specified Class . |
static void |
setDragPreview(DragPreview dragPreview) |
static void |
setFloatingEnabled(boolean enabled)
Sets whether global floating support should be enabled.
|
static void |
setLayoutManager(LayoutManager mgr)
Sets the currently installed
LayoutManager . |
static void |
setLayoutManager(String mgrClass)
Sets the currently installed
LayoutManager using the specified
class name. |
static void |
setMainDockingPort(Component window,
String portId)
Sets the "main"
DockingPort within the application window
containing the specified Component . |
static void |
setMinimized(Dockable dockable,
boolean minimized)
Sets the minimized state for the specified
Dockable . |
static void |
setMinimized(Dockable dockable,
boolean minimized,
Component window)
Sets the minimized state for the specified
Dockable . |
static void |
setMinimized(Dockable dockable,
boolean minimizing,
Component window,
int constraint)
Sets the minimized state for the specified
Dockable . |
static void |
setMinimized(Dockable dockable,
boolean minimizing,
int constraint)
Sets the minimized state for the specified
Dockable . |
static void |
setMinimizeManager(MinimizationManager mgr)
Sets the currently installed
MinimizationManager . |
static void |
setMinimizeManager(String mgrClass)
Sets the currently installed
MinimizationManager using the
specfied class name. |
static void |
setRubberBand(RubberBand rubberBand) |
static void |
setSingleTabsAllowed(boolean allowed)
Sets whether tabbed layouts are supported by default for
DockingPorts with a single Dockable in the CENTER region. |
static void |
setSplitProportion(Component dockable,
float proportion)
Sets the divider location of the split layout containing the specified
dockable
Component . |
static void |
setSplitProportion(Dockable dockable,
float proportion)
Sets the divider location of the split layout containing the specified
dockable
Component . |
static void |
setSplitProportion(DockingPort port,
float proportion)
Sets the divider location of the split layout embedded within the
specified
DockingPort . |
static boolean |
storeLayoutModel()
Sends the application's current layout model to external storage.
|
static void |
toggleMaximized(Component comp)
Maximizes the
Dockable associated with the specified component or
restores the Dockable if it is currently maximized. |
static void |
toggleMaximized(Dockable dockable)
Maximizes the specified
Dockable or restores the specified
Dockable if it is already maximized. |
static boolean |
undock(Component dockable) |
static boolean |
undock(Dockable dockable)
Undocks the specified
Dockable from its parent
DockingPort . |
static void |
unregisterDockable(Component comp) |
static void |
unregisterDockable(Dockable dockable) |
static void |
unregisterDockable(String dockingId) |
static void |
updateDragListeners(Dockable dockable)
Ensures that a valid
DragManager has been installed as a listener
for all of the specified Dockable's drag source
Components . |
public static final String MINIMIZE_MANAGER
public static final String LAYOUT_MANAGER
public static void close(Dockable dockable)
Dockable
from the
layout. If the Dockable
is embedded within the main application
frame or a floating dialog, it is removed from the container hierarchy.
If the Dockable
is presently minimized, it is removed from the
current minimization manager. If the Dockable
is already "closed"
or is null
, no operation is performed. "Closing" a
Dockable
only removes it from the visual layout. It does not
remove it from the internal Dockable
registry and all underlying
DockingState
information remains consistent so that the
Dockable
may later be restored to its original location within
the application.dockable
- the Dockable
to be closed.public static boolean dock(Component dockable, DockingPort port)
Component
into the CENTER region of the
specified DockingPort
. If the DockingManager
finds a
valid Dockable
instance mapped to the specified Component
,
the Dockable
will be docked into the DockingPort
. If the
Component
or DockingPort
is null
, or a valid
Dockable
cannot be found for the specified Component
,
this method returns false
. Otherwise, this method returns
true
if the docking operation was successful and false
if
the docking operation cannot be completed. This method defers processing
to dock(Component dockable , DockingPort port, String region)
.dockable
- the Component
to be docked.port
- the DockingPort
into which the specified
Component
will be docked.true
if the docking operation was successful,
false
otherwise.dock(Component, DockingPort, String)
public static boolean dock(Component dockable, DockingPort port, String region)
Component
into the supplied region of the
specified DockingPort
. If the DockingManager
finds a
valid Dockable
instance mapped to the specified Component
,
the Dockable
will be docked into the DockingPort
. If the
Component
or DockingPort
is null
, or a valid
Dockable
cannot be found for the specified Component
,
this method returns false
. Otherwise, this method returns
true
if the docking operation was successful and false
if
the docking operation cannot be completed. This method defers processing
to dock(Dockable dockable, DockingPort port, String region)
.dockable
- the Component
to be docked.port
- the DockingPort
into which the specified
Component
will be docked.region
- the region into which to dock the specified Component
true
if the docking operation was successful,
false
if the docking operation cannot be completed.dock(Dockable, DockingPort, String)
public static boolean dock(Dockable dockable, DockingPort port, String region)
Dockable
into the supplied region of the
specified DockingPort
. If the Dockable
or
DockingPort
is null
, this method returns false
.
Otherwise, this method returns true
if the docking operation was
successful and false
if the docking operation cannot be
completed.
This method determines the DockingStrategy
to be used for the
specified DockingPort
and defers processing to the
DockingStrategy
. This method's return value will be based upon
the DockingStrategy
implementation and is subject to conditions
such as whether the supplied region is deemed valid, whether the
DockingStrategy
allows this particular Dockable
to be
docked into the supplied region of the specified DockingPort
,
and so on. The DockingStrategy
used is obtained by a call to
getDockingStrategy(Object obj)
and may be controlled via
setDockingStrategy(Class c, DockingStrategy strategy)
, supplying
a DockingPort
implementation class and a customized
DockingStrategy
.dockable
- the Dockable
to be docked.port
- the DockingPort
into which the specified
Component
will be docked.region
- the region into which to dock the specified Dockable
true
if the docking operation was successful,
false
otherwise.DockingStrategy.dock(Dockable, DockingPort, String)
,
getDockingStrategy(Object)
,
setDockingStrategy(Class, DockingStrategy)
public static boolean dock(Component dockable, Component parent)
Component
relative to another already-docked
Component
in the CENTER region. Valid Dockable
instances
are looked up for both Component
parameters and processing is
deferred to dock(Dockable dockable, Dockable parent)
. If a valid
Dockable
cannot be resolved for either Component
, then
this method returns false
. The "parent" Dockable
must
currently be docked. If not, this method will return false
.
Otherwise, its parent DockingPort
will be resolved and the new
Dockable
will be docked into the DockingPort
relative to
the "parent" Dockable
.dockable
- the Component
to be dockedparent
- the Component
used as a reference point for dockingtrue
if the docking operation was successful;
false
otherwise.dock(Dockable, Dockable)
public static boolean dock(Dockable dockable, Dockable parent)
Dockable
relative to another already-docked
Dockable
in the CENTER region. The "parent" Dockable
must
currently be docked. If not, this method will return false
.
Otherwise, its parent DockingPort
will be resolved and the new
Dockable
will be docked into the DockingPort
relative to
the "parent" Dockable
. This method defers processing to
dock(Dockable dockable, Dockable parent, String region)
and
returns false
if any of the input parameters are null
.dockable
- the Dockable
to be dockedparent
- the Dockable
used as a reference point for dockingtrue
if the docking operation was successful;
false
otherwise.dock(Dockable, Dockable, String)
public static boolean dock(Component dockable, Component parent, String region)
Component
relative to another already-docked
Component
in the specified region. Valid Dockable
instances will be looked up for each of the Component
parameters.
If a valid Dockable
is not found for either Component
,
then this method returns false
. The "parent" Dockable
must currently be docked. If not, this method will return false
.
Otherwise, its parent DockingPort
will be resolved and the new
Dockable
will be docked into the DockingPort
relative to
the "parent" Dockable
. This method defers processing to
dock(Component dockable, Component parent, String region, float proportion)
and returns false
if any of the input parameters are null
.
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.dockable
- the Component
to be dockedparent
- the Component
used as a reference point for dockingregion
- the relative docking region into which dockable
will
be dockedtrue
if the docking operation was successful;
false
otherwise.dock(Component, Component, String, float)
public static boolean dock(Dockable dockable, Dockable parent, String region)
Dockable
relative to another already-docked
Dockable
in the specified region. The "parent" Dockable
must currently be docked. If not, this method will return false
.
Otherwise, its parent DockingPort
will be resolved and the new
Dockable
will be docked into the DockingPort
relative to
the "parent" Dockable
. This method defers processing to
dock(Dockable dockable, Dockable parent, String region, float proportion)
and returns false
if any of the input parameters are null
.
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.dockable
- the Dockable
to be dockedparent
- the Dockable
used as a reference point for dockingregion
- the docking region into which dockable
will be dockedtrue
if the docking operation was successful;
false
otherwise.dock(Dockable, Dockable, String, float)
public static boolean dock(Component dockable, Component parent, String region, float proportion)
Component
relative to another already-docked
Component
in the specified region with the specified split
proportion. Valid Dockable
instances will be looked up for each
of the Component
parameters. If a valid Dockable
is not
found for either Component
, then this method returns
false
. The "parent" Dockable
must currently be docked.
If not, this method will return false
. Otherwise, its parent
DockingPort
will be resolved and the new Dockable
will be
docked into the DockingPort
relative to the "parent"
Dockable
. If the specified region is CENTER, then the
proportion
parameter is ignored. Otherwise, a split layout should
result with the proportional space specified in the proportion
parameter allotted to the dockable
argument. This method defers
processing to
dock(Dockable dockable, Dockable parent, String region, float proportion)
.dockable
- the Component
to be dockedparent
- the Component
used as a reference point for dockingregion
- the relative docking region into which dockable
will
be dockedproportion
- the proportional space to allot the dockable
argument
if the docking operation results in a split layout.true
if the docking operation was successful;
false
otherwise.public static boolean dock(Dockable dockable, Dockable parent, String region, float proportion)
Dockable
relative to another already-docked
Dockable
in the specified region with the specified split
proportion. The "parent" Dockable
must currently be docked. If
not, this method will return false
. Otherwise, its parent
DockingPort
will be resolved and the new Dockable
will be
docked into the DockingPort
relative to the "parent"
Dockable
. If the specified region is CENTER, then the
proportion
parameter is ignored. Otherwise, a split layout should
result with the proportional space specified in the proportion
parameter allotted to the dockable
argument.dockable
- the Dockable
to be dockedparent
- the Dockable
used as a reference point for dockingregion
- the docking region into which dockable
will be dockedproportion
- the proportional space to allot the dockable
argument
if the docking operation results in a split layout.true
if the docking operation was successful;
false
otherwise.public static boolean isDocked(Component component)
Component
is currently docked.
This method looks up a parent DockingPort
for the specified
Component
via a call to
getDockingPort(Component dockable)
. This method returns
true
if a parent DockingPort
is found and false
if no parent DockingPort
is present. This method returns
false
if the Component
parameter is null
.component
- the Component
whose docking status is to be examinedtrue
if the Component
is currently docked;
otherwise false
.public static boolean isDocked(Dockable dockable)
Dockable
is currently docked.
This method looks up a parent DockingPort
for the specified
Dockable
via a call to getDockingPort(Dockable dockable)
.
This method returns true
if a parent DockingPort
is found
and false
if no parent DockingPort
is present. This
method returns false
if the Dockable
parameter is
null
.dockable
- the Dockable
whose docking status is to be examinedtrue
if the Dockable
is currently docked;
otherwise false
.public static boolean isDocked(DockingPort dockingPort, Dockable dockable)
Dockable
is docked within a supplied
DockingPort
instance. Returns true
if the
DockingPort
contains the specified Dockable
;
false
otherwise. This method returns false
if either of
the input parameters are null
.dockingPort
- the DockingPort
to be testeddockable
- the Dockable
instance to be examinedtrue
if the supplied DockingPort
contains the
specified Dockable
; false
otherwise.public static boolean isFloatingEnabled()
FloatPolicyManager.isGlobalFloatingEnabled()
.true
if global floating support is enabled, false
otherwise.FloatPolicyManager.isGlobalFloatingEnabled()
public static boolean isSingleTabsAllowed()
DockingPorts
with a single Dockable
in the CENTER region.
This is a global default setting and applies to any
This method defers processing to
org.flexdock.docking.props.PropertyManager.getDockingPortRoot()
.
As such, there are multiple "scopes" at which this property may be
overridden.
true
if the default setting for DockingPorts
allows a tabbed layout for a single Dockable
in the
CENTER region; false
otherwise.PropertyManager.getDockingPortRoot()
,
DockingPortPropertySet.isSingleTabsAllowed()
public static boolean isValidDockingRegion(String region)
DockingConstants
and
include NORTH_REGION
, SOUTH_REGION
, EAST_REGION
,
WEST_REGION
, and CENTER_REGION
. This method returns
true
if the supplied parameter is equal to one of these values.region
- the region value to be testedtrue
if the supplied parameter is a valid docking region;
false
otherwise.public static Dockable registerDockable(Component comp)
Dockable
for the specified
Component
. If the specified Component
implements the
Dockable
interface, then this method dispatches to
registerDockable(Dockable dockable)
. Otherwise, this method
dispatches to registerDockable(Component comp, String tabText)
.
This method attempts to resolve an appropriate value for tabText
by calling getName()
on the specified Component
. If the
resolved value is null
or empty, then the value "null"
is
used.
If comp
is null
, no exception is thrown and no action is
performed.
comp
- the target component for the Dockable
.Dockable
that has been registered for the supplied
Component
registerDockable(Dockable)
,
registerDockable(Component, String)
public static Dockable registerDockable(Component comp, String tabText)
Dockable
for the specified Component
and
dispatches to registerDockable(Dockable init)
. If comp
is null
, no exception is thrown and no action is performed.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 paneDockable
that has been registered for the supplied
Component
registerDockable(Dockable)
public static Dockable registerDockable(Dockable dockable)
Dockable
. All
Dockables
managed by the framework must, at some point, be
registered via this method. This method adds the Dockable
to the
internal registry, allowing querying by ID and Component
. Drag
listeners are added to the Dockable
to enable drag-n-drop docking
support. Docking properties are also initialized for the Dockable
.
This method fires a RegistrationEvent
once the Dockable
has been registered. If the Dockable
is null
, no
Exception
is thrown and no action is taken. The Dockable
returned by this method will be the same object passed in as an argument.dockable
- the Dockable that is being registered.Dockable
that has been registered.RegistrationEvent
public static void unregisterDockable(Component comp)
public static void unregisterDockable(String dockingId)
public static void unregisterDockable(Dockable dockable)
public static void removeDragListeners(Component comp)
Component
. If the specific listeners are not
present, then no action is taken. Drag listeners used by the docking
system are of type org.flexdock.docking.drag.DragManager
.comp
- the Component
from which to remove drag listeners.DragManager
public static boolean display(Dockable dockable)
Dockable
in the application's docking
layout. If the Dockable
has not previously been docked, a
suitable location is determined within the layout and the
Dockable
is docked to that location. If the Dockable
has
previously been docked within the layout and subsequently removed, as
with a call to DockingManager.close()
, the Dockable
will
be restored to its prior state within the layout. This method defers
processing to the display(Dockable dockable)
method for the
currently installed org.flexdock.docking.state.LayoutManager
.
The LayoutManager
implementation is responsible for handling the
semantics of determining an initial docking location or restoring a
Dockable
to its previous layout state. If the Dockable
parameter is null
, no Exception
is thrown and no action
is taken.dockable
- the Dockable
to be displayed.true
if the Dockable
was successfully displayed;
false
otherwise.getLayoutManager()
,
LayoutManager.display(Dockable)
public static boolean display(String dockable)
Dockable
with the specified ID within the
application's docking layout. A valid Dockable
is looked up for
the supplied ID. If none is found, this method returns false
.
Otherwise, processing is dispatched to display(Dockable dockable)
.
If the Dockable
has not previously been docked, a suitable
location is determined within the layout and the Dockable
is
docked to that location. If the Dockable
has previously been
docked within the layout and subsequently removed, as with a call to
DockingManager.close()
, the Dockable
will be restored to
its prior state within the layout. This method defers processing to the
display(Dockable dockable)
method for the currently installed
org.flexdock.docking.state.LayoutManager
. The
LayoutManager
implementation is responsible for handling the
semantics of determining an initial docking location or restoring a
Dockable
to its previous layout state. If the Dockable
parameter is null
, no Exception
is thrown and no action
is taken.dockable
- the ID of the Dockable
to be displayed.true
if the Dockable
was successfully displayed;
false
otherwise.display(Dockable)
,
getLayoutManager()
,
LayoutManager.display(Dockable)
public static DockingStrategy getDockingStrategy(Object obj)
DockingStrategy
associated with the Class
of
the Object
parameter. This method returns null
if the
parameter is null
. Otherwise, the method retrieves the
Object's
Class
and dispatches to
getDockingStrategy(Class classKey)
.
DockingStrategy
association follows a strict inheritance chain
using org.flexdock.util.ClassMapping
. If a mapping for
obj.getClass()
is not found, then the superclass is tested, and
so on until java.lang.Object
is reached. Thus, if a
DockingStrategy
mapping of Foo
exists for class
Bar
, and class Baz
extends Bar
, then calling
this method for an instance of Baz
will return an instance of
Foo
. 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.
obj
- the object whose DockingStrategy
association we wish
to testDockingStrategy
associated with the Class
type of the Object
parameter.getDockingStrategy(Class)
,
setDockingStrategy(Class, DockingStrategy)
,
ClassMapping.getClassInstance(Class)
public static DockingStrategy getDockingStrategy(Class classKey)
DockingStrategy
associated with specified
Class
. This method returns null
if the parameter is
null
.
DockingStrategy
association follows a strict inheritance chain
using org.flexdock.util.ClassMapping
. If a mapping for
classKey
is not found, then the superclass is tested, and so on
until java.lang.Object
is reached. Thus, if a
DockingStrategy
mapping of Foo
exists for class
Bar
, and class Baz
extends Bar
, then calling
this method for class Baz
will return an instance of Foo
.
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.
classKey
- the Class
whose DockingStrategy
association we
wish to testDockingStrategy
associated with the specified
Class
.setDockingStrategy(Class, DockingStrategy)
,
ClassMapping.getClassInstance(Class)
public static RootWindow[] getDockingWindows()
RootWindows
known to the docking framework
that contain DockingPorts
. Any Frame
, Applet
,
Dialog
, or Window
that has a DockingPort
added
as a descendent Component
will automatically have an
org.flexdock.util.RootWindow
wrapper instance associated with it.
This method will return an array of all known RootWindows that contain
DockingPorts
. Ordering of the array may be based off of a
java.util.Set
and is not guaranteed.RootWindows
that contain
DockingPorts
RootWindow
,
DockingPortTracker.getDockingWindows()
public static DockingPort getDockingPort(String portId)
DockingPort
with the specified ID. If the
portId
parameter is null
, or a DockingPort
with
the specified ID is not found, a null
reference is returned. This
method internally dispatches to
org.flexdock.docking.event.hierarchy.DockingPortTracker.findById(String portId)
.
portId
should match the value returned by a DockingPort's
getPersistentId()
method.portId
- the ID of the DockingPort
to be looked upDockingPort
with the specified IDDockingPort.getPersistentId()
,
DockingPortTracker.findById(String)
public static DockingPort getMainDockingPort(Component comp)
DockingPort
within the application window
containing the specified Component
. 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 of comp
is determined and
a set of docking ports encapsulated by a RootDockingPortInfo
instance is returned by a call to
getRootDockingPortInfo(Component comp)
. The resolved
RootDockingPortInfo
instance's main DockingPort
is
returned via its method getMainPort()
.
By default, the "main" DockingPort
assigned to any
RootDockingPortInfo
instance associated with a window will happen
to be the first root DockingPort
detected for that window. In
essence, the default settings make this method identical to
getRootDockingPort(Component comp)
. This, however, may be
altered by RootDockingPortInfo's
setMainPort(String portId)
method based upon the needs of the
application developer. In contrast,
getMainDockingPort(Component comp)
will always return the first
root DockingPort
found within a window.
If comp
is null
or the root window cannot be resolved,
then this method returns a null
reference. A null
reference is also returned if the root window does not contain any
DockingPorts
.
comp
- the Component
whose root window will be checked for a
main DockingPort
DockingPort
within the root window that contains
comp
getRootDockingPortInfo(Component)
,
getRootDockingPort(Component)
,
DockingPortTracker.getRootDockingPortInfo(Component)
,
RootDockingPortInfo.getMainPort()
,
RootDockingPortInfo.setMainPort(String)
public static DockingPort getRootDockingPort(Component comp)
DockingPort
found within the application
window containing the specified Component
. A "root"
DockingPort
is a DockingPort
embedded within a
window/frame/applet/dialog that is not nested within any other parent
DockingPorts
. The Component
parameter may or may not be
a root window container itself. If not, the root window containing
comp
is resolved and the first root DockingPort
found
within it is returned. This method defers actual processing to
org.flexdock.docking.event.hierarchy.DockingPortTracker.findByWindow(Component comp)
.
If comp
is null
or the root window cannot be resolved,
then this method returns a null
reference. A null
reference is also returned if the root window does not contain any
DockingPorts
.
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 and
getMainDockingPort(Component comp)
will exhibit identical
behavior.
comp
- the Component
whose root window will be checked for a
root DockingPort
DockingPort
found within the root window
that contains comp
getMainDockingPort(Component)
,
DockingPortTracker.findByWindow(Component)
,
RootDockingPortInfo
public static RootDockingPortInfo getRootDockingPortInfo(Component comp)
RootDockingPortInfo
instance associated with the root
window containing the specified Component
. The Component
parameter may or may not be a root window container itself. If not, the
root window containing comp
is resolved and the
RootDockingPortInfo
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 any DockingPort
embedded
within the window that does not have any other DockingPort
ancestors in it's container hierarchy.
If comp
is null
or the root window cannot be resolved,
then this method returns a null
reference. A null
reference is also returned if the root window does not contain any
DockingPorts
.
This method dispatches internally to
org.flexdock.docking.event.hierarchy.DockingPortTracker.getRootDockingPortInfo(Component comp)
.
comp
- the Component
whose root window will be checked for an
associated RootDockingPortInfo
.RootDockingPortInfo
instance associated with the root
window containing comp
.RootDockingPortInfo
,
DockingPortTracker.getRootDockingPortInfo(Component)
public static boolean storeLayoutModel() throws IOException, PersistenceException
org.flexdock.docking.state.LayoutManager
by invoking its
store()
method. If there is no LayoutManager
installed,
then this method returns false
.
The layout model itself, along with storage mechanism, is abstract and
dependent upon the particular LayoutManager
implementation. As
such, it may be possible that the LayoutManager
is unable to
persist the current layout state for non-Exceptional reasons. This method
returns true
if the layout model was successfully stored and
false
if the layout model could not be stored under circumstances
that do not generate an Exception
(for instance, if there is no
persistence implementation currently installed). If a problem occurs
during the persistence process, an IOException
is thrown.
true
if the current layout model was succesfully stored,
false
otherwise.IOException
PersisterException
PersistenceException
getLayoutManager()
,
setLayoutManager(LayoutManager)
,
LayoutManager.store()
public static boolean loadLayoutModel() throws IOException, PersistenceException
LayoutManager
. This method defers processing to
loadLayoutModel(boolean restore)
with an argument of
false
to indicate that the stored data model should merely be
loaded into memory and the LayoutManager
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 the LayoutManager
is unable to load
the previous layout state for non-Exceptional reasons. This method
returns true
if the layout model was successfully loaded and
false
if the layout model could not be loaded under circumstances
that do not generate an Exception
(for instance, if there was no
previous layout model found in storage). If a problem occurs during the
loading process, an IOException
is thrown.
true
if the current layout model was succesfully loaded,
false
otherwise.IOException
PersisterException
PersistenceException
loadLayoutModel(boolean)
,
LayoutManager.load()
public static boolean loadLayoutModel(boolean restore) throws IOException, PersistenceException
LayoutManager
and attempts to synchronize the application view
with the newly loaded layout model if the restore
parameter is
true
. If there is no currently installed LayoutManager
,
then this method returns false
. If the restore
parameter
is true
, then this method defers processing to
restoreLayout(boolean loadFromStorage)
with an argument of
true
. Otherwise, this method defers processing to the currently
installed org.flexdock.docking.state.LayoutManager
by invoking
its load()
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 the LayoutManager
is unable to load
the previous layout state for non-Exceptional reasons. This method
returns true
if the layout model was successfully loaded and
false
if the layout model could not be loaded under circumstances
that do not generate an Exception
(for instance, if there was no
previous layout model found in storage). If a problem occurs during the
loading process, an IOException
is thrown.
true
if the current layout model was succesfully loaded,
false
otherwise.IOException
PersisterException
PersistenceException
getLayoutManager()
,
setLayoutManager(LayoutManager)
,
restoreLayout(boolean)
,
LayoutManager.load()
public static boolean restoreLayout()
restoreLayout(boolean loadFromStorage)
with an argument of
false
. This instructs the currently installed
LayoutManager
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 returns false
.
true
if the in-memory layout model was properly restored
to the application view, false
otherwise.PersisterException
restoreLayout(boolean)
,
getLayoutManager()
,
setLayoutManager(LayoutManager)
,
LayoutManager.restore(boolean)
public static boolean restoreLayout(boolean loadFromStorage) throws IOException, PersistenceException
org.flexdock.docking.state.LayoutManager
by invoking its
restore(boolean loadFromStorage)
method. If there is no
LayoutManager
currently installed, then this method returns
false
.
If the loadFromStorage
parameter is true
, then the
LayoutManager
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 an IOException
.
loadFromStorage
- instructs whether to load any layout model from external
storage into memory before synchronizing the application view.true
if the in-memory layout model was properly restored
to the application view, false
otherwise.PersisterException
IOException
PersistenceException
getLayoutManager()
,
setLayoutManager(LayoutManager)
,
LayoutManager.restore(boolean)
public static DockingPort getDockingPort(Component dockable)
DockingPort
that contains the specified
Component
. If the Component
is null
, then a
null
reference is returned.
This method will only return the immediate parent DockingPort
of
the specified Component
This means that the DockingPort
returned by this method will not only be an ancestor Container
of
the specified Component
, but invoking its
isParentDockingPort(Component comp)
with the specified
Component
will also return true
. If both of these
conditions cannot be satisfied, then this method returns a null
reference.
dockable
- the Component
whose parent DockingPort
is to
be returned.DockingPort
that contains the
specified Component
.public static DockingPort getDockingPort(Dockable dockable)
DockingPort
that contains the specified
Dockable
. If the Dockable
is null
, then a
null
reference is returned.
This method will only return the immediate parent DockingPort
of
the specified Dockable
This means that a check is performed for
the Component
returned by the Dockable's
getComponent()
method. The DockingPort
returned by this
method will not only be an ancestor Container
of this
Component
, but invoking the DockingPort's
isParentDockingPort(Component comp)
with the this
Component
will also return true
. If both of these
conditions cannot be satisfied, then this method returns a null
reference.
dockable
- the Dockable
whose parent DockingPort
is to be
returned.DockingPort
that contains the
specified Dockable
.public static Dockable getDockable(Component comp)
Dockable
instance that models the specified
Component
. The Dockable
returned by this method will
return a reference to comp
when its getComponent()
method
is called. If comp
is null
, then this method will return
a null
reference.
The association between Dockable
and Component
is
established internally during registerDockable(Dockable dockable)
.
Thus, registerDockable(Dockable dockable)
must have been called
previously for a mapping to be found and a Dockable
to be
returned by this method. If no mapping is found for the specified
Component
, then this method returns a null
reference.
comp
- the Component
whose Dockable
instance is to be
returned.Dockable
that models the specified Component
registerDockable(Dockable)
,
Dockable.getComponent()
public static Dockable getDockable(String id)
Dockable
instance with the specified ID. The
Dockable
returned by this method will return a String equal
id
when its getPersistentId()
method is called. If
id
is null
, then this method will return a null
reference.
The association between Dockable
and id
is established
internally during registerDockable(Dockable dockable)
. Thus,
registerDockable(Dockable dockable)
must have been called
previously for a mapping to be found and a Dockable
to be
returned by this method. If no mapping is found for the specified
id
, then this method returns a null
reference.
id
- the persistent ID of the Dockable
instance is to be
returned.Dockable
that has the specified perstent ID.registerDockable(Dockable)
,
Dockable.getPersistentId()
public static Set getDockableIds()
Set
of String
IDs for all Dockables
registered with the framework. The IDs returned by this method will
correspond to the values returned for the getPersistentId()
method for each Dockable
registered with the framework.
Dockable
IDs are cached during
registerDockable(Dockable dockable)
. Thus, for an ID to appear
within the Set
returned by this method, the corresponding
Dockable
must have first been registered via
registerDockable(Dockable dockable)
.
If no Dockables
have been registered with the framework, then an
empty Set
is returned. This method will never return a
null
reference.Set
of String
IDs for all Dockables
registered with the framework.registerDockable(Dockable)
,
Dockable.getPersistentId()
public static DragManager getDragListener(Dockable dockable)
Dockable
. During registration, the
listener is added to each of the Components
within the
Dockable's
getDragSources()
List
. Thus, for this
method to return a valid DragManager
instance, the
Dockable
must first have been registered via
registerDockable(Dockable dockable)
. If the specified
Dockable
is null
or its getDragSources()
method
returns a null
, or if the Dockable
has not previously
been registered, this method will return a null
reference.dockable
- the Dockable
whose drag listener is to be returned.DragManager
responsible for listening to an managing
drag-related mouse events for the specified Dockable
.DragManager
,
Dockable.getDragSources()
,
registerDockable(Dockable)
public static LayoutManager getLayoutManager()
LayoutManager
. The
LayoutManager
is responsible for managing docking layout state.
This includes tracking the state for all Dockables
as they are
embedded, minimized, floated, or hidden. If a Dockable
is
embedded, the LayoutManager
is responsible for tracking its
position and size relative to other embedded Dockables
. If
floating, the LayoutManager
is responsible for supplying a
FloatManager
to maintain Dockable
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 the
LayoutManager
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 a null
LayoutManager
. Therefore, this method will always return a valid
LayoutManager
and never a null
reference.
LayoutManager
LayoutManager
,
setLayoutManager(LayoutManager)
,
setLayoutManager(String)
public static MinimizationManager getMinimizeManager()
MinimizationManager
. The
MinimizationManager
is responsible for minimizing and
unminimizing Dockables
, removing from and restoring to the
embedded docking layout through the currently installed
LayoutManager
.
The visual representation of a "minimized" Dockable
is somewhat
abstract, although it is commonly expressed in user interfaces with the
disappearance of the Dockable
from the layout and the addition of
a tab or label on one or more edges of the application window. The
MinimizationManager
implementation itself is responsible for
interpreting the visual characteristics and behavior of a minimized
Dockable
, but it must provide a "preview" feature to allow
viewing of minimized Dockables
, 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 the MinimizationManager
implementation.
Because the MinimizationManager
is a critical piece of the
docking infrastructure, it cannot be set to null
. Therefore,
this method will always return a valid MinimizationManager
and
never a null
reference.
MinimizationManager
.MinimizationManager
,
setMinimizeManager(MinimizationManager)
,
setMinimizeManager(String)
public static FloatManager getFloatManager()
FloatManager
. The
FloatManager
is actually provided by the currently installed
LayoutManager
. As such, this method is merely for convenience.
It internally obtains the installed LayoutManager
via
getLayoutManager()
and invokes its getFloatManager()
method.
The FloatManager
maintains information relevant to floating
Dockables
including grouping them together within dialogs and
tracking dialog size and position. The FloatManager
is
responsible for generating new dialogs, parenting on the proper
application window(s), and sending Dockables
to the proper
dialogs. It may be used by the LayoutManager
to restore hidden
Dockables
to proper floating state as needed.
Since the FloatManager
is provided by the currently installed
LayoutManager
, it cannot be set from within the
DockingManager
. To change the installed FloatManager
,
one must work directly with the installed LayoutManager
implementation per its particular custom API.
Since the FloatManager
is a critical piece of the docking
insfrastructure, this method will never return a null
reference.
FloatManager
provided by the currently installed
LayoutManager
getLayoutManager()
,
setLayoutManager(LayoutManager)
,
LayoutManager.getFloatManager()
public static DockingState getDockingState(String dockableId)
DockingState
for the Dockable
with the
specified ID. The DockingState
is used by the currently installed
LayoutManager
to track information regarding a Dockable's
current state in the docking layout. This includes relative size and
positioning to other Dockables
, minimization status, floating
status, and any other information used to track and potentially restore a
the Dockable
to the layout if it is currently hidden.
The Dockable
whose current DockingState
is resolved will
map to the specified dockableId
via its getPersistentId()
method. The semantics of this mapping relationship are the same as
DockingManager.getDockable(String id)
. If a valid
Dockable
cannot be found for the specified ID, then this method
returns a null
reference.
The DockingState
for any given Dockable
is ultimately
managed by the currently installed LayoutManager
. Therefore,
this method resolves the LayoutManager
via
getLayoutManager()
and defers processing to its
getDockingState(String dockableId)
method.
The underlying LayoutManager
does not provide any guarantees that
the same DockingState
reference always will be returned for a
given Dockable
; only that the returned DockingState
will
accurately reflect the current state maintained by the
LayoutManager
for that Dockable
. For instance, if the
LayoutManager
is capable of maintaining multiple layouts for an
application (as Eclipse does between perspectives), then the
LayoutManager
may or may not maintain multiple
DockingState
instances for a single Dockable
, one within
each layout context. Therefore, it is not a good idea to cache references
to the DockingState
instance returned by this method for future
use as the reference itself may possibly become stale over time depending
on the LayoutManager
implementation.
dockableId
- the persistent ID of the Dockable
whose current
DockingState
is to be returnedDockingState
maintained by the
LayoutManager
for the specified Dockable
DockingState
,
getLayoutManager()
,
LayoutManager.getDockingState(String)
,
getDockable(String)
,
Dockable.getPersistentId()
public static DockingState getDockingState(Dockable dockable)
DockingState
for the specified Dockable
. The
DockingState
is used by the currently installed
LayoutManager
to track information regarding a Dockable's
current state in the docking layout. This includes relative size and
positioning to other Dockables
, minimization status, floating
status, and any other information used to track and potentially restore a
the Dockable
to the layout if it is currently hidden.
If the dockable
parameter is null
, then this method
returns a null
reference.
The DockingState
for any given Dockable
is ultimately
managed by the currently installed LayoutManager
. Therefore,
this method resolves the LayoutManager
via
getLayoutManager()
and defers processing to its
getDockingState(String dockableId)
method.
The underlying LayoutManager
does not provide any guarantees that
the same DockingState
reference always will be returned for a
given Dockable
; only that the returned DockingState
will
accurately reflect the current state maintained by the
LayoutManager
for that Dockable
. For instance, if the
LayoutManager
is capable of maintaining multiple layouts for an
application (as Eclipse does between perspectives), then the
LayoutManager
may or may not maintain multiple
DockingState
instances for a single Dockable
, one within
each layout context. Therefore, it is not a good idea to cache references
to the DockingState
instance returned by this method for future
use as the reference itself may possibly become stale over time depending
on the LayoutManager
implementation.
dockable
- the Dockable
whose current DockingState
is to
be returnedDockingState
maintained by the
LayoutManager
for the specified Dockable
getLayoutManager()
,
LayoutManager.getDockingState(String)
public static DockableFactory getDockableFactory()
DockableFactory
. The
DockableFactory
installed by default is null
. Therefore,
this method will return a null
reference until the application
developer explicitly provides a DockableFactory
implementation
via setDockableFactory(DockableFactory factory)
.
Installing a DockableFactory
allows FlexDock to seamlessly create
and register Dockables
within getDockable(String id)
.
Generally, getDockable(String id)
will lookup the requested
Dockable
within the internal registry. If not found, and there is
no DockableFactory
installed, getDockable(String id)
returns a null
reference. When a DockableFactory
is
installed, however, failure to lookup a valid Dockable
will cause
getDockable(String id)
to invoke the installed
DockableFactory's
getDockable(String dockableId)
method,
transparently registering and returning the newly created
Dockable
from getDockable(String id)
.
DockableFactory
getDockable(String)
,
DockableFactory.getDockable(String)
public static void setAutoPersist(boolean enabled)
The storeLayoutModel()
provides a means of manually sending the
docking layout model to some type of external storage. When the
DockingManager
class loads, a shutdown hook is added to the
Runtime
. If auto-persist is enabled when the JVM exits, the
shutdown hook automatically calls storeLayoutModel()
, catching
and reporting any IOExceptions
that may occur.
enabled
- true
if automatic persistence is desired;
false
otherwise.storeLayoutModel()
,
Runtime.addShutdownHook(java.lang.Thread)
public static void setSplitProportion(Component dockable, float proportion)
Component
. The Dockable
instance associated
with the specified Component
is resolved via
getDockable(Component comp)
and processing is dispatched to
setSplitProportion(Dockable dockable, float proportion)
.
The resulting divider location will be a percentage of the split layout
size based upon the proportion
parameter. Valid values for
proportion
range from 0.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 a proportion
greater than
1.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
of 0.3F
does not imply that dockable
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 specified Component
resides (which may
possibly result in dockable
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 initially
0x0
before the Component
has been rendered to the screen.
If the specified Component
is null
, then no
Exception
is thrown and no action is taken. Identical behavior
occurs if a valid Dockable
cannot be resolved for the specified
Component
, or the Dockable
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.
dockable
- the Component
whose containing split layout is to be
resized.proportion
- the percentage of containing split layout size to which the
split divider should be set.setSplitProportion(Dockable, float)
,
getDockable(Component)
public static void setSplitProportion(Dockable dockable, float proportion)
Component
.
The resulting divider location will be a percentage of the split layout
size based upon the proportion
parameter. Valid values for
proportion
range from 0.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 a proportion
greater than
1.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
of 0.3F
does not imply that dockable
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 specified Dockable
resides (which may
possibly result in dockable
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 initially
0x0
before the Component
has been rendered to the screen.
If the specified Dockable
is null
, then no
Exception
is thrown and no action is taken. Identical behavior
occurs if the Dockable
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.
dockable
- the Dockable
whose containing split layout is to be
resized.proportion
- the percentage of containing split layout size to which the
split divider should be set.getDockable(Component)
public static void setSplitProportion(DockingPort port, float proportion)
DockingPort
. This method differs from both
setSplitProportion(Component dockable, float proportion)
and
setSplitProportion(Dockable dockable, float proportion)
in that
this method resolves the split layout embedded within the
specified DockingPort
, whereas the other methods modify the
split layout containing their respective Dockable
parameters.
The resulting divider location will be a percentage of the split layout
size based upon the proportion
parameter. Valid values for
proportion
range from 0.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 a proportion
greater
than 1.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 initially
0x0
before the Component
has been rendered to the screen.
If the specified DockingPort
is null
, then no
Exception
is thrown and no action is taken. Identical behavior
occurs if the DockingPort
does not contain split layout.
port
- the DockingPort
containing the split layout is to be
resized.proportion
- the percentage of split layout size to which the split divider
should be set.public static void setDockableFactory(DockableFactory factory)
DockableFactory
. null
values for the factory
parameter are acceptable.
Installing a DockableFactory
allows FlexDock to seamlessly create
and register Dockables
within getDockable(String id)
.
Generally, getDockable(String id)
will lookup the requested
Dockable
within the internal registry. If not found, and there is
no DockableFactory
installed, getDockable(String id)
returns a null
reference. When a DockableFactory
is
installed, however, failure to lookup a valid Dockable
will cause
getDockable(String id)
to invoke the installed
DockableFactory's
getDockable(String dockableId)
method,
transparently registering and returning the newly created
Dockable
from getDockable(String id)
.
factory
- the DockableFactory
to installgetDockableFactory()
,
getDockable(String)
,
DockableFactory.getDockable(String)
public static void setMinimized(Dockable dockable, boolean minimized)
Dockable
. This method
defers processing to
setMinimized(Dockable dockable, boolean minimized, Component window)
,
passing the current Window
ancestor of the specified
Dockable
as the window
parameter. Minimization
processessing is ultimately deferred to the currently installed
MinimizationManager
with a constraint of
MinimizationManager.UNSPECIFIED_LAYOUT_CONSTRAINT
.
The current MinimizationManager
is responsible for updating the
underlying DockingState
model for the specified Dockable
as well as rendering its own interpretation of the corresponding visual
state on the screen. If the supplied minimized
parameter matches
the current DockingState
, the MinimizationManager
is
responsible for providing the appropriate visual indications, or lack
thereof. If the specified Dockable
is null
, no
Exception
is thrown and no action is taken.
dockable
- the Dockable
whose minimzed state is to be modifiedminimized
- true
if the specified Dockable
should be
minimized, false
otherwise.setMinimized(Dockable, boolean, Component)
,
getMinimizeManager()
,
MinimizationManager.setMinimized(Dockable, boolean, Component, int)
,
DockingState.getMinimizedConstraint()
public static void setMinimized(Dockable dockable, boolean minimized, Component window)
Dockable
. This method
defers processing to
setMinimized(Dockable dockable, boolean minimizing, Component window, int constraint)
,
passing MinimizationManager.UNSPECIFIED_LAYOUT_CONSTRAINT
for the
constraint
parameter. Minimization processessing is ultimately
deferred to the currently installed MinimizationManager
.
The window
parameter is passed to the MinimizationManager
to indicate that minimization should be handled with respect to the
specified root window, or the root window containing the specified
Component
. null
values are acceptable for this
parameter.
The current MinimizationManager
is responsible for updating the
underlying DockingState
model for the specified Dockable
as well as rendering its own interpretation of the corresponding visual
state on the screen. If the supplied minimized
parameter matches
the current DockingState
, the MinimizationManager
is
responsible for providing the appropriate visual indications, or lack
thereof. If the specified Dockable
is null
, no
Exception
is thrown and no action is taken.
dockable
- the Dockable
whose minimzed state is to be modifiedminimized
- true
if the specified Dockable
should be
minimized, false
otherwise.window
- the Component
whose root window will be used by the
underlying MinimizationManager
for rendering the
Dockable
in its new minimized state.setMinimized(Dockable, boolean, Component, int)
,
getMinimizeManager()
,
MinimizationManager.setMinimized(Dockable, boolean, Component, int)
,
DockingState.getMinimizedConstraint()
public static void setMinimized(Dockable dockable, boolean minimizing, int constraint)
Dockable
. This method
defers processing to
setMinimized(Dockable dockable, boolean minimizing, Component window, int constraint)
,
passing null
for the window
parameter. Minimization
processessing is ultimately deferred to the currently installed
MinimizationManager
.
Valid values for the constraint
parameter may be found on the
MinimizationManager
interface and include
UNSPECIFIED_LAYOUT_CONSTRAINT, TOP, LEFT, BOTTOM, RIGHT, and CENTER.
However, constraint values must ultimately be interpreted by the current
MinimizationManager
implementation and, thus any integer value
may theoretically be valid for constraint
.
The current MinimizationManager
is responsible for updating the
underlying DockingState
model for the specified Dockable
as well as rendering its own interpretation of the corresponding visual
state on the screen. If the supplied minimized
parameter matches
the current DockingState
, the MinimizationManager
is
responsible for providing the appropriate visual indications, or lack
thereof. If the specified Dockable
is null
, no
Exception
is thrown and no action is taken.
dockable
- the Dockable
whose minimzed state is to be modifiedminimizing
- true
if the specified Dockable
should be
minimized, false
otherwise.constraint
- a value to indicate to the MinimizationManager
desired
rendering of the minimized Dockable
setMinimized(Dockable, boolean, Component, int)
,
getMinimizeManager()
,
MinimizationManager.setMinimized(Dockable, boolean, Component, int)
,
DockingState.getMinimizedConstraint()
public static void setMinimized(Dockable dockable, boolean minimizing, Component window, int constraint)
Dockable
. This method
defers processing to the currently installed MinimizationManager
.
The window
parameter is passed to the MinimizationManager
to indicate that minimization should be handled with respect to the
specified root window, or the root window containing the specified
Component
. If a null
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
underlying DockingState
model for the specified Dockable
as well as rendering its own interpretation of the corresponding visual
state on the screen. If the supplied minimized
parameter matches
the current DockingState
, the MinimizationManager
is
responsible for providing the appropriate visual indications, or lack
thereof. If the specified Dockable
is null
, no
Exception
is thrown and no action is taken.
Valid values for the constraint
parameter may be found on the
MinimizationManager
interface and include
UNSPECIFIED_LAYOUT_CONSTRAINT, TOP, LEFT, BOTTOM, RIGHT, and CENTER.
However, constraint values must ultimately be interpreted by the current
MinimizationManager
implementation and, thus any integer value
may theoretically be valid for constraint
.
dockable
- the Dockable
whose minimzed state is to be modifiedminimizing
- true
if the specified Dockable
should be
minimized, false
otherwise.window
- the Component
whose root window will be used by the
underlying MinimizationManager
for rendering the
Dockable
in its new minimized state.constraint
- a value to indicate to the MinimizationManager
desired
rendering of the minimized Dockable
getMinimizeManager()
,
MinimizationManager.setMinimized(Dockable, boolean, Component, int)
,
DockingState.getMinimizedConstraint()
public static void setMainDockingPort(Component window, String portId)
DockingPort
within the application window
containing the specified Component
. 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 of comp
is determined and
a set of docking ports encapsulated by a RootDockingPortInfo
instance is returned by a call to
getRootDockingPortInfo(Component comp)
. The resolved
RootDockingPortInfo
instance's main DockingPort
is set
via its method setMainPort(String portId)
.
By default, the "main" DockingPort
assigned to any
RootDockingPortInfo
instance associated with a window will happen
to be the first root DockingPort
detected for that window. This
method is used to alter that setting.
If comp
is null
or the root window cannot be resolved,
then this method returns with no action taken.
window
- the Component
whose root window will be checked for a
main DockingPort
portId
- the persistent ID of the DockingPort
to use as the
main DockingPort
for the specified window.getRootDockingPortInfo(Component)
,
getRootDockingPort(Component)
,
DockingPortTracker.getRootDockingPortInfo(Component)
,
RootDockingPortInfo.getMainPort()
,
RootDockingPortInfo.setMainPort(String)
public static void setMinimizeManager(MinimizationManager mgr)
MinimizationManager
. The
MinimizationManager
is responsible for minimizing and
unminimizing Dockables
, removing from and restoring to the
embedded docking layout through the currently installed
LayoutManager
.
The visual representation of a "minimized" Dockable
is somewhat
abstract, although it is commonly expressed in user interfaces with the
disappearance of the Dockable
from the layout and the addition of
a tab or label on one or more edges of the application window. The
MinimizationManager
implementation itself is responsible for
interpreting the visual characteristics and behavior of a minimized
Dockable
, but it must provide a "preview" feature to allow
viewing of minimized Dockables
, 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 the MinimizationManager
implementation.
Because the MinimizationManager
is a critical piece of the
docking infrastructure, it cannot be set to null
. If a
null
value is passed into this method, the default
MinimizationManager
provided by the framework is used instead.
mgr
- the MinimizationManager
to be installedMinimizationManager
,
getMinimizeManager()
,
setMinimizeManager(String)
public static void setMinimizeManager(String mgrClass)
MinimizationManager
using the
specfied class name. An attempt is make to instantiate a
MinimizationManager
based upon the supplied class name
String
. If the class cannot be instaniated, a stacktrace is
reported to the System.err and the default MinimizationManager
supplied by the framework is used. If the String
parameter is
null
, no error occurs and the default
MinimizationManager
is used. If the instantiated class is not a
valid instance of MinimizationManager
, then a
ClassCastException
is thrown.
The MinimizationManager
is responsible for minimizing and
unminimizing Dockables
, removing from and restoring to the
embedded docking layout through the currently installed
LayoutManager
.
The visual representation of a "minimized" Dockable
is somewhat
abstract, although it is commonly expressed in user interfaces with the
disappearance of the Dockable
from the layout and the addition of
a tab or label on one or more edges of the application window. The
MinimizationManager
implementation itself is responsible for
interpreting the visual characteristics and behavior of a minimized
Dockable
, but it must provide a "preview" feature to allow
viewing of minimized Dockables
, 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 the MinimizationManager
implementation.
Because the MinimizationManager
is a critical piece of the
docking infrastructure, it cannot be set to null
. If a
null
value is passed into this method, the default
MinimizationManager
provided by the framework is used instead.
mgrClass
- the class name of the MinimizationManager
to be
installedMinimizationManager
,
getMinimizeManager()
,
setMinimizeManager(String)
public static void setFloatingEnabled(boolean enabled)
FloatPolicyManager.setGlobalFloatingEnabled(boolean globalFloatingEnabled)
.enabled
- true
if global floating support should be enabled,
false
otherwise.FloatPolicyManager.setGlobalFloatingEnabled(boolean)
,
FloatPolicyManager.isGlobalFloatingEnabled()
public static void setDefaultPersistenceKey(String key)
public static String getDefaultPersistenceKey()
public static void setSingleTabsAllowed(boolean allowed)
DockingPorts
with a single Dockable
in the CENTER region.
This is a global default setting and applies to any DockingPort
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.
allowed
- true
if the default setting for DockingPorts
should allow a tabbed layout for a single Dockable
in
the CENTER region; false
otherwise.PropertyManager.getDockingPortRoot()
,
DockingPortPropertySet.setSingleTabsAllowed(boolean)
public static void setLayoutManager(LayoutManager mgr)
LayoutManager
. The
LayoutManager
is responsible for managing docking layout state.
This includes tracking the state for all Dockables
as they are
embedded, minimized, floated, or hidden. If a Dockable
is
embedded, the LayoutManager
is responsible for tracking its
position and size relative to other embedded Dockables
. If
floating, the LayoutManager
is responsible for supplying a
FloatManager
to maintain Dockable
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 the
LayoutManager
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 a null
LayoutManager
. FlexDock provides a default LayoutManager
implementation. If this method is passed a null
argument, the
default LayoutManager
is used instead.
mgr
- the LayoutManager
to install.LayoutManager
,
setLayoutManager(String)
,
getLayoutManager()
public static void setLayoutManager(String mgrClass)
LayoutManager
using the specified
class name. An attempt is make to instantiate a LayoutManager
based upon the supplied class name String
. If the class cannot
be instaniated, a stacktrace is reported to the System.err and the
default LayoutManager
supplied by the framework is used. If the
String
parameter is null
, no error occurs and the
default LayoutManager
is used. If the instantiated class is not a
valid instance of LayoutManager
, then a
ClassCastException
is thrown.
The LayoutManager
is responsible for managing docking layout
state. This includes tracking the state for all Dockables
as they
are embedded, minimized, floated, or hidden. If a Dockable
is
embedded, the LayoutManager
is responsible for tracking its
position and size relative to other embedded Dockables
. If
floating, the LayoutManager
is responsible for supplying a
FloatManager
to maintain Dockable
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 the
LayoutManager
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 a null
LayoutManager
. FlexDock provides a default LayoutManager
implementation. If this method is passed a null
argument, the
default LayoutManager
is used instead.
mgrClass
- the class name of the LayoutManager
to install.LayoutManager
,
setLayoutManager(LayoutManager)
,
getLayoutManager()
public static void setDockingStrategy(Class classKey, DockingStrategy strategy)
DockingStrategy
associated with specified Class
.
This method returns with no action taken if the specified Class
paramter is null
. If the strategy
parameter is
null
then any existing DockingStrategy
association with
the specified }Class} is removed. Otherwise, a new
DockingStrategy
association is added for the specified
Class
.
DockingStrategy
association follows a strict inheritance chain
using org.flexdock.util.ClassMapping
. This means that the
association created by this method applies for the specified
Class
and all direct subclasses, but associations for interfaces
are ignored. Associations also do not apply for subclasses that have
their own specific DockingStrategy
mapping.
classKey
- the Class
whose DockingStrategy
association we
wish to setstrategy
- the DockingStrategy
to be associated with the
specified Class
.getDockingStrategy(Class)
,
getDockingStrategy(Object)
,
ClassMapping.addClassMapping(Class, Class, Object)
,
ClassMapping.removeClassMapping(Class)
public static boolean undock(Dockable dockable)
Dockable
from its parent
DockingPort
. If the Dockable
is null
, or it
does not currently reside within a DockingPort
, then this method
returns false
with no action taken. Otherwise, this method
returns true
if the undocking operation was successful and
false
if the undocking operation could not be completed.
This method determines the DockingStrategy
to be used for
DockingPort
containing the specified Dockable
and defers
processing to the undock(Dockable dockable)
method on the
DockingStrategy
. This method's return value will be based upon
the DockingStrategy
implementation returned by a call to
getDockingStrategy(Object obj)
. The DockingStrategy
used
may be controlled via
setDockingStrategy(Class c, DockingStrategy strategy)
, supplying
a DockingPort
implementation class and a customized
DockingStrategy
.dockable
- the Dockable
to be undocked.true
if the undocking operation was successful,
false
otherwise.DockingStrategy.undock(Dockable)
,
getDockingStrategy(Object)
,
setDockingStrategy(Class, DockingStrategy)
public static boolean undock(Component dockable)
public static void updateDragListeners(Dockable dockable)
DragManager
has been installed as a listener
for all of the specified Dockable's
drag source
Components
. This method invokes the getDragSources()
method on the specified Dockable
and iterates over each
Component
in the returned List
. If any Component
does not have a valid DragManager
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 a Dockable's
drag source
List
. However, it is not necessary to call this method unless
the drag source list has been updated after calling
registerDockable(Dockable dockable)
, since
registerDockable(Dockable dockable)
will automatically initialize
each drag source for the specified Dockable
.
If the specified Dockable
is null
, then no
Exception
is thrown and no action is taken.
dockable
- the Dockable
whose drag sources are to be checked for
DragManagers
and updated accordingly.registerDockable(Dockable)
,
Dockable.getDragSources()
,
DragManager
public static float getDefaultSiblingSize()
public static void setDefaultSiblingSize(float size)
public static void setRubberBand(RubberBand rubberBand)
public static void setDragPreview(DragPreview dragPreview)
public static void toggleMaximized(Component comp)
Dockable
associated with the specified component or
restores the Dockable
if it is currently maximized. This method
forwards the request to toggleMaximized(Dockable)
after
obtaining the Dockable
associated to the component via
getDockable(Component)
.comp
- toggleMaximized(Dockable)
public static void toggleMaximized(Dockable dockable)
Dockable
or restores the specified
Dockable
if it is already maximized.
The scope of maximization is the root DockingPort
. The
specified Dockable
's current DockingPort
is asked to
temporarily lend the Dockable
for maximization and the root
DockingPort
is asked to temorarily host the Dockable
and
display it such that it occupies all (or the majority) of its screen
resources. If the Dockable
is already maximized, the root
DockingPort
is asked to return to its original state and the
Dockable
is returned to its original DockingPort
.
dockable
- public static boolean isMaximized(Dockable dockable)