org.jgraph.layout
Class TreeLayoutAlgorithm

java.lang.Object
  extended byorg.jgraph.layout.JGraphLayoutAlgorithm
      extended byorg.jgraph.layout.TreeLayoutAlgorithm
Direct Known Subclasses:
OrderedTreeLayoutAlgorithm

public class TreeLayoutAlgorithm
extends JGraphLayoutAlgorithm

TODO:COMMENT ME!


Nested Class Summary
protected  class TreeLayoutAlgorithm.PolyLine
           
protected  class TreeLayoutAlgorithm.TreeNode
           
 
Field Summary
protected  int alignment
           
protected  java.util.Map cell2node
           
protected  boolean centerRoot
           
protected  boolean combineLevelNodes
           
protected  JGraph graph
           
protected  int levelDistance
           
protected  int nodeDistance
           
protected  int orientation
           
 
Fields inherited from class org.jgraph.layout.JGraphLayoutAlgorithm
LAYOUT_ATTRIBUTES
 
Constructor Summary
TreeLayoutAlgorithm()
           
 
Method Summary
protected  TreeLayoutAlgorithm.TreeNode buildTree(CellView view)
           
protected  java.util.List buildTrees(java.util.List roots)
           
 JGraphLayoutSettings createSettings()
          Subclassers may return a new JComponent that allows to configure the layout.
protected  int distance(TreeLayoutAlgorithm.PolyLine right, TreeLayoutAlgorithm.PolyLine left)
           
 int getAlignment()
           
protected  java.util.List getChildren(CellView view)
           
 java.lang.String getHint()
          Get a human readable hint for using this layout.
protected  TreeLayoutAlgorithm.TreeNode getLeftMostX(TreeLayoutAlgorithm.TreeNode node)
           
 int getLevelDistance()
           
 int getNodeDistance()
           
 int getOrientation()
           
protected  TreeLayoutAlgorithm.TreeNode getRightMostX(TreeLayoutAlgorithm.TreeNode node)
           
protected  TreeLayoutAlgorithm.TreeNode getTreeNode(CellView view)
           
 boolean isCenterRoot()
           
 boolean isCombineLevelNodes()
           
protected  void join(TreeLayoutAlgorithm.TreeNode node)
           
protected  void layout(TreeLayoutAlgorithm.TreeNode node)
           
protected  void layoutTrees(java.util.List roots)
           
protected  void merge(TreeLayoutAlgorithm.PolyLine main, TreeLayoutAlgorithm.PolyLine left, int distance)
           
 void run(JGraph graph, java.lang.Object[] dynamic_cells, java.lang.Object[] static_cells)
          Executes the layout algorithm specifying which cells are to remain in place after the layout is applied.
 void setAlignment(int alignment)
          SwingConstants.TOP SwingConstants.CENTER SwingConstants.BOTTOM
 void setCenterRoot(boolean b)
           
 void setCombineLevelNodes(boolean combineLevelNodes)
           
 void setLevelDistance(int distance)
           
protected  void setLevelHeights(java.util.List roots)
           
 void setNodeDistance(int distance)
           
 void setOrientation(int orientation)
          SwingConstants.NORTH SwingConstants.EAST SwingConstants.SOUTH SwingConstants.WEST
protected  void setPosition(java.util.List roots)
           
 java.lang.String toString()
          Returns the name of this algorithm in human readable form.
 
Methods inherited from class org.jgraph.layout.JGraphLayoutAlgorithm
applyLayout, applyLayout, createDialog, createDialog, getMaximumProgress, getProgress, isAllowedToRun, populateDialog, run, setAllowedToRun, setMaximumProgress, setProgress
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

alignment

protected int alignment

orientation

protected int orientation

levelDistance

protected int levelDistance

nodeDistance

protected int nodeDistance

centerRoot

protected boolean centerRoot

combineLevelNodes

protected boolean combineLevelNodes

graph

protected JGraph graph

cell2node

protected java.util.Map cell2node
Constructor Detail

TreeLayoutAlgorithm

public TreeLayoutAlgorithm()
Method Detail

toString

public java.lang.String toString()
Returns the name of this algorithm in human readable form.


getHint

public java.lang.String getHint()
Get a human readable hint for using this layout.

Overrides:
getHint in class JGraphLayoutAlgorithm

createSettings

public JGraphLayoutSettings createSettings()
Description copied from class: JGraphLayoutAlgorithm
Subclassers may return a new JComponent that allows to configure the layout. The default implementation returns null.
Note: Settings creation may be expensive so the UI should cache the values returned by this method.

Overrides:
createSettings in class JGraphLayoutAlgorithm

setAlignment

public void setAlignment(int alignment)
SwingConstants.TOP SwingConstants.CENTER SwingConstants.BOTTOM

Parameters:
alignment -

setOrientation

public void setOrientation(int orientation)
SwingConstants.NORTH SwingConstants.EAST SwingConstants.SOUTH SwingConstants.WEST


setLevelDistance

public void setLevelDistance(int distance)

setNodeDistance

public void setNodeDistance(int distance)

setCenterRoot

public void setCenterRoot(boolean b)

run

public void run(JGraph graph,
                java.lang.Object[] dynamic_cells,
                java.lang.Object[] static_cells)
Description copied from class: JGraphLayoutAlgorithm
Executes the layout algorithm specifying which cells are to remain in place after the layout is applied.

Specified by:
run in class JGraphLayoutAlgorithm
Parameters:
graph - JGraph to be altered by layout
dynamic_cells - Cells that are to be moved by the layout
static_cells - Cells that are not to be moved, but allowed for by the layout

buildTrees

protected java.util.List buildTrees(java.util.List roots)

buildTree

protected TreeLayoutAlgorithm.TreeNode buildTree(CellView view)

getChildren

protected java.util.List getChildren(CellView view)

getTreeNode

protected TreeLayoutAlgorithm.TreeNode getTreeNode(CellView view)

layoutTrees

protected void layoutTrees(java.util.List roots)

layout

protected void layout(TreeLayoutAlgorithm.TreeNode node)

join

protected void join(TreeLayoutAlgorithm.TreeNode node)

getLeftMostX

protected TreeLayoutAlgorithm.TreeNode getLeftMostX(TreeLayoutAlgorithm.TreeNode node)

getRightMostX

protected TreeLayoutAlgorithm.TreeNode getRightMostX(TreeLayoutAlgorithm.TreeNode node)

merge

protected void merge(TreeLayoutAlgorithm.PolyLine main,
                     TreeLayoutAlgorithm.PolyLine left,
                     int distance)

distance

protected int distance(TreeLayoutAlgorithm.PolyLine right,
                       TreeLayoutAlgorithm.PolyLine left)

setPosition

protected void setPosition(java.util.List roots)

setLevelHeights

protected void setLevelHeights(java.util.List roots)

isCombineLevelNodes

public boolean isCombineLevelNodes()
Returns:
Returns the combineLevelNodes.

setCombineLevelNodes

public void setCombineLevelNodes(boolean combineLevelNodes)
Parameters:
combineLevelNodes - The combineLevelNodes to set.

getAlignment

public int getAlignment()
Returns:
Returns the alignment.

isCenterRoot

public boolean isCenterRoot()
Returns:
Returns the centerRoot.

getLevelDistance

public int getLevelDistance()
Returns:
Returns the levelDistance.

getNodeDistance

public int getNodeDistance()
Returns:
Returns the nodeDistance.

getOrientation

public int getOrientation()
Returns:
Returns the orientation.