edu.uci.ics.jung.visualization
Class VisualizationViewer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by edu.uci.ics.jung.visualization.VisualizationViewer
All Implemented Interfaces:
ChangeEventSupport, HasGraphLayout, LayoutTransformer, Transformer, ViewTransformer, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener
Direct Known Subclasses:
SatelliteVisualizationViewer

public class VisualizationViewer
extends JPanel
implements Transformer, LayoutTransformer, ViewTransformer, HasGraphLayout, ChangeListener, ChangeEventSupport

A class that maintains many of the details necessary for creating visualizations of graphs.

Author:
Joshua O'Madadhain, Tom Nelson, Danyel Fisher
See Also:
Serialized Form

Nested Class Summary
static interface VisualizationViewer.GraphMouse
          a convenience type to represent a class that processes all types of mouse events for the graph
protected  class VisualizationViewer.GraphMouseImpl
          this is the original GraphMouse class, renamed to use GraphMouse as the interface name, and updated to correctly apply the vv transform to the point point
static interface VisualizationViewer.Paintable
          an interface for the preRender and postRender
static interface VisualizationViewer.ToolTipListener
          The interface for the tool tip listener.
protected static class VisualizationViewer.ToolTipListenerWrapper
          used internally to wrap any legacy ToolTipListener implementations so they can be used as a ToolTipFunction
protected  class VisualizationViewer.VisualizationListener
          VisualizationListener reacts to changes in the size of the VisualizationViewer.
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  ChangeEventSupport changeSupport
           
protected  boolean doubleBuffered
          user-settable choice to use the offscreen image or not.
protected  VisualizationViewer.GraphMouse graphMouse
          provides MouseListener, MouseMotionListener, and MouseWheelListener events to the graph
protected  MutableTransformer layoutTransformer
           
protected  Map locationMap
          if true, then when the View is resized, the current Layout is resized to the same size.
protected  VisualizationModel model
          holds the state of this View
protected  BufferedImage offscreen
          an offscreen image to render the graph Used if doubleBuffered is set to true
protected  Graphics2D offscreenG2d
          graphics context for the offscreen image Used if doubleBuffered is set to true
protected  PickedState pickedState
          holds the state of which elements of the graph are currently 'picked'
protected  ItemListener pickEventListener
          a listener used to cause pick events to result in repaints, even if they come from another view
protected  PickSupport pickSupport
          pluggable support for picking graph elements by finding them based on their coordinates.
protected  List postRenderers
          a collection of user-implementable functions to render over the topology (after the graph is rendered)
protected  List preRenderers
          a collection of user-implementable functions to render under the topology (before the graph is rendered)
protected  Renderer renderer
          handles the actual drawing of graph elements
protected  Map renderingHints
          rendering hints used in drawing.
protected  ToolTipFunction toolTipFunction
          should be set to user-defined class to provide tooltips on the graph elements
protected  MutableTransformer viewTransformer
          Provides support for mutating the AffineTransform that is supplied to the rendering Graphics2D
 
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
VisualizationViewer(Layout layout, Renderer renderer)
          Create an instance with passed parameters.
VisualizationViewer(Layout layout, Renderer renderer, Dimension preferredSize)
          Create an instance with passed parameters.
VisualizationViewer(VisualizationModel model, Renderer renderer)
          Create an instance with passed parameters.
VisualizationViewer(VisualizationModel model, Renderer renderer, Dimension preferredSize)
          Create an instance with passed parameters.
 
Method Summary
 void addChangeListener(ChangeListener l)
          Adds a ChangeListener.
 void addGraphMouseListener(GraphMouseListener gel)
          This is the interface for adding a mouse listener.
 void addPostRenderPaintable(VisualizationViewer.Paintable paintable)
           
 void addPreRenderPaintable(VisualizationViewer.Paintable paintable)
           
protected  double average(long[] paintTimes)
          Returns the double average of a number of long values.
