edu.ksu.cis.bnj.gui.components
Class EdgeState

java.lang.Object
  extended bysalvo.jesus.graph.visual.GraphPanelState
      extended bysalvo.jesus.graph.visual.GraphPanelEdgeState
          extended byedu.ksu.cis.bnj.gui.components.EdgeState
All Implemented Interfaces:
java.io.Serializable

public class EdgeState
extends salvo.jesus.graph.visual.GraphPanelEdgeState

State object that represents the edge mode in a GraphPanel. Edge mode being the ability to add an edge interactively by dragging the mouse from a vertex and releasing the mouse on another vertex.

Author:
Jesus M. Salvo Jr. With a little modification here and there to eliminate stack trace errors. And also hooks here and there -- Roby Joehanes
See Also:
Serialized Form

Field Summary
protected  java.awt.Cursor edgecursor
          A cross-hair Cursor object
protected  salvo.jesus.graph.visual.GraphPanel gpanel
           
protected static java.awt.BasicStroke marquee
           
protected  NodeManager owner
           
protected  java.awt.Cursor previouscursor
          Existing cursor prior to changing the cursor to a cross-hair
protected  java.awt.geom.Line2D.Double probableedgeline
          Line2D object that is drawn when an edge is being interactively created.
protected  salvo.jesus.graph.visual.VisualVertex sourcevertex
          Reference to the VisualVertex object selected during the mousePressed() method.
 
Constructor Summary
EdgeState(NodeManager owner, salvo.jesus.graph.visual.GraphPanel gpanel)
          Creates a GraphPanelEdgeState object for the specified GraphPanel object.
 
Method Summary
 salvo.jesus.graph.visual.GraphPanelState mouseDragged(java.awt.event.MouseEvent e)
          If there was a vertex clicked during the start of the drag (during the mousePressed() event), draw a line from the source vertex to the current coordinate.
 salvo.jesus.graph.visual.GraphPanelState mouseMoved(java.awt.event.MouseEvent e)
          This method sets the cursor to a crosshair whenever the cursor enters a VisualVertex object.
 salvo.jesus.graph.visual.GraphPanelState mousePressed(java.awt.event.MouseEvent e)
          Identifies the source vertex of a new Edge being created.
 salvo.jesus.graph.visual.GraphPanelState mouseReleased(java.awt.event.MouseEvent e)
          Signifies the end of a drag.
 void paint(java.awt.Graphics2D g2d)
          Call VisualGraph.paint() method, passing the Graphics2D context and the probable edge line to be drawn
 
Methods inherited from class salvo.jesus.graph.visual.GraphPanelState
informTargetVisualGraphComponentOfKeyEvent, informTargetVisualGraphComponentOfMouseEvent, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, recommendState, setGraphPanel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sourcevertex

protected salvo.jesus.graph.visual.VisualVertex sourcevertex
Reference to the VisualVertex object selected during the mousePressed() method. This identifies the source vertex of an edge being created.


probableedgeline

protected java.awt.geom.Line2D.Double probableedgeline
Line2D object that is drawn when an edge is being interactively created.


edgecursor

protected java.awt.Cursor edgecursor
A cross-hair Cursor object


previouscursor

protected java.awt.Cursor previouscursor
Existing cursor prior to changing the cursor to a cross-hair


gpanel

protected salvo.jesus.graph.visual.GraphPanel gpanel

owner

protected NodeManager owner

marquee

protected static java.awt.BasicStroke marquee
Constructor Detail

EdgeState

public EdgeState(NodeManager owner,
                 salvo.jesus.graph.visual.GraphPanel gpanel)
Creates a GraphPanelEdgeState object for the specified GraphPanel object.

Method Detail

mousePressed

public salvo.jesus.graph.visual.GraphPanelState mousePressed(java.awt.event.MouseEvent e)
Identifies the source vertex of a new Edge being created.


mouseReleased

public salvo.jesus.graph.visual.GraphPanelState mouseReleased(java.awt.event.MouseEvent e)
Signifies the end of a drag. If there was a vertex clicked during the start of the drag (during the mousePressed() event) and there is a vertex at the end of the drag, then an edge is added to the graph, and the mouse cursor is returned to its original.


mouseDragged

public salvo.jesus.graph.visual.GraphPanelState mouseDragged(java.awt.event.MouseEvent e)
If there was a vertex clicked during the start of the drag (during the mousePressed() event), draw a line from the source vertex to the current coordinate.


mouseMoved

public salvo.jesus.graph.visual.GraphPanelState mouseMoved(java.awt.event.MouseEvent e)
This method sets the cursor to a crosshair whenever the cursor enters a VisualVertex object. The cursor is reset to its original when the mouse cursor leaves a VisualVertex object.


paint

public void paint(java.awt.Graphics2D g2d)
Call VisualGraph.paint() method, passing the Graphics2D context and the probable edge line to be drawn