Class TreeLayoutObserver
java.lang.Object
org.eclipse.zest.layouts.algorithms.TreeLayoutObserver
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.
- Since:
- 2.0
-
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 ofTreeLayoutObserver.TreeNode. -
Constructor Summary
ConstructorsConstructorDescriptionTreeLayoutObserver(LayoutContext context, TreeLayoutObserver.TreeNodeFactory nodeFactory) Creates a -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a listener that will be informed about changes in tree structure.Returns Super Root, that is an artificial node being a common parent for all nodes in observed tree structure.getTreeNode(NodeLayout node) Returns aTreeLayoutObserver.TreeNoderelated to given node layout.voidRecomputes all the information about the tree structure (the same effect as creating newTreeLayoutObserver).voidRemoves a listener from list of listener to be informed about changes in tree structure.voidstop()Stops this observer from listening to changes in observed layout context.
-
Constructor Details
-
TreeLayoutObserver
Creates a- Parameters:
context-nodeFactory-
-
-
Method Details
-
recomputeTree
public void recomputeTree()Recomputes all the information about the tree structure (the same effect as creating newTreeLayoutObserver). -
stop
public void stop()Stops this observer from listening to changes in observed layout context. After calling this method the information about tree structure can be updated only whenrecomputeTree()is called. -
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 aTreeLayoutObserver.TreeNoderelated to given node layout. If such aTreeNodedoesn't exist, it's created.- Parameters:
node-
-
addTreeListener
Adds a listener that will be informed about changes in tree structure.- Parameters:
listener- listener to add
-
removeTreeListener
Removes a listener from list of listener to be informed about changes in tree structure.- Parameters:
listener- listener to remove
-