bibliothek.gui.dock.wizard
Class WizardNodeMap

java.lang.Object
  extended by bibliothek.gui.dock.wizard.WizardNodeMap

public abstract class WizardNodeMap
extends Object

The node map tells the location of nodes and columns. It does not offer any logic to change these properties.

Author:
Benjamin Sigg

Nested Class Summary
 class WizardNodeMap.Cell
          A cell is a single SplitNode, usually a Leaf, and a part of a WizardNodeMap.Column.
 class WizardNodeMap.Column
          A column is a set of WizardNodeMap.Cells.
 
Constructor Summary
WizardNodeMap(WizardSplitDockStation station, PersistentColumn[] persistentColumns)
          Creates a new map using the current content of station
 
Method Summary
 WizardNodeMap.Column getColumn(bibliothek.gui.dock.station.split.SplitNode node)
          Searches the column which contains node.
 WizardNodeMap.Column getColumn(bibliothek.gui.dock.station.split.SplitNode node, boolean upwards)
          Gets the WizardNodeMap.Column which contains node.
 int getColumnCount()
          Gets the number of columns.
 Map<bibliothek.gui.dock.station.split.SplitNode,WizardNodeMap.Column> getColumns()
          Gets all the columns of this map.
 PersistentCell getHeadCell(bibliothek.gui.dock.station.split.SplitNode node)
          Follows the tree downwards using the right path until a Leaf is found, the cell matching that leaf is returned.
 WizardNodeMap.Column getHeadColumn(bibliothek.gui.dock.station.split.SplitNode node)
          Searches the WizardNodeMap.Column which is nearest to the inside of the parent Container, e.g.
 bibliothek.gui.dock.station.split.Leaf[] getLastLeafOfColumns()
          Goes through all WizardNodeMap.Columns all collects the last cell of these columns.
 WizardNodeMap.Column getOutermostColumn()
          Searches the WizardNodeMap.Column which is closest to the inside of the parent Container.
 PersistentColumn[] getPersistentColumns()
           
 WizardNodeMap.Column[] getSortedColumns()
          Gets all the columns sorted by their index.
protected abstract  void handlePersistentColumnsAdapted(PersistentColumn[] persistentColumns)
          Called if the current set of PersistentColumns has been changed.
 boolean isColumnRoot(bibliothek.gui.dock.station.split.SplitNode node)
          Tells whether node is the root node of a WizardNodeMap.Column.
 boolean isHeaderLevel(bibliothek.gui.dock.station.split.SplitNode node)
          Tells whether node is part of the header.
 boolean isHeaderLevel(bibliothek.gui.dock.station.split.SplitNode node, boolean recursive)
          Tells whether node is part of the header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WizardNodeMap

public WizardNodeMap(WizardSplitDockStation station,
                     PersistentColumn[] persistentColumns)
Creates a new map using the current content of station

Parameters:
station - the station whose content is to be analyzed
persistentColumns - the current columns and their current size
Method Detail

getColumns

public Map<bibliothek.gui.dock.station.split.SplitNode,WizardNodeMap.Column> getColumns()
Gets all the columns of this map.

Returns:
all the columns

getColumnCount

public int getColumnCount()
Gets the number of columns.

Returns:
the number of columns

getSortedColumns

public WizardNodeMap.Column[] getSortedColumns()
Gets all the columns sorted by their index.

Returns:
the ordered columns

isColumnRoot

public boolean isColumnRoot(bibliothek.gui.dock.station.split.SplitNode node)
Tells whether node is the root node of a WizardNodeMap.Column.

Parameters:
node - the node to check
Returns:
whether node is the root of a WizardNodeMap.Column

isHeaderLevel

public boolean isHeaderLevel(bibliothek.gui.dock.station.split.SplitNode node)
Tells whether node is part of the header. The header includes all nodes whose orientation is orthogonal to the orientation of the layout.

Parameters:
node - the node to check
Returns:
whether node belongs to the header

isHeaderLevel

public boolean isHeaderLevel(bibliothek.gui.dock.station.split.SplitNode node,
                             boolean recursive)
Tells whether node is part of the header. If recursive is true, then this node is considered to be part of the header if the parent node is part of the header (but the recursive attribute does not apply to the parent).

Parameters:
node - the node to check
recursive - whether to check the parent node as well
Returns:
whether node belongs to the header

getOutermostColumn

public WizardNodeMap.Column getOutermostColumn()
Searches the WizardNodeMap.Column which is closest to the inside of the parent Container.

Returns:
the outer most column

getHeadColumn

public WizardNodeMap.Column getHeadColumn(bibliothek.gui.dock.station.split.SplitNode node)
Searches the WizardNodeMap.Column which is nearest to the inside of the parent Container, e.g. is WizardSplitDockStation.Side is WizardSplitDockStation.Side.RIGHT, then this method would return the left most WizardNodeMap.Column.

Parameters:
node - the node in whose subtree the WizardNodeMap.Column should be searched
Returns:
the outer most column or null if not found

getHeadCell

public PersistentCell getHeadCell(bibliothek.gui.dock.station.split.SplitNode node)
Follows the tree downwards using the right path until a Leaf is found, the cell matching that leaf is returned.

Parameters:
node - the starting point of the search
Returns:
a cell or null

getColumn

public WizardNodeMap.Column getColumn(bibliothek.gui.dock.station.split.SplitNode node)
Searches the column which contains node. If node is part of the header, then the result represents the column at the right side of the divider.

Parameters:
node - the node whose column index is searched
Returns:
the column, may be null

getColumn

public WizardNodeMap.Column getColumn(bibliothek.gui.dock.station.split.SplitNode node,
                                      boolean upwards)
Gets the WizardNodeMap.Column which contains node.

Parameters:
node - the node whose column is searched
upwards - if false, then node has to be a isColumnRoot(SplitNode), otherwise it can be a child of a column root as well.
Returns:
the column or null

getLastLeafOfColumns

public bibliothek.gui.dock.station.split.Leaf[] getLastLeafOfColumns()
Goes through all WizardNodeMap.Columns all collects the last cell of these columns.

Returns:
the last cell of each WizardNodeMap.Column

getPersistentColumns

public PersistentColumn[] getPersistentColumns()

handlePersistentColumnsAdapted

protected abstract void handlePersistentColumnsAdapted(PersistentColumn[] persistentColumns)
Called if the current set of PersistentColumns has been changed.

Parameters:
persistentColumns - the new set of persistent columns