JGraphpad Pro
v6.0.5.0


com.jgraph.pad.tool
Class JGraphpadEdgeTool

java.lang.Object
  extended byorg.jgraph.graph.BasicMarqueeHandler
      extended bycom.jgraph.editor.JGraphEditorTool
          extended bycom.jgraph.pad.tool.JGraphpadVertexTool
              extended bycom.jgraph.pad.tool.JGraphpadEdgeTool

public class JGraphpadEdgeTool
extends JGraphpadVertexTool

Tool that inserts edges based on a prototype.


Field Summary
protected  org.jgraph.graph.PortView current
          Initial and current port view.
static String NAME_EDGETOOL
          Defines the default name for tools of this kind.
protected  org.jgraph.graph.PortView start
          Initial and current port view.
 
Fields inherited from class com.jgraph.pad.tool.JGraphpadVertexTool
NAME_VERTEXTOOL, previewEnabled, previewView, prototype, singleClickSize, threshold
 
Fields inherited from class com.jgraph.editor.JGraphEditorTool
isAlwaysActive, name
 
Fields inherited from class org.jgraph.graph.BasicMarqueeHandler
currentPoint, marqueeBounds, previousCursor, startPoint
 
Constructor Summary
JGraphpadEdgeTool(Object prototype)
          Constructs a new edge tool for the specified prototype using NAME_EDGETOOL.
JGraphpadEdgeTool(String name, Object prototype)
          Constructs a new edge tool for the specified name and prototype.
 
Method Summary
protected  void execute(org.jgraph.JGraph graph, Object edge)
          Overrides the parent's implementation to insert the specified edge into cache.
 boolean isForceMarqueeEvent(MouseEvent event)
          Returns true if the in any case except the selection cell under the mouse pointer is an edge.
 void mouseDragged(MouseEvent event)
          Overrides the parent's implementation to avoid flickering by checking if the state of the preview will change.
 void mouseMoved(MouseEvent event)
          Overrides the parent's implementation to highlight ports which are under the mousepointer.
 void mousePressed(MouseEvent event)
          Extends the parent's implementation to find the port view at the mouse location and set the startPoint accordingly.
 void mouseReleased(MouseEvent event)
          Extends the parent's implementation to reset start and current.
 void overlay(org.jgraph.JGraph graph, Graphics g, boolean clear)
          Extends the parent's implementation to draw the highlighted port using paintPort(JGraph, Graphics).
protected  void paintPort(org.jgraph.JGraph graph, Graphics g)
          Paints the current port in highlighted state.
protected  void processMouseDraggedEvent(MouseEvent event)
          Overrides the parent's implementation to update the preview to connect to the port under the mouse or use the location of the mouse as a point.
 
Methods inherited from class com.jgraph.pad.tool.JGraphpadVertexTool
createCell, getPrototype, getSingleClickSize, getThreshold, isConstrainedSizeEvent, isPreviewEnabled, setPreviewEnabled, setPrototype, setSingleClickSize, setThreshold
 
Methods inherited from class com.jgraph.editor.JGraphEditorTool
getName, isAlwaysActive, setAlwaysActive, setName
 
Methods inherited from class org.jgraph.graph.BasicMarqueeHandler
getCurrentPoint, getGraphForEvent, getMarqueeBounds, getPreviousCursor, getStartPoint, handleMarqueeEvent, isMarqueeTriggerEvent, 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

NAME_EDGETOOL

public static final String NAME_EDGETOOL
Defines the default name for tools of this kind.

See Also:
Constant Field Values

start

protected org.jgraph.graph.PortView start
Initial and current port view.


current

protected org.jgraph.graph.PortView current
Initial and current port view.

Constructor Detail

JGraphpadEdgeTool

public JGraphpadEdgeTool(Object prototype)
Constructs a new edge tool for the specified prototype using NAME_EDGETOOL.

Parameters:
prototype - The prototype cell to create new edges with.

JGraphpadEdgeTool

public JGraphpadEdgeTool(String name,
                         Object prototype)
Constructs a new edge tool for the specified name and prototype. Edgetools must be always active to be able to click on source/target vertices without triggering a cell move.

Parameters:
name - The name of the tool to be created.
prototype - The prototype cell to create new edges with.
Method Detail

isForceMarqueeEvent

public boolean isForceMarqueeEvent(MouseEvent event)
Returns true if the in any case except the selection cell under the mouse pointer is an edge. This is used to fetch control when a source/target selection is made for connecting via a new edge.

Returns:
Returns false if the selection cell under the mouse is an edge.

mousePressed

public void mousePressed(MouseEvent event)
Extends the parent's implementation to find the port view at the mouse location and set the startPoint accordingly.

Overrides:
mousePressed in class JGraphpadVertexTool
Parameters:
event - The object that describes the event.

mouseMoved

public void mouseMoved(MouseEvent event)
Overrides the parent's implementation to highlight ports which are under the mousepointer.

Parameters:
event - The object that describes the event.

mouseDragged

public void mouseDragged(MouseEvent event)
Overrides the parent's implementation to avoid flickering by checking if the state of the preview will change.

Parameters:
event - The object that describes the event.

processMouseDraggedEvent

protected void processMouseDraggedEvent(MouseEvent event)
Overrides the parent's implementation to update the preview to connect to the port under the mouse or use the location of the mouse as a point.

Overrides:
processMouseDraggedEvent in class JGraphpadVertexTool
Parameters:
event - The object that describes the event.

mouseReleased

public void mouseReleased(MouseEvent event)
Extends the parent's implementation to reset start and current.

Overrides:
mouseReleased in class JGraphpadVertexTool
Parameters:
event - The object that describes the event.

execute

protected void execute(org.jgraph.JGraph graph,
                       Object edge)
Overrides the parent's implementation to insert the specified edge into cache.

Overrides:
execute in class JGraphpadVertexTool
Parameters:
edge - The edge to be inserted into cache.

overlay

public void overlay(org.jgraph.JGraph graph,
                    Graphics g,
                    boolean clear)
Extends the parent's implementation to draw the highlighted port using paintPort(JGraph, Graphics).

Overrides:
overlay in class JGraphpadVertexTool
Parameters:
graph - The graph to paint in.
g - The graphics to use for paiting.
clear - Wether to clear the display.

paintPort

protected void paintPort(org.jgraph.JGraph graph,
                         Graphics g)
Paints the current port in highlighted state.

Parameters:
graph - The graph to paint the port in.
g - The graphics to use for paiting.

JGraphpad Pro
v6.0.5.0


Copyright (C) 2005 JGraph.com. All rights reserved.