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
Modifier and TypeClassDescriptionstatic class
A superclass for listeners that can be added to this observer to get notification whenever the tree structure changes.static class
Represents a node in a tree structure and stores all information related to it.static class
TreeLayoutObserver
uses instance of this class to create instances ofTreeLayoutHelper.TreeNode
. -
Constructor Summary
ConstructorDescriptionTreeLayoutHelper
(TreeLayoutHelper.TreeNodeFactory nodeFactory) Constructs a newTreeLayoutHelper
for observing the givenLayoutContext
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
computeTree
(org.eclipse.gef.graph.Node[] nodes) Recomputes all the information about the tree structure (the same effect as creating newTreeLayoutObserver
).protected TreeLayoutHelper.TreeNode
Returns Super Root, that is an artificial node being a common parent for all nodes in observed tree structure.protected TreeLayoutHelper.TreeNode
getTreeNode
(org.eclipse.gef.graph.Node node) Returns aTreeLayoutHelper.TreeNode
related to given node layout.
-
Constructor Details
-
TreeLayoutHelper
Constructs a newTreeLayoutHelper
for observing the givenLayoutContext
. The givenTreeLayoutHelper.TreeNodeFactory
will be used for the construction ofTreeLayoutHelper.TreeNode
s. If no factory is supplied, theTreeLayoutHelper.TreeNodeFactory
will be used.- Parameters:
nodeFactory
- TheTreeLayoutHelper.TreeNodeFactory
to 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.TreeNode
related to given node layout. If such aTreeNode
doesn't exist, it's created.- Parameters:
node
- TheNode
for which to return the correspondingTreeLayoutHelper.TreeNode
.- Returns:
- The already existing
TreeLayoutHelper.TreeNode
related to the givenNode
or a newly created one in case there was no relatedTreeLayoutHelper.TreeNode
before.
-