|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.abego.treelayout.TreeLayout<TreeNode>
TreeNode
- public class TreeLayout<TreeNode>
Implements the actual tree layout algorithm.
The nodes with their final layout can be retrieved through
getNodeBounds()
.
See this summary to get an overview how to use TreeLayout.
Nested Class Summary | |
---|---|
static class |
TreeLayout.DumpConfiguration
|
Constructor Summary | |
---|---|
TreeLayout(TreeForTreeLayout<TreeNode> tree,
NodeExtentProvider<TreeNode> nodeExtentProvider,
Configuration<TreeNode> configuration)
|
|
TreeLayout(TreeForTreeLayout<TreeNode> tree,
NodeExtentProvider<TreeNode> nodeExtentProvider,
Configuration<TreeNode> configuration,
boolean useIdentity)
Creates a TreeLayout for a given tree. |
Method Summary | |
---|---|
void |
checkTree()
Check if the tree is a "valid" tree. |
void |
dumpTree(PrintStream printStream)
|
void |
dumpTree(PrintStream printStream,
TreeLayout.DumpConfiguration dumpConfiguration)
Prints a dump of the tree to the given printStream, using the node's "toString" method. |
Rectangle2D |
getBounds()
Returns the bounds of the tree layout. |
Configuration<TreeNode> |
getConfiguration()
Returns the Configuration used by this TreeLayout . |
int |
getLevelCount()
Returns the number of levels of the tree. |
Map<TreeNode,Rectangle2D.Double> |
getNodeBounds()
Returns the layout of the tree nodes by mapping each node of the tree to its bounds (position and size). |
NodeExtentProvider<TreeNode> |
getNodeExtentProvider()
Returns the NodeExtentProvider used by this TreeLayout . |
double |
getSizeOfLevel(int level)
Returns the size of a level. |
TreeForTreeLayout<TreeNode> |
getTree()
Returns the Tree the layout is created for. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TreeLayout(TreeForTreeLayout<TreeNode> tree, NodeExtentProvider<TreeNode> nodeExtentProvider, Configuration<TreeNode> configuration, boolean useIdentity)
In addition to the tree the NodeExtentProvider
and the
TreeLayout.DumpConfiguration
must be given.
useIdentity
- [default: false] when true, identity ("==") is used instead of
equality ("equals(...)") when checking nodes. Within a tree
each node must only be once (using this check).public TreeLayout(TreeForTreeLayout<TreeNode> tree, NodeExtentProvider<TreeNode> nodeExtentProvider, Configuration<TreeNode> configuration)
Method Detail |
---|
public TreeForTreeLayout<TreeNode> getTree()
public NodeExtentProvider<TreeNode> getNodeExtentProvider()
NodeExtentProvider
used by this TreeLayout
.
public Configuration<TreeNode> getConfiguration()
TreeLayout
.
public Rectangle2D getBounds()
The bounds of a TreeLayout is the smallest rectangle containing the bounds of all nodes in the layout. It always starts at (0,0).
public int getLevelCount()
public double getSizeOfLevel(int level)
When the root is located at the top or bottom the size of a level is the maximal height of the nodes of that level. When the root is located at the left or right the size of a level is the maximal width of the nodes of that level.
level
-
public Map<TreeNode,Rectangle2D.Double> getNodeBounds()
For each rectangle x and y will be >= 0. At least one rectangle will have an x == 0 and at least one rectangle will have an y == 0.
public void checkTree()
Typically you will use this method during development when you get an unexpected layout from your trees.
The following checks are performed:
public void dumpTree(PrintStream printStream, TreeLayout.DumpConfiguration dumpConfiguration)
printStream
- dumpConfiguration
- [default: new DumpConfiguration()]public void dumpTree(PrintStream printStream)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |