Package org.eclipse.zest.core.widgets

# Class GraphContainer

java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Item
org.eclipse.zest.core.widgets.GraphItem
org.eclipse.zest.core.widgets.GraphNode
org.eclipse.zest.core.widgets.GraphContainer

All Implemented Interfaces:
  `IContainer`, `IContainer2`

public class GraphContainer extends GraphNode implements IContainer2
A Container than can be added to a Graph. Nodes can be added to this container. The container supports collapsing and expanding and has the same properties as the nodes. Containers cannot have custom figures.

## Field Summary

Fields
Modifier and Type
Field
Description
`org.eclipse.zest.core.widgets.internal.ZestRootLayer`
`zestLayer`

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

`graph, HIGHLIGHT_NONE, HIGHLIGHT_ON, highlighted, internalNode, nodeFigure, parent, size`

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

`CONNECTION, CONTAINER, GRAPH, NODE`

## Constructor Summary

Constructors
Constructor
Description
`GraphContainer(IContainer graph, int style)`
Creates a new GraphContainer.
`GraphContainer(IContainer graph, int style, String text)`
Deprecated, for removal: This API element is subject to removal in a future version.
Since Zest 2.0, use `GraphContainer(Graph, int)`, `GraphNode.setText(String)`
`GraphContainer(IContainer graph, int style, String text, Image image)`
Deprecated, for removal: This API element is subject to removal in a future version.
Since Zest 2.0, use `GraphContainer(Graph, int)`, `GraphNode.setText(String)`, and `GraphNode.setImage(Image)`

## Method Summary

Modifier and Type
Method
Description
`void`
`addNode(GraphNode node)`
`void`
`addSubgraphFigure(org.eclipse.draw2d.IFigure figure)`
`void`
`applyLayout()`
Re-applies the current layout algorithm
`void`
`close(boolean animate)`
Close this node.
`List<GraphConnection>`
`getConnections()`
Returns list of connections laying inside this container.
`Graph`
`getGraph()`
Gets the graph that this container has been added to.
`protected org.eclipse.draw2d.geometry.Rectangle`
`getHideContainerBounds()`
`Widget`
`getItem()`
`int`
`getItemType()`
Gets the graph item type.
`LayoutAlgorithm`
`getLayoutAlgorithm()`
`DisplayIndependentRectangle`
`getLayoutBounds()`
`final LayoutContext`
`getLayoutContext()`
`org.eclipse.draw2d.IFigure`
`getNodeFigure()`
Returns the figure of the whole node.
`List<GraphNode>`
`getNodes()`
`double`
`getScale()`
Get the scale for this container.
`protected void`
`initFigure()`
NON API MEMBERS
`void`
`open(boolean animate)`
Open the container.
`protected void`
`refreshLocation()`
`void`
`setCustomFigure(org.eclipse.draw2d.IFigure nodeFigure)`
Custom figures cannot be set on a GraphContainer.
`void`
`setLayoutAlgorithm(LayoutAlgorithm algorithm, boolean applyLayout)`
Sets the LayoutAlgorithm for this container and optionally applies it.
`void`
`setScale(double scale)`
Set the scale for this container.
`protected void`
`updateFigureForModel(org.eclipse.draw2d.IFigure currentFigure)`

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

`cacheLabel, createFigureForModel, dispose, fishEye, getBackgroundColor, getBackgroundHighlightColor, getBorderColor, getBorderHighlightColor, getBorderWidth, getFont, getForegroundColor, getForegroundHighlightColor, getGraphModel, getHideNodeHelper, getHighlightColor, getLayout, getLayoutEntity, getLocation, getModelFigure, getNodeStyle, getSize, getSourceConnections, getStyle, getTargetConnections, getTooltip, highlight, initModel, isDisposed, isHighlighted, isSelected, isSizeFixed, isVisible, setBackgroundColor, setBackgroundHighlightColor, setBorderColor, setBorderHighlightColor, setBorderWidth, setCacheLabel, setFont, setForegroundColor, setForegroundHighlightColor, setHideNodeHelper, setHighlightColor, setImage, setLocation, setModelFigure, setNodeStyle, setSize, setText, setTooltip, setVisible, toString, unhighlight`

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

`checkStyle`

### Methods inherited from class org.eclipse.swt.widgets.Item

`checkSubclass, getImage, getText`

### Methods inherited from class org.eclipse.swt.widgets.Widget

`addDisposeListener, addListener, addTypedListener, checkWidget, getData, getData, getDisplay, getListeners, getTypedListeners, isAutoDirection, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setData`

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

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

## Field Details

### zestLayer

public org.eclipse.zest.core.widgets.internal.ZestRootLayer zestLayer

## Constructor Details

