svn commit: r12612 - trunk/src_new/org/argouml/uml/diagram: activity/ui collaboration/ui deployment/ui state/ui static_structure/ui ui use_case/ui
[email protected] 13 May 2007 18:30:41 -0000
Newsgroups
gmane.comp.lang.uml.argouml.cvs
Message-ID
<[email protected] >
Author: tfmorris
Date: 2007-05-13 11:30:40-0700
New Revision: 12612
Modified:
trunk/src_new/org/argouml/uml/diagram/activity/ui/SelectionActionState.java
trunk/src_new/org/argouml/uml/diagram/collaboration/ui/SelectionClassifierRole.java
trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionComponent.java
trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionComponentInstance.java
trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionNode.java
trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionNodeInstance.java
trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionObject.java
trunk/src_new/org/argouml/uml/diagram/state/ui/SelectionState.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionClass.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionGeneralizableElement.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionInterface.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionStereotype.java
trunk/src_new/org/argouml/uml/diagram/ui/SelectionNodeClarifiers.java
trunk/src_new/org/argouml/uml/diagram/ui/SelectionNodeClarifiers2.java
trunk/src_new/org/argouml/uml/diagram/use_case/ui/SelectionActor.java
trunk/src_new/org/argouml/uml/diagram/use_case/ui/SelectionUseCase.java
Log:
Fix self-association for Class toolbelt and reverse-mode toolbelt clicks
Modified: trunk/src_new/org/argouml/uml/diagram/activity/ui/SelectionActionState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/activity/ui/SelectionActionState.java?view=diff&rev=12612&p1=trunk/src_new/org/argouml/uml/diagram/activity/ui/SelectionActionState.java&p2=trunk/src_new/org/argouml/uml/diagram/activity/ui/SelectionActionState.java&r1=12611&r2=12612
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/activity/ui/SelectionActionState.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/activity/ui/SelectionActionState.java 2007-05-13 11:30:40-0700
@@ -152,7 +152,7 @@
@Override
protected String getInstructions(int index) {
- return instructions[index - 10];
+ return instructions[index - BASE];
}
@Override
@@ -161,8 +161,8 @@
}
@Override
- protected boolean isDragEdgeReverse(int index) {
- if (index == 10 || index == 13 ) {
+ protected boolean isReverseEdge(int index) {
+ if (index == TOP || index == RIGHT ) {
return true;
}
return false;
Modified: trunk/src_new/org/argouml/uml/diagram/collaboration/ui/SelectionClassifierRole.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/collaboration/ui/SelectionClassifierRole.java?view=diff&rev=12612&p1=trunk/src_new/org/argouml/uml/diagram/collaboration/ui/SelectionClassifierRole.java&p2=trunk/src_new/org/argouml/uml/diagram/collaboration/ui/SelectionClassifierRole.java&r1=12611&r2=12612
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/collaboration/ui/SelectionClassifierRole.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/collaboration/ui/SelectionClassifierRole.java 2007-05-13 11:30:40-0700
@@ -109,7 +109,7 @@
@Override
protected String getInstructions(int index) {
- return instructions[index - 10];
+ return instructions[index - BASE];
}
@Override
@@ -128,8 +128,8 @@
}
@Override
- protected boolean isDragEdgeReverse(int index) {
- if (index == 13) {
+ protected boolean isReverseEdge(int index) {
+ if (index == RIGHT) {
return true;
}
return false;
Modified: trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionComponent.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionComponent.java?view=diff&rev=12612&p1=trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionComponent.java&p2=trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionComponent.java&r1=12611&r2=12612
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionComponent.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionComponent.java 2007-05-13 11:30:40-0700
@@ -78,7 +78,7 @@
@Override
protected String getInstructions(int index) {
- return instructions[index - 10];
+ return instructions[index - BASE];
}
@Override
@@ -97,8 +97,8 @@
}
@Override
- protected boolean isDragEdgeReverse(int index) {
- if (index == 11 || index == 13) {
+ protected boolean isReverseEdge(int index) {
+ if (index == BOTTOM || index == RIGHT) {
return true;
}
return false;
Modified: trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionComponentInstance.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionComponentInstance.java?view=diff&rev=12612&p1=trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionComponentInstance.java&p2=trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionComponentInstance.java&r1=12611&r2=12612
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionComponentInstance.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionComponentInstance.java 2007-05-13 11:30:40-0700
@@ -75,7 +75,7 @@
@Override
protected String getInstructions(int index) {
- return instructions[index - 10];
+ return instructions[index - BASE];
}
@Override
@@ -94,8 +94,8 @@
}
@Override
- protected boolean isDragEdgeReverse(int index) {
- if (index == 11 || index == 13) {
+ protected boolean isReverseEdge(int index) {
+ if (index == BOTTOM || index == RIGHT) {
return true;
}
return false;
Modified: trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionNode.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionNode.java?view=diff&rev=12612&p1=trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionNode.java&p2=trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionNode.java&r1=12611&r2=12612
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionNode.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionNode.java 2007-05-13 11:30:40-0700
@@ -73,7 +73,7 @@
@Override
protected String getInstructions(int index) {
- return instructions[index - 10];
+ return instructions[index - BASE];
}
@Override
@@ -92,8 +92,8 @@
}
@Override
- protected boolean isDragEdgeReverse(int index) {
- if (index == 11 || index == 13) {
+ protected boolean isReverseEdge(int index) {
+ if (index == BOTTOM || index == RIGHT) {
return true;
}
return false;
Modified: trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionNodeInstance.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionNodeInstance.java?view=diff&rev=12612&p1=trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionNodeInstance.java&p2=trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionNodeInstance.java&r1=12611&r2=12612
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionNodeInstance.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionNodeInstance.java 2007-05-13 11:30:40-0700
@@ -72,7 +72,7 @@
@Override
protected String getInstructions(int index) {
- return instructions[index - 10];
+ return instructions[index - BASE];
}
@Override
@@ -91,8 +91,8 @@
}
@Override
- protected boolean isDragEdgeReverse(int index) {
- if (index == 11 || index == 13) {
+ protected boolean isReverseEdge(int index) {
+ if (index == BOTTOM || index == RIGHT) {
return true;
}
return false;
Modified: trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionObject.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionObject.java?view=diff&rev=12612&p1=trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionObject.java&p2=trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionObject.java&r1=12611&r2=12612
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionObject.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/deployment/ui/SelectionObject.java 2007-05-13 11:30:40-0700
@@ -75,7 +75,7 @@
@Override
protected String getInstructions(int index) {
- return instructions[index - 10];
+ return instructions[index - BASE];
}
@Override
@@ -94,8 +94,8 @@
}
@Override
- protected boolean isDragEdgeReverse(int index) {
- if (index == 11 || index == 13) {
+ protected boolean isReverseEdge(int index) {
+ if (index == BOTTOM || index == RIGHT) {
return true;
}
return false;
Modified: trunk/src_new/org/argouml/uml/diagram/state/ui/SelectionState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/state/ui/SelectionState.java?view=diff&rev=12612&p1=trunk/src_new/org/argouml/uml/diagram/state/ui/SelectionState.java&p2=trunk/src_new/org/argouml/uml/diagram/state/ui/SelectionState.java&r1=12611&r2=12612
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/state/ui/SelectionState.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/state/ui/SelectionState.java 2007-05-13 11:30:40-0700
@@ -89,10 +89,10 @@
System.arraycopy(icons, 0, workingIcons, 0, icons.length);
if (!showOutgoing) {
- workingIcons[12] = null;
+ workingIcons[LEFT] = null;
}
if (!showIncoming) {
- workingIcons[13] = null;
+ workingIcons[RIGHT] = null;
}
return workingIcons;
@@ -100,7 +100,7 @@
@Override
protected String getInstructions(int index) {
- return instructions[index - 10];
+ return instructions[index - BASE];
}
@Override
@@ -119,7 +119,7 @@
}
@Override
- protected boolean isDragEdgeReverse(int index) {
+ protected boolean isReverseEdge(int index) {
if (index == 13) {
return true;
}
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionClass.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionClass.java?view=diff&rev=12612&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionClass.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionClass.java&r1=12611&r2=12612
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionClass.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionClass.java 2007-05-13 11:30:40-0700
@@ -77,7 +77,7 @@
Model.getMetaTypes().getGeneralization(),
Model.getMetaTypes().getAssociation(),
Model.getMetaTypes().getAssociation(),
- null, // no drag for self-association
+ Model.getMetaTypes().getAssociation(),
};
/**
@@ -97,19 +97,19 @@
// No Generalizations on Deployment Diagram
if (Globals.curEditor().getGraphModel()
instanceof DeploymentDiagramGraphModel) {
- workingIcons[10] = null;
- workingIcons[11] = null;
+ workingIcons[TOP] = null;
+ workingIcons[BOTTOM] = null;
}
if (useComposite) {
- workingIcons[12] = compos;
- workingIcons[12] = compos;
+ workingIcons[LEFT] = compos;
+ workingIcons[LEFT] = compos;
}
return workingIcons;
}
@Override
protected String getInstructions(int index) {
- return instructions[index - 10];
+ return instructions[index - BASE];
}
@Override
@@ -119,16 +119,28 @@
@Override
protected Object getNewEdgeType(int i) {
+ if (i == 0) {
+ i = getButton();
+ }
return edgeType[i - 10];
}
@Override
- protected boolean isDragEdgeReverse(int i) {
- if (i == 11 || i == 13) {
+ protected boolean isReverseEdge(int i) {
+ if (i == BOTTOM || i == LEFT) {
return true;
}
return false;
}
+
+ @Override
+ protected boolean isDraggableHandle(int index) {
+ // Self-association isn't draggable
+ if (index == LOWER_LEFT) {
+ return false;
+ }
+ return true;
+ }
@Override
protected boolean isEdgePostProcessRequested() {
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionGeneralizableElement.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionGeneralizableElement.java?view=diff&rev=12612&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionGeneralizableElement.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionGeneralizableElement.java&r1=12611&r2=12612
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionGeneralizableElement.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionGeneralizableElement.java 2007-05-13 11:30:40-0700
@@ -93,20 +93,20 @@
@Override
protected String getInstructions(int i) {
- return instructions[ i - 10];
+ return instructions[ i - BASE];
}
@Override
protected Object getNewEdgeType(int i) {
- if (i == 10 || i == 11) {
+ if (i == TOP || i == BOTTOM) {
return Model.getMetaTypes().getGeneralization();
}
return null;
}
@Override
- protected boolean isDragEdgeReverse(int i) {
- if (i == 11) {
+ protected boolean isReverseEdge(int i) {
+ if (i == BOTTOM) {
return true;
}
return false;
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionInterface.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionInterface.java?view=diff&rev=12612&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionInterface.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionInterface.java&r1=12611&r2=12612
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionInterface.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionInterface.java 2007-05-13 11:30:40-0700
@@ -74,7 +74,7 @@
if (index == 0) {
index = getButton();
}
- if (index == 10) {
+ if (index == TOP) {
return Model.getCoreFactory().buildInterface();
} else {
return Model.getCoreFactory().buildClass();
@@ -83,9 +83,9 @@
@Override
protected Object getNewEdgeType(int index) {
- if (index == 10) {
+ if (index == TOP) {
return Model.getMetaTypes().getGeneralization();
- } else if (index == 11) {
+ } else if (index == BOTTOM) {
return Model.getMetaTypes().getAbstraction();
}
return null;
@@ -94,9 +94,9 @@
@Override
protected Object getNewNodeType(int index) {
- if (index == 10) {
+ if (index == TOP) {
return Model.getMetaTypes().getInterface();
- } else if (index == 11) {
+ } else if (index == BOTTOM) {
return Model.getMetaTypes().getUMLClass();
}
return null;
@@ -109,11 +109,11 @@
@Override
protected String getInstructions(int index) {
- return instructions[index - 10];
+ return instructions[index - BASE];
}
@Override
- protected boolean isDragEdgeReverse(int index) {
+ protected boolean isReverseEdge(int index) {
if (index == 11) {
return true;
}
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionStereotype.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionStereotype.java?view=diff&rev=12612&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionStereotype.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionStereotype.java&r1=12611&r2=12612
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionStereotype.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/SelectionStereotype.java 2007-05-13 11:30:40-0700
@@ -137,22 +137,22 @@
@Override
protected String getInstructions(int index) {
- return instructions[index - 10];
+ return instructions[index - BASE];
}
@Override
protected Object getNewEdgeType(int index) {
- if (index == 10) {
+ if (index == TOP) {
return Model.getMetaTypes().getDependency();
- } else if (index == 11) {
+ } else if (index == BOTTOM) {
return Model.getMetaTypes().getGeneralization();
}
return null;
}
@Override
- protected boolean isDragEdgeReverse(int index) {
- if (index == 11) {
+ protected boolean isReverseEdge(int index) {
+ if (index == BOTTOM) {
return true;
}
return false;
Modified: trunk/src_new/org/argouml/uml/diagram/ui/SelectionNodeClarifiers.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/SelectionNodeClarifiers.java?view=diff&rev=12612&p1=trunk/src_new/org/argouml/uml/diagram/ui/SelectionNodeClarifiers.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/SelectionNodeClarifiers.java&r1=12611&r2=12612
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/SelectionNodeClarifiers.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/SelectionNodeClarifiers.java 2007-05-13 11:30:40-0700
@@ -66,7 +66,7 @@
}
@Override
- protected boolean isDragEdgeReverse(int index) {
+ protected boolean isReverseEdge(int index) {
return false;
}
Modified: trunk/src_new/org/argouml/uml/diagram/ui/SelectionNodeClarifiers2.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/SelectionNodeClarifiers2.java?view=diff&rev=12612&p1=trunk/src_new/org/argouml/uml/diagram/ui/SelectionNodeClarifiers2.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/SelectionNodeClarifiers2.java&r1=12611&r2=12612
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/SelectionNodeClarifiers2.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/SelectionNodeClarifiers2.java 2007-05-13 11:30:40-0700
@@ -62,7 +62,21 @@
private static final Logger LOG =
Logger.getLogger(SelectionNodeClarifiers2.class);
-
+ /** Base index of array */
+ protected static final int BASE = 10;
+ /** Top Handle */
+ protected static final int TOP = 10;
+ /** Bottom Handle */
+ protected static final int BOTTOM = 11;
+ /** Left Handle */
+ protected static final int LEFT = 12;
+ /** Right Handle */
+ protected static final int RIGHT = 13;
+ /** Lower left corner Handle */
+ protected static final int LOWER_LEFT = 14;
+
+ private static final int OFFSET = 2;
+
private int button;
/**
@@ -97,19 +111,20 @@
int ch = getContent().getHeight();
if (icons[0] != null) {
- paintButtonAbove(icons[0], g, cx + cw / 2, cy, 10);
+ paintButtonAbove(icons[0], g, cx + cw / 2, cy, TOP);
}
if (icons[1] != null) {
- paintButtonBelow(icons[1], g, cx + cw / 2, cy + ch + 2, 11);
+ paintButtonBelow(icons[1], g, cx + cw / 2, cy + ch + OFFSET,
+ BOTTOM);
}
if (icons[2] != null) {
- paintButtonLeft(icons[2], g, cx + cw + 2, cy + ch / 2, 12);
+ paintButtonLeft(icons[2], g, cx + cw + OFFSET, cy + ch / 2, LEFT);
}
if (icons[3] != null) {
- paintButtonRight(icons[3], g, cx, cy + ch / 2, 13);
+ paintButtonRight(icons[3], g, cx, cy + ch / 2, RIGHT);
}
if (icons[4] != null) {
- paintButtonRight(icons[4], g, cx, cy + ch, 14);
+ paintButtonRight(icons[4], g, cx, cy + ch, LOWER_LEFT);
}
}
@@ -125,7 +140,6 @@
* org.tigris.gef.presentation.Handle)
*/
public void hitHandle(Rectangle r, Handle h) {
- super.hitHandle(r, h);
if (h.index != -1) {
// super implementation found a hit
return;
@@ -171,27 +185,27 @@
if (icons[0] != null && hitAbove(cx + cw / 2, cy,
icons[0].getIconWidth(), icons[0].getIconHeight(),
r)) {
- h.index = 10;
+ h.index = TOP;
h.instructions = getInstructions(h.index);
} else if (icons[1] != null && hitBelow(cx + cw / 2, cy + ch,
icons[1].getIconWidth(), icons[1].getIconHeight(),
r)) {
- h.index = 11;
+ h.index = BOTTOM;
h.instructions = getInstructions(h.index);
} else if (icons[2] != null && hitLeft(cx + cw, cy + ch / 2,
icons[2].getIconWidth(), icons[2].getIconHeight(),
r)) {
- h.index = 12;
+ h.index = LEFT;
h.instructions = getInstructions(h.index);
} else if (icons[3] != null && hitRight(cx, cy + ch / 2,
icons[3].getIconWidth(), icons[3].getIconHeight(),
r)) {
- h.index = 13;
+ h.index = RIGHT;
h.instructions = getInstructions(h.index);
- } else if (icons[4] != null && hitRight(cx, cy + ch - 10,
+ } else if (icons[4] != null && hitRight(cx, cy + ch,
icons[4].getIconWidth(), icons[4].getIconHeight(),
r)) {
- h.index = 14;
+ h.index = LOWER_LEFT;
h.instructions = getInstructions(h.index);
} else {
h.index = -1;
@@ -209,6 +223,9 @@
super.dragHandle(mX, mY, anX, anY, hand);
return;
}
+ if (!isDraggableHandle(hand.index)) {
+ return;
+ }
int cx = getContent().getX(), cy = getContent().getY();
int cw = getContent().getWidth(), ch = getContent().getHeight();
@@ -219,23 +236,25 @@
button = hand.index;
switch (hand.index) {
- case 10:
+ case TOP:
by = cy;
bx = cx + cw / 2;
break;
- case 11:
+ case BOTTOM:
by = cy + ch;
bx = cx + cw / 2;
break;
- case 12:
+ case LEFT:
by = cy + ch / 2;
bx = cx + cw;
break;
- case 13:
+ case RIGHT:
by = cy + ch / 2;
bx = cx;
break;
- case 14:
+ case LOWER_LEFT:
+ by = cy + ch;
+ bx = cx + cw;
break;
default:
LOG.warn("invalid handle number");
@@ -244,7 +263,7 @@
Object nodeType = getNewNodeType(hand.index);
Object edgeType = getNewEdgeType(hand.index);
- boolean reverse = isDragEdgeReverse(hand.index);
+ boolean reverse = isReverseEdge(hand.index);
if (edgeType != null && nodeType != null) {
Editor ce = Globals.curEditor();
@@ -257,28 +276,44 @@
}
}
+ @Override
+ public void buttonClicked(int buttonCode) {
+ super.buttonClicked(buttonCode);
+ }
protected Object createEdgeAbove(MutableGraphModel gm, Object newNode) {
- return gm.connect(getContent().getOwner(), newNode, getNewEdgeType(10));
+ return createEdge(gm, newNode, TOP);
}
protected Object createEdgeUnder(MutableGraphModel gm, Object newNode) {
- return gm.connect(getContent().getOwner(), newNode, getNewEdgeType(11));
+ return createEdge(gm, newNode, BOTTOM);
}
protected Object createEdgeLeft(MutableGraphModel gm, Object newNode) {
- return gm.connect(getContent().getOwner(), newNode, getNewEdgeType(12));
+ return createEdge(gm, newNode, LEFT);
}
-
protected Object createEdgeRight(MutableGraphModel gm, Object newNode) {
- return gm.connect(getContent().getOwner(), newNode, getNewEdgeType(13));
+ return createEdge(gm, newNode, RIGHT);
}
+ private Object createEdge(MutableGraphModel gm, Object newNode, int index) {
+ Object edge;
+ if (isReverseEdge(index)) {
+ edge = gm.connect(
+ newNode, getContent().getOwner(), getNewEdgeType(index));
+ } else {
+ edge = gm.connect(
+ getContent().getOwner(), newNode, getNewEdgeType(index));
+ }
+ return edge;
+ }
+
protected Object createEdgeToSelf(MutableGraphModel gm) {
- return gm.connect(
+ Object edge = gm.connect(
getContent().getOwner(), getContent().getOwner(),
- getNewEdgeType(14));
+ getNewEdgeType(LOWER_LEFT));
+ return edge;
}
/**
@@ -323,11 +358,24 @@
* eg. specialization instead of generalization. Default
* implementation always returns false.
*/
- protected boolean isDragEdgeReverse(int index) {
+ protected boolean isReverseEdge(int index) {
return false;
}
/**
+ * 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).
+ *
+ * @param index
+ * handle index to check draggability for
+ * @return true if this handle is draggable, false otherwise
+ */
+ protected boolean isDraggableHandle(int index) {
+ return true;
+ }
+
+ /**
* Request post processing of edge by GEF after it is created using
* {@link ModeCreateEdgeAndNode#ModeCreateEdgeAndNode(Editor, Object, Object, boolean)
*
Modified: trunk/src_new/org/argouml/uml/diagram/use_case/ui/SelectionActor.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/use_case/ui/SelectionActor.java?view=diff&rev=12612&p1=trunk/src_new/org/argouml/uml/diagram/use_case/ui/SelectionActor.java&p2=trunk/src_new/org/argouml/uml/diagram/use_case/ui/SelectionActor.java&r1=12611&r2=12612
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/use_case/ui/SelectionActor.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/use_case/ui/SelectionActor.java 2007-05-13 11:30:40-0700
@@ -87,17 +87,17 @@
@Override
protected String getInstructions(int index) {
- return instructions[index - 10];
+ return instructions[index - BASE];
}
@Override
protected Object getNewEdgeType(int index) {
- return edgeType[index - 10];
+ return edgeType[index - BASE];
}
@Override
protected Object getNewNodeType(int index) {
- if (index == 10 || index == 11) {
+ if (index == TOP || index == BOTTOM) {
return Model.getMetaTypes().getActor();
} else {
return Model.getMetaTypes().getUseCase();
@@ -109,7 +109,7 @@
if (index == 0) {
index = getButton();
}
- if (index == 10 || index == 11) {
+ if (index == TOP || index == BOTTOM) {
return Model.getUseCasesFactory().createActor();
} else {
return Model.getUseCasesFactory().createUseCase();
@@ -117,8 +117,8 @@
}
@Override
- protected boolean isDragEdgeReverse(int index) {
- if (index == 11 || index == 13) {
+ protected boolean isReverseEdge(int index) {
+ if (index == BOTTOM || index == RIGHT) {
return true;
}
return false;
Modified: trunk/src_new/org/argouml/uml/diagram/use_case/ui/SelectionUseCase.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/use_case/ui/SelectionUseCase.java?view=diff&rev=12612&p1=trunk/src_new/org/argouml/uml/diagram/use_case/ui/SelectionUseCase.java&p2=trunk/src_new/org/argouml/uml/diagram/use_case/ui/SelectionUseCase.java&r1=12611&r2=12612
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/use_case/ui/SelectionUseCase.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/use_case/ui/SelectionUseCase.java 2007-05-13 11:30:40-0700
@@ -97,7 +97,7 @@
if (index == 0) {
index = getButton();
}
- if (index == 10 || index == 11) {
+ if (index == TOP || index == BOTTOM) {
return Model.getUseCasesFactory().createUseCase();
}
return Model.getUseCasesFactory().createActor();
@@ -105,15 +105,15 @@
@Override
protected Object getNewNodeType(int index) {
- if (index == 10 || index == 11) {
+ if (index == TOP || index == BOTTOM) {
return Model.getMetaTypes().getUseCase();
}
return Model.getMetaTypes().getActor();
}
@Override
- protected boolean isDragEdgeReverse(int index) {
- if (index == 11) {
+ protected boolean isReverseEdge(int index) {
+ if (index == BOTTOM) {
return true;
}
return false;