org.eclipse.viatra.addon.viewers.runtime.zest.sources

## Class ZestContentProvider

- java.lang.Object
- - org.eclipse.viatra.addon.viewers.runtime.model.listeners.AbstractViewerStateListener
  - - org.eclipse.viatra.addon.viewers.runtime.zest.sources.ZestContentProvider

- All Implemented Interfaces:
    org.eclipse.jface.viewers.IContentProvider, IViewerStateListener, IGraphEdgeContentProvider, INestedGraphContentProvider

      public class ZestContentProvider
      extends AbstractViewerStateListener
      implements IGraphEdgeContentProvider

  Content provider for Zest graphs. The implementation is more performant than `ZestContentWithIsolatedNodesProvider`, but does not support displaying isolated nodes.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `displayContainment`
    `protected ViewerState` | `state`
    `protected ModifiableZestContentViewer` | `viewer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ZestContentProvider()`
    `ZestContentProvider(boolean displayContainment)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `containmentAppeared(Containment containment)`
    `void` | `containmentDisappeared(Containment containment)`
    `void` | `dispose()`
    `void` | `edgeAppeared(Edge edge)`
    `void` | `edgeDisappeared(Edge edge)`
    `java.lang.Object[]` | `getEdges()` Returns all content elements which represent edges.
    `java.lang.Object[]` | `getNestedGraphNodes(java.lang.Object node)` Returns the content elements representing the nodes within the graph that is nested inside the node represented by the given content element.
    `java.lang.Object[]` | `getNodes()` Returns all content elements which represent nodes on the first level of the graph.
    `java.lang.Object` | `getSource(java.lang.Object edge)`
    `java.lang.Object` | `getTarget(java.lang.Object edge)`
    `boolean` | `hasNestedGraph(java.lang.Object node)` Determines whether the node represented by the given content element has nested children.
    `void` | `inputChanged(org.eclipse.jface.viewers.Viewer viewer, java.lang.Object oldInput, java.lang.Object newInput)`
    `void` | `itemAppeared(Item item)`
    `void` | `itemDisappeared(Item item)`

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

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

- - ### Field Detail

    - #### viewer

          protected ModifiableZestContentViewer viewer

    - #### state

          protected ViewerState state

    - #### displayContainment

          protected boolean displayContainment

  - ### Constructor Detail

    - #### ZestContentProvider

          public ZestContentProvider()

    - #### ZestContentProvider

          public ZestContentProvider(boolean displayContainment)

  - ### Method Detail

    - #### getNodes

          public java.lang.Object[] getNodes()

      Description copied from interface: `IGraphEdgeContentProvider`
      Returns all content elements which represent nodes on the first level of the graph. If no nodes exist, either an empty array or `null` is returned.
      Specified by:
        `getNodes` in interface `IGraphEdgeContentProvider`
      Specified by:
        `getNodes` in interface `INestedGraphContentProvider`
      Returns:
        All content elements which represent nodes on the first level of the graph.

    - #### getNestedGraphNodes

          public java.lang.Object[] getNestedGraphNodes(java.lang.Object node)

      Description copied from interface: `INestedGraphContentProvider`
      Returns the content elements representing the nodes within the graph that is nested inside the node represented by the given content element. If the node does not contain a nested graph, either an empty array or `null` is returned.
      Specified by:
        `getNestedGraphNodes` in interface `INestedGraphContentProvider`
      Parameters:
        `node` - A content element that represents a node.
      Returns:
        The content elements representing the nodes within the graph that is nested inside the node represented by the given content element.

    - #### hasNestedGraph

          public boolean hasNestedGraph(java.lang.Object node)

      Description copied from interface: `INestedGraphContentProvider`
      Determines whether the node represented by the given content element has nested children.
      Specified by:
        `hasNestedGraph` in interface `INestedGraphContentProvider`
      Parameters:
        `node` - A content element that represents a node, according to the `INestedGraphContentProvider.getNodes()` method.
      Returns:
        `true` when the node represented by the given content element has nested children, otherwise `false`.

    - #### getEdges

          public java.lang.Object[] getEdges()

      Description copied from interface: `IGraphEdgeContentProvider`
      Returns all content elements which represent edges.
      Specified by:
        `getEdges` in interface `IGraphEdgeContentProvider`
      Returns:

    - #### getSource

          public java.lang.Object getSource(java.lang.Object edge)

      Specified by:
        `getSource` in interface `IGraphEdgeContentProvider`

    - #### getTarget

          public java.lang.Object getTarget(java.lang.Object edge)

      Specified by:
        `getTarget` in interface `IGraphEdgeContentProvider`

    - #### inputChanged

          public void inputChanged(org.eclipse.jface.viewers.Viewer viewer,
                                   java.lang.Object oldInput,
                                   java.lang.Object newInput)

      Specified by:
        `inputChanged` in interface `org.eclipse.jface.viewers.IContentProvider`

    - #### itemAppeared

          public void itemAppeared(Item item)

      Specified by:
        `itemAppeared` in interface `IViewerStateListener`
      Overrides:
        `itemAppeared` in class `AbstractViewerStateListener`

    - #### itemDisappeared

          public void itemDisappeared(Item item)

      Specified by:
        `itemDisappeared` in interface `IViewerStateListener`
      Overrides:
        `itemDisappeared` in class `AbstractViewerStateListener`

    - #### edgeAppeared

          public void edgeAppeared(Edge edge)

      Specified by:
        `edgeAppeared` in interface `IViewerStateListener`
      Overrides:
        `edgeAppeared` in class `AbstractViewerStateListener`

    - #### edgeDisappeared

          public void edgeDisappeared(Edge edge)

      Specified by:
        `edgeDisappeared` in interface `IViewerStateListener`
      Overrides:
        `edgeDisappeared` in class `AbstractViewerStateListener`

    - #### containmentAppeared

          public void containmentAppeared(Containment containment)

      Specified by:
        `containmentAppeared` in interface `IViewerStateListener`
      Overrides:
        `containmentAppeared` in class `AbstractViewerStateListener`

    - #### containmentDisappeared

          public void containmentDisappeared(Containment containment)

      Specified by:
        `containmentDisappeared` in interface `IViewerStateListener`
      Overrides:
        `containmentDisappeared` in class `AbstractViewerStateListener`

    - #### dispose

          public void dispose()

      Specified by:
        `dispose` in interface `org.eclipse.jface.viewers.IContentProvider`