Class GraphNavigator

All Implemented Interfaces:
AdjustmentListener, ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, GraphLayoutCacheListener, GraphModelListener

  • Field Details

    • CURSOR_DEFAULT

      protected static final Cursor CURSOR_DEFAULT
      Shared cursor objects to avoid expensive constructor calls.
    • CURSOR_HAND

      protected static final Cursor CURSOR_HAND
      Shared cursor objects to avoid expensive constructor calls.
    • componentListener

      protected ComponentListener componentListener
      Component listener to udpate the scale.
    • initialLayoutCache

      protected transient GraphLayoutCache initialLayoutCache
      References the inital layout cache of the backing graph.
    • backingGraph

      protected JGraph backingGraph
      Holds the backing graph and references the displayed (current) graph.
    • currentGraph

      protected WeakReference currentGraph
      Weak reference to the current graph.
    • maximumScale

      protected double maximumScale
      Specifies the maximum scale for the navigator view. Default is 0.5
  • Constructor Details

    • GraphNavigator

      public GraphNavigator(JGraph backingGraph)
      Constructs a new graph navigator using backingGraph to display the graph in currentGraph.
      Parameters:
      backingGraph - The backing graph to render the display.
  • Method Details

    • getScrollPane

      public GraphNavigator.NavigatorPane getScrollPane()
      Returns the navigator pane that contains the backing graph.
      Returns:
      Returns the navigator pane.
    • getMaximumScale

      public double getMaximumScale()
      Returns the maximum scale to be used for the backing graph.
      Returns:
      Returns the maximumScale.
    • setMaximumScale

      public void setMaximumScale(double maximumScale)
      Sets the maximum scale to be used for the backing graph.
      Parameters:
      maximumScale - The maximumScale to set.
    • getBackingGraph

      public JGraph getBackingGraph()
      Returns the backing graph that is used to display currentGraph.
      Returns:
      Returns the backing graph.
    • setBackingGraph

      public void setBackingGraph(JGraph backingGraph)
      Sets the backing graph that is used to display currentGraph.
      Parameters:
      backingGraph - The backing graph to set.
    • getCurrentGraph

      public JGraph getCurrentGraph()
      Returns the graph that is currently displayed.
      Returns:
      Returns the backing graph.
    • setCurrentGraph

      public void setCurrentGraph(JGraph sourceGraph)
      Sets the graph that is currently displayed.
      Parameters:
      sourceGraph - The current graph to set.
    • updateScale

      protected void updateScale()
      Updates the scale of the backing graph.
    • graphLayoutCacheChanged

      public void graphLayoutCacheChanged(GraphLayoutCacheEvent e)
      Description copied from interface: GraphLayoutCacheListener
      Invoked after a cell has changed in some way. The vertex/vertices may have changed bounds or altered adjacency, or other attributes have changed that may affect presentation.
      Specified by:
      graphLayoutCacheChanged in interface GraphLayoutCacheListener
    • graphChanged

      public void graphChanged(GraphModelEvent e)
      Description copied from interface: GraphModelListener
      Invoked after a cell has changed in some way. The vertex/vertices may have changed bounds or altered adjacency, or other attributes have changed that may affect presentation. Note : Read the notes on the GraphModelEvent class carefully. A GraphModelEvent is the undo of the event that has just occurred, i.e. if you undo this event is executed.
      Specified by:
      graphChanged in interface GraphModelListener
    • propertyChange

      public void propertyChange(PropertyChangeEvent event)
      Specified by:
      propertyChange in interface PropertyChangeListener
    • adjustmentValueChanged

      public void adjustmentValueChanged(AdjustmentEvent e)
      Specified by:
      adjustmentValueChanged in interface AdjustmentListener
    • getParentScrollPane

      public static JScrollPane getParentScrollPane(Component component)
      Helper method that returns the parent scrollpane for the specified component in the component hierarchy. If the component is itself a scrollpane then it is returned.
      Returns:
      Returns the parent scrollpane or component.
    • getParentGraph

      public static JGraph getParentGraph(Component component)
      Helper method that returns the parent JGraph for the specified component in the component hierarchy. The component itself is never returned.
      Returns:
      Returns the parent scrollpane or component.
    • createInstance

      public static GraphNavigator createInstance(JGraph graph)