protected  void checkOffscreenImage(Dimension d)
          Ensure that, if doubleBuffering is enabled, the offscreen image buffer exists and is the correct size.
 void fireStateChanged()
          Notifies all listeners that have registered interest for notification on this event type.
 Point2D getCenter()
           
 ChangeListener[] getChangeListeners()
          Returns an array of all the ChangeListeners added with addChangeListener().
 Layout getGraphLayout()
          Returns the current graph layout.
 VisualizationViewer.GraphMouse getGraphMouse()
           
 MutableTransformer getLayoutTransformer()
           
 VisualizationModel getModel()
           
 double getOffsetX()
          Deprecated. use getTranslateX
 double getOffsetY()
          Deprecated. use getTranslateY()
 PickedState getPickedState()
           
 PickSupport getPickSupport()
           
 Renderer getRenderer()
          Returns the renderer used by this instance.
 Map getRenderingHints()
           
 double getScaleX()
          Deprecated. access via getViewTransformer method
 double getScaleY()
          Deprecated. access via getViewTransformer method
 String getToolTipText(MouseEvent event)
          called by the superclass to display tooltips
 double getTranslateX()
          Deprecated. access via getViewTransformer method
 double getTranslateY()
          Deprecated. access via getViewTransformer method
 MutableTransformer getViewTransformer()
           
 void init()
          Pre-relaxes and starts a visRunner thread Passes thru to the model
protected  void initMouseClicker()
          Deprecated. replaced by setGraphMouse()
 Point2D inverseLayoutTransform(Point2D p)
          convert the supplied screen coordinate to the graph coordinate.
 Point2D inverseTransform(Point2D p)
          Transform the mouse point with the inverse transform of the VisualizationViewer.
 Point2D inverseViewTransform(Point2D p)
          convert the supplied screen coordinate to the graph coordinate.
 boolean isDoubleBuffered()
          whether this class uses double buffering.
 boolean isPicked(Edge e)
          Deprecated. Use getPickedState.isPicked(e).
 boolean isPicked(Vertex v)
          Deprecated. Use getPickedState.isPicked(e).
 boolean isVisRunnerRunning()
          Returns a flag that says whether the visRunner thread is running.
 Point2D layoutTransform(Point2D p)
          convert the supplied graph coordinate to the screen coordinate
protected  void paintComponent(Graphics g)
           
protected  void pick(Vertex picked, boolean b)
          Deprecated. Use getPickedState.pick(picked, b).
 void prerelax()
          convenience pass-thru to the model
 void removeChangeListener(ChangeListener l)
          Removes a ChangeListener.
 void removePostRenderPaintable(VisualizationViewer.Paintable paintable)
           
 void removePreRenderPaintable(VisualizationViewer.Paintable paintable)
           
protected  void renderGraph(Graphics2D g2d)
           
 void restart()
          Restarts layout, then calls init(); passes thru to the model
 void scale(double scalex, double scaley)
          Deprecated. access via getViewTransformer method
 void scale(double scalex, double scaley, Point2D from)
          Deprecated. access via getViewTransformer method
