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.Serializable
This class models a grouping ofDockables
within a floatingDockingFrame
. TheFloatingGroup
tracks the current screen bounds of theDockingFrame
and the ID for eachDockable
within the group. TheFloatingGroup
may be persisted to external storage and recreated across JVM sessions. This allows theDockingFrame
to be recreated and displayed with the previous screen bounds and all of theDockables
contained within the group to be restored to their previous state within theDockingFrame
.
In addition to providing persistent state across application sessions, theFloatingGroup
allows for a floatingDockable
to be closed and then later restored to its original floating state within the same JVM session. The currently installedFloatManager
may useFloatingGroups
to determine which visibleDockingFrame
into which to restore a closedDockable
, or to create and display a newDockingFrame
to 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 newFloatingGroup
with the specifiedgroupName
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDockable(java.lang.String dockableId)
java.lang.Object
clone()
void
destroy()
java.awt.Rectangle
getBounds()
Returns the cached screen bounds of theDockingFrame
associated with thisFloatingGroup
.int
getDockableCount()
java.util.Iterator
getDockableIterator()
DockingFrame
getFrame()
Returns a reference to theDockingFrame
associated with thisFloatingGroup
.java.lang.String
getName()
Returns the name of thisFloatingGroup
.void
removeDockable(java.lang.String dockableId)
void
setBounds(java.awt.Rectangle rect)
Sets the screen bounds representing theDockingFrame
associated with thisFloatingGroup
.void
setFrame(DockingFrame frame)
Sets a reference to theDockingFrame
associated with thisFloatingGroup
.
-
-
-
Constructor Detail
-
FloatingGroup
public FloatingGroup(java.lang.String groupName)
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:
FloatManager.getGroup(String)
-
-
Method Detail
-
getBounds
public java.awt.Rectangle 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(Rectangle)
-
setBounds
public void setBounds(java.awt.Rectangle rect)
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:
getBounds()
-
getName
public java.lang.String 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:
FloatingGroup(String)
,FloatManager.getGroup(String)
-
getFrame
public DockingFrame 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(DockingFrame)
,FloatManager.getGroup(Dockable)
-
setFrame
public void setFrame(DockingFrame frame)
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:
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:
clone
in classjava.lang.Object
-
-