bibliothek.gui.dock.toolbar.perspective
Class CToolbarGroupPerspective

java.lang.Object
  extended by bibliothek.gui.dock.toolbar.perspective.CToolbarGroupPerspective

public class CToolbarGroupPerspective
extends Object

A wrapper around a ToolbarGroupDockPerspective, offers features that are usefull in the Common project only.
A group of toolbars is organized similar to a table: there are columns of toolbars, and each column has its own size.
Important note: "columns" is an abstract idea, they do not exist as DockStations. The CToolbarGroupPerspective tries to keep its abstract representation of columns valid, if however two CToolbarGroupPerspectives point to the same ToolbarGroupDockPerspective one perspective can modify the underlying data structure without the other perspectice noticing the changes immediatelly.

Author:
Benjamin Sigg

Nested Class Summary
 class CToolbarGroupPerspective.Column
          Represents a single column of toolbars in a group of toolbars.
 
Constructor Summary
CToolbarGroupPerspective(ToolbarGroupDockPerspective delegate)
          Creates a new perspective wrapping around delegate.
 
Method Summary
 CToolbarGroupPerspective.Column column(int index)
          Gets or creates the CToolbarGroupPerspective.Column at index.
 boolean equals(Object obj)
           
 int getColumnCount()
          Gets the total number of columns.
 ToolbarGroupDockPerspective getDelegate()
          Allows access to the internal representation of this perspective.
 CToolbarPerspective getToolbar(int index)
          Gets the toolbar at location index.
 int getToolbarCount()
          Gets the total number of toolbars in this group.
 CToolbarGroupPerspective.Column insert(int index)
          Creates a new, empty column.
 CToolbarPerspective toolbar(int column, int index)
          Gets or creates a toolbar in column column at location index.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CToolbarGroupPerspective

public CToolbarGroupPerspective(ToolbarGroupDockPerspective delegate)
Creates a new perspective wrapping around delegate.

Parameters:
delegate - the internal representation, not null
Method Detail

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getDelegate

public ToolbarGroupDockPerspective getDelegate()
Allows access to the internal representation of this perspective.

Returns:
the internal representation, not null

getToolbarCount

public int getToolbarCount()
Gets the total number of toolbars in this group. This method assumes that the client did not modify the ToolbarStrategy.

Returns:
the total number of toolbars

getToolbar

public CToolbarPerspective getToolbar(int index)
Gets the toolbar at location index.

Parameters:
index - the location of the toolbar
Returns:
the toolbar or null if the child at index has the wrong type. A result of null is only to be expected if the client modified the ToolbarStrategy.

getColumnCount

public int getColumnCount()
Gets the total number of columns.

Returns:
the number of columns

column

public CToolbarGroupPerspective.Column column(int index)
Gets or creates the CToolbarGroupPerspective.Column at index. Note that a CToolbarGroupPerspective.Column requires at least one child, a new CToolbarGroupPerspective.Column will not appear until one child has been added.

Parameters:
index - the index of an existing column, -1 or getColumnCount()
Returns:
the column, note that this method may create a new CToolbarGroupPerspective.Column object every time it is called
See Also:
insert(int), CToolbarGroupPerspective.Column

insert

public CToolbarGroupPerspective.Column insert(int index)
Creates a new, empty column. Only when the client adds a child to the CToolbarGroupPerspective.Column the column will insert itself at index. Creating a list of empty columns, and adding children afterwards, will actually change the order of the columns to the order in which the children were added.

Parameters:
index - the location where to insert the new column
Returns:
the new empty column
See Also:
CToolbarGroupPerspective.Column

toolbar

public CToolbarPerspective toolbar(int column,
                                   int index)
Gets or creates a toolbar in column column at location index.

Parameters:
column - the column in which to search or add the toolbar
index - the location of the toolbar
Returns:
the toolbar or null if a child of this station has the wrong type