GoGraph
v1.0


gograph.base.graph
Class GGMarqueeHandler

java.lang.Object
  |
  +--org.jgraph.graph.BasicMarqueeHandler
        |
        +--gograph.base.graph.GGMarqueeHandler

public class GGMarqueeHandler
extends org.jgraph.graph.BasicMarqueeHandler

MarqueeHandler that connects vertices and displays popupmenus.

See Also:
GoGraph

Field Summary
protected  java.awt.Point current
           
protected  org.jgraph.graph.PortView firstPort
          Holds the first and the current port.
protected  GoGraph gograph
          Access back to GoGraph panel.
protected  org.jgraph.graph.PortView port
           
protected  java.awt.Point start
          Holds the start and the current point.
 
Fields inherited from class org.jgraph.graph.BasicMarqueeHandler
currentPoint, marqueeBounds, previousCursor, startPoint
 
Constructor Summary
GGMarqueeHandler(GoGraph gograph)
          Creates a new instance of GGMarqueeHandler.
 
Method Summary
 javax.swing.JPopupMenu createPopupMenu(java.awt.Point pt, java.lang.Object cell)
          Creates a JPopupMenu containing context available actions.
 org.jgraph.graph.Port[] getConnectingPorts()
          Returns the two selected ports for connection
 org.jgraph.graph.PortView getSourcePortAt(java.awt.Point point)
          Find a cell at point and return its first port as a PortView.
protected  org.jgraph.graph.PortView getTargetPortAt(java.awt.Point point)
          Find a cell at point and return its first port as a PortView.
 boolean isForceMarqueeEvent(java.awt.event.MouseEvent e)
          Override to gain control (for popupMenu and connectMode).
 void mouseDragged(java.awt.event.MouseEvent e)
          Find port under mouse and repaint connector.
 void mouseMoved(java.awt.event.MouseEvent e)
          Show special cursor if over port.
 void mousePressed(java.awt.event.MouseEvent e)
          Display popupMenu or remember start location and first port.
 void mouseReleased(java.awt.event.MouseEvent e)
          Connect the first port and the current port in the graph or repaint.
protected  void paintConnector(java.awt.Color fg, java.awt.Color bg, java.awt.Graphics g)
          Use xor-mode on graphics to paint connector.
protected  void paintPort(java.awt.Graphics g)
          Use the preview flag to draw a highlighted port.
 
Methods inherited from class org.jgraph.graph.BasicMarqueeHandler
getCurrentPoint, getMarqueeBounds, getPreviousCursor, getStartPoint, overlay, paint, setCurrentPoint, setMarqueeBounds, setPreviousCursor, setStartPoint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gograph

protected GoGraph gograph
Access back to GoGraph panel.


start

protected java.awt.Point start
Holds the start and the current point.


current

protected java.awt.Point current

firstPort

protected org.jgraph.graph.PortView firstPort
Holds the first and the current port.


port

protected org.jgraph.graph.PortView port
Constructor Detail

GGMarqueeHandler

public GGMarqueeHandler(GoGraph gograph)
Creates a new instance of GGMarqueeHandler.

Parameters:
gograph - Access back to GoGraph panel.
Method Detail

isForceMarqueeEvent

public boolean isForceMarqueeEvent(java.awt.event.MouseEvent e)
Override to gain control (for popupMenu and connectMode).

Overrides:
isForceMarqueeEvent in class org.jgraph.graph.BasicMarqueeHandler
Parameters:
e - Source mouse event.
Returns:
True if this handler should be preferred over other handlers.

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Display popupMenu or remember start location and first port.

Overrides:
mousePressed in class org.jgraph.graph.BasicMarqueeHandler
Parameters:
e - Source mouse event.

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Find port under mouse and repaint connector.

Overrides:
mouseDragged in class org.jgraph.graph.BasicMarqueeHandler
Parameters:
e - Source mouse event.

getSourcePortAt

public org.jgraph.graph.PortView getSourcePortAt(java.awt.Point point)
Find a cell at point and return its first port as a PortView.

Parameters:
point - Point where port is.
Returns:
Found PortView.

getTargetPortAt

protected org.jgraph.graph.PortView getTargetPortAt(java.awt.Point point)
Find a cell at point and return its first port as a PortView.

Parameters:
point - Point where cell is.
Returns:
Found PortView.

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Connect the first port and the current port in the graph or repaint.

Overrides:
mouseReleased in class org.jgraph.graph.BasicMarqueeHandler
Parameters:
e - Source mouse event.

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Show special cursor if over port.

Overrides:
mouseMoved in class org.jgraph.graph.BasicMarqueeHandler
Parameters:
e - Source mouse event.

paintConnector

protected void paintConnector(java.awt.Color fg,
                              java.awt.Color bg,
                              java.awt.Graphics g)
Use xor-mode on graphics to paint connector.

Parameters:
fg - Foreground color.
bg - Background color.
g - Graphics context.

paintPort

protected void paintPort(java.awt.Graphics g)
Use the preview flag to draw a highlighted port.

Parameters:
g - Graphics context.

createPopupMenu

public javax.swing.JPopupMenu createPopupMenu(java.awt.Point pt,
                                              java.lang.Object cell)
Creates a JPopupMenu containing context available actions.

Parameters:
pt - Point where to evaluate context.
cell - Cell on which to evaluate context.
Returns:
Created JPopupMenu.

getConnectingPorts

public org.jgraph.graph.Port[] getConnectingPorts()
Returns the two selected ports for connection

Returns:
Ports array.

GoGraph
v1.0


Copyright (C) 2003 Stewe Frei. All rights reserved.