Package ghidra.service.graph

# Interface GraphDisplay

public interface GraphDisplay
Interface for objects that display (or consume) graphs. Normally, a graph display represents a visual component for displaying and interacting with a graph. Some implementation may not be a visual component, but instead consumes/processes the graph (i.e. graph exporter). In this case, there is no interactive element and once the graph has been set on the display, it is closed.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addAction(DockingActionIf action)`
  Adds the action to the graph display.
  `void`
  `clear()`
  Clears all graph vertices and edges from this graph display
  `void`
  `close()`
  Closes this graph display window.
  `Collection<DockingActionIf>`
  `getActions()`
  Gets all actions that have been added to this graph display.
  `AttributedVertex`
  `getFocusedVertex()`
  Returns the currently focused vertex or null if no vertex is focused
  `AttributedGraph`
  `getGraph()`
  Returns the graph for this display
  `String`
  `getGraphTitle()`
  Returns the title of the current graph
  `Set<AttributedVertex>`
  `getSelectedVertices()`
  Returns a set of vertex ids for all the currently selected vertices
  `void`
  `selectVertices(Set<AttributedVertex> vertexSet, EventTrigger eventTrigger)`
  Tells the graph display window to select the vertices with the given ids
  `void`
  `setFocusedVertex(AttributedVertex vertex, EventTrigger eventTrigger)`
  Tells the graph display window to focus the vertex with the given id
  `void`
  `setGraph(AttributedGraph graph, GraphDisplayOptions options, String title, boolean append, TaskMonitor monitor)`
  Sets the graph to be displayed or consumed by this graph display
  `default void`
  `setGraph(AttributedGraph graph, String title, boolean append, TaskMonitor monitor)`
  Deprecated.
  You should now use the form that takes in a `GraphDisplayOptions`
  `void`
  `setGraphDisplayListener(GraphDisplayListener listener)`
  Sets a `GraphDisplayListener` to be notified when the user changes the vertex focus or selects one or more nodes in a graph window
  `void`
  `updateVertexName(AttributedVertex vertex, String newName)`
  Updates a vertex to a new name

- ## Method Details

  - ### setGraphDisplayListener

    void setGraphDisplayListener(GraphDisplayListener listener)
    Sets a `GraphDisplayListener` to be notified when the user changes the vertex focus or selects one or more nodes in a graph window
    Parameters:
      `listener` - the listener to be notified

  - ### setFocusedVertex

    void setFocusedVertex(AttributedVertex vertex, EventTrigger eventTrigger)
    Tells the graph display window to focus the vertex with the given id
    Parameters:
      `vertex` - the vertex to focus
      `eventTrigger` - Provides a hint to the GraphDisplay as to why we are updating the graph location so that the GraphDisplay can decide if it should send out a notification via the `GraphDisplayListener.locationFocusChanged(AttributedVertex)`. For example, if we are updating the location due to an event from the main application, we don't want to notify the application the graph changed to avoid event cycles. See `EventTrigger` for more information.

  - ### getGraph

    AttributedGraph getGraph()
    Returns the graph for this display
    Returns:
      the graph for this display

  - ### getFocusedVertex

    AttributedVertex getFocusedVertex()
    Returns the currently focused vertex or null if no vertex is focused
    Returns:
      the currently focused vertex or null if no vertex is focused

  - ### selectVertices

    void selectVertices(Set<AttributedVertex> vertexSet, EventTrigger eventTrigger)
    Tells the graph display window to select the vertices with the given ids
    Parameters:
      `vertexSet` - the set of vertices to select
      `eventTrigger` - Provides a hint to the GraphDisplay as to why we are updating the graph location so that the GraphDisplay can decide if it should send out a notification via the `GraphDisplayListener.selectionChanged(Set)`. For example, if we are updating the location due to an event from the main application, we don't want to notify the application the graph changed to avoid event cycles. See `EventTrigger` for more information.

  - ### getSelectedVertices

    Set<AttributedVertex> getSelectedVertices()
    Returns a set of vertex ids for all the currently selected vertices
    Returns:
      a set of vertex ids for all the currently selected vertices

  - ### close

    void close()
    Closes this graph display window.

  - ### setGraph

    @Deprecated default void setGraph(AttributedGraph graph, String title, boolean append, TaskMonitor monitor) throws CancelledException
    Deprecated.
    You should now use the form that takes in a `GraphDisplayOptions`
    Sets the graph to be displayed or consumed by this graph display
    Parameters:
      `graph` - the graph to display or consume
      `title` - a title for the graph
      `append` - if true, append the new graph to any existing graph
      `monitor` - a `TaskMonitor` which can be used to cancel the graphing operation
    Throws:
      `CancelledException` - thrown if the graphing operation was cancelled

  - ### setGraph

    void setGraph(AttributedGraph graph, GraphDisplayOptions options, String title, boolean append, TaskMonitor monitor) throws CancelledException
    Sets the graph to be displayed or consumed by this graph display
    Parameters:
      `graph` - the graph to display or consume
      `options` - `GraphDisplayOptions` for configuring how the display will render vertices and edges based on there vertex type and edge type respectively.
      `title` - a title for the graph
      `append` - if true, append the new graph to any existing graph
      `monitor` - a `TaskMonitor` which can be used to cancel the graphing operation
    Throws:
      `CancelledException` - thrown if the graphing operation was cancelled

  - ### clear

    void clear()
    Clears all graph vertices and edges from this graph display

  - ### updateVertexName

    void updateVertexName(AttributedVertex vertex, String newName)
    Updates a vertex to a new name
    Parameters:
      `vertex` - the vertex to rename
      `newName` - the new name for the vertex

  - ### getGraphTitle

    String getGraphTitle()
    Returns the title of the current graph
    Returns:
      the title of the current graph

  - ### addAction

    void addAction(DockingActionIf action)
    Adds the action to the graph display. Not all GraphDisplays support adding custom actions, so this may have no effect.
    Parameters:
      `action` - the action to add

  - ### getActions

    Collection<DockingActionIf> getActions()
    Gets all actions that have been added to this graph display. If this display does not support actions, then an empty collection will be returned.
    Returns:
      the actions