### GraphContainer

public GraphContainer(IContainer graph, int style)
Creates a new GraphContainer. A GraphContainer may contain nodes, and has many of the same properties as a graph node.

Parameters:
  `graph` - The graph that the container is being added to
  `style` -

### GraphContainer

@Deprecated(since="1.12", forRemoval=true) public GraphContainer(IContainer graph, int style, String text)
Deprecated, for removal: This API element is subject to removal in a future version.
Since Zest 2.0, use `GraphContainer(Graph, int)`, `GraphNode.setText(String)`

### GraphContainer

@Deprecated(since="1.12", forRemoval=true) public GraphContainer(IContainer graph, int style, String text, Image image)
Deprecated, for removal: This API element is subject to removal in a future version.
Since Zest 2.0, use `GraphContainer(Graph, int)`, `GraphNode.setText(String)`, and `GraphNode.setImage(Image)`

## Method Details

### setCustomFigure

public void setCustomFigure(org.eclipse.draw2d.IFigure nodeFigure)
Custom figures cannot be set on a GraphContainer.

### getNodeFigure

public org.eclipse.draw2d.IFigure getNodeFigure()
Description copied from class: `GraphNode`
Returns the figure of the whole node.

Overrides:
  `getNodeFigure` in class `GraphNode`
Returns:
  nodeFigure

### close

public void close(boolean animate)
Close this node.

Parameters:
  `animate` -

### open

public void open(boolean animate)
Open the container. This opens the graph container to show the nodes within and update the twistie

### getGraph

public Graph getGraph()
Gets the graph that this container has been added to.

Specified by:
  `getGraph` in interface `IContainer`

### getItem

public Widget getItem()

Specified by:
  `getItem` in interface `IContainer2`

### getItemType

public int getItemType()
Description copied from class: `GraphItem`
Gets the graph item type. The item type is one of: GRAPH, NODE or CONNECTION

Specified by:
  `getItemType` in interface `IContainer`
Overrides:
  `getItemType` in class `GraphNode`

### setLayoutAlgorithm

public void setLayoutAlgorithm(LayoutAlgorithm algorithm, boolean applyLayout)
Description copied from interface: `IContainer`
Sets the LayoutAlgorithm for this container and optionally applies it.

Specified by:
  `setLayoutAlgorithm` in interface `IContainer`
Parameters:
  `algorithm` - The layout algorithm to set
  `applyLayout` -

### getLayoutAlgorithm

public LayoutAlgorithm getLayoutAlgorithm()

Since:
  1.10

### getLayoutContext

public final LayoutContext getLayoutContext()

Specified by:
  `getLayoutContext` in interface `IContainer2`
@noreference
  This method is not intended to be referenced by clients.

### getLayoutBounds

public DisplayIndependentRectangle getLayoutBounds()

Specified by:
  `getLayoutBounds` in interface `IContainer2`
Since:
  1.12

### applyLayout

public void applyLayout()
Description copied from interface: `IContainer`
Re-applies the current layout algorithm

Specified by:
  `applyLayout` in interface `IContainer`

### getScale

public double getScale()
Get the scale for this container. This is the scale applied to the children contained within

### setScale

public void setScale(double scale)
Set the scale for this container. This is the scale applied to the children contained within.

Parameters:
  `scale` -

### getHideContainerBounds

protected org.eclipse.draw2d.geometry.Rectangle getHideContainerBounds()

Overrides:
  `getHideContainerBounds` in class `GraphNode`

### initFigure

protected void initFigure()
NON API MEMBERS

Overrides:
  `initFigure` in class `GraphNode`

### updateFigureForModel

protected void updateFigureForModel(org.eclipse.draw2d.IFigure currentFigure)

Overrides:
  `updateFigureForModel` in class `GraphNode`

### refreshLocation

protected void refreshLocation()

Overrides:
  `refreshLocation` in class `GraphNode`

### addSubgraphFigure

public void addSubgraphFigure(org.eclipse.draw2d.IFigure figure)

Specified by:
  `addSubgraphFigure` in interface `IContainer2`
Parameters:
  `figure` -
@noreference
  This method is not intended to be referenced by clients.

### addNode

public void addNode(GraphNode node)

Specified by:
  `addNode` in interface `IContainer2`
Parameters:
  `node` -
@noreference
  This method is not intended to be referenced by clients.

### getNodes

public List<GraphNode> getNodes()

Specified by:
  `getNodes` in interface `IContainer`

### getConnections

public List<GraphConnection> getConnections()
Description copied from interface: `IContainer2`
Returns list of connections laying inside this container. Only connections which both source and target nodes lay directly in this container are returned.

Specified by:
  `getConnections` in interface `IContainer2`
Since:
  1.12