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 newFloatingGroupwith the specifiedgroupName. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDockable(String dockableId) clone()voiddestroy()Returns the cached screen bounds of theDockingFrameassociated with thisFloatingGroup.intgetFrame()Returns a reference to theDockingFrameassociated with thisFloatingGroup.getName()Returns the name of thisFloatingGroup.voidremoveDockable(String dockableId) voidSets the screen bounds representing theDockingFrameassociated with thisFloatingGroup.voidsetFrame(DockingFrame frame) Sets a reference to theDockingFrameassociated with thisFloatingGroup.
-
Constructor Details
-
FloatingGroup
Creates a newFloatingGroupwith the specifiedgroupName. This group may be looked up from the currently installedFloatManagerusing thisgroupName.groupNameshould be unique to this group.- Parameters:
groupName- the unique identifier for thisFloatingGroup- See Also:
-
-
Method Details
-
getBounds
Returns the cached screen bounds of theDockingFrameassociated with thisFloatingGroup. If no screen bounds have been previously cached, this method returnsnull. Otherwise, this method returns a clone of the cachedRectangleso that its fields may not be directly modified.- Returns:
- the cached screen bounds of the
DockingFrameassociated with thisFloatingGroup. - See Also:
-
setBounds
Sets the screen bounds representing theDockingFrameassociated with thisFloatingGroup. Ifrectisnull, then the cached screen bounds are set tonull. Otherwise, the field values are copied from the specifiedRectangleinto 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 theDockingFrameassociated with thisFloatingGroup.- See Also:
-
getName
Returns the name of thisFloatingGroup. This value may be used as a key to lookup thisFloatingGroupfrom the currently installedFloatManagerby invoking itsgetGroup(String groupName)method.- Returns:
- the name of this
FloatingGroup. - See Also:
-
getFrame
Returns a reference to theDockingFrameassociated with thisFloatingGroup. This method allows easy lookup to establish an association with aDockableand aDockingFrame. When attempting to find an existingDockingFrameinto which to restore a hiddenDockable, theDockable'sFloatingGroupmay be looked up by the currently installedFloatManagerby calling itsgetGroup(Dockable dockable)method. Once the group has been resolved, the actualDockingFramereference may be obtained by this method and theDockablemay be restored to the screen. Or, this method may returnnulland theDockingFramewill have to be recreated before theDockablecan be restored.- Returns:
- a reference to the
DockingFrameassociated with thisFloatingGroup. - See Also:
-
setFrame
Sets a reference to theDockingFrameassociated with thisFloatingGroup. This method allows help enable easy lookup to establish an association with aDockableand aDockingFrame. When attempting to find an existingDockingFrameinto which to restore a hiddenDockable, theDockable'sFloatingGroupmay be looked up by the currently installedFloatManagerby calling itsgetGroup(Dockable dockable)method. Once the group has been resolved, the actualDockingFramereference may be obtained by callinggetFrame()and theDockablemay be restored to the screen. Or,getFrame()may returnnulland theDockingFramewill have to be recreated before theDockablecan be restored. This method establishes the association betweenFloatingGroupandDockingFrame.- Parameters:
frame- theDockingFrameto be associated with thisFloatingGroup.- See Also:
-
addDockable
-
getDockableIterator
-
removeDockable
-
getDockableCount
public int getDockableCount() -
destroy
public void destroy() -
clone
-