bibliothek.gui.dock.wizard
Class WizardColumnModel

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

public class WizardColumnModel
extends Object

This class offers an interface to the tree of a SplitDockStation that handles as if the tree would build a table.

Author:
Benjamin Sigg

Constructor Summary
WizardColumnModel(WizardSplitDockStation station)
           
WizardColumnModel(WizardSplitDockStation station, double factorW, double factorH)
           
 
Method Summary
protected  int applyPersistentSizes(WizardNodeMap map, boolean revalidate)
          Updates the dividers of all Nodes such that the actual size of the columns and cells results.
 bibliothek.gui.dock.station.split.Leaf[] getLastLeafOfColumns()
           
protected  WizardNodeMap getMap()
          Gets a map containing the current columns and cells.
 PersistentColumn[] getPersistentColumns()
           
 Dimension getPreferredSize()
          Gets the current preferred size of the entire WizardSplitDockStation
 boolean isHeaderLevel(bibliothek.gui.dock.station.split.SplitNode node)
           
 boolean isHeaderLevel(bibliothek.gui.dock.station.split.SplitNode node, boolean recursive)
           
 void resetToPreferredSize(int index)
          Updates the size of the index'th column such that it has its preferred size.
 void resetToPreferredSizes()
          Updates the size of each cell and column such that they met their preferred size.
 void setDivider(bibliothek.gui.dock.station.split.Divideable divideable, double divider)
          Called if the user changed the position of a dividier.
 void setFactors(double factorW, double factorH)
           
 void setPersistentColumns(bibliothek.gui.Dockable[][] columnsAndCells, int[][] cellSizes, int[] columnSizes)
          Visits all PersistentColumns and PersistentCells and updates them according to the values delivered to this method.
 void updateBounds(double x, double y)
          Updates the boundaries of all SplitNodes.
protected  void updateBounds(double x, double y, double width, double height, WizardNodeMap.Column column, WizardNodeMap map)
          Update the boundaries of the column column and all its children.
protected  void updateBounds(bibliothek.gui.dock.station.split.SplitNode node, double x, double y, double width, double height, WizardNodeMap map)
          Updates the boundaries of node and all its children.
protected  void updateBoundsRecursive(bibliothek.gui.dock.station.split.SplitNode node, double x, double y, double width, double height, WizardNodeMap map)
          Updates the boundaries of node and all its children.
 double validateColumnDivider(double divider)
          Calculates the valid value of divider for the outermost column
 double validateDivider(double divider, bibliothek.gui.dock.station.split.Leaf leaf)
          Calculates the valid value of divider for leaf.
 double validateDivider(double divider, bibliothek.gui.dock.station.split.Node node)
          Calculates the valid value of divider for node.
 double validateDivider(WizardNodeMap.Column column, double divider, bibliothek.gui.dock.station.split.Leaf leaf, WizardNodeMap map)
           
 double validateDivider(WizardNodeMap.Column column, double divider, bibliothek.gui.dock.station.split.Node node, WizardNodeMap map)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WizardColumnModel

public WizardColumnModel(WizardSplitDockStation station)

WizardColumnModel

public WizardColumnModel(WizardSplitDockStation station,
                         double factorW,
                         double factorH)
Method Detail

setFactors

public void setFactors(double factorW,
                       double factorH)

getLastLeafOfColumns

public bibliothek.gui.dock.station.split.Leaf[] getLastLeafOfColumns()

getPersistentColumns

public PersistentColumn[] getPersistentColumns()

isHeaderLevel

public boolean isHeaderLevel(bibliothek.gui.dock.station.split.SplitNode node)

isHeaderLevel

public boolean isHeaderLevel(bibliothek.gui.dock.station.split.SplitNode node,
                             boolean recursive)

getMap

protected WizardNodeMap getMap()
Gets a map containing the current columns and cells. This method may decide at any time to create a new map. Callers may use the map to ask as many queries as they want, they should however never use more than one map at the same time.

Returns:
the current map of cells and columns

getPreferredSize

public Dimension getPreferredSize()
Gets the current preferred size of the entire WizardSplitDockStation

Returns:
the current preferred size

setPersistentColumns

