Author: bobtarling
Date: 2008-04-13 15:42:58-0700
New Revision: 14338
Modified:
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java
trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModeCreateMessage.java
Log:
Remove UI code from modelChanged
Modified: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java?view=diff&rev=14338&p1=trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java&p2=trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java&r1=14337&r2=14338
==============================================================================
--- trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java (original)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/FigClassifierRole.java 2008-04-13 15:42:58-0700
@@ -32,8 +32,6 @@
import java.util.ArrayList;
import java.util.List;
-import javax.swing.SwingUtilities;
-
import org.apache.log4j.Logger;
import org.argouml.model.AddAssociationEvent;
import org.argouml.model.AttributeChangeEvent;
@@ -142,17 +140,7 @@
if (mee instanceof AddAssociationEvent
|| mee instanceof RemoveAssociationEvent
|| mee instanceof AttributeChangeEvent) {
- Runnable doWorkRunnable = new Runnable() {
- public void run() {
- renderingChanged();
- updateListeners(getOwner(), getOwner());
- notationProvider.updateListener(
- FigClassifierRole.this, getOwner(), mee);
- damage();
- }
- };
-
- SwingUtilities.invokeLater(doWorkRunnable);
+ notationProvider.updateListener(this, getOwner(), mee);
}
}
@@ -258,7 +246,7 @@
&& Model.getFacade().isACreateAction(mess.getAction())) {
LOG.info("Added a create message");
- relocate();
+ relocate();
}
}
}
Modified: trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModeCreateMessage.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModeCreateMessage.java?view=diff&rev=14338&p1=trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModeCreateMessage.java&p2=trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModeCreateMessage.java&r1=14337&r2=14338
==============================================================================
--- trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModeCreateMessage.java (original)
+++ trunk/src/argouml-core-diagrams-sequence2/src/org/argouml/uml/diagram/sequence2/ui/ModeCreateMessage.java 2008-04-13 15:42:58-0700
@@ -33,6 +33,7 @@
import org.tigris.gef.base.Editor;
import org.tigris.gef.base.Layer;
import org.tigris.gef.base.ModeCreatePolyEdge;
+import org.tigris.gef.presentation.FigEdge;
/**
* Mode to create a link between two figclassifierroles.
@@ -67,73 +68,74 @@
LOG.debug("ModeCreateMessage created without editor.");
}
}
+
@Override
- public void mouseReleased(MouseEvent me) {
- // the parent will create the message
- super.mouseReleased(me);
-
+ public void endAttached(FigEdge fe) {
+ super.endAttached(fe);
final SequenceDiagramGraphModel gm =
(SequenceDiagramGraphModel) getEditor().getGraphModel();
- final Object edge = getNewEdge();
- if (Model.getFacade().isAMessage(edge)) {
- final Object action = Model.getFacade().getAction(edge);
- if (Model.getFacade().isACallAction(action)) {
-
- // we need to create a ModeCreateMessage for adding
- // a new message
+ Object message = fe.getOwner();
+ FigClassifierRole dcr = (FigClassifierRole) fe.getDestFigNode();
+ FigClassifierRole scr = (FigClassifierRole) fe.getSourceFigNode();
+
+ final Object action = Model.getFacade().getAction(message);
+ if (Model.getFacade().isACallAction(action)) {
+
+ // we need to create a ModeCreateMessage for adding
+ // a new message
// ModeManager modeManager = editor.getModeManager();
// ModeCreateMessage mode = new ModeCreateMessage(editor);
// mode.getArgs().put("action",
// Model.getMetaTypes().getReturnAction());
// modeManager.push(mode);
- // get the source of the return message
- final Object returnMessageSource =
- Model.getFacade().getReceiver(edge);
- // get the dest of the return message
- final Object returnMessageDest =
- Model.getFacade().getSender(edge);
-
- // create the return message modelelement with the interaction
- // and the collaboration
- final Object returnMessage = gm.connect(
- returnMessageSource,
- returnMessageDest,
- Model.getMetaTypes().getMessage(),
- Model.getMetaTypes().getReturnAction());
-
- final Layer layer = editor.getLayerManager().getActiveLayer();
-
- final FigMessage callEdge = (FigMessage)
- layer.presentationFor(edge);
-
- final FigMessage returnEdge = new FigMessage(returnMessage);
+ // get the source of the return message
+ final Object returnMessageSource =
+ Model.getFacade().getReceiver(message);
+ // get the dest of the return message
+ final Object returnMessageDest =
+ Model.getFacade().getSender(message);
+
+ // create the return message modelelement with the interaction
+ // and the collaboration
+ final Object returnMessage = gm.connect(
+ returnMessageSource,
+ returnMessageDest,
+ Model.getMetaTypes().getMessage(),
+ Model.getMetaTypes().getReturnAction());
+
+ final Layer layer = editor.getLayerManager().getActiveLayer();
+
+ final FigMessage returnEdge = new FigMessage(returnMessage);
- returnEdge.setSourcePortFig(callEdge.getDestPortFig());
- returnEdge.setSourceFigNode(callEdge.getDestFigNode());
- returnEdge.setDestPortFig(callEdge.getSourcePortFig());
- returnEdge.setDestFigNode(callEdge.getSourceFigNode());
-
- final Point[] points = returnEdge.getPoints();
- for (int i=0; i < points.length; ++i) {
- // TODO: this shouldn't be hardcoded
- // 20 is the height of the spline
- // 50 is the default activation height
- points[i].y = callEdge.getY() + 50 + 20;
- }
- returnEdge.setPoints(points);
-
- if (returnEdge.isSelfMessage()) {
- returnEdge.convertToArc();
- }
-
- // FIXME #5005: The message is added,
- // it doesn't need to be added again.
- // The problem here is that the diagram
- // isn't damaged, and btw the edge ends' X are wrong.
- layer.add(returnEdge);
+ returnEdge.setSourcePortFig(fe.getDestPortFig());
+ returnEdge.setSourceFigNode(dcr);
+ returnEdge.setDestPortFig(fe.getSourcePortFig());
+ returnEdge.setDestFigNode(scr);
+
+ final Point[] points = returnEdge.getPoints();
+ for (int i=0; i < points.length; ++i) {
+ // TODO: this shouldn't be hardcoded
+ // 20 is the height of the spline
+ // 50 is the default activation height
+ points[i].y = fe.getY() + 50 + 20;
+ }
+ returnEdge.setPoints(points);
+
+ if (returnEdge.isSelfMessage()) {
+ returnEdge.convertToArc();
}
+
+ // FIXME #5005: The message is added,
+ // it doesn't need to be added again.
+ // The problem here is that the diagram
+ // isn't damaged, and btw the edge ends' X are wrong.
+ layer.add(returnEdge);
}
+ dcr.createActivations();
+ dcr.renderingChanged();
+ scr.createActivations();
+ scr.renderingChanged();
}
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.