public class JGraphTreeLayout extends JGraphAbstractTreeLayout
TreeNode
structure with appropriate interfaces to the
actual graph model. The layout can be configured by orientation, the
alignment of the nodes per level, the minimum distance betweenModifier and Type | Class and Description |
---|---|
protected class |
JGraphTreeLayout.PolyLine
ADT of a straight part of a polyline
|
protected class |
JGraphTreeLayout.StandardTreeNode
An ADT representing a node in a tree structure.
|
JGraphAbstractTreeLayout.TreeNode
JGraphLayout.Stoppable
Modifier and Type | Field and Description |
---|---|
protected int |
alignment
alignment indicates what part of the vertices will be lined up on each
row (level) of the tree.
|
protected boolean |
combineLevelNodes
Whether or not to bring all nodes on the same level to the same height in
the tree
|
graph, levelDistance, lowerLevelValues, nodeDistance, nodes, oldOrigin, orientation, positionMultipleTrees, routeTreeEdges, treeBoundary, treeDistance, upperLevelValues
VERSION
Constructor and Description |
---|
JGraphTreeLayout() |
Modifier and Type | Method and Description |
---|---|
protected int |
distance(JGraphTreeLayout.PolyLine right,
JGraphTreeLayout.PolyLine left) |
int |
getAlignment() |
protected JGraphTreeLayout.StandardTreeNode |
getLeftMostX(JGraphTreeLayout.StandardTreeNode node)
Obtains the left most point on the sub-tree under the specified tree node
|
protected JGraphTreeLayout.StandardTreeNode |
getRightMostX(JGraphTreeLayout.StandardTreeNode node)
Obtains the right most point on the sub-tree under the specified tree
node
|
protected JGraphTreeLayout.StandardTreeNode |
getTreeNode(java.lang.Object cell)
Obtains the tree node corresponding to the specified cell
|
boolean |
isCombineLevelNodes() |
protected void |
join(JGraphTreeLayout.StandardTreeNode node)
Joins nodes underneath the specified tree node
|
protected void |
layout(JGraphTreeLayout.StandardTreeNode node)
Top-level method that performs actual layout of tree for a specific node.
|
protected void |
merge(JGraphTreeLayout.PolyLine main,
JGraphTreeLayout.PolyLine left,
double distance)
Merges two parts of a polyline together
|
void |
run(JGraphFacade graph)
The API method used to exercise the layout upon the facade description
and produce a separate description of the vertex position and edge
routing changes made.
|
void |
setAlignment(int alignment)
SwingConstants.TOP SwingConstants.CENTER SwingConstants.BOTTOM are valid
inputs to this method
|
void |
setCombineLevelNodes(boolean combineLevelNodes) |
protected void |
setLevelHeights(JGraphTreeLayout.StandardTreeNode root)
Sets the heights of the level under the specified node
|
protected void |
setPosition(java.util.List roots)
Sets the position of the tree nodes specified
|
protected void |
spaceMultipleTrees(JGraphTreeLayout.StandardTreeNode root)
Ensures that the specified root is spaced far enough from previous trees
so not to overlap any cells.
|
java.lang.String |
toString()
Returns
Tree , the name of this algorithm. |
getLevelDistance, getNodeDistance, getOrientation, getRouteTreeEdges, getTreeDistance, isPositionMultipleTrees, setLevelDistance, setNodeDistance, setOrientation, setPositionMultipleTrees, setRouteTreeEdges, setTreeDistance
protected int alignment
protected boolean combineLevelNodes
public void run(JGraphFacade graph)
run
in interface JGraphLayout
run
in class JGraphAbstractTreeLayout
graph
- the facade describing the graph and its configurationprotected JGraphTreeLayout.StandardTreeNode getTreeNode(java.lang.Object cell)
cell
- the cell whose tree node is to be foundprotected void layout(JGraphTreeLayout.StandardTreeNode node)
node
- the tree node to be laid outprotected void join(JGraphTreeLayout.StandardTreeNode node)
node
- the node under which the tree is to be formedprotected JGraphTreeLayout.StandardTreeNode getLeftMostX(JGraphTreeLayout.StandardTreeNode node)
node
- the start of the sub-tree to be analysedprotected JGraphTreeLayout.StandardTreeNode getRightMostX(JGraphTreeLayout.StandardTreeNode node)
node
- the start of the sub-tree to be analysedprotected void merge(JGraphTreeLayout.PolyLine main, JGraphTreeLayout.PolyLine left, double distance)
main
- the main part of the polylineleft
- the polyline to be addeddistance
- protected int distance(JGraphTreeLayout.PolyLine right, JGraphTreeLayout.PolyLine left)
right
- first part of polylineleft
- second part of polylineprotected void setPosition(java.util.List roots)
roots
- the tree node whose position is to be setprotected void setLevelHeights(JGraphTreeLayout.StandardTreeNode root)
root
- the node under which level heights will be setprotected void spaceMultipleTrees(JGraphTreeLayout.StandardTreeNode root)
root
- the root of the tree to be spaced correctlypublic int getAlignment()
public void setAlignment(int alignment)
alignment
- public boolean isCombineLevelNodes()
public void setCombineLevelNodes(boolean combineLevelNodes)
combineLevelNodes
- The combineLevelNodes to set.public java.lang.String toString()
Tree
, the name of this algorithm.toString
in class java.lang.Object
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.