edu.uci.ics.jung.visualization.annotations
Class AnnotatingGraphMousePlugin<V,E>

java.lang.Object
  extended by edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
      extended by edu.uci.ics.jung.visualization.annotations.AnnotatingGraphMousePlugin<V,E>
All Implemented Interfaces:
GraphMousePlugin, MouseListener, MouseMotionListener, EventListener

public class AnnotatingGraphMousePlugin<V,E>
extends AbstractGraphMousePlugin
implements MouseListener, MouseMotionListener

AnnotatingGraphMousePlugin can create Shape and Text annotations in a layer of the graph visualization.

Author:
Tom Nelson

Field Summary
protected  boolean added
          set to true when the AnnotationPaintable has been added to the view component
protected  int additionalModifiers
          additional modifiers for the action of adding to an existing selection
protected  Color annotationColor
          color for annotations
protected  AnnotationManager annotationManager
          a Paintable to store all Annotations
protected  MultiLayerTransformer basicTransformer
          holds rendering transforms
protected  boolean fill
           
protected  Annotation.Layer layer
          layer for annotations
protected  VisualizationServer.Paintable lensPaintable
          the Paintable for the Shape annotation
protected  RenderContext<V,E> rc
          holds rendering settings
protected  RectangularShape rectangularShape
          used to draw a Shape annotation
 
Fields inherited from class edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
cursor, down, modifiers
 
Constructor Summary
AnnotatingGraphMousePlugin(RenderContext<V,E> rc)
          create an instance with default settings
AnnotatingGraphMousePlugin(RenderContext<V,E> rc, int selectionModifiers, int additionalModifiers)
          create an instance with overides
 
Method Summary
 Color getAnnotationColor()
           
 Annotation.Layer getLayer()
           
 RectangularShape getRectangularShape()
           
 boolean isFill()
           
 void mouseClicked(MouseEvent e)
           
 void mouseDragged(MouseEvent e)
          Draws the transient Paintable that will become a Shape annotation when the mouse button is released
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void mousePressed(MouseEvent e)
          Sets the location for an Annotation.
 void mouseReleased(MouseEvent e)
          Completes the process of adding a Shape annotation and removed the transient paintable
 void setAnnotationColor(Color lensColor)
           
 void setFill(boolean fill)
           
 void setLayer(Annotation.Layer layer)
           
 void setRectangularShape(RectangularShape rect)
           
 
Methods inherited from class edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
checkModifiers, getCursor, getModifiers, setCursor, setModifiers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

additionalModifiers

protected int additionalModifiers
additional modifiers for the action of adding to an existing selection


rectangularShape

protected RectangularShape rectangularShape
used to draw a Shape annotation


lensPaintable

protected VisualizationServer.Paintable lensPaintable
the Paintable for the Shape annotation


annotationManager

protected AnnotationManager annotationManager
a Paintable to store all Annotations


annotationColor

protected Color annotationColor
color for annotations


layer

protected Annotation.Layer layer
layer for annotations


fill

protected boolean fill

basicTransformer

protected MultiLayerTransformer basicTransformer
holds rendering transforms


rc

protected RenderContext<V,E> rc
holds rendering settings


added

protected boolean added
set to true when the AnnotationPaintable has been added to the view component

Constructor Detail

AnnotatingGraphMousePlugin

public AnnotatingGraphMousePlugin(RenderContext<V,E> rc)
create an instance with default settings


AnnotatingGraphMousePlugin

public AnnotatingGraphMousePlugin(RenderContext<V,E> rc,
                                  int selectionModifiers,
                                  int additionalModifiers)
create an instance with overides

Parameters:
selectionModifiers - for primary selection
additionalModifiers - for additional selection
Method Detail

getAnnotationColor

public Color getAnnotationColor()
Returns:
Returns the lensColor.

setAnnotationColor

public void setAnnotationColor(Color lensColor)
Parameters:
lensColor - The lensColor to set.

mousePressed

public void mousePressed(MouseEvent e)
Sets the location for an Annotation. Will either pop up a dialog to prompt for text input for a text annotation, or begin the process of drawing a Shape annotation

Specified by:
mousePressed in interface MouseListener
Parameters:
e - the event

mouseReleased

public void mouseReleased(MouseEvent e)
Completes the process of adding a Shape annotation and removed the transient paintable

Specified by:
mouseReleased in interface MouseListener

mouseDragged

public void mouseDragged(MouseEvent e)
Draws the transient Paintable that will become a Shape annotation when the mouse button is released

Specified by:
mouseDragged in interface MouseMotionListener

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener

mouseMoved

public void mouseMoved(MouseEvent e)
Specified by:
mouseMoved in interface MouseMotionListener

getRectangularShape

public RectangularShape getRectangularShape()
Returns:
the rect

setRectangularShape

public void setRectangularShape(RectangularShape rect)
Parameters:
rect - the rect to set

getLayer

public Annotation.Layer getLayer()
Returns:
the layer

setLayer

public void setLayer(Annotation.Layer layer)
Parameters:
layer - the layer to set

isFill

public boolean isFill()
Returns:
the fill

setFill

public void setFill(boolean fill)
Parameters:
fill - the fill to set


Copyright © 2009. All Rights Reserved.