Class TreeLayoutAlgorithm
java.lang.Object
org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithm
org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm
- All Implemented Interfaces:
- LayoutAlgorithm
The TreeLayoutAlgorithm class implements a simple algorithm to arrange graph
 nodes in a layered tree-like layout.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classDeprecated, for removal: This API element is subject to removal in a future version.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intTree direction constant for which root is placed at the bottom and branches spread upwardsstatic final intTree direction constant for which root is placed at the left and branches spread to the rightstatic final intTree direction constant for which root is placed at the right and branches spread to the leftstatic final intTree direction constant for which root is placed at the top and branches spread downwardsFields inherited from class org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithmcontext
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a default Tree Layout.TreeLayoutAlgorithm(int direction) Create a Tree Layout with a specified direction.TreeLayoutAlgorithm(int direction, Dimension nodeSpace) Create a Tree Layout with fixed size spacing around nodes.
- 
Method SummaryModifier and TypeMethodDescriptionvoidapplyLayout(boolean clean) Makes this algorithm perform layout computation and apply it to its context.intbooleanvoidsetDirection(int direction) voidsetLayoutContext(LayoutContext context) Sets the layout context for this algorithm.voidsetNodeSpace(Dimension nodeSpace) voidsetResizing(boolean resizing) 
- 
Field Details- 
TOP_DOWNpublic static final int TOP_DOWNTree direction constant for which root is placed at the top and branches spread downwards- Since:
- 2.0
- See Also:
 
- 
BOTTOM_UPpublic static final int BOTTOM_UPTree direction constant for which root is placed at the bottom and branches spread upwards- Since:
- 2.0
- See Also:
 
- 
LEFT_RIGHTpublic static final int LEFT_RIGHTTree direction constant for which root is placed at the left and branches spread to the right- Since:
- 2.0
- See Also:
 
- 
RIGHT_LEFTpublic static final int RIGHT_LEFTTree direction constant for which root is placed at the right and branches spread to the left- Since:
- 2.0
- See Also:
 
 
- 
- 
Constructor Details- 
TreeLayoutAlgorithmpublic TreeLayoutAlgorithm()Create a default Tree Layout.
- 
TreeLayoutAlgorithmpublic TreeLayoutAlgorithm(int direction) Create a Tree Layout with a specified direction.- Parameters:
- direction- The direction, one of- BOTTOM_UP,- LEFT_RIGHT,- RIGHT_LEFT,- TOP_DOWN
 
- 
TreeLayoutAlgorithmCreate a Tree Layout with fixed size spacing around nodes. If nodeSpace is not null, the layout will size the container to the ideal space to just contain all nodes of fixed size without any overlap. Otherwise, the algorithm will size for the container's available space.- Parameters:
- direction- The direction, one of- BOTTOM_UP,- LEFT_RIGHT,- RIGHT_LEFT,- TOP_DOWN
- nodeSpace- the size to make each node. May be null.
- Since:
- 2.0
 
 
- 
- 
Method Details- 
setNodeSpace- Parameters:
- nodeSpace- the nodeSpaceSize to set
- Since:
- 2.0
 
- 
getDirectionpublic int getDirection()- Since:
- 2.0
 
- 
setDirectionpublic void setDirection(int direction) - Since:
- 2.0
 
- 
isResizingpublic boolean isResizing()- Returns:
- true if this algorithm is set to resize elements
- Since:
- 2.0
 
- 
setResizingpublic void setResizing(boolean resizing) - Parameters:
- resizing- true if this algorithm should resize elements (default is false)
- Since:
- 2.0
 
- 
setLayoutContextDescription copied from interface:LayoutAlgorithmSets the layout context for this algorithm. The receiver will unregister from its previous layout context and register to the new one (registration means for example adding listeners). After a call to this method, the receiving algorithm can compute and cache internal data related to given context and perform an initial layout.- Specified by:
- setLayoutContextin interface- LayoutAlgorithm
- Overrides:
- setLayoutContextin class- AbstractLayoutAlgorithm
- Parameters:
- context- a new layout context or null if this algorithm should not perform any layout
 
- 
applyLayoutpublic void applyLayout(boolean clean) Description copied from interface:LayoutAlgorithmMakes this algorithm perform layout computation and apply it to its context.- Parameters:
- clean- if true the receiver should assume that the layout context has changed significantly and recompute the whole layout even if it keeps track of changes with listeners. False can be used after dynamic layout in a context is turned back on so that layout algorithm working in background can apply accumulated changes. Static layout algorithm can ignore this call entirely if clean is false.
 
 
- 
TreeLayoutAlgorithminstead.