org.argouml.uml.diagram.ui
Class SelectionNodeClarifiers2

java.lang.Object
  extended by SelectionButtons
      extended by org.argouml.uml.diagram.ui.SelectionNodeClarifiers2
Direct Known Subclasses:
SelectionActionState, SelectionActor, SelectionClass, SelectionClassifierRole, SelectionClassifierRole, SelectionComment, SelectionComponent, SelectionComponentInstance, SelectionGeneralizableElement, SelectionInterface, SelectionNode, SelectionNodeInstance, SelectionObject, SelectionState, SelectionStereotype, SelectionUseCase

public abstract class SelectionNodeClarifiers2
extends SelectionButtons

Enhanced version of SelectionNodeClarifiers with the new methods necessary for the enhanced support marked as abstract so that implementors are forced to implement them. SelectionNodeClarifiers is simple extension of this which implements null versions of the required methods for backward compatibility with the previous implementation.

To upgrade subtypes of SelectionNodeClarifiers, change them to extend this class instead and implement the required abstract methods. The methods paintButtons, dragHandle, hitHandle, and createEdge* can all usually be removed.


Field Summary
protected static int BASE
          Base index of array
protected static int BOTTOM
          Bottom Handle
protected static int LEFT
          Left Handle
protected static int LOWER_LEFT
          Lower left corner Handle
protected static int RIGHT
          Right Handle
protected static int TOP
          Top Handle
 
Constructor Summary
SelectionNodeClarifiers2(Fig f)
          Construct a new SelectionNodeClarifiers for the given Fig
 
Method Summary
 void buttonClicked(int buttonCode)
           
protected  java.lang.Object createEdgeAbove(MutableGraphModel gm, java.lang.Object newNode)
           
protected  java.lang.Object createEdgeLeft(MutableGraphModel gm, java.lang.Object newNode)
           
protected  java.lang.Object createEdgeRight(MutableGraphModel gm, java.lang.Object newNode)
           
protected  java.lang.Object createEdgeToSelf(MutableGraphModel gm)
           
protected  java.lang.Object createEdgeUnder(MutableGraphModel gm, java.lang.Object newNode)
           
 void dragHandle(int mX, int mY, int anX, int anY, Handle hand)
           
protected  int getButton()
           
protected abstract  javax.swing.Icon[] getIcons()
          Get array of icons to use when drawing handles.
protected abstract  java.lang.String getInstructions(int index)
          Get the "instructions" string to pass to GEF for the given handle number.
protected abstract  java.lang.Object getNewEdgeType(int index)
          Get the edge type to create when dragging from the given handle number.
protected  ModeCreateEdgeAndNode getNewModeCreateEdgeAndNode(Editor ce, java.lang.Object edgeType, boolean postProcess, SelectionNodeClarifiers2 nodeCreator)
          Override this to implement post-processing.
protected  java.lang.Object getNewNode(int arg0)
           
protected abstract  java.lang.Object getNewNodeType(int index)
          Get the node type to create when dragging from the given handle number.
 void hitHandle(java.awt.Rectangle cursor, Handle h)
          Compute handle selection, if any, from cursor location.
protected  boolean isDraggableHandle(int index)
          Get the draggability of a particular handle.
protected  boolean isEdgePostProcessRequested()
          Request post processing of edge by GEF after it is created using ModeCreateEdgeAndNode#ModeCreateEdgeAndNode(Editor, Object, Object, boolean)
protected  boolean isReverseEdge(int index)
          Get the node type to create when dragging from the given handle number.
 void paint(java.awt.Graphics g)
           
 void paintButtons(java.awt.Graphics g)
           
protected  void postProcessEdge2(java.lang.Object newEdge)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE

protected static final int BASE
Base index of array

See Also:
Constant Field Values

TOP

protected static final int TOP
Top Handle

See Also:
Constant Field Values

BOTTOM

protected static final int BOTTOM
Bottom Handle

See Also:
Constant Field Values

LEFT

protected static final int LEFT
Left Handle

See Also:
Constant Field Values

RIGHT

protected static final int RIGHT
Right Handle

See Also:
Constant Field Values

LOWER_LEFT

protected static final int LOWER_LEFT
Lower left corner Handle

