Class TreeLayoutHelper
java.lang.Object
org.eclipse.gef.layout.algorithms.TreeLayoutHelper
A helper class for layout algorithms that are based on tree structure. It
keeps track of changes in observed layout context and stores current
information about the tree structure - children of each node and several
other parameters.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA superclass for listeners that can be added to this observer to get notification whenever the tree structure changes.static classRepresents a node in a tree structure and stores all information related to it.static classTreeLayoutObserveruses instance of this class to create instances ofTreeLayoutHelper.TreeNode. -
Constructor Summary
ConstructorsConstructorDescriptionTreeLayoutHelper(TreeLayoutHelper.TreeNodeFactory nodeFactory) Constructs a newTreeLayoutHelperfor observing the givenLayoutContext. -
Method Summary
Modifier and TypeMethodDescriptionvoidcomputeTree(org.eclipse.gef.graph.Node[] nodes) Recomputes all the information about the tree structure (the same effect as creating newTreeLayoutObserver).protected TreeLayoutHelper.TreeNodeReturns Super Root, that is an artificial node being a common parent for all nodes in observed tree structure.protected TreeLayoutHelper.TreeNodegetTreeNode(org.eclipse.gef.graph.Node node) Returns aTreeLayoutHelper.TreeNoderelated to given node layout.
-
Constructor Details
-
TreeLayoutHelper
Constructs a newTreeLayoutHelperfor observing the givenLayoutContext. The givenTreeLayoutHelper.TreeNodeFactorywill be used for the construction ofTreeLayoutHelper.TreeNodes. If no factory is supplied, theTreeLayoutHelper.TreeNodeFactorywill be used.- Parameters:
nodeFactory- TheTreeLayoutHelper.TreeNodeFactoryto use.
-
-
Method Details
-
computeTree
public void computeTree(org.eclipse.gef.graph.Node[] nodes) Recomputes all the information about the tree structure (the same effect as creating newTreeLayoutObserver).- Parameters:
nodes- nodes
-
getSuperRoot
Returns Super Root, that is an artificial node being a common parent for all nodes in observed tree structure.- Returns:
- Super Root
-
getTreeNode
Returns aTreeLayoutHelper.TreeNoderelated to given node layout. If such aTreeNodedoesn't exist, it's created.- Parameters:
node- TheNodefor which to return the correspondingTreeLayoutHelper.TreeNode.- Returns:
- The already existing
TreeLayoutHelper.TreeNoderelated to the givenNodeor a newly created one in case there was no relatedTreeLayoutHelper.TreeNodebefore.
-