Interface SubgraphLayout
- All Superinterfaces:
EntityLayout
- All Known Implementing Classes:
DefaultSubgraph,FigureSubgraph,LabelSubgraph,TriangleSubgraph
An interface for subgraphs in layout. A subgraph is a set of pruned nodes
that will be displayed as one element. A subgraph must contain at least one
node (empty subgraphs will be removed from its context). Every node can
belong to at most one subgraph.
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intConstant for bottom-up direction.static final intConstant for direction from left to right.SubgraphLayoutstatic final intConstant for direction from right to left.static final intConstant for top-down direction (default). -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNodes(NodeLayout[] nodes) Adds nodes to this subgraph.intgetNodes()Returns all the nodes belonging to this subgraph.booleanbooleanReturns true if this subgraph is visualized as a particular object on the graph.voidremoveNodes(NodeLayout[] nodes) Removes nodes from this subgraph.voidsetDirection(int direction) Sets the direction of this subgraph (does nothing in case of subgraphs that don't depend on direction)Methods inherited from interface org.eclipse.zest.layouts.interfaces.EntityLayout
getItems, getLocation, getPredecessingEntities, getPreferredAspectRatio, getSize, getSuccessingEntities, isMovable, isResizable, setLocation, setSize
-
Field Details
-
TOP_DOWN
static final int TOP_DOWNConstant for top-down direction (default).- See Also:
-
BOTTOM_UP
static final int BOTTOM_UPConstant for bottom-up direction.- See Also:
-
LEFT_RIGHT
static final int LEFT_RIGHTConstant for direction from left to right.SubgraphLayout- See Also:
-
RIGHT_LEFT
static final int RIGHT_LEFTConstant for direction from right to left.- See Also:
-
-
Method Details
-
getNodes
NodeLayout[] getNodes()Returns all the nodes belonging to this subgraph. Replacing elements in the returned array does not affect this subgraph.- Returns:
- array of nodes
-
countNodes
int countNodes()- Returns:
- number of nodes pruned into this subgraph
-
addNodes
Adds nodes to this subgraph. If given nodes already belong to another subgraph, they are first removed from them.- Parameters:
nodes- array of nodes to add
-
removeNodes
Removes nodes from this subgraph.- Parameters:
nodes- array of nodes to remove
-
isGraphEntity
boolean isGraphEntity()Returns true if this subgraph is visualized as a particular object on the graph. If this method returns false, it means that this subgraph will not be visible so all methods related to location, size and direction should be ignored.- Returns:
- whether or not this subgraph is a graph entity that should be laid out.
-
isDirectionDependant
boolean isDirectionDependant()- Returns:
- true if this subgraph is visualized differently depending on direction
-
setDirection
void setDirection(int direction) Sets the direction of this subgraph (does nothing in case of subgraphs that don't depend on direction)- Parameters:
direction- one of constants:TOP_DOWN,BOTTOM_UP,LEFT_RIGHT,RIGHT_LEFT
-