See Also:
Constant Field Values
Constructor Detail

SelectionNodeClarifiers2

public SelectionNodeClarifiers2(Fig f)
Construct a new SelectionNodeClarifiers for the given Fig

Parameters:
f - the given Fig
Method Detail

paint

public void paint(java.awt.Graphics g)

paintButtons

public final void paintButtons(java.awt.Graphics g)

getNewNode

protected java.lang.Object getNewNode(int arg0)

hitHandle

public void hitHandle(java.awt.Rectangle cursor,
                      Handle h)
Compute handle selection, if any, from cursor location.

Parameters:
cursor - cursor point represented by a 0-size rectangle
h - handle in which to return selected Handle information (output parameter). A handle index of -1 indicates that the cursor is not over any handle. If GEF had any API documentation you could see the following:
See Also:
org.tigris.gef.base.SelectionResize#hitHandle(java.awt.Rectangle, org.tigris.gef.presentation.Handle)

dragHandle

public void dragHandle(int mX,
                       int mY,
                       int anX,
                       int anY,
                       Handle hand)

getNewModeCreateEdgeAndNode

protected ModeCreateEdgeAndNode getNewModeCreateEdgeAndNode(Editor ce,
                                                            java.lang.Object edgeType,
                                                            boolean postProcess,
                                                            SelectionNodeClarifiers2 nodeCreator)
Override this to implement post-processing.

Parameters:
ce - the current Editor
edgeType - the new edge type
postProcess - true if post-processing is wanted
nodeCreator - this class will create the node
Returns:
the ModeCreate

buttonClicked

public void buttonClicked(int buttonCode)

createEdgeAbove

protected java.lang.Object createEdgeAbove(MutableGraphModel gm,
                                           java.lang.Object newNode)

createEdgeUnder

protected java.lang.Object createEdgeUnder(MutableGraphModel gm,
                                           java.lang.Object newNode)

createEdgeLeft

protected java.lang.Object createEdgeLeft(MutableGraphModel gm,
                                          java.lang.Object newNode)

createEdgeRight

protected java.lang.Object createEdgeRight(MutableGraphModel gm,
                                           java.lang.Object newNode)

createEdgeToSelf

protected java.lang.Object createEdgeToSelf(MutableGraphModel gm)

getIcons

protected abstract javax.swing.Icon[] getIcons()
Get array of icons to use when drawing handles.

Returns:
icon or null

getInstructions

protected abstract java.lang.String getInstructions(int index)
Get the "instructions" string to pass to GEF for the given handle number.

Parameters:
index - handle number that is being dragged from
Returns:
string or null

getNewNodeType

protected abstract java.lang.Object getNewNodeType(int index)
Get the node type to create when dragging from the given handle number.

Parameters:
index - handle number that is being dragged from
Returns:
metatype for model element. Null to disallow drag.

getNewEdgeType

protected abstract java.lang.Object getNewEdgeType(int index)
Get the edge type to create when dragging from the given handle number.

Parameters:
index - handle number that is being dragged from
Returns:
metatype for model element. Null to disallow drag.

isReverseEdge

protected boolean isReverseEdge(int index)
Get the node type to create when dragging from the given handle number.

Parameters:
index - handle number that is being dragged from
Returns:
true to reverse direction of assocation from direction of drag. eg. specialization instead of generalization. Default implementation always returns false.

isDraggableHandle

protected boolean isDraggableHandle(int index)
Get the draggability of a particular handle. Default implementation always returns true. Override to return false for handles which shouldn't be draggable (i.e. they only support clicks, not drags).

Parameters:
index - handle index to check draggability for
Returns:
true if this handle is draggable, false otherwise

isEdgePostProcessRequested

protected boolean isEdgePostProcessRequested()
Request post processing of edge by GEF after it is created using ModeCreateEdgeAndNode#ModeCreateEdgeAndNode(Editor, Object, Object, boolean)

Returns:
true if postprocessing requested

postProcessEdge2

protected void postProcessEdge2(java.lang.Object newEdge)
Parameters:
newEdge - the new edge to post-process

getButton

protected int getButton()
Returns:
index of last button/handle that was clicked


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook