Package org.flexdock.docking.state
Class FloatingGroup
java.lang.Object
org.flexdock.docking.state.FloatingGroup
- All Implemented Interfaces:
Serializable
,Cloneable
This class models a grouping of
In addition to providing persistent state across application sessions, the
Dockables
within a floating DockingFrame
.
The FloatingGroup
tracks the current screen bounds of the DockingFrame
and
the ID for each Dockable
within the group. The FloatingGroup
may be persisted to external storage and recreated across JVM sessions. This allows the
DockingFrame
to be recreated and displayed with the previous screen bounds and all
of the Dockables
contained within the group to be restored to their previous state
within the DockingFrame
.
In addition to providing persistent state across application sessions, the
FloatingGroup
allows for a floating Dockable
to be closed and then later restored to its original
floating state within the same JVM session. The currently installed FloatManager
may
use FloatingGroups
to determine which visible DockingFrame
into which to
restore a closed Dockable
, or to create and display a new DockingFrame
to the same end on an as-needed basis.- Author:
- Christopher Butler
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFloatingGroup
(String groupName) Creates a newFloatingGroup
with the specifiedgroupName
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDockable
(String dockableId) clone()
void
destroy()
Returns the cached screen bounds of theDockingFrame
associated with thisFloatingGroup
.int
getFrame()
Returns a reference to theDockingFrame
associated with thisFloatingGroup
.getName()
Returns the name of thisFloatingGroup
.void
removeDockable
(String dockableId) void
Sets the screen bounds representing theDockingFrame
associated with thisFloatingGroup
.void
setFrame
(DockingFrame frame) Sets a reference to theDockingFrame
associated with thisFloatingGroup
.
-
Constructor Details
-
FloatingGroup
Creates a newFloatingGroup
with the specifiedgroupName
. This group may be looked up from the currently installedFloatManager
using thisgroupName
.groupName
should be unique to this group.- Parameters:
groupName
- the unique identifier for thisFloatingGroup
- See Also:
-
-
Method Details
-
getBounds
Returns the cached screen bounds of theDockingFrame
associated with thisFloatingGroup
. If no screen bounds have been previously cached, this method returnsnull
. Otherwise, this method returns a clone of the cachedRectangle
so that its fields may not be directly modified.- Returns:
- the cached screen bounds of the
DockingFrame
associated with thisFloatingGroup
. - See Also:
-
setBounds
Sets the screen bounds representing theDockingFrame
associated with thisFloatingGroup
. Ifrect
isnull
, then the cached screen bounds are set tonull
. Otherwise, the field values are copied from the specifiedRectangle
into the cached screen bounds rather than updating the internal object reference. This is done to prevent the cached screen bounds' fields from subsequently being modified directly.- Parameters:
rect
- the new screen bounds representing theDockingFrame
associated with thisFloatingGroup
.- See Also:
-
getName
Returns the name of thisFloatingGroup
. This value may be used as a key to lookup thisFloatingGroup
from the currently installedFloatManager
by invoking itsgetGroup(String groupName)
method.- Returns:
- the name of this
FloatingGroup
. - See Also:
-
getFrame
Returns a reference to theDockingFrame
associated with thisFloatingGroup
. This method allows easy lookup to establish an association with aDockable
and aDockingFrame
. When attempting to find an existingDockingFrame
into which to restore a hiddenDockable
, theDockable's
FloatingGroup
may be looked up by the currently installedFloatManager
by calling itsgetGroup(Dockable dockable)
method. Once the group has been resolved, the actualDockingFrame
reference may be obtained by this method and theDockable
may be restored to the screen. Or, this method may returnnull
and theDockingFrame
will have to be recreated before theDockable
can be restored.- Returns:
- a reference to the
DockingFrame
associated with thisFloatingGroup
. - See Also:
-
setFrame
Sets a reference to theDockingFrame
associated with thisFloatingGroup
. This method allows help enable easy lookup to establish an association with aDockable
and aDockingFrame
. When attempting to find an existingDockingFrame
into which to restore a hiddenDockable
, theDockable's
FloatingGroup
may be looked up by the currently installedFloatManager
by calling itsgetGroup(Dockable dockable)
method. Once the group has been resolved, the actualDockingFrame
reference may be obtained by callinggetFrame()
and theDockable
may be restored to the screen. Or,getFrame()
may returnnull
and theDockingFrame
will have to be recreated before theDockable
can be restored. This method establishes the association betweenFloatingGroup
andDockingFrame
.- Parameters:
frame
- theDockingFrame
to be associated with thisFloatingGroup
.- See Also:
-
addDockable
-
getDockableIterator
-
removeDockable
-
getDockableCount
public int getDockableCount() -
destroy
public void destroy() -
clone
-