Package org.flexdock.docking.state
Class FloatingGroup
- java.lang.Object
-
- org.flexdock.docking.state.FloatingGroup
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class FloatingGroup extends java.lang.Object implements java.lang.Cloneable, java.io.SerializableThis class models a grouping ofDockableswithin a floatingDockingFrame. TheFloatingGrouptracks the current screen bounds of theDockingFrameand the ID for eachDockablewithin the group. TheFloatingGroupmay be persisted to external storage and recreated across JVM sessions. This allows theDockingFrameto be recreated and displayed with the previous screen bounds and all of theDockablescontained within the group to be restored to their previous state within theDockingFrame.
In addition to providing persistent state across application sessions, theFloatingGroupallows for a floatingDockableto be closed and then later restored to its original floating state within the same JVM session. The currently installedFloatManagermay useFloatingGroupsto determine which visibleDockingFrameinto which to restore a closedDockable, or to create and display a newDockingFrameto the same end on an as-needed basis.- Author:
- Christopher Butler
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FloatingGroup(java.lang.String groupName)Creates a newFloatingGroupwith the specifiedgroupName.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDockable(java.lang.String dockableId)java.lang.Objectclone()voiddestroy()java.awt.RectanglegetBounds()Returns the cached screen bounds of theDockingFrameassociated with thisFloatingGroup.intgetDockableCount()java.util.IteratorgetDockableIterator()DockingFramegetFrame()Returns a reference to theDockingFrameassociated with thisFloatingGroup.java.lang.StringgetName()Returns the name of thisFloatingGroup.voidremoveDockable(java.lang.String dockableId)voidsetBounds(java.awt.Rectangle rect)Sets the screen bounds representing theDockingFrameassociated with thisFloatingGroup.voidsetFrame(DockingFrame frame)Sets a reference to theDockingFrameassociated with thisFloatingGroup.
-
-
-
Constructor Detail
-
FloatingGroup
public FloatingGroup(java.lang.String groupName)
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:
FloatManager.getGroup(String)
-
-
Method Detail
-
getBounds
public java.awt.Rectangle 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(Rectangle)
-
setBounds
public void setBounds(java.awt.Rectangle rect)
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:
getBounds()
-
getName
public java.lang.String 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:
FloatingGroup(String),FloatManager.getGroup(String)
-
getFrame
public DockingFrame 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(DockingFrame),FloatManager.getGroup(Dockable)
-
setFrame
public void setFrame(DockingFrame frame)
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:
getFrame(),FloatManager.getGroup(Dockable)
-
addDockable
public void addDockable(java.lang.String dockableId)
-
getDockableIterator
public java.util.Iterator getDockableIterator()
-
removeDockable
public void removeDockable(java.lang.String dockableId)
-
getDockableCount
public int getDockableCount()
-
destroy
public void destroy()
-
clone
public java.lang.Object clone()
- Overrides:
clonein classjava.lang.Object
-
-