public void setPersistentColumns(bibliothek.gui.Dockable[][] columnsAndCells,
                                 int[][] cellSizes,
                                 int[] columnSizes)
Visits all PersistentColumns and PersistentCells and updates them according to the values delivered to this method. If the current layout does not match the arguments, then some cells will simply be ignored.

Parameters:
columnsAndCells - the children of the station, sorted into columns and cells. The actual layout on the station does not have to match this array, the other arguments of the method however must.
cellSizes - the size of each cell, this array must have the same dimensions as columnsAndCells
columnSizes - the size of each column, this array must have the same dimensions as columnsAndCells

setDivider

public void setDivider(bibliothek.gui.dock.station.split.Divideable divideable,
                       double divider)
Called if the user changed the position of a dividier.

Parameters:
node - the node whose dividier changed
divider - the new dividier

resetToPreferredSizes

public void resetToPreferredSizes()
Updates the size of each cell and column such that they met their preferred size.


resetToPreferredSize

public void resetToPreferredSize(int index)
Updates the size of the index'th column such that it has its preferred size.

Parameters:
index - the index of the column to update

applyPersistentSizes

protected int applyPersistentSizes(WizardNodeMap map,
                                   boolean revalidate)
Updates the dividers of all Nodes such that the actual size of the columns and cells results.

Parameters:
map - information about the layout of the station
revalidate - if true, a call to JComponent.revalidate() is made
Returns:
the number of pixels required to show all columns

updateBounds

public void updateBounds(double x,
                         double y)
Updates the boundaries of all SplitNodes.

Parameters:
x - the top left corner
y - the top left corner

updateBounds

protected void updateBounds(bibliothek.gui.dock.station.split.SplitNode node,
                            double x,
                            double y,
                            double width,
                            double height,
                            WizardNodeMap map)
Updates the boundaries of node and all its children. This method forwards the call to either #updateBounds(SplitNode, double, double, double, double) or #updateBounds(double, double, double, double, Column) depending on the existence of a WizardNodeMap.Column for node in map.

Parameters:
node - the node whose boundaries are to be updated
x - the minimum x coordinate
y - the minimum y coordinate
width - the maximum width
height - the maximum height
map - more information about the current layout.

updateBounds

protected void updateBounds(double x,
                            double y,
                            double width,
                            double height,
                            WizardNodeMap.Column column,
                            WizardNodeMap map)
Update the boundaries of the column column and all its children.

Parameters:
x - the minimum x coordinate
y - the minimum y coordinate
width - the maximum width
height - the maximum height
column - the column whose boundaries are to be updated
map - information about the current layout

updateBoundsRecursive

protected void updateBoundsRecursive(bibliothek.gui.dock.station.split.SplitNode node,
                                     double x,
                                     double y,
                                     double width,
                                     double height,
                                     WizardNodeMap map)
Updates the boundaries of node and all its children. This method recursively visites all children of node and forwards the call to updateBounds(SplitNode, double, double, double, double, WizardNodeMap) if a Root or a Node is found.

Parameters:
node - the node whose boundaries are to be update
x - the minimum x coordinate
y - the minimum y coordinate
width - the maximum width
height - the maximum height
map - information about the current layout

validateDivider

public double validateDivider(double divider,
                              bibliothek.gui.dock.station.split.Node node)
Calculates the valid value of divider for node.

Parameters:
divider - the location of the divider
node - the node whose divider is changed
Returns:
the valid divider

validateDivider

public double validateDivider(double divider,
                              bibliothek.gui.dock.station.split.Leaf leaf)
Calculates the valid value of divider for leaf.

Parameters:
divider - the location of the divider
node - the node whose divider is changed
Returns:
the valid divider

validateColumnDivider

public double validateColumnDivider(double divider)
Calculates the valid value of divider for the outermost column

Parameters:
divider - the location of the divider
node - the node whose divider is changed
Returns:
the valid divider

validateDivider

public double validateDivider(WizardNodeMap.Column column,
                              double divider,
                              bibliothek.gui.dock.station.split.Node node,
                              WizardNodeMap map)

validateDivider

public double validateDivider(WizardNodeMap.Column column,
                              double divider,
                              bibliothek.gui.dock.station.split.Leaf leaf,
                              WizardNodeMap map)