Package ghidra.graph.viewer.layout

# Class JungWrappingVisualGraphLayoutAdapter<V extends VisualVertex,E extends VisualEdge<V>>

java.lang.Object
ghidra.graph.viewer.layout.JungWrappingVisualGraphLayoutAdapter<V,E>

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

All Implemented Interfaces:
  `com.google.common.base.Function<V,Point2D>`, `edu.uci.ics.jung.algorithms.layout.Layout<V,E>`, `VisualGraphLayout<V,E>`, `Function<V,Point2D>`

Direct Known Subclasses:
  `JungLayout`

public class JungWrappingVisualGraphLayoutAdapter<V extends VisualVertex,E extends VisualEdge<V>> extends Object implements VisualGraphLayout<V,E>
A wrapper that allows for existing Jung layouts to be used inside of the Visual Graph system.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected edu.uci.ics.jung.algorithms.layout.Layout<V,E>`
  `delegate`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JungWrappingVisualGraphLayoutAdapter(edu.uci.ics.jung.algorithms.layout.Layout<V,E> jungLayout)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addLayoutListener(LayoutListener<V,E> listener)`
  Adds a layout listener
  `Point2D`
  `apply(V v)`
  `LayoutPositions<V,E>`
  `calculateLocations(VisualGraph<V,E> graph, TaskMonitor monitor)`
  Signals to again layout the current graph.
  `protected edu.uci.ics.jung.algorithms.layout.Layout<V,E>`
  `cloneJungLayout(VisualGraph<V,E> newGraph)`
  `JungWrappingVisualGraphLayoutAdapter`
  `cloneLayout(VisualGraph<V,E> newGraph)`
  Creates a new version of this layout using the given graph.
  `void`
  `dispose()`
  Cleanup any resource being managed by this layout.
  `edu.uci.ics.jung.visualization.renderers.Renderer.EdgeLabel<V,E>`
  `getEdgeLabelRenderer()`
  Returns an optional custom edge label renderer.
  `edu.uci.ics.jung.visualization.renderers.BasicEdgeRenderer<V,E>`
  `getEdgeRenderer()`
  Returns an optional edge renderer.
  `com.google.common.base.Function<E,Shape>`
  `getEdgeShapeTransformer(edu.uci.ics.jung.visualization.RenderContext<V,E> context)`
  Returns an optional edge shape transformer.
  `edu.uci.ics.jung.graph.Graph<V,E>`
  `getGraph()`
  `Dimension`
  `getSize()`
  `VisualGraph<V,E>`
  `getVisualGraph()`
  Returns the graph of this layout
  `void`
  `initialize()`
  `boolean`
  `isLocked(V v)`
  `void`
  `lock(V v, boolean lock)`
  `void`
  `removeLayoutListener(LayoutListener<V,E> listener)`
  Removes a layout listener
  `void`
  `reset()`
  `void`
  `setGraph(edu.uci.ics.jung.graph.Graph<V,E> graph)`
  `void`
  `setInitializer(com.google.common.base.Function<V,Point2D> t)`
  `void`
  `setLocation(V v, Point2D location)`
  `void`
  `setLocation(V v, Point2D location, LayoutListener.ChangeType changeType)`
  Allows the client to change the location while specifying the type of change.
  `void`
  `setSize(Dimension d)`
  `boolean`
  `usesEdgeArticulations()`
  Returns true if this layout uses articulated edges.

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

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

  ### Methods inherited from interface com.google.common.base.Function

  `equals`

  ### Methods inherited from interface java.util.function.Function

  `andThen, compose`

- ## Field Details

  - ### delegate

    protected edu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>> delegate

- ## Constructor Details

  - ### JungWrappingVisualGraphLayoutAdapter

    public JungWrappingVisualGraphLayoutAdapter(edu.uci.ics.jung.algorithms.layout.Layout<V,E> jungLayout)

