Class AnnotatingGraphMousePlugin<V,E>
- java.lang.Object
-
- org.jungrapht.visualization.control.AbstractGraphMousePlugin
-
- org.jungrapht.visualization.annotations.AnnotatingGraphMousePlugin<V,E>
-
- All Implemented Interfaces:
MouseListener,MouseMotionListener,EventListener,GraphMousePlugin
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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jungrapht.visualization.control.AbstractGraphMousePlugin
AbstractGraphMousePlugin.Selecting
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanaddedset to true when the AnnotationPaintable has been added to the view componentprotected intadditionalModifiersadditional modifiers for the action of adding to an existing selectionprotected ColorannotationColorcolor for annotationsprotected AnnotationManagerannotationManagera Paintable to store all Annotationsprotected MultiLayerTransformerbasicTransformerholds rendering transformsprotected booleanfillprotected Annotation.Layerlayerlayer for annotationsprotected VisualizationServer.PaintablelensPaintablethe Paintable for the Shape annotationprotected intmodifiersprotected RenderContext<V,E>rcholds rendering settingsprotected RectangularShaperectangularShapeused to draw a Shape annotation-
Fields inherited from class org.jungrapht.visualization.control.AbstractGraphMousePlugin
cursor, down
-
-
Constructor Summary
Constructors Constructor Description AnnotatingGraphMousePlugin(RenderContext<V,E> rc)Create an instance with defaults for primary (button 1) and secondary (button 1 + shift) selection.AnnotatingGraphMousePlugin(RenderContext<V,E> rc, int selectionModifiers, int additionalModifiers)Create an instance with the specified primary and secondary selection mechanisms.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ColorgetAnnotationColor()Annotation.LayergetLayer()RectangularShapegetRectangularShape()booleanisFill()voidmouseClicked(MouseEvent e)voidmouseDragged(MouseEvent e)Draws the transient Paintable that will become a Shape annotation when the mouse button is releasedvoidmouseEntered(MouseEvent e)voidmouseExited(MouseEvent e)voidmouseMoved(MouseEvent e)voidmousePressed(MouseEvent e)Sets the location for an Annotation.voidmouseReleased(MouseEvent e)Completes the process of adding a Shape annotation and removed the transient paintablevoidsetAnnotationColor(Color lensColor)voidsetFill(boolean fill)voidsetLayer(Annotation.Layer layer)voidsetRectangularShape(RectangularShape rect)-
Methods inherited from class org.jungrapht.visualization.control.AbstractGraphMousePlugin
checkModifiers, getCursor, getModifiersEx, setCursor, setModifiers
-
-
-
-
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
-
modifiers
protected int modifiers
-
-
Constructor Detail
-
AnnotatingGraphMousePlugin
public AnnotatingGraphMousePlugin(RenderContext<V,E> rc)
Create an instance with defaults for primary (button 1) and secondary (button 1 + shift) selection.- Parameters:
rc- the RenderContext for which this plugin will be used
-
AnnotatingGraphMousePlugin
public AnnotatingGraphMousePlugin(RenderContext<V,E> rc, int selectionModifiers, int additionalModifiers)
Create an instance with the specified primary and secondary selection mechanisms.- Parameters:
rc- the RenderContext for which this plugin will be usedselectionModifiers- for primary selectionadditionalModifiers- 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:
mousePressedin interfaceMouseListener- 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:
mouseReleasedin interfaceMouseListener
-
mouseDragged
public void mouseDragged(MouseEvent e)
Draws the transient Paintable that will become a Shape annotation when the mouse button is released- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
mouseClicked
public void mouseClicked(MouseEvent e)
- Specified by:
mouseClickedin interfaceMouseListener
-
mouseEntered
public void mouseEntered(MouseEvent e)
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
public void mouseExited(MouseEvent e)
- Specified by:
mouseExitedin interfaceMouseListener
-
mouseMoved
public void mouseMoved(MouseEvent e)
- Specified by:
mouseMovedin interfaceMouseMotionListener
-
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
-
-