Class TriangleSubgraph
java.lang.Object
org.eclipse.zest.core.widgets.DefaultSubgraph
org.eclipse.zest.core.widgets.FigureSubgraph
org.eclipse.zest.core.widgets.custom.TriangleSubgraph
- All Implemented Interfaces:
- EntityLayout,- SubgraphLayout
A subgraph that is visualized in a graph as a triangle. It assumes that nodes
 in context that uses them are arranged in a tree structure and the nodes
 added to the subgraph are a subtree (except for the subtree's root, which
 should not be added).
 The triangle has three features that show the properties of a subtree
 contained within it:
 
- Height of the triangle is proportional to the height of the
 subtree. If the subtree contains the whole tree, the triangle's height will
 be equal to value provided with
 TriangleSubgraph.TriangleParameters.referenceHeight(default is 50).
- Length of the triangle's base depends on the number of leaves in
 the subtree. More precisely, it is proportional to the logarithm of the
 percent that the subtree's leaves make of the whole context's leaves. The
 proportion factor is adjusted so that for a subtree containing all the leaves
 the base has length provided with TriangleSubgraphTriangleSubgraph.TriangleParameters.referenceBase(default is 50) and for a subtree containing only one leaf the base has length 1.
- Background color of the triangle depends on average number of children for nodes in the subtree. The less is this value, the more bright is the color (up to white for a subtree with average number of children equal to 1). The average value is calculated only for nodes that have at least one child. The root of the subtree (which is not directly added to this subgraph) is also accounted.
TreeLayoutObserver is created for the context. It must keep track of
 changes in the graph structure, so events related to it should not be
 intercepted by other listeners before they reach the subgraph's observer.- Since:
- 1.14
- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from class org.eclipse.zest.core.widgets.FigureSubgraphFigureSubgraph.SubgraphFigrueListenerNested classes/interfaces inherited from class org.eclipse.zest.core.widgets.DefaultSubgraphDefaultSubgraph.DefaultSubgraphFactory, DefaultSubgraph.LabelSubgraphFactory, DefaultSubgraph.PrunedSuccessorsSubgraphFactory, DefaultSubgraph.TriangleSubgraphFactory
- 
Field SummaryFields inherited from class org.eclipse.zest.core.widgets.FigureSubgraphfigureFields inherited from class org.eclipse.zest.core.widgets.DefaultSubgraphcontext, disposed, nodesFields inherited from interface org.eclipse.zest.layouts.interfaces.SubgraphLayoutBOTTOM_UP, LEFT_RIGHT, RIGHT_LEFT, TOP_DOWN
- 
Constructor SummaryConstructorsConstructorDescriptionTriangleSubgraph(NodeLayout[] nodes, LayoutContext context, TriangleSubgraph.TriangleParameters triangleParameters) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidCreates a figure for this subgraph and stores it inFigureSubgraph.figure.booleanvoidChanges the color of the triangle visualizing this subgraph.voidsetDirection(int direction) Sets the direction of this subgraph (does nothing in case of subgraphs that don't depend on direction)protected voidUpdates the figure stored inFigureSubgraph.figuredepending on current nodes contained in this subgraph.Methods inherited from class org.eclipse.zest.core.widgets.FigureSubgraphaddNodes, applyLayoutChanges, dispose, getFigure, getLocation, getPredecessingEntities, getSize, getSuccessingEntities, isGraphEntity, isMovable, refreshLocation, removeNodes, setLocationMethods inherited from class org.eclipse.zest.core.widgets.DefaultSubgraphcountNodes, getItems, getNodes, getPreferredAspectRatio, isResizable, refreshConnectionsVisibility, refreshSize, removeDisposedNodes, setSize
- 
Constructor Details- 
TriangleSubgraphpublic TriangleSubgraph(NodeLayout[] nodes, LayoutContext context, TriangleSubgraph.TriangleParameters triangleParameters) 
 
- 
- 
Method Details- 
createFigureprotected void createFigure()Description copied from class:FigureSubgraphCreates a figure for this subgraph and stores it inFigureSubgraph.figure. This method may not be called right after creation of the subgraph but later when the figure is actually needed (lazy initialization).- Specified by:
- createFigurein class- FigureSubgraph
 
- 
updateFigureprotected void updateFigure()Description copied from class:FigureSubgraphUpdates the figure stored inFigureSubgraph.figuredepending on current nodes contained in this subgraph. If this method creates a new instance of IFigure, it should remember to add aFigureSubgraph.SubgraphFigrueListenerto it.- Specified by:
- updateFigurein class- FigureSubgraph
 
- 
isDirectionDependantpublic boolean isDirectionDependant()- Specified by:
- isDirectionDependantin interface- SubgraphLayout
- Overrides:
- isDirectionDependantin class- DefaultSubgraph
- Returns:
- true if this subgraph is visualized differently depending on direction
 
- 
setDirectionpublic void setDirection(int direction) Description copied from interface:SubgraphLayoutSets the direction of this subgraph (does nothing in case of subgraphs that don't depend on direction)- Specified by:
- setDirectionin interface- SubgraphLayout
- Overrides:
- setDirectionin class- DefaultSubgraph
- Parameters:
- direction- one of constants:- SubgraphLayout.TOP_DOWN,- SubgraphLayout.BOTTOM_UP,- SubgraphLayout.LEFT_RIGHT,- SubgraphLayout.RIGHT_LEFT
 
- 
setColorChanges the color of the triangle visualizing this subgraph.- Parameters:
- color- color to use
 
 
-