Package org.eclipse.zest.layouts.interfaces

# Interface SubgraphLayout

All Superinterfaces:
  `EntityLayout`

All Known Implementing Classes:
  `DefaultSubgraph`, `FigureSubgraph`, `LabelSubgraph`, `TriangleSubgraph`

public interface SubgraphLayout extends EntityLayout
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

Fields
Modifier and Type
Field
Description
`static final int`
`BOTTOM_UP`
Constant for bottom-up direction.
`static final int`
`LEFT_RIGHT`
Constant for direction from left to right.SubgraphLayout
`static final int`
`RIGHT_LEFT`
Constant for direction from right to left.
`static final int`
`TOP_DOWN`
Constant for top-down direction (default).

## Method Summary

Modifier and Type
Method
Description
`void`
`addNodes(NodeLayout[] nodes)`
Adds nodes to this subgraph.
`int`
`countNodes()`
`NodeLayout[]`
`getNodes()`
Returns all the nodes belonging to this subgraph.
`boolean`
`isDirectionDependant()`
`boolean`
`isGraphEntity()`
Returns true if this subgraph is visualized as a particular object on the graph.
`void`
`removeNodes(NodeLayout[] nodes)`
Removes nodes from this subgraph.
`void`
`setDirection(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_DOWN
Constant for top-down direction (default).

See Also:
  - Constant Field Values

### BOTTOM_UP

static final int BOTTOM_UP
Constant for bottom-up direction.

See Also:
  - Constant Field Values

### LEFT_RIGHT

static final int LEFT_RIGHT
Constant for direction from left to right.SubgraphLayout

See Also:
  - Constant Field Values

### RIGHT_LEFT

static final int RIGHT_LEFT
Constant for direction from right to left.

See Also:
  - Constant Field Values

## 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

void addNodes(NodeLayout[] nodes)
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

void removeNodes(NodeLayout[] nodes)
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`