svn commit: r16623 - trunk/src/argouml-app/src/org/argouml/notation/providers: . uml
Michiel van der Wulp <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mvw
Date: 2009-01-15 13:36:00-0800
New Revision: 16623
Modified:
trunk/src/argouml-app/src/org/argouml/notation/providers/MessageNotation.java
trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
Log:
Point 3 from the plan of attack in issue 5150: Notation of a Message is possible in 3 ways now.
This took some editing of MessageNotation to have the Fig listen to some more model-changes.
This still needs some more testing to get complete: for all possible changes of the model, the diagram should update.
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/MessageNotation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/MessageNotation.java?view=diff&pathrev=16623&r1=16622&r2=16623
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/MessageNotation.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/MessageNotation.java 2009-01-15 13:36:00-0800
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2006-2007 The Regents of the University of California. All
+// Copyright (c) 2006-2009 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -25,7 +25,6 @@
package org.argouml.notation.providers;
import java.beans.PropertyChangeListener;
-import java.util.Iterator;
import java.util.List;
import org.argouml.model.Model;
@@ -55,22 +54,34 @@
* @see org.argouml.notation.providers.NotationProvider#initialiseListener(java.beans.PropertyChangeListener, java.lang.Object)
*/
public void initialiseListener(PropertyChangeListener listener,
- Object modelElement) {
- addElementListener(listener, modelElement,
+ Object umlMessage) {
+ addElementListener(listener, umlMessage,
new String[] {"activator", "predecessor", "successor",
- "sender", "receiver", "action"});
- Object action = Model.getFacade().getAction(modelElement);
+ "sender", "receiver", "action", "name"});
+ Object action = Model.getFacade().getAction(umlMessage);
if (action != null) {
addElementListener(listener, action,
new String[] {"remove", "recurrence", "script",
- "actualArgument"});
+ "actualArgument", "signal", "operation"});
List args = Model.getFacade().getActualArguments(action);
- Iterator it = args.iterator();
- while (it.hasNext()) {
- Object argument = it.next();
+ for (Object argument : args) {
addElementListener(listener, argument,
new String[] {"remove", "value"});
}
+ if (Model.getFacade().isACallAction(action)) {
+ Object operation = Model.getFacade().getOperation(action);
+ if (Model.getFacade().isAOperation(operation)) {
+ addElementListener(listener, operation,
+ new String[] {"name"});
+ }
+ }
+ if (Model.getFacade().isASendAction(action)) {
+ Object signal = Model.getFacade().getSignal(action);
+ if (Model.getFacade().isASignal(signal)) {
+ addElementListener(listener, signal,
+ new String[] {"name"});
+ }
+ }
}
}
Modified: trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java?view=diff&pathrev=16623&r1=16622&r2=16623
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java (original)
+++ trunk/src/argouml-app/src/org/argouml/notation/providers/uml/AbstractMessageNotationUml.java 2009-01-15 13:36:00-0800
@@ -84,11 +84,10 @@
* (formerly, the supported syntax was: name: action ) <p>
*
* Generating a string from the model has some extra functionality:
- * (to be implemented)
* If obtaining the Script of the Action returns an empty string,
* then an alternative representation is given:
* If the action is a CallAction, use the name of its Operation,
- * and if it is a SendAction, the name of its Event.
+ * and if it is a SendAction, the name of its Signal.
* If also this returns no string, then we display the name of the Message. <p>
*
* Rationale:
@@ -202,15 +201,23 @@
/* TODO: The recurrence goes in front of the action?
* Does this not contradict the header JavaDoc? */
}
-
- action = NotationUtilityUml.generateActionSequence(umlAction);
-
+ }
+ action = NotationUtilityUml.generateActionSequence(umlAction);
+ if ("".equals(action)) {
+ action = getInitiatorOfAction(umlAction);
+ if ("".equals(action)) {
+ // This may return null:
+ String n = Model.getFacade().getName(umlMessage);
+ if (n != null) {
+ action = n;
+ }
+ }
+ }
+ else if (!action.endsWith(")")) {
/* Dirty fix for issue 1758 (Needs to be amended
* when we start supporting parameters):
*/
- if (!action.endsWith(")")) {
- action = action + "()";
- }
+ action = action + "()";
}
if (!showSequenceNumbers) {
@@ -219,6 +226,29 @@
return predecessors + number + " : " + action;
}
+ protected String getInitiatorOfAction(Object umlAction) {
+ String result = "";
+ if (Model.getFacade().isACallAction(umlAction)) {
+ Object umlOperation = Model.getFacade().getOperation(umlAction);
+ if (Model.getFacade().isAOperation(umlOperation)) {
+ StringBuilder sb = new StringBuilder(
+ Model.getFacade().getName(umlOperation));
+ if (sb.length() > 0) {
+ sb.append("()");
+ result = sb.toString();
+ }
+ }
+ } else if (Model.getFacade().isASendAction(umlAction)) {
+ Object umlSignal = Model.getFacade().getSignal(umlAction);
+ if (Model.getFacade().isASignal(umlSignal)) {
+ String n = Model.getFacade().getName(umlSignal);
+ if (n != null) {
+ result = n;
+ }
+ }
+ }
+ return result;
+ }
protected List<CustomSeparator> initParameterSeparators() {
List<CustomSeparator> separators = new ArrayList<CustomSeparator>();
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=1027083
To unsubscribe from this discussion, e-mail: [[email protected]].