- ## Method Details

  - ### initialize

    public void initialize()
    Specified by:
      `initialize` in interface `edu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### reset

    public void reset()
    Specified by:
      `reset` in interface `edu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### calculateLocations

    public LayoutPositions<V,E> calculateLocations(VisualGraph<V,E> graph, TaskMonitor monitor)
    Description copied from interface: `VisualGraphLayout`
    Signals to again layout the current graph. The locations generated by the layout will be returned, but not actually applied to the graph. This allows clients to generate new locations and then apply them in a delayed fashion, like for animation.
    Specified by:
      `calculateLocations` in interface `VisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>`
    Parameters:
      `graph` - the graph that contains the vertices to layout
      `monitor` - the task monitor used to report progress or to cancel
    Returns:
      the layout locations

  - ### cloneLayout

    public JungWrappingVisualGraphLayoutAdapter cloneLayout(VisualGraph<V,E> newGraph)
    Description copied from interface: `VisualGraphLayout`
    Creates a new version of this layout using the given graph. Also, the new layout will have the same state as this layout (i.e., vertex positions (and edge articulations, if applicable)).
    Specified by:
      `cloneLayout` in interface `VisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>`
    Parameters:
      `newGraph` - the new graph for the new layout
    Returns:
      the new layout

  - ### cloneJungLayout

    protected edu.uci.ics.jung.algorithms.layout.Layout<V,E> cloneJungLayout(VisualGraph<V,E> newGraph)

  - ### usesEdgeArticulations

    public boolean usesEdgeArticulations()
    Description copied from interface: `VisualGraphLayout`
    Returns true if this layout uses articulated edges. All `VisualEdge`s have the ability to articulate. This method servers as a shortcut for algorithms so that they need not loop over all edges to determine if they have articulations. (Looping over large graphs is time intensive.)

    What are articulations?

    Specified by:
      `usesEdgeArticulations` in interface `VisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>`
    Returns:
      true if this layout uses articulated edges.

  - ### dispose

    public void dispose()
    Description copied from interface: `VisualGraphLayout`
    Cleanup any resource being managed by this layout.
    Specified by:
      `dispose` in interface `VisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### getGraph

    public edu.uci.ics.jung.graph.Graph<V,E> getGraph()
    Specified by:
      `getGraph` in interface `edu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### getSize

    public Dimension getSize()
    Specified by:
      `getSize` in interface `edu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### isLocked

    public boolean isLocked(V v)
    Specified by:
      `isLocked` in interface `edu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### lock

    public void lock(V v, boolean lock)
    Specified by:
      `lock` in interface `edu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### setGraph

    public void setGraph(edu.uci.ics.jung.graph.Graph<V,E> graph)
    Specified by:
      `setGraph` in interface `edu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### setInitializer

    public void setInitializer(com.google.common.base.Function<V,Point2D> t)
    Specified by:
      `setInitializer` in interface `edu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### setSize

    public void setSize(Dimension d)
    Specified by:
      `setSize` in interface `edu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### apply

    public Point2D apply(V v)
    Specified by:
      `apply` in interface `com.google.common.base.Function<V extends VisualVertex,E extends VisualEdge<V>>`
    Specified by:
      `apply` in interface `Function<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### getEdgeRenderer

    public edu.uci.ics.jung.visualization.renderers.BasicEdgeRenderer<V,E> getEdgeRenderer()
    Description copied from interface: `VisualGraphLayout`
    Returns an optional edge renderer. This is used to render each edge.
    Specified by:
      `getEdgeRenderer` in interface `VisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>`
    Returns:
      an optional edge renderer

  - ### getEdgeShapeTransformer

    public com.google.common.base.Function<E,Shape> getEdgeShapeTransformer(edu.uci.ics.jung.visualization.RenderContext<V,E> context)
    Description copied from interface: `VisualGraphLayout`
    Returns an optional edge shape transformer. This is used to create shapes for each edge.
    Specified by:
      `getEdgeShapeTransformer` in interface `VisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>`
    Parameters:
      `context` - RenderContext needed to get rendering information
    Returns:
      an optional edge shape transformer

  - ### getEdgeLabelRenderer

    public edu.uci.ics.jung.visualization.renderers.Renderer.EdgeLabel<V,E> getEdgeLabelRenderer()
    Description copied from interface: `VisualGraphLayout`
    Returns an optional custom edge label renderer. This is used to add labels to the edges.
    Specified by:
      `getEdgeLabelRenderer` in interface `VisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>`
    Returns:
      an optional renderer

  - ### addLayoutListener

    public void addLayoutListener(LayoutListener<V,E> listener)
    Description copied from interface: `VisualGraphLayout`
    Adds a layout listener
    Specified by:
      `addLayoutListener` in interface `VisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>`
    Parameters:
      `listener` - the listener

  - ### removeLayoutListener

    public void removeLayoutListener(LayoutListener<V,E> listener)
    Description copied from interface: `VisualGraphLayout`
    Removes a layout listener
    Specified by:
      `removeLayoutListener` in interface `VisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>`
    Parameters:
      `listener` - the listener

  - ### setLocation

    public void setLocation(V v, Point2D location)
    Specified by:
      `setLocation` in interface `edu.uci.ics.jung.algorithms.layout.Layout<V extends VisualVertex,E extends VisualEdge<V>>`

  - ### setLocation

    public void setLocation(V v, Point2D location, LayoutListener.ChangeType changeType)
    Description copied from interface: `VisualGraphLayout`
    Allows the client to change the location while specifying the type of change.

    Calling `Layout.setLocation(Object, Point2D)` will use `LayoutListener.ChangeType.API`.

    Specified by:
      `setLocation` in interface `VisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>`
    Parameters:
      `v` - the vertex
      `location` - the new location
      `changeType` - the type of change

  - ### getVisualGraph

    public VisualGraph<V,E> getVisualGraph()
    Description copied from interface: `VisualGraphLayout`
    Returns the graph of this layout
    Specified by:
      `getVisualGraph` in interface `VisualGraphLayout<V extends VisualVertex,E extends VisualEdge<V>>`
    Returns:
      the graph of this layout