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

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

public class NormalState
extends salvo.jesus.graph.visual.GraphPanelNormalState

State object that represents the normal mode in a GraphPanel. Normal mode being 1) drag vertex and right click on VisualGraphComponents to cause a popup menu to be displayed.

Author:
Jesus M. Salvo Jr. With some adjustments and adding selection box for multiple item selection -- Roby Joehanes
See Also:
Serialized Form

Field Summary
protected  salvo.jesus.graph.visual.GraphPanel gpanel
           
protected static java.awt.BasicStroke marquee
           
protected  java.awt.Cursor movecursor
          A Cursor object of type Cursor.MOVE_CURSOR
protected  NodeManager owner
           
protected  int previous_x
          Stores the previous x-coordinate of targetedvertex when dragging a VisualVertex object.
protected  int previous_y
          Stores the previous y-coordinate of targetedvertex when dragging a VisualVertex object.
protected  java.awt.Cursor previouscursor
          Existing cursor prior to changing the cursor.
protected  java.awt.Rectangle selectionBox
           
protected  salvo.jesus.graph.visual.VisualEdge targetedge
          VisualEdge object selected during the mousePressed() method
protected  salvo.jesus.graph.visual.VisualVertex targetvertex
          VisualVertex object selected during the mousePressed() method
 
Constructor Summary
NormalState(NodeManager owner, salvo.jesus.graph.visual.GraphPanel gpanel)
          Creates a GraphPanelNormalState object for the specified GraphPanel object.
 
Method Summary
 salvo.jesus.graph.visual.GraphPanelState mouseDragged(java.awt.event.MouseEvent e)
          If there was a VisualVertex object selected during the mousePressed() method, then drag the VisualVertex object to the new location specfied by the MouseEvent e.
 salvo.jesus.graph.visual.GraphPanelState mouseMoved(java.awt.event.MouseEvent e)
          This method sets the cursor to a MOVE_CURSOR whenever the cursor enters a VisualVertex object.
 salvo.jesus.graph.visual.GraphPanelState mousePressed(java.awt.event.MouseEvent e)
          If there is a VisualGraphComponent at the coordinate specified in the MouseEvent e, then a JPopupMenu will be shown by calling the popup() method whose context is the selected VisualGraphComponent.
 salvo.jesus.graph.visual.GraphPanelState mouseReleased(java.awt.event.MouseEvent e)
          Shows a popup menu if there was a VisualGraphComponent during the mousePressed() event.
 void paint(java.awt.Graphics2D g2d)
           
 
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

targetvertex

protected salvo.jesus.graph.visual.VisualVertex targetvertex
VisualVertex object selected during the mousePressed() method


targetedge

protected salvo.jesus.graph.visual.VisualEdge targetedge
VisualEdge object selected during the mousePressed() method


previouscursor

protected java.awt.Cursor previouscursor
Existing cursor prior to changing the cursor.


movecursor

protected java.awt.Cursor movecursor
A Cursor object of type Cursor.MOVE_CURSOR


previous_x

protected int previous_x
Stores the previous x-coordinate of targetedvertex when dragging a VisualVertex object.


previous_y

protected int previous_y
Stores the previous y-coordinate of targetedvertex when dragging a VisualVertex object.


gpanel

protected salvo.jesus.graph.visual.GraphPanel gpanel

owner

protected NodeManager owner

marquee

protected static java.awt.BasicStroke marquee

selectionBox

protected java.awt.Rectangle selectionBox
Constructor Detail

NormalState

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

Method Detail

mousePressed

public salvo.jesus.graph.visual.GraphPanelState mousePressed(java.awt.event.MouseEvent e)
If there is a VisualGraphComponent at the coordinate specified in the MouseEvent e, then a JPopupMenu will be shown by calling the popup() method whose context is the selected VisualGraphComponent.


mouseReleased

public salvo.jesus.graph.visual.GraphPanelState mouseReleased(java.awt.event.MouseEvent e)
Shows a popup menu if there was a VisualGraphComponent during the mousePressed() event.


mouseDragged

public salvo.jesus.graph.visual.GraphPanelState mouseDragged(java.awt.event.MouseEvent e)
If there was a VisualVertex object selected during the mousePressed() method, then drag the VisualVertex object to the new location specfied by the MouseEvent e.


paint

public void paint(java.awt.Graphics2D g2d)

mouseMoved

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