edu.iastate.reload.ui
Class MyMarqueeHandler

java.lang.Object
  extended by org.jgraph.graph.BasicMarqueeHandler
      extended by edu.iastate.reload.ui.MyMarqueeHandler

public class MyMarqueeHandler
extends org.jgraph.graph.BasicMarqueeHandler

support node and edge drawing, adapted from GPMarqueeHandler of JGraphpad

Author:
Jie Li

Field Summary
protected  org.jgraph.graph.PortView firstPort
          first position of the edge
protected  org.jgraph.graph.PortView lastPort
          last position of the edge
(package private) static org.apache.log4j.Logger logger
          log4j facility
protected  boolean remanent
          A boolean telling wether or not a button creating an Edge or a Vertex should be remanent or not.
 
Fields inherited from class org.jgraph.graph.BasicMarqueeHandler
currentPoint, marqueeBounds, previousCursor, startPoint
 
Constructor Summary
MyMarqueeHandler()
           
MyMarqueeHandler(NetworkEditForm form)
           
 
Method Summary
 org.jgraph.graph.GraphCell addEdge(java.awt.geom.Point2D start, java.awt.geom.Point2D current, org.jgraph.graph.PortView firstPort, org.jgraph.graph.PortView port)
           
 org.jgraph.graph.GraphCell addVertexnPorts(java.awt.geom.Rectangle2D bounds)
          This is a convenient hook to automatically add a cell, its ports and a custom user object.
 org.jgraph.graph.AttributeMap getAttributeMap(org.jgraph.graph.GraphCell cell, java.awt.geom.Rectangle2D bounds)
          You can override how the view attributes of the cell are created
 java.lang.String getPortName(int i)
          Unless the cell is created with differenciated port names, ports are all called undifferenciated_port followed by the i indice.
 org.jgraph.graph.PortView getPortViewAt(int x, int y)
           
 double[] getXPortsList()
          By default a cell don't have ports
 double[] getYPortsList()
          By default a cell don't have ports
 boolean hasFlottingPort()
          By default there aren't any floatting port.
 boolean isForceMarqueeEvent(java.awt.event.MouseEvent e)
           
protected  boolean isPopupTrigger(java.awt.event.MouseEvent e)
          detect if this is a right click mouse request
 void mouseDragged(java.awt.event.MouseEvent event)
           
 void mouseMoved(java.awt.event.MouseEvent event)
           
 void mousePressed(java.awt.event.MouseEvent event)
           
 void mouseReleased(java.awt.event.MouseEvent event)
           
 void overlay(org.jgraph.JGraph gpgraph, java.awt.Graphics g, boolean clear)
           
protected  java.awt.geom.Rectangle2D reSize(java.awt.geom.Rectangle2D bounds)
          By default we don't resize the cell but this may be be overriden in order to implement an automatic resizing...
 
Methods inherited from class org.jgraph.graph.BasicMarqueeHandler
getCurrentPoint, getGraphForEvent, getMarqueeBounds, getPreviousCursor, getStartPoint, handleMarqueeEvent, isMarqueeTriggerEvent, paint, processMouseDraggedEvent, setCurrentPoint, setMarqueeBounds, setPreviousCursor, setStartPoint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.log4j.Logger logger
log4j facility


firstPort

protected org.jgraph.graph.PortView firstPort
first position of the edge


lastPort

protected org.jgraph.graph.PortView lastPort
last position of the edge


remanent

protected boolean remanent
A boolean telling wether or not a button creating an Edge or a Vertex should be remanent or not. If true, then you will continue with this button selectionned while if false you will the selection action will be restored after you added a cell.

Constructor Detail

MyMarqueeHandler

public MyMarqueeHandler()

MyMarqueeHandler

public MyMarqueeHandler(NetworkEditForm form)
Method Detail

getPortViewAt

public org.jgraph.graph.PortView getPortViewAt(int x,
                                               int y)

overlay

public void overlay(org.jgraph.JGraph gpgraph,
                    java.awt.Graphics g,
                    boolean clear)
Overrides:
overlay in class org.jgraph.graph.BasicMarqueeHandler

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent event)
Overrides:
mouseDragged in class org.jgraph.graph.BasicMarqueeHandler

isForceMarqueeEvent

public boolean isForceMarqueeEvent(java.awt.event.MouseEvent e)
Overrides:
isForceMarqueeEvent in class org.jgraph.graph.BasicMarqueeHandler

isPopupTrigger

protected boolean isPopupTrigger(java.awt.event.MouseEvent e)
detect if this is a right click mouse request

Parameters:
e - the event
Returns:
the popup trigger

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent event)
Overrides:
mouseMoved in class org.jgraph.graph.BasicMarqueeHandler

mousePressed

public void mousePressed(java.awt.event.MouseEvent event)
Overrides:
mousePressed in class org.jgraph.graph.BasicMarqueeHandler

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent event)
Overrides:
mouseReleased in class org.jgraph.graph.BasicMarqueeHandler

addEdge

public org.jgraph.graph.GraphCell addEdge(java.awt.geom.Point2D start,
                                          java.awt.geom.Point2D current,
                                          org.jgraph.graph.PortView firstPort,
                                          org.jgraph.graph.PortView port)

addVertexnPorts

public org.jgraph.graph.GraphCell addVertexnPorts(java.awt.geom.Rectangle2D bounds)
This is a convenient hook to automatically add a cell, its ports and a custom user object. Especially override in priority some of the other methods of this class in order to meet your needs.

Parameters:
bounds -

hasFlottingPort

public boolean hasFlottingPort()
By default there aren't any floatting port. If you want some, then you will get a better graphical result by implementing the getPerimeterPoint method in the renderer of the cell view.

Returns:
boolean

getPortName

public java.lang.String getPortName(int i)
Unless the cell is created with differenciated port names, ports are all called undifferenciated_port followed by the i indice.

Parameters:
i - int
Returns:
String

getAttributeMap

public org.jgraph.graph.AttributeMap getAttributeMap(org.jgraph.graph.GraphCell cell,
                                                     java.awt.geom.Rectangle2D bounds)
You can override how the view attributes of the cell are created

Parameters:
cell -
bounds -
Returns:
a new attribute map with the defined bounds

reSize

protected java.awt.geom.Rectangle2D reSize(java.awt.geom.Rectangle2D bounds)
By default we don't resize the cell but this may be be overriden in order to implement an automatic resizing...

Parameters:
bounds -
Returns:
the resized rectangle

getXPortsList

public double[] getXPortsList()
By default a cell don't have ports

Returns:
double[]

getYPortsList

public double[] getYPortsList()
By default a cell don't have ports

Returns:
double[]