protected  void scaleToLayout(Dimension layoutSize)
           
 void setDoubleBuffered(boolean doubleBuffered)
          set whether this class uses its offscreen image or not.
 void setGraphLayout(Layout layout)
          Removes the current graph layout, and adds a new one.
 void setGraphLayout(Layout layout, boolean scaleToLayout)
          Removes the current graph layout, and adds a new one, optionally re-scaling the view to show the entire layout
 void setGraphMouse(VisualizationViewer.GraphMouse graphMouse)
          a setter for the GraphMouse.
 void setLayoutTransformer(MutableTransformer transformer)
           
 void setModel(VisualizationModel model)
           
 void setOffset(double offsetx, double offsety)
          Deprecated. use setTranslate(double, offset, double offset)
 void setPickedState(PickedState pickedState)
           
 void setPickSupport(PickSupport pickSupport)
           
 void setRenderer(Renderer r)
          Sets the showing Renderer to be the input Renderer.
 void setRenderingHints(Map renderingHints)
           
 void setScale(double scalex, double scaley)
          Deprecated. access via getViewTransformer method
 void setScale(double scalex, double scaley, Point2D from)
          Deprecated. access via getViewTransformer method
 void setTextCallback(StatusCallback scb)
          convenience pass-thru to model
 void setToolTipFunction(ToolTipFunction toolTipFunction)
           
 void setToolTipListener(VisualizationViewer.ToolTipListener listener)
          sets the tooltip listener to the user's defined implementation of ToolTipListener
 void setTranslate(double tx, double ty)
          Deprecated. access via getViewTransformer method
 void setViewTransformer(MutableTransformer transformer)
           
 void setVisible(boolean aFlag)
           
protected  void start()
          convenience pass-thru to the model
 void stateChanged(ChangeEvent e)
          In response to changes from the model, repaint the view, then fire an event to any listeners.
 void stop()
          convenience pass-thru to model
 void suspend()
          convenience pass-thru to the model
 Point2D transform(Point2D p)
          Transform the mouse point with the current transform of the VisualizationViewer.
 void translate(double tx, double ty)
          Deprecated. access via getViewTransformer method
 void unsuspend()
          convenience pass-thru to the model
 Point2D viewTransform(Point2D p)
          convert the supplied graph coordinate to the screen coordinate
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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

changeSupport

protected ChangeEventSupport changeSupport

model

protected VisualizationModel model
holds the state of this View


renderer

protected Renderer renderer
handles the actual drawing of graph elements


toolTipFunction

protected ToolTipFunction toolTipFunction
should be set to user-defined class to provide tooltips on the graph elements


renderingHints

protected Map renderingHints
rendering hints used in drawing. Anti-aliasing is on by default


pickSupport

protected PickSupport pickSupport
pluggable support for picking graph elements by finding them based on their coordinates. Typically used in mouse events.


pickedState

protected PickedState pickedState
holds the state of which elements of the graph are currently 'picked'


pickEventListener

protected ItemListener pickEventListener
a listener used to cause pick events to result in repaints, even if they come from another view


offscreen

protected BufferedImage offscreen
an offscreen image to render the graph Used if doubleBuffered is set to true


offscreenG2d

protected Graphics2D offscreenG2d
graphics context for the offscreen image Used if doubleBuffered is set to true


doubleBuffered

protected boolean doubleBuffered
user-settable choice to use the offscreen image or not. 'false' by default


viewTransformer

protected MutableTransformer viewTransformer
Provides support for mutating the AffineTransform that is supplied to the rendering Graphics2D


layoutTransformer

protected MutableTransformer layoutTransformer

preRenderers

protected List preRenderers
a collection of user-implementable functions to render under the topology (before the graph is rendered)


postRenderers

protected List postRenderers
a collection of user-implementable functions to render over the topology (after the graph is rendered)


graphMouse

protected VisualizationViewer.GraphMouse graphMouse
provides MouseListener, MouseMotionListener, and MouseWheelListener events to the graph


locationMap

protected Map locationMap
if true, then when the View is resized, the current Layout is resized to the same size.

Constructor Detail

VisualizationViewer

public VisualizationViewer(Layout layout,
                           Renderer renderer)
Create an instance with passed parameters.

Parameters:
layout - The Layout to apply, with its associated Graph
renderer - The Renderer to draw it with

VisualizationViewer

public VisualizationViewer(Layout layout,
                           Renderer renderer,
                           Dimension preferredSize)
Create an instance with passed parameters.

Parameters:
layout - The Layout to apply, with its associated Graph
renderer - The Renderer to draw it with
preferredSize - the preferred size of this View

VisualizationViewer

public VisualizationViewer(VisualizationModel model,
                           Renderer renderer)
Create an instance with passed parameters.

