Package ghidra.graph.viewer

# Class VisualGraphView<V extends VisualVertex,E extends VisualEdge<V>,G extends VisualGraph<V,E>>

java.lang.Object
ghidra.graph.viewer.VisualGraphView<V,E,G>

Type Parameters:
  `V` - the vertex type
  `E` - the edge type
  `G` - the graph type

public class VisualGraphView<V extends VisualVertex,E extends VisualEdge<V>,G extends VisualGraph<V,E>> extends Object
A view object, where 'view' is used in the sense of the Model-View-Controller (MVC) pattern. This class will contain all UI widgets need to display and interact with a graph.

Implementation Note:

1. The graph of this component can be null, changing to non-null values over the lifetime of this view. This allows this view to be installed in a UI component, with the contents changing as needed.
2. When the graph is `set`, the view portion of the class is recreated.
3. At any given point in time there may not be a `graphComponent`. This means that this class must maintain settings state that it will apply when the component is created. This state is atypical and makes this class a bit harder to understand.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected GraphComponent<V,E,G>`
  `graphComponent`
  `protected LayoutProvider<V,E,G>`
  `layoutProvider`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VisualGraphView()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addSatelliteListener(GraphSatelliteListener l)`
  `boolean`
  `arePopupsEnabled()`
  `boolean`
  `arePopupsVisible()`
  `void`
  `cleanup()`
  Effectively clears this display.
  `protected void`
  `disposeViewer()`
  `GraphPerspectiveInfo<V,E>`
  `generateGraphPerspective()`
  `V`
  `getFocusedVertex()`
  `GraphComponent<V,E,G>`
  `getGraphComponent()`
  `LayoutProvider<V,E,G>`
  `getLayoutProvider()`
  `GraphViewer<V,E>`
  `getPrimaryGraphViewer()`
  Returns the primary viewer of the graph (as opposed to the satellite viewer).
  `GraphComponent.SatellitePosition`
  `getSatellitePosition()`
  `SatelliteGraphViewer<V,E>`
  `getSatelliteViewer()`
  `Set<V>`
  `getSelectedVertices()`
  `JComponent`
  `getUndockedSatelliteComponent()`
  `PathHighlightMode`
  `getVertexFocusPathHighlightMode()`
  `PathHighlightMode`
  `getVertexHoverPathHighlightMode()`
  `Point`
  `getVertexPointInViewSpace(V v)`
  `JComponent`
  `getViewComponent()`
  `VisualGraphViewUpdater<V,E>`
  `getViewUpdater()`
  `G`
  `getVisualGraph()`
  `protected <T> T`
  `getWithBusyCursor(Supplier<T> s)`
  `protected void`
  `installGraphViewer()`
  `boolean`
  `isSatelliteComponent(Component c)`
  `boolean`
  `isSatelliteDocked()`
  Returns whether the satellite intended to be docked.
  `boolean`
  `isSatelliteVisible()`
  Returns whether the satellite intended to be visible.
  `boolean`
  `isScaledPastInteractionThreshold()`
  `protected void`
  `maybeTwinkleVertex(V twinkleVertex, boolean doTwinkle)`
  `void`
  `optionsChanged()`
  Called when the options used by this graph view have changed
  `protected void`
  `removeSatellite()`
  `void`
  `repaint()`
  `void`
  `requestFocus()`
  `protected void`
  `setContent(Component c)`
  `void`
  `setGraph(G graph)`
  `protected void`
  `setGraphComponent(GraphComponent<V,E,G> newComponent)`
  `void`
  `setGraphPerspective(GraphPerspectiveInfo<V,E> newPerspective)`
  Sets the perspective for this view
  `void`
  `setLayoutProvider(LayoutProvider<V,E,G> newLayoutProvider)`
  Sets the given layout provider, but does not actually perform a layout.
  `void`
  `setPopupsVisible(boolean visible)`
  `void`
  `setSatelliteDocked(boolean docked)`
  `void`
  `setSatellitePosition(GraphComponent.SatellitePosition position)`
  `void`
  `setSatelliteVisible(boolean visible)`
  `protected void`
  `setSouthComponent(JComponent component)`
  `void`
  `setStatusMessage(String message)`
  Sets a message to be painted on the viewer.
  `void`
  `setTooltipProvider(VertexTooltipProvider<V,E> provider)`
  `void`
  `setVertexClickListener(VertexClickListener<V,E> l)`
  Sets a listener that allows clients to be notified of vertex double-clicks.
  `void`
  `setVertexFocusListener(VertexFocusListener<V> l)`
  `void`
  `setVertexFocusPathHighlightMode(PathHighlightMode mode)`
  `void`
  `setVertexHoverPathHighlightMode(PathHighlightMode mode)`
  `void`
  `showErrorView(String errorMessage)`
  `MouseEvent`
  `translateMouseEventFromVertexToViewSpace(V v, MouseEvent e)`
  `Point`
  `translatePointFromVertexToViewSpace(V v, Point p)`
  `Rectangle`
  `translateRectangleFromVertexToViewSpace(V v, Rectangle r)`
  `void`
  `zoomInGraph()`
  `void`
  `zoomOutGraph()`
  `void`
  `zoomToVertex(V v)`
  `void`
  `zoomToWindow()`

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

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

