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 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:
  Serialized Form

### Constructor Summary

Constructors
Constructor and Description
`FloatingGroup(java.lang.String groupName)` Creates a new `FloatingGroup` with the specified `groupName`.

### Method Summary

Methods
`void` `addDockable(java.lang.String dockableId)`
`java.lang.Object` `clone()`
`void` `destroy()`
`java.awt.Rectangle` `getBounds()` Returns the cached screen bounds of the `DockingFrame` associated with this `FloatingGroup`.
`int` `getDockableCount()`
`java.util.Iterator` `getDockableIterator()`
`DockingFrame` `getFrame()` Returns a reference to the `DockingFrame` associated with this `FloatingGroup`.
`java.lang.String` `getName()` Returns the name of this `FloatingGroup`.
`void` `removeDockable(java.lang.String dockableId)`
`void` `setBounds(java.awt.Rectangle rect)` Sets the screen bounds representing the `DockingFrame` associated with this `FloatingGroup`.
`void` `setFrame(DockingFrame frame)` Sets a reference to the `DockingFrame` associated with this `FloatingGroup`.

### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### FloatingGroup

    public FloatingGroup(java.lang.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:
  `FloatManager.getGroup(String)`

### Method Detail

#### getBounds

    public java.awt.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(Rectangle)`

#### setBounds

    public void setBounds(java.awt.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:
  `getBounds()`

#### getName

    public java.lang.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:
  `FloatingGroup(String)`, `FloatManager.getGroup(String)`

#### 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(DockingFrame)`, `FloatManager.getGroup(Dockable)`

#### 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:
  `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 class `java.lang.Object`