org.argouml.uml.diagram.ui
Class ModeCreateEdgeAndNode

java.lang.Object
  extended byorg.tigris.gef.base.ModeImpl
      extended byorg.tigris.gef.base.FigModifyingModeImpl
          extended byorg.tigris.gef.base.ModeCreate
              extended byorg.argouml.uml.diagram.ui.ModeCreateEdgeAndNode
All Implemented Interfaces:
java.util.EventListener, org.tigris.gef.base.FigModifyingMode, java.awt.event.KeyListener, org.tigris.gef.base.Mode, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

public class ModeCreateEdgeAndNode
extends org.tigris.gef.base.ModeCreate

A Mode to interpret user input while creating an edge. Basically mouse down starts creating an edge from a source port Fig, mouse motion paints a rubberband line, mouse up finds the destination port and finishes creating the edge and makes an FigEdge and sends it to the back of the Layer. The argument "edgeClass" determines the type if edge to suggest that the Editor's GraphModel construct. The GraphModel is responsible for acutally making an edge in the underlying model and connecting it to other model elements.

See Also:
Serialized Form

Field Summary
private  boolean _destToSource
          False if drawing from source and destination.
protected  org.tigris.gef.presentation.FigEdge _fe
           
protected  org.tigris.gef.presentation.FigNode _fn
           
protected  org.tigris.gef.presentation.Handle _handle
          The number of points added so far.
private  java.lang.Object _newEdge
          The new NetEdge that is being created
protected  boolean _postProcessEdge
           
private  org.tigris.gef.presentation.FigNode _sourceFigNode
          The FigNode on the NetNode that owns the start port
private  java.lang.Object _startPort
          The NetPort where the arc is paintn from
private  org.tigris.gef.presentation.Fig _startPortFig
          The Fig that presents the starting NetPort
protected static org.apache.log4j.Logger cat
           
static int Drags_To_Existing
           
static int Drags_To_New
           
(package private) static long serialVersionUID
           
 
Fields inherited from class org.tigris.gef.base.ModeCreate
_defaultHeight, _defaultWidth, _newItem, anchorX, anchorY
 
Fields inherited from class org.tigris.gef.base.FigModifyingModeImpl
editor
 
Fields inherited from class org.tigris.gef.base.ModeImpl
_args
 
Constructor Summary
ModeCreateEdgeAndNode()
           
ModeCreateEdgeAndNode(org.tigris.gef.base.Editor ed, java.lang.Class edgeClass, java.lang.Class nodeClass, boolean post)
           
 
Method Summary
 org.tigris.gef.presentation.Fig createNewItem(java.awt.event.MouseEvent me, int snapX, int snapY)
          Create the new item that will be drawn.
 void done()
           
 java.lang.String instructions()
           
 void keyTyped(java.awt.event.KeyEvent ke)
           
 void mouseDragged(java.awt.event.MouseEvent me)
           
 void mouseMoved(java.awt.event.MouseEvent me)
           
 void mousePressed(java.awt.event.MouseEvent me)
          On mousePressed determine what port the user is dragging from.
 void mouseReleased(java.awt.event.MouseEvent me)
          On mouseReleased, find the destination port, ask the GraphModel to connect the two ports.
 void postProcessEdge()
           
 void setup(org.tigris.gef.presentation.FigNode fn, java.lang.Object port, int x, int y, boolean reverse)
           
 
Methods inherited from class org.tigris.gef.base.ModeCreate
creationDrag, getInitialCursor, keyPressed, paint
 
Methods inherited from class org.tigris.gef.base.FigModifyingModeImpl
getEditor, isFigEnclosedIn, print, setCursor, setEditor
 
Methods inherited from class org.tigris.gef.base.ModeImpl
canExit, getArg, getArgs, init, keyReleased, leave, mouseClicked, mouseEntered, mouseExited, setArg, setArgs, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.tigris.gef.base.Mode
canExit, getArg, getArgs, init, setArg, setArgs, start
 

Field Detail

cat

protected static org.apache.log4j.Logger cat

Drags_To_Existing

public static int Drags_To_Existing

Drags_To_New

public static int Drags_To_New

_startPort

private java.lang.Object _startPort
The NetPort where the arc is paintn from


_startPortFig

private org.tigris.gef.presentation.Fig _startPortFig
The Fig that presents the starting NetPort


_sourceFigNode

private org.tigris.gef.presentation.FigNode _sourceFigNode
The FigNode on the NetNode that owns the start port


_newEdge

private java.lang.Object _newEdge
The new NetEdge that is being created


_destToSource

private boolean _destToSource
False if drawing from source and destination. True if drawing from destination to source.


_handle

protected org.tigris.gef.presentation.Handle _handle
The number of points added so far.


_fn

protected org.tigris.gef.presentation.FigNode _fn

_fe

protected org.tigris.gef.presentation.FigEdge _fe

_postProcessEdge

protected boolean _postProcessEdge

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

ModeCreateEdgeAndNode

public ModeCreateEdgeAndNode()

ModeCreateEdgeAndNode

public ModeCreateEdgeAndNode(org.tigris.gef.base.Editor ed,
                             java.lang.Class edgeClass,
                             java.lang.Class nodeClass,
                             boolean post)
Method Detail

setup

public void setup(org.tigris.gef.presentation.FigNode fn,
                  java.lang.Object port,
                  int x,
                  int y,
                  boolean reverse)

instructions

public java.lang.String instructions()

createNewItem

public org.tigris.gef.presentation.Fig createNewItem(java.awt.event.MouseEvent me,
                                                     int snapX,
                                                     int snapY)
Create the new item that will be drawn. In this case I would rather create the FigEdge when I am done. Here I just create a rubberband FigLine to show during dragging.


done

public void done()

mousePressed

public void mousePressed(java.awt.event.MouseEvent me)
On mousePressed determine what port the user is dragging from. The mousePressed event is sent via ModeSelect.


mouseReleased

public void mouseReleased(java.awt.event.MouseEvent me)
On mouseReleased, find the destination port, ask the GraphModel to connect the two ports. If that connection is allowed, then construct a new FigEdge and add it to the Layer and send it to the back.


mouseMoved

public void mouseMoved(java.awt.event.MouseEvent me)

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent me)

keyTyped

public void keyTyped(java.awt.event.KeyEvent ke)

postProcessEdge

public void postProcessEdge()


ArgoUML © 1996-2004 (20040316)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook