Class TreeLayoutHelper
- java.lang.Object
-
- org.eclipse.gef.layout.algorithms.TreeLayoutHelper
-
public class TreeLayoutHelper extends java.lang.ObjectA 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 Classes Modifier and Type Class Description static classTreeLayoutHelper.TreeListenerA superclass for listeners that can be added to this observer to get notification whenever the tree structure changes.static classTreeLayoutHelper.TreeNodeRepresents a node in a tree structure and stores all information related to it.static classTreeLayoutHelper.TreeNodeFactoryTreeLayoutObserveruses instance of this class to create instances ofTreeLayoutHelper.TreeNode.
-
Constructor Summary
Constructors Constructor Description TreeLayoutHelper(TreeLayoutHelper.TreeNodeFactory nodeFactory)Constructs a newTreeLayoutHelperfor observing the givenLayoutContext.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomputeTree(org.eclipse.gef.graph.Node[] nodes)Recomputes all the information about the tree structure (the same effect as creating newTreeLayoutObserver).protected TreeLayoutHelper.TreeNodegetSuperRoot()Returns 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 Detail
-
TreeLayoutHelper
public TreeLayoutHelper(TreeLayoutHelper.TreeNodeFactory nodeFactory)
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 Detail
-
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
protected TreeLayoutHelper.TreeNode getSuperRoot()
Returns Super Root, that is an artificial node being a common parent for all nodes in observed tree structure.- Returns:
- Super Root
-
getTreeNode
protected TreeLayoutHelper.TreeNode getTreeNode(org.eclipse.gef.graph.Node node)
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.
-
-