bibliothek.gui.dock.common
Class CGrid

java.lang.Object
  extended by bibliothek.gui.dock.common.CGrid

public class CGrid
extends Object

A CGrid is a mechanism to layout a set of CDockable on a SplitDockStation like the one used in the center of the CContentArea or on the CWorkingArea. CGrids also can register new CDockables to a CControl.
A CGrid is a rectangle containing several CDockables. All these dockables have boundaries, within the rectangle of the grid.
A grid can be deployed on CWorkingAreas or CContentAreas. As soon as a grid is deployed, all its dockables get visible.

Author:
Benjamin Sigg

Constructor Summary
CGrid()
          Creates a new grid.
CGrid(CControl control)
          Creates a new grid.
 
Method Summary
 void add(double x, double y, double width, double height, CDockable... dockables)
          Adds a new set of CDockables to this grid.
 void addHorizontalDivider(double x1, double x2, double y)
          Informs this grid about a horizontal divider that should be inserted into the layout.
 void addVerticalDivider(double x, double y1, double y2)
          Informs this grid about a horizontal divider that should be inserted into the layout.
 SplitDockTree toTree()
          Creates and returns a tree which contains the CommonDockables of this CGrid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CGrid

public CGrid()
Creates a new grid.


CGrid

public CGrid(CControl control)
Creates a new grid. New CDockables will be registered at control.

Parameters:
control - the control where this grid should register new CDockables.
Method Detail

toTree

public SplitDockTree toTree()
Creates and returns a tree which contains the CommonDockables of this CGrid. The branches of the tree are put in a way, that this boundaries of the CommonDockables are respected as good as possible.

Returns:
the contents of this grid as tree

add

public void add(double x,
                double y,
                double width,
                double height,
                CDockable... dockables)
Adds a new set of CDockables to this grid. The CDockables are also added to the CControl of this CGrid.

Parameters:
x - the x-coordinate of the dockables
y - the y-coordinate of the dockables
width - the width of the dockables
height - the height of the dockables
dockables - a list of SingleCDockables and MultipleCDockables.

addHorizontalDivider

public void addHorizontalDivider(double x1,
                                 double x2,
                                 double y)
Informs this grid about a horizontal divider that should be inserted into the layout. There are no guarantees that the divider really is inserted.

Parameters:
x1 - the first x coordinate of the divider
x2 - the second x coordinate of the divider
y - the y coordinate of the divider

addVerticalDivider

public void addVerticalDivider(double x,
                               double y1,
                               double y2)
Informs this grid about a horizontal divider that should be inserted into the layout. There are no guarantees that the divider really is inserted.

Parameters:
x - the x coordinate of the divider
y1 - the first y coordinate of the divider
y2 - the second y coordinate of the divider