Class FloatingGroup

java.lang.Object
org.flexdock.docking.state.FloatingGroup
All Implemented Interfaces:
Serializable, Cloneable

public class FloatingGroup extends Object implements Cloneable, Serializable
This class models a grouping of 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 Details

    • FloatingGroup

      public FloatingGroup(String groupName)
      Creates a new FloatingGroup with the specified groupName. This group may be looked up from the currently installed FloatManager using this groupName. groupName should be unique to this group.
      Parameters:
      groupName - the unique identifier for this FloatingGroup
      See Also:
  • Method Details

    • getBounds

      public Rectangle getBounds()
      Returns the cached screen bounds of the DockingFrame associated with this FloatingGroup. If no screen bounds have been previously cached, this method returns null. Otherwise, this method returns a clone of the cached Rectangle so that its fields may not be directly modified.
      Returns:
      the cached screen bounds of the DockingFrame associated with this FloatingGroup.
      See Also:
    • setBounds

      public void setBounds(Rectangle rect)
      Sets the screen bounds representing the DockingFrame associated with this FloatingGroup. If rect is null, then the cached screen bounds are set to null. Otherwise, the field values are copied from the specified Rectangle 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 the DockingFrame associated with this FloatingGroup.
      See Also:
    • getName

      public String getName()
      Returns the name of this FloatingGroup. This value may be used as a key to lookup this FloatingGroup from the currently installed FloatManager by invoking its getGroup(String groupName) method.
      Returns:
      the name of this FloatingGroup.
      See Also:
    • getFrame

      public DockingFrame getFrame()
      Returns a reference to the DockingFrame associated with this FloatingGroup. This method allows easy lookup to establish an association with a Dockable and a DockingFrame. When attempting to find an existing DockingFrame into which to restore a hidden Dockable, the Dockable's FloatingGroup may be looked up by the currently installed FloatManager by calling its getGroup(Dockable dockable) method. Once the group has been resolved, the actual DockingFrame reference may be obtained by this method and the Dockable may be restored to the screen. Or, this method may return null and the DockingFrame will have to be recreated before the Dockable can be restored.
      Returns:
      a reference to the DockingFrame associated with this FloatingGroup.
      See Also:
    • setFrame

      public void setFrame(DockingFrame frame)
      Sets a reference to the DockingFrame associated with this FloatingGroup. This method allows help enable easy lookup to establish an association with a Dockable and a DockingFrame. When attempting to find an existing DockingFrame into which to restore a hidden Dockable, the Dockable's FloatingGroup may be looked up by the currently installed FloatManager by calling its getGroup(Dockable dockable) method. Once the group has been resolved, the actual DockingFrame reference may be obtained by calling getFrame() and the Dockable may be restored to the screen. Or, getFrame()may return null and the DockingFrame will have to be recreated before the Dockable can be restored. This method establishes the association between FloatingGroup and DockingFrame.
      Parameters:
      frame - the DockingFrame to be associated with this FloatingGroup.
      See Also:
    • addDockable

      public void addDockable(String dockableId)
    • getDockableIterator

      public Iterator getDockableIterator()
    • removeDockable

      public void removeDockable(String dockableId)
    • getDockableCount

      public int getDockableCount()
    • destroy

      public void destroy()
    • clone

      public Object clone()
      Overrides:
      clone in class Object