Class EditingGraphMousePlugin<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
-
- edu.uci.ics.jung.visualization.control.EditingGraphMousePlugin<V,E>
-
- All Implemented Interfaces:
GraphMousePlugin
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.util.EventListener
public class EditingGraphMousePlugin<V,E> extends AbstractGraphMousePlugin implements java.awt.event.MouseListener, java.awt.event.MouseMotionListener
A plugin that can create vertices, undirected edges, and directed edges using mouse gestures.
-
-
Field Summary
Fields Modifier and Type Field Description protected VisualizationServer.Paintable
arrowPaintable
protected java.awt.Shape
arrowShape
protected java.awt.geom.Point2D
down
protected org.apache.commons.collections4.Factory<E>
edgeFactory
protected edu.uci.ics.jung.graph.util.EdgeType
edgeIsDirected
protected VisualizationServer.Paintable
edgePaintable
protected java.awt.Shape
edgeShape
protected java.awt.Shape
rawArrowShape
protected java.awt.geom.CubicCurve2D
rawEdge
protected V
startVertex
protected org.apache.commons.collections4.Factory<V>
vertexFactory
-
Fields inherited from class edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
cursor, modifiers
-
-
Constructor Summary
Constructors Constructor Description EditingGraphMousePlugin(int modifiers, org.apache.commons.collections4.Factory<V> vertexFactory, org.apache.commons.collections4.Factory<E> edgeFactory)
create instance and prepare shapes for visual effectsEditingGraphMousePlugin(org.apache.commons.collections4.Factory<V> vertexFactory, org.apache.commons.collections4.Factory<E> edgeFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkModifiers(java.awt.event.MouseEvent e)
Overridden to be more flexible, and pass events with key combinations.void
mouseClicked(java.awt.event.MouseEvent e)
void
mouseDragged(java.awt.event.MouseEvent e)
If startVertex is non-null, stretch an edge shape between startVertex and the mouse pointer to simulate edge creationvoid
mouseEntered(java.awt.event.MouseEvent e)
void
mouseExited(java.awt.event.MouseEvent e)
void
mouseMoved(java.awt.event.MouseEvent e)
void
mousePressed(java.awt.event.MouseEvent e)
If the mouse is pressed in an empty area, create a new vertex there.void
mouseReleased(java.awt.event.MouseEvent e)
If startVertex is non-null, and the mouse is released over an existing vertex, create an undirected edge from startVertex to the vertex under the mouse pointer.-
Methods inherited from class edu.uci.ics.jung.visualization.control.AbstractGraphMousePlugin
getCursor, getModifiers, setCursor, setModifiers
-
-
-
-
Field Detail
-
startVertex
protected V startVertex
-
down
protected java.awt.geom.Point2D down
-
rawEdge
protected java.awt.geom.CubicCurve2D rawEdge
-
edgeShape
protected java.awt.Shape edgeShape
-
rawArrowShape
protected java.awt.Shape rawArrowShape
-
arrowShape
protected java.awt.Shape arrowShape
-
edgePaintable
protected VisualizationServer.Paintable edgePaintable
-
arrowPaintable
protected VisualizationServer.Paintable arrowPaintable
-
edgeIsDirected
protected edu.uci.ics.jung.graph.util.EdgeType edgeIsDirected
-
vertexFactory
protected org.apache.commons.collections4.Factory<V> vertexFactory
-
edgeFactory
protected org.apache.commons.collections4.Factory<E> edgeFactory
-
-
Method Detail
-
checkModifiers
public boolean checkModifiers(java.awt.event.MouseEvent e)
Overridden to be more flexible, and pass events with key combinations. The default responds to both ButtonOne and ButtonOne+Shift- Specified by:
checkModifiers
in interfaceGraphMousePlugin
- Overrides:
checkModifiers
in classAbstractGraphMousePlugin
- Parameters:
e
- an event to compare to- Returns:
- whether the member modifers match the event modifiers
-
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
If the mouse is pressed in an empty area, create a new vertex there. If the mouse is pressed on an existing vertex, prepare to create an edge from that vertex to another- Specified by:
mousePressed
in interfacejava.awt.event.MouseListener
-
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
If startVertex is non-null, and the mouse is released over an existing vertex, create an undirected edge from startVertex to the vertex under the mouse pointer. If shift was also pressed, create a directed edge instead.- Specified by:
mouseReleased
in interfacejava.awt.event.MouseListener
-
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
If startVertex is non-null, stretch an edge shape between startVertex and the mouse pointer to simulate edge creation- Specified by:
mouseDragged
in interfacejava.awt.event.MouseMotionListener
-
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
mouseClicked
in interfacejava.awt.event.MouseListener
-
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEntered
in interfacejava.awt.event.MouseListener
-
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExited
in interfacejava.awt.event.MouseListener
-
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- Specified by:
mouseMoved
in interfacejava.awt.event.MouseMotionListener
-
-