Package casa.lepton.ui
Class EdgeDrawer
java.lang.Object
casa.lepton.ui.EdgeDrawer
- All Implemented Interfaces:
KeyListener
,MouseListener
,MouseMotionListener
,EventListener
,org.graphstream.ui.swingViewer.LayerRenderer
public class EdgeDrawer
extends Object
implements KeyListener, MouseListener, MouseMotionListener, org.graphstream.ui.swingViewer.LayerRenderer
Class used in "manual mode" (ie when no IN_DGS nor WALK_CLASS is supplied) to
allow to add and delete edges "manually".
An edge is added by dragging from a source node to a target node. An edge is
removed by selected it and then pressing the 'delete' key.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
enable
(boolean enable) Enable or disable the ability to draw or delete edgesvoid
keyPressed
(KeyEvent ke) void
keyReleased
(KeyEvent ke) void
void
Select and/or unselect an edgevoid
void
void
void
mouseMoved
(MouseEvent me) void
Initialize dragging if the mouse is pressed on a nodevoid
Add an edge if dragging ends on a nodevoid
render
(Graphics2D graphics, org.graphstream.ui.graphicGraph.GraphicGraph graph, double px2Gu, int widthPx, int heightPx, double minXGu, double minYGu, double maxXGu, double maxYGu)
-
Constructor Details
-
EdgeDrawer
-
-
Method Details
-
enable
public void enable(boolean enable) Enable or disable the ability to draw or delete edges- Parameters:
enable
- true if this object must be enabled
-
mouseClicked
Select and/or unselect an edge- Specified by:
mouseClicked
in interfaceMouseListener
- Parameters:
me
- the mouse event
-
mousePressed
Initialize dragging if the mouse is pressed on a node- Specified by:
mousePressed
in interfaceMouseListener
- Parameters:
me
- the mouse event
-
mouseReleased
Add an edge if dragging ends on a node- Specified by:
mouseReleased
in interfaceMouseListener
- Parameters:
me
- the mouse event
-
mouseEntered
- Specified by:
mouseEntered
in interfaceMouseListener
-
mouseExited
- Specified by:
mouseExited
in interfaceMouseListener
-
mouseDragged
- Specified by:
mouseDragged
in interfaceMouseMotionListener
-
mouseMoved
- Specified by:
mouseMoved
in interfaceMouseMotionListener
-
keyTyped
- Specified by:
keyTyped
in interfaceKeyListener
-
keyPressed
- Specified by:
keyPressed
in interfaceKeyListener
-
keyReleased
- Specified by:
keyReleased
in interfaceKeyListener
-
render
public void render(Graphics2D graphics, org.graphstream.ui.graphicGraph.GraphicGraph graph, double px2Gu, int widthPx, int heightPx, double minXGu, double minYGu, double maxXGu, double maxYGu) - Specified by:
render
in interfaceorg.graphstream.ui.swingViewer.LayerRenderer
-