Class GraphViewer<V extends VisualVertex,E extends VisualEdge<V>>

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
edu.uci.ics.jung.visualization.BasicVisualizationServer<V,E>
edu.uci.ics.jung.visualization.VisualizationViewer<V,E>
ghidra.graph.viewer.GraphViewer<V,E>
Type Parameters:
V - the vertex type
E - the edge type
All Implemented Interfaces:
edu.uci.ics.jung.visualization.util.ChangeEventSupport, edu.uci.ics.jung.visualization.VisualizationServer<V,E>, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener

public class GraphViewer<V extends VisualVertex,E extends VisualEdge<V>> extends edu.uci.ics.jung.visualization.VisualizationViewer<V,E>
The base viewer for the Graph module. This viewer provides methods for manipulating the graph using the mouse.

The viewer is currently an extension of the VisualizationViewer and as such it is accessed by much of the event handling subsystem, such as the mouse plugins, as well as the rendering system.

Also, tooltips/popups for edges and vertices are handled by this class.

This class creates a VisualGraphViewUpdater that perform graph transformations, such as panning the graph, with and without animation, as requested.

See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • createPathHighlighter

      protected VisualGraphPathHighlighter<V,E> createPathHighlighter(PathHighlightListener listener)
    • createViewUpdater

      protected VisualGraphViewUpdater<V,E> createViewUpdater()
    • getVisualGraphLayout

      public VisualGraphLayout<V,E> getVisualGraphLayout()
    • setGraphLayout

      public void setGraphLayout(edu.uci.ics.jung.algorithms.layout.Layout<V,E> layout)
      Specified by:
      setGraphLayout in interface edu.uci.ics.jung.visualization.VisualizationServer<V extends VisualVertex,E extends VisualEdge<V>>
      Overrides:
      setGraphLayout in class edu.uci.ics.jung.visualization.BasicVisualizationServer<V extends VisualVertex,E extends VisualEdge<V>>
    • getVisualGraph

      public VisualGraph<V,E> getVisualGraph()
    • getGraphMouse

      public VisualGraphPluggableGraphMouse<V,E> getGraphMouse()
      Overrides:
      getGraphMouse in class edu.uci.ics.jung.visualization.VisualizationViewer<V extends VisualVertex,E extends VisualEdge<V>>
    • setGraphMouse

      public void setGraphMouse(edu.uci.ics.jung.visualization.VisualizationViewer.GraphMouse graphMouse)
      Overrides:
      setGraphMouse in class edu.uci.ics.jung.visualization.VisualizationViewer<V extends VisualVertex,E extends VisualEdge<V>>
    • setGraphOptions

      public void setGraphOptions(VisualGraphOptions options)
    • optionsChanged

      public void optionsChanged()
    • getOptions

      public VisualGraphOptions getOptions()
    • setVertexHoverPathHighlightMode

      public void setVertexHoverPathHighlightMode(PathHighlightMode hoverMode)
    • setVertexFocusPathHighlightMode

      public void setVertexFocusPathHighlightMode(PathHighlightMode focusMode)
    • getVertexHoverPathHighlightMode

      public PathHighlightMode getVertexHoverPathHighlightMode()
    • getVertexFocusPathHighlightMode

      public PathHighlightMode getVertexFocusPathHighlightMode()
    • setViewerInitializedListener

      public void setViewerInitializedListener(Consumer<GraphViewer<V,E>> listener)
    • getPathHighlighter

      public VisualGraphPathHighlighter<V,E> getPathHighlighter()
    • getViewUpdater

      public VisualGraphViewUpdater<V,E> getViewUpdater()
    • getGPickedVertexState

      public GPickedState<V> getGPickedVertexState()
    • setVertexTooltipProvider

      public void setVertexTooltipProvider(VertexTooltipProvider<V,E> vertexTooltipProvider)
    • useMouseRelativeZoom

      public boolean useMouseRelativeZoom()
      When true (the default), the zoom will center wherever the mouse is positioned. False will zoom at the center of the view.
      Returns:
      true if using mouse-relative zoom
    • add

      public Component add(Component comp)
      !!Super Hacky Override!! The code we are overriding blindly calls add(), without first checking to see if it has already been added. Java 6 added a method, removeNotify(), that is called when components are removed. When add is called in the overridden method, it triggers a call to remove, which triggers removeNotify(). This call is made during the painting process. The problem therein is that out buttons borders get reset (see AbstractButton.removeNotify()) when we repaint, which means that mouse hovers do not work correctly (SCR 6819).
      Overrides:
      add in class Container
    • paintComponent

      protected void paintComponent(Graphics g)
      !!Super Hacky Override!! This is done to make sure that we center the view when we are fully laid-out. If you know of a better way to do this, then, get rid of this overridden method and do the good thing.
      Overrides:
      paintComponent in class edu.uci.ics.jung.visualization.BasicVisualizationServer<V extends VisualVertex,E extends VisualEdge<V>>
    • getCenter

      public Point2D getCenter()
      Specified by:
      getCenter in interface edu.uci.ics.jung.visualization.VisualizationServer<V extends VisualVertex,E extends VisualEdge<V>>
      Overrides:
      getCenter in class edu.uci.ics.jung.visualization.BasicVisualizationServer<V extends VisualVertex,E extends VisualEdge<V>>
    • setPopupsVisible

      public void setPopupsVisible(boolean visible)
    • getToolTipText

      public String getToolTipText(MouseEvent event)
      Overrides:
      getToolTipText in class edu.uci.ics.jung.visualization.VisualizationViewer<V extends VisualVertex,E extends VisualEdge<V>>
    • createVertexMouseInfo

      public VertexMouseInfo<V,E> createVertexMouseInfo(MouseEvent e, V v, Point2D vertexBasedClickPoint)
    • dispose

      public void dispose()