com.javadocking.dock
Interface CompositeDock

All Superinterfaces:
Dock
All Known Implementing Classes:
BorderDock, CompositeGridDock, CompositeLineDock, FloatDock, SplitDock

public interface CompositeDock
extends Dock

This is a Dock that can contain other child docks.

Information on using composite docks is in How to Use Composite Docks in The Sanaware Developer Guide.

Child docks can be added. They can not be removed explicitly. When a child dock is empty, the method emptyChild(Dock) of the composite parent dock has to be called. The parent dock can then remove the child.

Dockables can also be added with the method Dock.addDockable(com.javadocking.dockable.Dockable, java.awt.Point, java.awt.Point). When this dockable is added, a child dock is created with the child dock factory, retrieved by getChildDockFactory(). The dockable is added to this child dock, and the child dock is added to this composite dock.

Author:
Heidi Rakels.

Field Summary
static java.lang.String CHILD_DOCK_PREFIX
          The name childDock that will be used to create property names for specifying properties of child docks.
 
Method Summary
 void addChildDock(Dock dock, Position position)
           Adds the given dock as child dock at the given position.
 void clearGhosts()
          Clears the ghost child docks from this dock.
 void emptyChild(Dock childDock)
          Is called when the specified child dock is empty.
 Dock getChildDock(int index)
          Gets the child dock with the specified index.
 int getChildDockCount()
          Gets the number of child docks of this dock.
 DockFactory getChildDockFactory()
          Gets the factory that creates the child docks for this composite dock.
 Position getChildDockPosition(Dock childDock)
          Gets the position, where the child dock is docked in this dock.
 void ghostChild(Dock childDock)
          Makes the given empty child dock invisible.
 void setChildDockFactory(DockFactory dockFactory)
          Sets the factory that creates the child docks for this composite dock.
 
Methods inherited from interface com.javadocking.dock.Dock
addDockable, addDockingListener, getDockPriority, getParentDock, isEmpty, isFull, loadProperties, removeDockingListener, retrieveDockingRectangle, saveProperties, setParentDock
 

Field Detail

CHILD_DOCK_PREFIX

static final java.lang.String CHILD_DOCK_PREFIX
The name childDock that will be used to create property names for specifying properties of child docks.

See Also:
Constant Field Values
Method Detail

addChildDock

void addChildDock(Dock dock,
                  Position position)
                  throws java.lang.IllegalStateException

Adds the given dock as child dock at the given position.

If there is already a dock at the given position, the child is added at the first free position. If the given position is illegal, then the dock is added at the first free position.

Parameters:
dock - The new child dock for this dock.
position - The position for the child dock.
Throws:
java.lang.IllegalStateException - If the dock is full.

emptyChild

void emptyChild(Dock childDock)
Is called when the specified child dock is empty. Normally this child dock will be removed.

Parameters:
childDock - The child dock that is empty.

ghostChild

void ghostChild(Dock childDock)
Makes the given empty child dock invisible. It may not be removed, because there are still listeners attached to the child dock, that are currently dragging the dockable. The dock is becoming a ghost. It is still there, but it is invisible.

Parameters:
childDock - The child dock that is empty, but not may be removed.

clearGhosts

void clearGhosts()
Clears the ghost child docks from this dock. The ghost child docks are removed.


getChildDockCount

int getChildDockCount()
Gets the number of child docks of this dock.

Returns:
The number of child docks of this dock.

getChildDock

Dock getChildDock(int index)
                  throws java.lang.IndexOutOfBoundsException
Gets the child dock with the specified index.

Parameters:
index - The index of the child dock.
Returns:
The child dock with the specified index.
Throws:
java.lang.IndexOutOfBoundsException - If the index is out of range (index < 0 || index >= getChildDockCount()).

getChildDockPosition

Position getChildDockPosition(Dock childDock)
                              throws java.lang.IllegalArgumentException
Gets the position, where the child dock is docked in this dock.

Parameters:
childDock - The dockable that is docked in this dock.
Returns:
The position where the child dock is docked in this dock. Not null.
Throws:
java.lang.IllegalArgumentException - If the given dock is not docked in this dock.

getChildDockFactory

DockFactory getChildDockFactory()
Gets the factory that creates the child docks for this composite dock.

Returns:
The factory that creates the child docks for this composite dock.

setChildDockFactory

void setChildDockFactory(DockFactory dockFactory)
Sets the factory that creates the child docks for this composite dock.

Parameters:
dockFactory - The factory that creates the child docks for this composite dock.
Throws:
java.lang.IllegalArgumentException - When the child dock factory is null.