org.eclipse.gef4.zest.core.widgets

## Class GraphContainer

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

All Implemented Interfaces:
  IContainer

    public class GraphContainer
    extends GraphNode
    implements IContainer

A Container that 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 inherited from class org.eclipse.gef4.zest.core.widgets.GraphNode

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

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

`CONNECTION, CONTAINER, GRAPH, NODE`

### Constructor Summary

Constructors
Constructor and Description
`GraphContainer(GraphContainer container, int style)` Deprecated. Since Zest 2.0, use `GraphContainer(GraphWidget, int)` .
`GraphContainer(GraphWidget graph, int style)` Creates a new GraphContainer.
`GraphContainer(GraphWidget graph, int style, java.lang.String text, Image image)` Deprecated. Since Zest 2.0, use `GraphContainer(GraphWidget, int)` , `GraphNode.setText(String)`, and `GraphNode.setImage(Image)`

### Method Summary

Methods
`void` `addNode(GraphNode node)`
`void` `addSubgraphFigure(org.eclipse.draw2d.IFigure figure)`
`void` `applyLayout()`
`void` `close(boolean animate)` Close this node.
`java.util.List<GraphConnection>` `getConnections()` Returns list of connections laying inside this container.
`GraphWidget` `getGraph()` Gets the graph that this container has been added to.
`Widget` `getItem()`
`int` `getItemType()` Gets the graph item type.
`org.eclipse.gef4.layout.LayoutAlgorithm` `getLayoutAlgorithm()`
`org.eclipse.gef4.geometry.planar.Rectangle` `getLayoutBounds()`
`org.eclipse.gef4.zest.core.widgets.InternalLayoutContext` `getLayoutContext()`
`java.util.List<GraphNode>` `getNodes()`
`double` `getScale()` Get the scale for this container.
`protected void` `initFigure()` NON API MEMBERS
`void` `open(boolean animate)` Open the container.
`void` `setCustomFigure(org.eclipse.draw2d.IFigure nodeFigure)` Custom figures cannot be set on a GraphContainer.
`void` `setLayoutAlgorithm(org.eclipse.gef4.layout.LayoutAlgorithm algorithm, boolean applyLayout)`
`void` `setScale(double scale)` Set the scale for this container.
`protected void` `updateFigureForModel(org.eclipse.draw2d.IFigure currentFigure)`

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

`cacheLabel, createFigureForModel, dispose, fishEye, getBackgroundColor, getBorderColor, getBorderHighlightColor, getBorderWidth, getFigure, getFont, getForegroundColor, getGraphWidget, getHighlightColor, getLayout, getLocation, getNodeStyle, getSize, getSourceConnections, getStyle, getTargetConnections, getTooltip, highlight, initModel, isDisposed, isSelected, isSizeFixed, isVisible, setBackgroundColor, setBorderColor, setBorderHighlightColor, setBorderWidth, setCacheLabel, setFont, setForegroundColor, setHighlightColor, setImage, setLocation, setNodeStyle, setSize, setText, setTooltip, setVisible, toString, unhighlight`

### Methods inherited from class org.eclipse.gef4.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, checkWidget, getData, getData, getDisplay, getListeners, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData`

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

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

### Constructor Detail

#### GraphContainer

    public GraphContainer(GraphWidget 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` -
Since:
  2.0

#### GraphContainer

    public GraphContainer(GraphWidget graph,
                  int style,
                  java.lang.String text,
                  Image image)

Deprecated. Since Zest 2.0, use `GraphContainer(GraphWidget, int)` , `GraphNode.setText(String)`, and `GraphNode.setImage(Image)`

#### GraphContainer

    public GraphContainer(GraphContainer container,
                  int style)

Deprecated. Since Zest 2.0, use `GraphContainer(GraphWidget, int)` .

### Method Detail

#### setCustomFigure

    public void setCustomFigure(org.eclipse.draw2d.IFigure nodeFigure)

Custom figures cannot be set on a GraphContainer.

#### 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 GraphWidget 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 `IContainer`
Since:
  2.0

#### 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(org.eclipse.gef4.layout.LayoutAlgorithm algorithm,
                          boolean applyLayout)

Specified by:
  `setLayoutAlgorithm` in interface `IContainer`
Since:
  2.0

#### getLayoutContext

    public org.eclipse.gef4.zest.core.widgets.InternalLayoutContext getLayoutContext()

Specified by:
  `getLayoutContext` in interface `IContainer`
Returns:

#### getLayoutBounds

    public org.eclipse.gef4.geometry.planar.Rectangle getLayoutBounds()

Specified by:
  `getLayoutBounds` in interface `IContainer`
Returns:
Since:
  2.0

#### applyLayout

    public void applyLayout()

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

Returns:

#### setScale

    public void setScale(double scale)

Set the scale for this container. This is the scale applied to the children contained within.

Parameters:
  `scale` -

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

#### addSubgraphFigure

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

Specified by:
  `addSubgraphFigure` in interface `IContainer`

#### addNode

    public void addNode(GraphNode node)

Specified by:
  `addNode` in interface `IContainer`

#### getNodes

    public java.util.List<GraphNode> getNodes()

Specified by:
  `getNodes` in interface `IContainer`

#### getConnections

    public java.util.List<GraphConnection> getConnections()

Description copied from interface: `IContainer`
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 `IContainer`
Returns:
Since:
  2.0

#### getLayoutAlgorithm

    public org.eclipse.gef4.layout.LayoutAlgorithm getLayoutAlgorithm()

Since:
  2.0