Parameters:
model -
renderer -

VisualizationViewer

public VisualizationViewer(VisualizationModel model,
                           Renderer renderer,
                           Dimension preferredSize)
Create an instance with passed parameters.

Parameters:
model -
renderer -
preferredSize - initial preferred size of the view
Method Detail

setDoubleBuffered

public void setDoubleBuffered(boolean doubleBuffered)
set whether this class uses its offscreen image or not. If true, then doubleBuffering in the superclass is set to 'false'

Overrides:
setDoubleBuffered in class JComponent

isDoubleBuffered

public boolean isDoubleBuffered()
whether this class uses double buffering. The superclass will be the opposite state.

Overrides:
isDoubleBuffered in class JComponent

checkOffscreenImage

protected void checkOffscreenImage(Dimension d)
Ensure that, if doubleBuffering is enabled, the offscreen image buffer exists and is the correct size.

Parameters:
d -

getModel

public VisualizationModel getModel()
Returns:
Returns the model.

setModel

public void setModel(VisualizationModel model)
Parameters:
model - The model to set.

stateChanged

public void stateChanged(ChangeEvent e)
In response to changes from the model, repaint the view, then fire an event to any listeners. Examples of listeners are the GraphZoomScrollPane and the BirdsEyeVisualizationViewer

Specified by:
stateChanged in interface ChangeListener

initMouseClicker

protected void initMouseClicker()
Deprecated. replaced by setGraphMouse()

Creates a default mouseClicker behavior: a default.

See Also:
VisualizationViewer.GraphMouseImpl

setTextCallback

public void setTextCallback(StatusCallback scb)
convenience pass-thru to model

Parameters:
scb -

setGraphMouse

