Class AnnotatingGraphMousePlugin<V,E>
java.lang.Object
edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) classthe Paintable that draws a Shape annotation only while it is being created -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanset to true when the AnnotationPaintable has been added to the view componentprotected intadditional modifiers for the action of adding to an existing selectionprotected Colorcolor for annotationsprotected AnnotationManagera Paintable to store all Annotationsprotected MultiLayerTransformerholds rendering transformsprotected booleanprotected Annotation.Layerlayer for annotationsprotected VisualizationServer.Paintablethe Paintable for the Shape annotationprotected RenderContext<V, E> holds rendering settingsprotected RectangularShapeused to draw a Shape annotationFields inherited from class AbstractGraphMousePlugin
cursor, down, modifiers -
Constructor Summary
ConstructorsConstructorDescriptionCreate 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
Modifier and TypeMethodDescriptiongetLayer()booleanisFill()voidvoidDraws the transient Paintable that will become a Shape annotation when the mouse button is releasedvoidvoidvoidvoidSets the location for an Annotation.voidCompletes the process of adding a Shape annotation and removed the transient paintablevoidsetAnnotationColor(Color lensColor) voidsetFill(boolean fill) voidsetLayer(Annotation.Layer layer) voidMethods inherited from class AbstractGraphMousePlugin
checkModifiers, getCursor, getModifiers, setCursor, setModifiers
-
Field Details
-
additionalModifiers
protected int additionalModifiersadditional modifiers for the action of adding to an existing selection -
rectangularShape
used to draw a Shape annotation -
lensPaintable
the Paintable for the Shape annotation -
annotationManager
a Paintable to store all Annotations -
annotationColor
color for annotations -
layer
layer for annotations -
fill
protected boolean fill -
basicTransformer
holds rendering transforms -
rc
holds rendering settings -
added
protected boolean addedset to true when the AnnotationPaintable has been added to the view component
-
-
Constructor Details
-
AnnotatingGraphMousePlugin
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 Details
-
getAnnotationColor
- Returns:
- Returns the lensColor.
-
setAnnotationColor
- Parameters:
lensColor- The lensColor to set.
-
mousePressed
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
Completes the process of adding a Shape annotation and removed the transient paintable- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseDragged
Draws the transient Paintable that will become a Shape annotation when the mouse button is released- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
- Specified by:
mouseExitedin interfaceMouseListener
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener
-
getRectangularShape
- Returns:
- the rect
-
setRectangularShape
- Parameters:
rect- the rect to set
-
getLayer
- Returns:
- the layer
-
setLayer
- 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
-