Class SpaceTreeLayoutAlgorithm
java.lang.Object
org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithm
org.eclipse.zest.layouts.algorithms.SpaceTreeLayoutAlgorithm
- All Implemented Interfaces:
- LayoutAlgorithm
Layout algorithm implementing SpaceTree. It assumes that nodes in the layout
 context make a tree structure.
 It expands and collapses nodes to optimize use of available space. In order
 to keep the tree structure clearly visible, it also keeps track of the nodes'
 positions to makes sure they stay in their current layer and don't overlap
 with each other.
 It's recommended to set an 
ExpandCollapseManger returned by
 getExpandCollapseManager() in the LayoutContext that
 will be used with this layout algorithm. Other
 ExpandCollapseManagers could also work, but the algorithm's
 functionality would be very limited.- Since:
- 2.0
- 
Nested Class SummaryNested classes/interfaces inherited from class org.eclipse.zest.layouts.algorithms.AbstractLayoutAlgorithmAbstractLayoutAlgorithm.Zest1
- 
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 SummaryConstructorsConstructorDescriptionConstructs an instance ofSpaceTreeLayoutAlgorithmthat places the root of a tree at the top of the graph.SpaceTreeLayoutAlgorithm(int direction) Constructs an instance ofSpaceTreeLayoutAlgorithmthat places the root of a tree according to given direction
- 
Method SummaryModifier and TypeMethodDescriptionvoidapplyLayout(boolean clean) Makes this algorithm perform layout computation and apply it to its context.intprotected voidrefreshLayout(boolean animation) voidsetDirection(int direction) Sets direction (placement) of the treevoidsetLayoutContext(LayoutContext context) Sets the layout context for this algorithm.
- 
Field Details- 
TOP_DOWNpublic static final int TOP_DOWNTree direction constant for which root is placed at the top and branches spread downwards- See Also:
 
- 
BOTTOM_UPpublic static final int BOTTOM_UPTree direction constant for which root is placed at the bottom and branches spread upwards- 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- 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- See Also:
 
 
- 
- 
Constructor Details- 
SpaceTreeLayoutAlgorithmpublic SpaceTreeLayoutAlgorithm()Constructs an instance ofSpaceTreeLayoutAlgorithmthat places the root of a tree at the top of the graph.
- 
SpaceTreeLayoutAlgorithmpublic SpaceTreeLayoutAlgorithm(int direction) Constructs an instance ofSpaceTreeLayoutAlgorithmthat places the root of a tree according to given direction- Parameters:
- direction- direction of the tree, sould be one of the following:- TOP_DOWN,- BOTTOM_UP,- LEFT_RIGHT,- RIGHT_LEFT.
 
 
- 
- 
Method Details- 
getDirectionpublic int getDirection()- Returns:
- current direction (placement) of the tree
 
- 
setDirectionpublic void setDirection(int direction) Sets direction (placement) of the tree- Parameters:
- direction- direction of the tree, sould be one of the following:- TOP_DOWN,- BOTTOM_UP,- LEFT_RIGHT,- RIGHT_LEFT.
 
- 
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.
 
- 
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
 
- 
getExpandCollapseManager- Returns:
- ExpandCollapseManagerthat can (and should) be used on layout context managed by this layout algorithm.
 
- 
refreshLayoutprotected void refreshLayout(boolean animation) 
 
-