JGraphpad Pro
v6.0.5.0


com.jgraph.editor.factory
Class JGraphEditorNavigator

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycom.jgraph.editor.factory.JGraphEditorNavigator
All Implemented Interfaces:
Accessible, AdjustmentListener, EventListener, org.jgraph.event.GraphLayoutCacheListener, org.jgraph.event.GraphModelListener, ImageObserver, MenuContainer, PropertyChangeListener, Serializable

public class JGraphEditorNavigator
extends JPanel
implements org.jgraph.event.GraphLayoutCacheListener, org.jgraph.event.GraphModelListener, PropertyChangeListener, AdjustmentListener

Birds-eye view on a graph. The displayed graph may be changed at runtime. The class provides the JGraphEditorNavigator.FactoryMethod to be added to an editor factory.

See Also:
Serialized Form

Nested Class Summary
static class JGraphEditorNavigator.FactoryMethod
          Factory method to construct a new navigator.
 class JGraphEditorNavigator.NavigatorPane
          Scrollpane that implements special painting used for the navigator preview.
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  org.jgraph.JGraph backingGraph
          Holds the backing graph and references the displayed (current) graph.
protected  ComponentListener componentListener
          Component listener to udpate the scale.
protected  WeakReference currentGraph
          Weak reference to the current graph.
protected static Cursor CURSOR_DEFAULT
          Shared cursor objects to avoid expensive constructor calls.
protected static Cursor CURSOR_HAND
          Shared cursor objects to avoid expensive constructor calls.
static Color DEFAULT_BACKGROUND
          Shared cursor objects to avoid expensive constructor calls.
protected  org.jgraph.graph.GraphLayoutCache initialLayoutCache
          References the inital layout cache of the backing graph.
protected  boolean isBackgroundImageVisible
          Specifies whether the background image of the enclosing diagram pane should be visible.
protected  double maximumScale
          Specifies the maximum scale for the navigator view.
protected  JGraphEditorNavigator.NavigatorPane navigatorPane
          Holds the navigator pane the displays the backing graph.
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JGraphEditorNavigator(org.jgraph.JGraph backingGraph)
          Constructs a new graph navigator using backingGraph to display the graph in currentGraph.
 
Method Summary
 void adjustmentValueChanged(AdjustmentEvent e)
           
 org.jgraph.JGraph getBackingGraph()
          Returns the backing graph that is used to display currentGraph.
 org.jgraph.JGraph getCurrentGraph()
          Returns the graph that is currently displayed.
 double getMaximumScale()
          Returns the maximum scale to be used for the backing graph.
static org.jgraph.JGraph getParentGraph(Component component)
          Helper method that returns the parent JGraph for the specified component in the component hierarchy.
static JScrollPane getParentScrollPane(Component component)
          Helper method that returns the parent scrollpane for the specified component in the component hierarchy.
 JGraphEditorNavigator.NavigatorPane getScrollPane()
          Returns the navigator pane that contains the backing graph.
 void graphChanged(org.jgraph.event.GraphModelEvent e)
           
 void graphLayoutCacheChanged(org.jgraph.event.GraphLayoutCacheEvent e)
           
 boolean isBackgroundImageVisible()
           
 void propertyChange(PropertyChangeEvent event)
           
 void setBackgroundImageVisible(boolean isBackgroundImageVisible)
           
 void setBackingGraph(org.jgraph.JGraph backingGraph)
          Sets the backing graph that is used to display currentGraph.
 void setCurrentGraph(org.jgraph.JGraph sourceGraph)
          Sets the graph that is currently displayed.
 void setMaximumScale(double maximumScale)
          Sets the maximum scale to be used for the backing graph.
protected  void updateScale()
          Updates the scale of the backing graph.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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.


DEFAULT_BACKGROUND

public static Color DEFAULT_BACKGROUND
Shared cursor objects to avoid expensive constructor calls.


componentListener

protected ComponentListener componentListener
Component listener to udpate the scale.


initialLayoutCache

protected transient org.jgraph.graph.GraphLayoutCache initialLayoutCache
References the inital layout cache of the backing graph.


backingGraph

protected org.jgraph.JGraph backingGraph
Holds the backing graph and references the displayed (current) graph.


currentGraph

protected WeakReference currentGraph
Weak reference to the current graph.


navigatorPane

protected JGraphEditorNavigator.NavigatorPane navigatorPane
Holds the navigator pane the displays the backing graph.


maximumScale

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


isBackgroundImageVisible

protected boolean isBackgroundImageVisible
Specifies whether the background image of the enclosing diagram pane should be visible. Default is true.

Constructor Detail

JGraphEditorNavigator

public JGraphEditorNavigator(org.jgraph.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 Detail

getScrollPane

public JGraphEditorNavigator.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 org.jgraph.JGraph getBackingGraph()
Returns the backing graph that is used to display currentGraph.

Returns:
Returns the backing graph.

setBackingGraph

public void setBackingGraph(org.jgraph.JGraph backingGraph)
Sets the backing graph that is used to display currentGraph.

Parameters:
backingGraph - The backing graph to set.

getCurrentGraph

public org.jgraph.JGraph getCurrentGraph()
Returns the graph that is currently displayed.

Returns:
Returns the backing graph.

isBackgroundImageVisible

public boolean isBackgroundImageVisible()
Returns:
Returns the isBackgroundImageVisible.

setBackgroundImageVisible

public void setBackgroundImageVisible(boolean isBackgroundImageVisible)
Parameters:
isBackgroundImageVisible - The isBackgroundImageVisible to set.

setCurrentGraph

public void setCurrentGraph(org.jgraph.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(org.jgraph.event.GraphLayoutCacheEvent e)
Specified by:
graphLayoutCacheChanged in interface org.jgraph.event.GraphLayoutCacheListener

graphChanged

public void graphChanged(org.jgraph.event.GraphModelEvent e)
Specified by:
graphChanged in interface org.jgraph.event.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 org.jgraph.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.

JGraphpad Pro
v6.0.5.0


Copyright (C) 2005 JGraph.com. All rights reserved.