Author: bobtarling
Date: 2010-07-21 07:20:17-0700
New Revision: 18543
Modified:
trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java
trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java
trunk/src/argouml-core-model/src/org/argouml/model/UmlFactory.java
Log:
Overload buildNode with a new method that accept a property name
Modified: trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java?view=diff&pathrev=18543&r1=18542&r2=18543
==============================================================================
--- trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java (original)
+++ trunk/src/argouml-core-model-euml/src/org/argouml/model/euml/UmlFactoryEUMLImpl.java 2010-07-21 07:20:17-0700
@@ -269,12 +269,19 @@
return connection;
}
- public Object buildNode(Object elementType, Object container) {
+ public Object buildNode(
+ final Object elementType,
+ final Object container,
+ final String propertyName) {
Object element = buildNode(elementType);
modelImpl.getCoreHelper().addOwnedElement(container, element);
return element;
}
+ public Object buildNode(Object elementType, Object container) {
+ return buildNode(elementType, container, null);
+ }
+
public Object buildNode(Object elementType) {
Object o = null;
if (elementType == metaTypes.getActor()) {
Modified: trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java?view=diff&pathrev=18543&r1=18542&r2=18543
==============================================================================
--- trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java (original)
+++ trunk/src/argouml-core-model-mdr/src/org/argouml/model/mdr/UmlFactoryMDRImpl.java 2010-07-21 07:20:17-0700
@@ -765,7 +765,7 @@
+ elementType);
}
- public Object buildNode(Object elementType, Object container) {
+ public Object buildNode(Object elementType, Object container, String properyName) {
Object element = null;
@@ -825,28 +825,28 @@
element = Model.getStateMachinesFactory().buildGuard(container);
} else if (elementType == metaTypes.getCreateAction()) {
element = Model.getCommonBehaviorFactory().createCreateAction();
- setNewAction(container, (Action) element);
+ setNewAction(container, (Action) element, properyName);
} else if (elementType == metaTypes.getCallAction()) {
element = Model.getCommonBehaviorFactory().createCallAction();
- setNewAction(container, (Action) element);
+ setNewAction(container, (Action) element, properyName);
} else if (elementType == metaTypes.getReturnAction()) {
element = Model.getCommonBehaviorFactory().createReturnAction();
- setNewAction(container, (Action) element);
+ setNewAction(container, (Action) element, properyName);
} else if (elementType == metaTypes.getDestroyAction()) {
element = Model.getCommonBehaviorFactory().createDestroyAction();
- setNewAction(container, (Action) element);
+ setNewAction(container, (Action) element, properyName);
} else if (elementType == metaTypes.getSendAction()) {
element = Model.getCommonBehaviorFactory().createSendAction();
- setNewAction(container, (Action) element);
+ setNewAction(container, (Action) element, properyName);
} else if (elementType == metaTypes.getTerminateAction()) {
element = Model.getCommonBehaviorFactory().createTerminateAction();
- setNewAction(container, (Action) element);
+ setNewAction(container, (Action) element, properyName);
} else if (elementType == metaTypes.getUninterpretedAction()) {
element = Model.getCommonBehaviorFactory().createUninterpretedAction();
- setNewAction(container, (Action) element);
+ setNewAction(container, (Action) element, properyName);
} else if (elementType == metaTypes.getActionSequence()) {
element = Model.getCommonBehaviorFactory().createActionSequence();
- setNewAction(container, (Action) element);
+ setNewAction(container, (Action) element, properyName);
} else if (elementType == metaTypes.getCallEvent()) {
element = Model.getStateMachinesFactory().createCallEvent();
if (container instanceof Transition) {
@@ -911,17 +911,28 @@
return element;
}
- private void setNewAction(Object container, Action action) {
+ private void setNewAction(Object container, Action action, String propertyName) {
if (container instanceof Transition) {
((Transition) container).setEffect(action);
} else if (container instanceof State) {
- ((State) container).setEntry(action);
+ if ("exit".equals(propertyName)) {
+ ((State) container).setExit(action);
+ } else if ("doActivity".equals(propertyName)) {
+ ((State) container).setDoActivity(action);
+ } else {
+ ((State) container).setEntry(action);
+ }
} else if (container instanceof ActionSequence) {
((ActionSequence) container).getAction().add(action);
} else {
throw new IllegalArgumentException("Did not expect a " + container);
}
}
+
+ public Object buildNode(Object elementType, Object container) {
+ return buildNode(elementType, container, null);
+ }
+
/**
* Add a newly created event to a trigger
Modified: trunk/src/argouml-core-model/src/org/argouml/model/UmlFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-model/src/org/argouml/model/UmlFactory.java?view=diff&pathrev=18543&r1=18542&r2=18543
==============================================================================
--- trunk/src/argouml-core-model/src/org/argouml/model/UmlFactory.java (original)
+++ trunk/src/argouml-core-model/src/org/argouml/model/UmlFactory.java 2010-07-21 07:20:17-0700
@@ -97,6 +97,20 @@
Object buildNode(Object elementType, Object container);
/**
+ * Creates a UML model element of the given type and adds
+ * it to the passed in container.
+ *
+ * @param elementType the type of model element to build
+ * @param container the model element that will contain the
+ * newly built model element
+ * @param property the property name of the containment
+ * this is only required when a container has multiple
+ * properties old containing the same type of object
+ * @return the model element
+ */
+ Object buildNode(Object elementType, Object container, String property);
+
+ /**
* Checks if some type of UML model element is valid to
* connect other UML model elements.<p>
*
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2636380
To unsubscribe from this discussion, e-mail: [[email protected]].
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.