public void setGraphMouse(VisualizationViewer.GraphMouse graphMouse)
a setter for the GraphMouse. This will remove any previous GraphMouse (including the one that is added in the initMouseClicker method.

Parameters:
graphMouse - new value

getGraphMouse

public VisualizationViewer.GraphMouse getGraphMouse()
Returns:
the current GraphMouse

setRenderer

public void setRenderer(Renderer r)
Sets the showing Renderer to be the input Renderer. Also tells the Renderer to refer to this visualizationviewer as a PickedKey. (Because Renderers maintain a small amount of state, such as the PickedKey, it is important to create a separate instance for each VV instance.)


getRenderer

public Renderer getRenderer()
Returns the renderer used by this instance.


setGraphLayout

public void setGraphLayout(Layout layout)
Removes the current graph layout, and adds a new one.

Parameters:
layout - the new layout to set

setGraphLayout

public void setGraphLayout(Layout layout,
                           boolean scaleToLayout)
Removes the current graph layout, and adds a new one, optionally re-scaling the view to show the entire layout

Parameters:
layout - the new layout to set
scaleToLayout - whether to scale the view to show the whole layout

scaleToLayout

protected void scaleToLayout(Dimension layoutSize)

getGraphLayout

public Layout getGraphLayout()
Returns the current graph layout. Passes thru to the model

Specified by:
getGraphLayout in interface HasGraphLayout

addGraphMouseListener

public void addGraphMouseListener(GraphMouseListener gel)
This is the interface for adding a mouse listener. The GEL will be called back with mouse clicks on vertices.

Parameters:
gel -

init

public void init()
Pre-relaxes and starts a visRunner thread Passes thru to the model


restart

public void restart()
Restarts layout, then calls init(); passes thru to the model


setVisible

public void setVisible(boolean aFlag)
Overrides:
setVisible in class JComponent
See Also:
JComponent.setVisible(boolean)

prerelax

public void prerelax()
convenience pass-thru to the model


start

protected void start()
convenience pass-thru to the model


suspend

public void suspend()
convenience pass-thru to the model


unsuspend

public void unsuspend()
convenience pass-thru to the model


isPicked

public boolean isPicked(Vertex v)
Deprecated. Use getPickedState.isPicked(e).


isPicked

public boolean isPicked(Edge e)
Deprecated. Use getPickedState.isPicked(e).


pick

protected void pick(Vertex picked,
                    boolean b)
Deprecated. Use getPickedState.pick(picked, b).


isVisRunnerRunning

public boolean isVisRunnerRunning()
Returns a flag that says whether the visRunner thread is running. If it is not, then you may need to restart the thread.


scale

public void scale(double scalex,
                  double scaley)
Deprecated. access via getViewTransformer method

setter for the scale fires a PropertyChangeEvent with the AffineTransforms representing the previous and new values for scale and offset

Parameters:
scalex -
scaley -

scale

public void scale(double scalex,
                  double scaley,
                  Point2D from)
Deprecated. access via getViewTransformer method

have the model scale the graph with the passed parameters. If 'from' is null, use the center of this View as the center to scale from

Parameters:
scalex -
scaley -
from -

setScale

public void setScale(double scalex,
                     double scaley)
Deprecated. access via getViewTransformer method

have the model replace the transform scale values with the passed parameters

Parameters:
scalex -
scaley -

setScale

public void setScale(double scalex,
                     double scaley,
                     Point2D from)
Deprecated. access via getViewTransformer method

Have the model replace the transform scale values with the passed parameters. If 'from' is null, use this View's center as the center to scale from.

Parameters:
scalex -
scaley -

getScaleX

public double getScaleX()
Deprecated. access via getViewTransformer method

getter for scalex

Returns:
scalex

getScaleY

public double getScaleY()
Deprecated. access via getViewTransformer method

getter for scaley


getOffsetX

public double getOffsetX()
Deprecated. use getTranslateX

getter for offsetx


getTranslateX

public double getTranslateX()
Deprecated. access via getViewTransformer method

gets the translateX from the model

Returns:
the translateX

getOffsetY

public double getOffsetY()
Deprecated. use getTranslateY()

getter for offsety


getTranslateY

public double getTranslateY()
Deprecated. access via getViewTransformer method

gets the translateY from the model

Returns:
the translateY

setOffset

public void setOffset(double offsetx,
                      double offsety)
Deprecated. use setTranslate(double, offset, double offset)

set the offset values that will be used in the translation component of the graph rendering transform. Changes the transform to the identity transform, then sets the translation conponents to the passed values Fires a PropertyChangeEvent with the AffineTransforms representing the previous and new values for the transform

Parameters:
offsetx -
offsety -

setTranslate

public void setTranslate(double tx,
                         double ty)
Deprecated. access via getViewTransformer method

sets the translate x,y in the model previous translate values are lost

Parameters:
tx -
ty -

translate

public void translate(double tx,
                      double ty)
Deprecated. access via getViewTransformer method

Translates the model's current transform by tX and ty.


inverseTransform

public Point2D inverseTransform(Point2D p)
Transform the mouse point with the inverse transform of the VisualizationViewer. This maps from screen coordinates to graph coordinates.

Specified by:
inverseTransform in interface Transformer
Parameters:
p - the point to transform (typically, a mouse point)
Returns:
a transformed Point2D

inverseViewTransform

public Point2D inverseViewTransform(Point2D p)
Description copied from interface: ViewTransformer
convert the supplied screen coordinate to the graph coordinate.

Specified by:
inverseViewTransform in interface ViewTransformer
Parameters:
p - screen point to convert
Returns:
the graph point

inverseLayoutTransform

public Point2D inverseLayoutTransform(Point2D p)
Description copied from interface: LayoutTransformer
convert the supplied screen coordinate to the graph coordinate.

Specified by:
inverseLayoutTransform in interface LayoutTransformer
Parameters:
p - screen point to convert
Returns:
the graph point

transform

public Point2D transform(Point2D p)
Transform the mouse point with the current transform of the VisualizationViewer. This maps from graph coordinates to screen coordinates.

Specified by:
transform in interface Transformer
Parameters:
p - the point to transform
Returns:
a transformed Point2D

viewTransform

public Point2D viewTransform(Point2D p)
Description copied from interface: ViewTransformer
convert the supplied graph coordinate to the screen coordinate

Specified by:
viewTransform in interface ViewTransformer
Parameters:
p - graph point to convert
Returns:
screen point

layoutTransform

public Point2D layoutTransform(Point2D p)
Description copied from interface: LayoutTransformer
convert the supplied graph coordinate to the screen coordinate

Specified by:
layoutTransform in interface LayoutTransformer
Parameters:
p - graph point to convert
Returns:
screen point

setViewTransformer

public void setViewTransformer(MutableTransformer transformer)
Parameters:
transformer - The transformer to set.

setLayoutTransformer

public void setLayoutTransformer(MutableTransformer transformer)

getViewTransformer

public MutableTransformer getViewTransformer()

getLayoutTransformer

public MutableTransformer getLayoutTransformer()

getRenderingHints

public Map getRenderingHints()
Returns:
Returns the renderingHints.

setRenderingHints

public void setRenderingHints(Map renderingHints)
Parameters:
renderingHints - The renderingHints to set.

paintComponent

protected void paintComponent(Graphics g)
Overrides:
paintComponent in class JComponent

renderGraph

protected void renderGraph(Graphics2D g2d)

average

protected double average(long[] paintTimes)
Returns the double average of a number of long values.

Parameters:
paintTimes - an array of longs
Returns:
the average of the doubles

stop

public void stop()
convenience pass-thru to model


setToolTipListener

public void setToolTipListener(VisualizationViewer.ToolTipListener listener)
sets the tooltip listener to the user's defined implementation of ToolTipListener

Parameters:
listener - the listener to ser

setToolTipFunction

public void setToolTipFunction(ToolTipFunction toolTipFunction)

getToolTipText

public String getToolTipText(MouseEvent event)
called by the superclass to display tooltips

Overrides:
getToolTipText in class JComponent

addPreRenderPaintable

public void addPreRenderPaintable(VisualizationViewer.Paintable paintable)
Parameters:
paintable - The paintable to add.

removePreRenderPaintable

public void removePreRenderPaintable(VisualizationViewer.Paintable paintable)
Parameters:
paintable - The paintable to remove.

addPostRenderPaintable

public void addPostRenderPaintable(VisualizationViewer.Paintable paintable)
Parameters:
paintable - The paintable to add.

removePostRenderPaintable

public void removePostRenderPaintable(VisualizationViewer.Paintable paintable)
Parameters:
paintable - The paintable to remove.

addChangeListener

public void addChangeListener(ChangeListener l)
Adds a ChangeListener.

Specified by:
addChangeListener in interface ChangeEventSupport
Parameters:
l - the listener to be added

removeChangeListener

public void removeChangeListener(ChangeListener l)
Removes a ChangeListener.

Specified by:
removeChangeListener in interface ChangeEventSupport
Parameters:
l - the listener to be removed

getChangeListeners

public ChangeListener[] getChangeListeners()
Returns an array of all the ChangeListeners added with addChangeListener().

Specified by:
getChangeListeners in interface ChangeEventSupport
Returns:
all of the ChangeListeners added or an empty array if no listeners have been added

fireStateChanged

public void fireStateChanged()
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created.

Specified by:
fireStateChanged in interface ChangeEventSupport
See Also:
EventListenerList

getPickedState

public PickedState getPickedState()
Returns:
Returns the pickedState.

setPickedState

public void setPickedState(PickedState pickedState)
Parameters:
pickedState - The pickedState to set.

getPickSupport

public PickSupport getPickSupport()
Returns:
Returns the pickSupport.

setPickSupport

public void setPickSupport(PickSupport pickSupport)
Parameters:
pickSupport - The pickSupport to set.

getCenter

public Point2D getCenter()