Package org.eclipse.zest.core.widgets

# Class FigureSubgraph

java.lang.Object
org.eclipse.zest.core.widgets.DefaultSubgraph
org.eclipse.zest.core.widgets.FigureSubgraph

All Implemented Interfaces:
  `EntityLayout`, `SubgraphLayout`

Direct Known Subclasses:
  `LabelSubgraph`, `TriangleSubgraph`

public abstract class FigureSubgraph extends DefaultSubgraph
A subgraph layout that represents a subgraph as a single figure. An entity representing subgraph is not resizable by layout algorithm unless proper methods are redefined in a subclass.

Since:
  1.14

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`protected class`
`FigureSubgraph.SubgraphFigrueListener`
Listens to changes in this subgraph's figure and fires proper event in its layout context.

## Nested classes/interfaces inherited from class org.eclipse.zest.core.widgets.DefaultSubgraph

`DefaultSubgraph.DefaultSubgraphFactory, DefaultSubgraph.LabelSubgraphFactory, DefaultSubgraph.PrunedSuccessorsSubgraphFactory, DefaultSubgraph.TriangleSubgraphFactory`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected IFigure`
`figure`

### Fields inherited from class org.eclipse.zest.core.widgets.DefaultSubgraph

`context, disposed, nodes`

### Fields inherited from interface org.eclipse.zest.layouts.interfaces.SubgraphLayout

`BOTTOM_UP, LEFT_RIGHT, RIGHT_LEFT, TOP_DOWN`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`FigureSubgraph(NodeLayout[] nodes, LayoutContext context)`

## Method Summary

Modifier and Type
Method
Description
`void`
`addNodes(NodeLayout[] nodes)`
Adds nodes to this subgraph.
`protected void`
`applyLayoutChanges()`
`protected abstract void`
`createFigure()`
Creates a figure for this subgraph and stores it in `figure`.
`protected void`
`dispose()`
`IFigure`
`getFigure()`
`DisplayIndependentPoint`
`getLocation()`
Returns a point laying in the center of this entity.
`EntityLayout[]`
`getPredecessingEntities()`
Returns all entities that are direct predecessors of this entity.
`DisplayIndependentDimension`
`getSize()`
`EntityLayout[]`
`getSuccessingEntities()`
Returns all entities that are direct successors of this entity.
`boolean`
`isGraphEntity()`
Returns true if this subgraph is visualized as a particular object on the graph.
`boolean`
`isMovable()`
`protected void`
`refreshLocation()`
Makes sure that value returned by `DefaultSubgraph.getLocation()` will be equal to current location of this subgraph.
`void`
`removeNodes(NodeLayout[] nodes)`
Removes nodes from this subgraph.
`void`
`setLocation(double x, double y)`
Sets the position of this entity.
`protected abstract void`
`updateFigure()`
Updates the figure stored in `figure` depending on current nodes contained in this subgraph.

### Methods inherited from class org.eclipse.zest.core.widgets.DefaultSubgraph

`countNodes, getItems, getNodes, getPreferredAspectRatio, isDirectionDependant, isResizable, refreshConnectionsVisibility, refreshSize, removeDisposedNodes, setDirection, setSize`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### figure

protected IFigure figure

## Constructor Details

### FigureSubgraph

protected FigureSubgraph(NodeLayout[] nodes, LayoutContext context)

## Method Details

### createFigure

protected abstract void createFigure()
Creates a figure for this subgraph and stores it in `figure`. This method may not be called right after creation of the subgraph but later when the figure is actually needed (lazy initialization).

### updateFigure

protected abstract void updateFigure()
Updates the figure stored in `figure` depending on current nodes contained in this subgraph. If this method creates a new instance of IFigure, it should remember to add a `FigureSubgraph.SubgraphFigrueListener` to it.

### getFigure

public IFigure getFigure()

### addNodes

public void addNodes(NodeLayout[] nodes)
Adds nodes to this subgraph. If given nodes already belong to another subgraph, they are first removed from them. All nodes added to this subgraph are moved to the center of the figure (so that collapsing and expanding animation looks cool).

Specified by:
  `addNodes` in interface `SubgraphLayout`
Overrides:
  `addNodes` in class `DefaultSubgraph`
Parameters:
  `nodes` - array of nodes to add

### removeNodes

public void removeNodes(NodeLayout[] nodes)
Description copied from interface: `SubgraphLayout`
Removes nodes from this subgraph.

Specified by:
  `removeNodes` in interface `SubgraphLayout`
Overrides:
  `removeNodes` in class `DefaultSubgraph`
Parameters:
  `nodes` - array of nodes to remove

### getSuccessingEntities

public EntityLayout[] getSuccessingEntities()
Description copied from interface: `EntityLayout`
Returns all entities that are direct successors of this entity. Successor entities of an unpruned node N are:

- all unpruned successor nodes of node N
- all subgraphs that are `GraphEntities` and contain at least one successor node of node N

Successor entities of a subgraph S that is a `GraphEntity` are:

- all unpruned nodes that are successor of at least one node from subgraph S
- all subgraphs that are `GraphEntities` and contain at least one node that is a successor of at least one node from subgraph S

For subgraphs that are not `GraphEntities` an empty array will be returned.
Entities connected with this node by a bidirectional connection are considered both successors and predecessors. Any subsequent changes to the returned array do not affect this node.

Specified by:
  `getSuccessingEntities` in interface `EntityLayout`
Overrides:
  `getSuccessingEntities` in class `DefaultSubgraph`
Returns:
  array of successors of this node

### getPredecessingEntities

public EntityLayout[] getPredecessingEntities()
Description copied from interface: `EntityLayout`
Returns all entities that are direct predecessors of this entity. Predecessor entities of an unpruned node A are:

- all unpruned predecessor nodes of node N
- all subgraphs that are `GraphEntities` and contain at least one predecessor node of node N

Successor entities of a subgraph S that is a `GraphEntity` are:

- all unpruned nodes that are predecessor of at least one node from subgraph S
- all subgraphs that are `GraphEntities` and contain at least one node that is a predecessor of at least one node from subgraph S

For subgraphs that are not `GraphEntities` an empty array will be returned.
Entities connected with this node by a bidirectional connection are considered both successors and predecessors. Any subsequent changes to the returned array do not affect this node.

Specified by:
  `getPredecessingEntities` in interface `EntityLayout`
Overrides:
  `getPredecessingEntities` in class `DefaultSubgraph`
Returns:
  array of predecessors of this node

### getSize

public DisplayIndependentDimension getSize()

Specified by:
  `getSize` in interface `EntityLayout`
Overrides:
  `getSize` in class `DefaultSubgraph`

### getLocation

public DisplayIndependentPoint getLocation()
Description copied from interface: `EntityLayout`
Returns a point laying in the center of this entity. Any subsequent changes to the returned point won't affect this node.

Specified by:
  `getLocation` in interface `EntityLayout`
Overrides:
  `getLocation` in class `DefaultSubgraph`
Returns:
  position of the center of this node

### setLocation

public void setLocation(double x, double y)
Description copied from interface: `EntityLayout`
Sets the position of this entity. The node will be moved so that it's center is located in the given point.

Specified by:
  `setLocation` in interface `EntityLayout`
Overrides:
  `setLocation` in class `DefaultSubgraph`
Parameters:
  `x` - the x-position
  `y` - the y-position

### refreshLocation

protected void refreshLocation()
Description copied from class: `DefaultSubgraph`
Makes sure that value returned by `DefaultSubgraph.getLocation()` will be equal to current location of this subgraph.

Overrides:
  `refreshLocation` in class `DefaultSubgraph`

### isGraphEntity

public boolean isGraphEntity()
Description copied from interface: `SubgraphLayout`
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.

Specified by:
  `isGraphEntity` in interface `SubgraphLayout`
Overrides:
  `isGraphEntity` in class `DefaultSubgraph`
Returns:
  whether or not this subgraph is a graph entity that should be laid out.

### isMovable

public boolean isMovable()

Specified by:
  `isMovable` in interface `EntityLayout`
Overrides:
  `isMovable` in class `DefaultSubgraph`

### dispose

protected void dispose()

Overrides:
  `dispose` in class `DefaultSubgraph`

### applyLayoutChanges

protected void applyLayoutChanges()

Overrides:
  `applyLayoutChanges` in class `DefaultSubgraph`