svn commit: r16411 - trunk/src/argouml-app/src/org/argouml/uml/diagram/ui
Bob Tarling <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: bobtarling
Date: 2008-12-21 17:39:14-0800
New Revision: 16411
Modified:
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEdgeAssociationClass.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeAssociation.java
Log:
Allow removal of part of a n-ary association class to also remove other parts
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEdgeAssociationClass.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEdgeAssociationClass.java?view=diff&pathrev=16411&r1=16410&r2=16411
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEdgeAssociationClass.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigEdgeAssociationClass.java 2008-12-21 17:39:14-0800
@@ -156,18 +156,25 @@
@Override
protected Fig getRemoveDelegate() {
FigNode node = getDestFigNode();
- if (!(node instanceof FigEdgePort)) {
+ if (!(node instanceof FigEdgePort || node instanceof FigNodeAssociation)) {
node = getSourceFigNode();
}
- if (!(node instanceof FigEdgePort)) {
+ if (!(node instanceof FigEdgePort || node instanceof FigNodeAssociation)) {
LOG.warn("The is no FigEdgePort attached"
+ " to the association class link");
return null;
}
+
+ final Fig delegate;
// Actually return the FigEdge that the FigEdgePort is part of.
- Fig delegate = node.getGroup();
+ if (node instanceof FigEdgePort) {
+ delegate = node.getGroup();
+ } else {
+ delegate = node;
+ }
if (LOG.isInfoEnabled()) {
LOG.info("Delegating remove to " + delegate.getClass().getName());
+// throw new IllegalArgumentException();
}
return delegate;
}
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeAssociation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeAssociation.java?view=diff&pathrev=16411&r1=16410&r2=16411
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeAssociation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeAssociation.java 2008-12-21 17:39:14-0800
@@ -40,6 +40,7 @@
import org.tigris.gef.graph.MutableGraphModel;
import org.tigris.gef.presentation.FigDiamond;
import org.tigris.gef.presentation.FigEdge;
+import org.tigris.gef.presentation.FigNode;
import org.tigris.gef.presentation.FigText;
/**
@@ -285,6 +286,41 @@
return aSize;
}
+
+
+ /**
+ * Remove entire composite Fig from Diagram. Discover the attached
+ * FigEdgeAssociationClass and the FigClassAssociationClass attached to
+ * that. Remove them from the diagram before removing this.
+ */
+ @Override
+ protected void removeFromDiagramImpl() {
+ FigEdgeAssociationClass figEdgeLink = null;
+ final List edges = getFigEdges();
+
+ if (edges != null) {
+ for (Iterator it = edges.iterator(); it.hasNext()
+ && figEdgeLink == null;) {
+ Object o = it.next();
+ if (o instanceof FigEdgeAssociationClass) {
+ figEdgeLink = (FigEdgeAssociationClass) o;
+ }
+ }
+ }
+
+ if (figEdgeLink != null) {
+ FigNode figClassBox = figEdgeLink.getDestFigNode();
+ if (!(figClassBox instanceof FigClassAssociationClass)) {
+ figClassBox = figEdgeLink.getSourceFigNode();
+ }
+ figEdgeLink.removeFromDiagramImpl();
+ ((FigClassAssociationClass) figClassBox).removeFromDiagramImpl();
+ }
+
+ super.removeFromDiagramImpl();
+ }
+
+
} /* end class FigNodeAssociation */
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=989303
To unsubscribe from this discussion, e-mail: [[email protected]].