- ## Field Details

  - ### graphComponent

    protected GraphComponent<V extends VisualVertex,E extends VisualEdge<V>,G extends VisualGraph<V,E>> graphComponent

  - ### layoutProvider

    protected LayoutProvider<V extends VisualVertex,E extends VisualEdge<V>,G extends VisualGraph<V,E>> layoutProvider

- ## Constructor Details

  - ### VisualGraphView

    public VisualGraphView()

- ## Method Details

  - ### getViewComponent

    public JComponent getViewComponent()

  - ### setSouthComponent

    protected void setSouthComponent(JComponent component)

  - ### removeSatellite

    protected void removeSatellite()

  - ### optionsChanged

    public void optionsChanged()
    Called when the options used by this graph view have changed

  - ### setLayoutProvider

    public void setLayoutProvider(LayoutProvider<V,E,G> newLayoutProvider)
    Sets the given layout provider, but does not actually perform a layout.
    Parameters:
      `newLayoutProvider` - the new provider

  - ### setGraph

    public void setGraph(G graph)

  - ### addSatelliteListener

    public void addSatelliteListener(GraphSatelliteListener l)

  - ### setVertexFocusListener

    public void setVertexFocusListener(VertexFocusListener<V> l)

  - ### setVertexClickListener

    public void setVertexClickListener(VertexClickListener<V,E> l)
    Sets a listener that allows clients to be notified of vertex double-clicks. Normal mouse processing is handled by the `VisualGraphMousePlugin` class. This is a convenience method so that clients do not have to deal with the mouse plugin.
    Parameters:
      `l` - the listener

  - ### installGraphViewer

    protected void installGraphViewer()

  - ### setGraphComponent

    protected void setGraphComponent(GraphComponent<V,E,G> newComponent)

  - ### setContent

    protected void setContent(Component c)

  - ### getWithBusyCursor

    protected <T> T getWithBusyCursor(Supplier<T> s)

  - ### getVisualGraph

    public G getVisualGraph()

  - ### getPrimaryGraphViewer

    public GraphViewer<V,E> getPrimaryGraphViewer()
    Returns the primary viewer of the graph (as opposed to the satellite viewer). The viewer returned is responsible for maintaining view information for a given graph.
    Returns:
      the primary viewer

  - ### getSatelliteViewer

    public SatelliteGraphViewer<V,E> getSatelliteViewer()

  - ### setGraphPerspective

    public void setGraphPerspective(GraphPerspectiveInfo<V,E> newPerspective)
    Sets the perspective for this view
    Parameters:
      `newPerspective` - the new perspective

  - ### generateGraphPerspective

    public GraphPerspectiveInfo<V,E> generateGraphPerspective()

  - ### showErrorView

    public void showErrorView(String errorMessage)

  - ### setStatusMessage

    public void setStatusMessage(String message)
    Sets a message to be painted on the viewer. This is useful to show a text message to the user. Passing null will clear the message.
    Parameters:
      `message` - the status message

  - ### getGraphComponent

    public GraphComponent<V,E,G> getGraphComponent()

  - ### isSatelliteVisible

    public boolean isSatelliteVisible()
    Returns whether the satellite intended to be visible. If this component is built, then a result of true means that the satellite is showing. If the component is not yet built, then a result of true means that the satellite will be made visible when the component is built.
    Returns:
      true if visible

  - ### setSatelliteVisible

    public void setSatelliteVisible(boolean visible)

  - ### setSatelliteDocked

    public void setSatelliteDocked(boolean docked)

  - ### setSatellitePosition

    public void setSatellitePosition(GraphComponent.SatellitePosition position)

  - ### getSatellitePosition

    public GraphComponent.SatellitePosition getSatellitePosition()

  - ### isSatelliteDocked

    public boolean isSatelliteDocked()
    Returns whether the satellite intended to be docked. If this component is built, then a result of true means that the satellite is docked. If the component is not yet built, then a result of true means that the satellite will be made docked when the component is built.
    Returns:
      true if visible

  - ### setPopupsVisible

    public void setPopupsVisible(boolean visible)

  - ### arePopupsVisible

    public boolean arePopupsVisible()

  - ### arePopupsEnabled

    public boolean arePopupsEnabled()

  - ### getUndockedSatelliteComponent

    public JComponent getUndockedSatelliteComponent()

  - ### isSatelliteComponent

    public boolean isSatelliteComponent(Component c)

  - ### setVertexHoverPathHighlightMode

    public void setVertexHoverPathHighlightMode(PathHighlightMode mode)

  - ### setVertexFocusPathHighlightMode

    public void setVertexFocusPathHighlightMode(PathHighlightMode mode)

  - ### getVertexFocusPathHighlightMode

    public PathHighlightMode getVertexFocusPathHighlightMode()

  - ### getVertexHoverPathHighlightMode

    public PathHighlightMode getVertexHoverPathHighlightMode()

  - ### setTooltipProvider

    public void setTooltipProvider(VertexTooltipProvider<V,E> provider)

  - ### zoomOutGraph

    public void zoomOutGraph()

  - ### zoomInGraph

    public void zoomInGraph()

  - ### zoomToVertex

    public void zoomToVertex(V v)

  - ### zoomToWindow

    public void zoomToWindow()

  - ### getViewUpdater

    public VisualGraphViewUpdater<V,E> getViewUpdater()

  - ### getVertexPointInViewSpace

    public Point getVertexPointInViewSpace(V v)

  - ### translatePointFromVertexToViewSpace

    public Point translatePointFromVertexToViewSpace(V v, Point p)

  - ### translateRectangleFromVertexToViewSpace

    public Rectangle translateRectangleFromVertexToViewSpace(V v, Rectangle r)

  - ### translateMouseEventFromVertexToViewSpace

    public MouseEvent translateMouseEventFromVertexToViewSpace(V v, MouseEvent e)

  - ### isScaledPastInteractionThreshold

    public boolean isScaledPastInteractionThreshold()

  - ### maybeTwinkleVertex

    protected void maybeTwinkleVertex(V twinkleVertex, boolean doTwinkle)

  - ### requestFocus

    public void requestFocus()

  - ### repaint

    public void repaint()

  - ### getFocusedVertex

    public V getFocusedVertex()

  - ### getSelectedVertices

    public Set<V> getSelectedVertices()

  - ### getLayoutProvider

    public LayoutProvider<V,E,G> getLayoutProvider()

  - ### cleanup

    public void cleanup()
    Effectively clears this display. This method is not called dispose, as that implies the end of an object's lifecycle. This object can be re-used after this method is called.

  - ### disposeViewer

    protected void disposeViewer()