Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class TreeArrangement
- Object
- TreeArrangement
ImplementsGraphArrangement
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.
Fields
public static final int TOP_TO_BOTTOM = 0 | Children below their parent. |
public static final int LEFT_TO_RIGHT = 1 | Children to the right of their parent, as in a mind map or file tree. |
Constructors
public TreeArrangement() |
Methods
public int getDirection() | TOP_TO_BOTTOM, the default, or LEFT_TO_RIGHT. |
public void setDirection(int direction) | Sets the direction the tree grows. |
public double getLevelGap() | The space between a parent and its children in world units. |
public void setLevelGap(double levelGap) | Sets the space between levels. |
public double getSiblingGap() | The space between neighbouring subtrees in world units. |
public void setSiblingGap(double siblingGap) | Sets the space between neighbouring subtrees. |
public String getRootId() | The id of the root, or null to start from every node no edge enters. |
public void setRootId(String rootId) | Sets the root. |
public ArrangementResult arrange(GraphModel model) | Computes a position for every node, and a route for edges the arrangement bends. |
Inherited methods
Field details
TOP_TO_BOTTOM
public static final int TOP_TO_BOTTOM = 0Children below their parent.
LEFT_TO_RIGHT
public static final int LEFT_TO_RIGHT = 1Children to the right of their parent, as in a mind map or file tree.
Constructor details
TreeArrangement
public TreeArrangement()Method details
getDirection
public int getDirection()TOP_TO_BOTTOM, the default, or LEFT_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
public String getRootId()The id of the root, or null to start from every node no edge enters.
setRootId
public void setRootId(String rootId)Sets the root.
arrange
public ArrangementResult arrange(GraphModel model)Computes a position for every node, and a route for edges the arrangement
bends.