Class TreeArrangement
java.lang.Object
com.codename1.graph.arrange.TreeArrangement
- All Implemented Interfaces:
GraphArrangement
An arrangement for hierarchies, such as an org chart or a file tree: every node below its parent, parents centred over their children, and no subtree overlapping another.
A graph that is not a tree is laid out by a spanning tree found breadth
first from the root (setRootId, or every node no edge enters); the other
edges are drawn straight between wherever their ends land. Several roots
make a forest, laid out side by side.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intChildren to the right of their parent, as in a mind map or file tree.static final intChildren below their parent. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionarrange(GraphModel model) Computes a position for every node, and a route for edges the arrangement bends.intTOP_TO_BOTTOM, the default, orLEFT_TO_RIGHT.doubleThe space between a parent and its children in world units.The id of the root, or null to start from every node no edge enters.doubleThe space between neighbouring subtrees in world units.voidsetDirection(int direction) Sets the direction the tree grows.voidsetLevelGap(double levelGap) Sets the space between levels.voidSets the root.voidsetSiblingGap(double siblingGap) Sets the space between neighbouring subtrees.
-
Field Details
-
TOP_TO_BOTTOM
public static final int TOP_TO_BOTTOMChildren below their parent.- See Also:
-
LEFT_TO_RIGHT
public static final int LEFT_TO_RIGHTChildren to the right of their parent, as in a mind map or file tree.- See Also:
-
-
Constructor Details
-
TreeArrangement
public TreeArrangement()
-
-
Method Details
-
getDirection
public int getDirection()TOP_TO_BOTTOM, the default, orLEFT_TO_RIGHT. -
setDirection
public void setDirection(int direction) Sets the direction the tree grows. -
getLevelGap
public double getLevelGap()The space between a parent and its children in world units. -
setLevelGap
public void setLevelGap(double levelGap) Sets the space between levels. -
getSiblingGap
public double getSiblingGap()The space between neighbouring subtrees in world units. -
setSiblingGap
public void setSiblingGap(double siblingGap) Sets the space between neighbouring subtrees. -
getRootId
The id of the root, or null to start from every node no edge enters. -
setRootId
Sets the root. -
arrange
Description copied from interface:GraphArrangementComputes a position for every node, and a route for edges the arrangement bends.- Specified by:
arrangein interfaceGraphArrangement
-