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

  • 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 java.lang.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.
    • Constructor Detail

      • VisualGraphView

        public VisualGraphView()
    • Method Detail

      • getViewComponent

        public javax.swing.JComponent getViewComponent()
      • setSouthComponent

        protected void setSouthComponent​(javax.swing.JComponent component)
      • removeSatellite

        protected void removeSatellite()
      • 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)
      • 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​(java.awt.Component c)
      • getWithBusyCursor

        protected <T> T getWithBusyCursor​(java.util.function.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
      • setGraphPerspective

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

        public void showErrorView​(java.lang.String errorMessage)
      • setStatusMessage

        public void setStatusMessage​(java.lang.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
      • 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)
      • 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)
      • arePopupsEnabled

        public boolean arePopupsEnabled()
      • getUndockedSatelliteComponent

        public javax.swing.JComponent getUndockedSatelliteComponent()
      • isSatelliteComponent

        public boolean isSatelliteComponent​(java.awt.Component c)
      • setVertexHoverPathHighlightMode

        public void setVertexHoverPathHighlightMode​(PathHighlightMode mode)
      • setVertexFocusPathHighlightMode

        public void setVertexFocusPathHighlightMode​(PathHighlightMode mode)
      • getVertexFocusPathHighlightMode

        public PathHighlightMode getVertexFocusPathHighlightMode()
      • getVertexHoverPathHighlightMode

        public PathHighlightMode getVertexHoverPathHighlightMode()
      • zoomOutGraph

        public void zoomOutGraph()
      • zoomInGraph

        public void zoomInGraph()
      • zoomToVertex

        public void zoomToVertex​(V v)
      • zoomToWindow

        public void zoomToWindow()
      • getVertexPointInViewSpace

        public java.awt.Point getVertexPointInViewSpace​(V v)
      • translatePointFromVertexToViewSpace

        public java.awt.Point translatePointFromVertexToViewSpace​(V v,
                                                                  java.awt.Point p)
      • translateRectangleFromVertexToViewSpace

        public java.awt.Rectangle translateRectangleFromVertexToViewSpace​(V v,
                                                                          java.awt.Rectangle r)
      • translateMouseEventFromVertexToViewSpace

        public java.awt.event.MouseEvent translateMouseEventFromVertexToViewSpace​(V v,
                                                                                  java.awt.event.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 java.util.Set<V> getSelectedVertices()
      • 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()