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 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 ofTreeLayoutObserver.TreeNode
. -
Constructor Summary
ConstructorsConstructorDescriptionTreeLayoutObserver
(LayoutContext context, TreeLayoutObserver.TreeNodeFactory nodeFactory) Creates a -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds 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.TreeNode
related to given node layout.void
Recomputes all the information about the tree structure (the same effect as creating newTreeLayoutObserver
).void
Removes a listener from list of listener to be informed about changes in tree structure.void
stop()
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.TreeNode
related to given node layout. If such aTreeNode
doesn'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
-