summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2012-08-03 01:39:44 (EDT)
committer Manik Kishore2012-08-07 05:02:13 (EDT)
commitd6d7d860b70cc5c925762ef5b5083ab53b5e846c (patch)
treef2595769581bd735eab3d96c9ad4a754a68b52d3
parent3ccb48c4298affcb507c4c64da4e4015becd785b (diff)
downloadorg.eclipse.stardust.ui.web-d6d7d860b70cc5c925762ef5b5083ab53b5e846c.zip
org.eclipse.stardust.ui.web-d6d7d860b70cc5c925762ef5b5083ab53b5e846c.tar.gz
org.eclipse.stardust.ui.web-d6d7d860b70cc5c925762ef5b5083ab53b5e846c.tar.bz2
Jira-ID: CRNT-25577
1)Added code to set TYPE_PROPERTY for all model elements in ModelElementMarshaller. 2)Added method toLaneType and toDataMappingConnectionType in ModelElementMarshaller 3)Made changes in processCommand in m_diagram.js to use type attribute for added[] objects 3)Changed the connection path attribute for dataFlow in m_connection.js git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@58147 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementMarshaller.java109
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_connection.js2
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_dataSymbol.js4
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js22
4 files changed, 113 insertions, 24 deletions
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementMarshaller.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementMarshaller.java
index 2b23c5f..987135f 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementMarshaller.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementMarshaller.java
@@ -42,7 +42,6 @@ import org.eclipse.stardust.model.xpdl.carnot.StartEventSymbol;
import org.eclipse.stardust.model.xpdl.carnot.TransitionConnectionType;
import org.eclipse.stardust.model.xpdl.carnot.TransitionType;
//import org.eclipse.stardust.ui.web.modeler.service.ModelService;
-import org.eclipse.stardust.model.xpdl.carnot.impl.DataTypeImpl;
import org.eclipse.stardust.model.xpdl.carnot.impl.LaneSymbolImpl;
import org.eclipse.stardust.model.xpdl.carnot.impl.ProcessDefinitionTypeImpl;
import org.eclipse.stardust.model.xpdl.carnot.util.ActivityUtil;
@@ -83,6 +82,10 @@ public class ModelElementMarshaller
{
jsResult = toProcessDefinition((ProcessDefinitionType) modelElement);
}
+ else if (modelElement instanceof LaneSymbolImpl)
+ {
+ jsResult = toLaneType((LaneSymbolImpl) modelElement);
+ }
else if (modelElement instanceof ActivityType)
{
jsResult = toActivityType((ActivityType) modelElement);
@@ -95,6 +98,10 @@ public class ModelElementMarshaller
{
jsResult = toStartEventJson((StartEventSymbol) modelElement);
}
+ else if (modelElement instanceof EndEventSymbol)
+ {
+ jsResult = toEndEventJson((EndEventSymbol) modelElement);
+ }
else if (modelElement instanceof ApplicationType)
{
jsResult = toApplication((ApplicationType) modelElement);
@@ -103,6 +110,10 @@ public class ModelElementMarshaller
{
jsResult = toTransitionType((TransitionConnectionType) modelElement);
}
+ else if (modelElement instanceof DataMappingConnectionType)
+ {
+ jsResult = toDataMappingConnectionType((DataMappingConnectionType) modelElement);
+ }
else if (modelElement instanceof DataType)
{
jsResult = toDataTypeJson((DataType) modelElement);
@@ -190,6 +201,26 @@ public class ModelElementMarshaller
}
/**
+ *
+ * @param laneSymbol
+ * @return
+ */
+ public JsonObject toLaneType(LaneSymbolImpl laneSymbol)
+ {
+ JsonObject laneSymbolJson = new JsonObject();
+
+ laneSymbolJson.addProperty(ModelerConstants.OID_PROPERTY,
+ laneSymbol.getElementOid());
+ laneSymbolJson.addProperty(ModelerConstants.ID_PROPERTY, laneSymbol.getId());
+ laneSymbolJson.addProperty(ModelerConstants.NAME_PROPERTY, laneSymbol.getName());
+ laneSymbolJson.addProperty(ModelerConstants.WIDTH_PROPERTY, laneSymbol.getWidth());
+ laneSymbolJson.addProperty(ModelerConstants.HEIGHT_PROPERTY, laneSymbol.getHeight());
+ laneSymbolJson.addProperty(ModelerConstants.TYPE_PROPERTY, ModelerConstants.SWIMLANE_SYMBOL);
+
+ return laneSymbolJson;
+ }
+
+ /**
* @return
*/
public JsonObject toProcessDefinitionDiagram(
@@ -644,7 +675,7 @@ public class ModelElementMarshaller
activitySymbol.getWidth());
activitySymbolJson.addProperty(ModelerConstants.HEIGHT_PROPERTY,
activitySymbol.getHeight());
-
+
ActivityType activity = activitySymbol.getActivity();
JsonObject activityJson = toActivityType(activity);
@@ -654,6 +685,8 @@ public class ModelElementMarshaller
if (activity.getId().toLowerCase().startsWith("gateway"))
{
+ activitySymbolJson.addProperty(ModelerConstants.TYPE_PROPERTY,
+ ModelerConstants.GATEWAY_SYMBOL);
// TODO Refactor
// Identify the gateway symbol for this activity and update the
// location and dimension attributes.
@@ -684,6 +717,11 @@ public class ModelElementMarshaller
thisGatewaySymbol.getHeight());
}
}
+ else
+ {
+ activitySymbolJson.addProperty(ModelerConstants.TYPE_PROPERTY,
+ ModelerConstants.ACTIVITY_SYMBOL);
+ }
// TODO Obtain access points on client
@@ -759,6 +797,7 @@ public class ModelElementMarshaller
eventJson.addProperty(ModelerConstants.TYPE_PROPERTY, ModelerConstants.EVENT_KEY);
eventJson.addProperty(ModelerConstants.EVENT_TYPE_PROPERTY,
ModelerConstants.START_EVENT);
+ eventSymbolJson.addProperty(ModelerConstants.TYPE_PROPERTY,ModelerConstants.EVENT_SYMBOL);
// eventJson.put(ID_PROPERTY,
// String.valueOf(startEventSymbol.getModelElement().getId()));
// loadDescription(eventJson,
@@ -805,7 +844,9 @@ public class ModelElementMarshaller
JsonObject eventJson = new JsonObject();
eventSymbolJson.add(ModelerConstants.MODEL_ELEMENT_PROPERTY, eventJson);
-
+
+ eventSymbolJson.addProperty(ModelerConstants.TYPE_PROPERTY,ModelerConstants.EVENT_SYMBOL);
+
eventJson.addProperty(ModelerConstants.TYPE_PROPERTY, ModelerConstants.EVENT_KEY);
eventJson.addProperty(ModelerConstants.EVENT_TYPE_PROPERTY,
ModelerConstants.STOP_EVENT);
@@ -815,7 +856,7 @@ public class ModelElementMarshaller
// endEventSymbol.getModelElement());
// loadAttributes(endEventSymbol.getModelElement(),
// eventJson);
-
+
return eventSymbolJson;
}
@@ -864,7 +905,7 @@ public class ModelElementMarshaller
dataSymbolJson.addProperty(ModelerConstants.X_PROPERTY, dataSymbol.getXPos());
dataSymbolJson.addProperty(ModelerConstants.Y_PROPERTY, dataSymbol.getYPos());
dataSymbolJson.addProperty(ModelerConstants.TYPE_PROPERTY, ModelerConstants.DATA_SYMBOL);
- dataSymbolJson.add("data", toDataTypeJson(dataSymbol.getData()));
+ dataSymbolJson.add(ModelerConstants.DATA, toDataTypeJson(dataSymbol.getData()));
dataSymbolJson.addProperty(ModelerConstants.DATA_FULL_ID_PROPERTY,
MBFacade.createFullId(ModelUtils.findContainingModel(dataSymbol.getData()), dataSymbol.getData()));
@@ -975,6 +1016,64 @@ public class ModelElementMarshaller
/**
*
+ * @param dataMappingConnection
+ * @return
+ */
+ public JsonObject toDataMappingConnectionType(DataMappingConnectionType dataMappingConnection)
+ {
+ JsonObject connectionJson = new JsonObject();
+
+ connectionJson.addProperty(ModelerConstants.OID_PROPERTY,
+ dataMappingConnection.getElementOid());
+ connectionJson.addProperty(ModelerConstants.FROM_MODEL_ELEMENT_OID,
+ dataMappingConnection.getDataSymbol().getElementOid());
+ connectionJson.addProperty(ModelerConstants.FROM_MODEL_ELEMENT_TYPE,
+ ModelerConstants.DATA);
+ connectionJson.addProperty(ModelerConstants.TO_MODEL_ELEMENT_OID,
+ dataMappingConnection.getActivitySymbol().getElementOid());
+ connectionJson.addProperty(ModelerConstants.TO_MODEL_ELEMENT_TYPE,
+ ModelerConstants.ACTIVITY_KEY);
+ connectionJson.addProperty(
+ ModelerConstants.FROM_ANCHOR_POINT_ORIENTATION_PROPERTY,
+ mapAnchorOrientation(dataMappingConnection.getSourceAnchor()));
+ connectionJson.addProperty(
+ ModelerConstants.TO_ANCHOR_POINT_ORIENTATION_PROPERTY,
+ mapAnchorOrientation(dataMappingConnection.getTargetAnchor()));
+
+ JsonObject dataFlowJson = new JsonObject();
+ connectionJson.add(ModelerConstants.MODEL_ELEMENT_PROPERTY, dataFlowJson);
+
+ dataFlowJson.addProperty(ModelerConstants.TYPE_PROPERTY,
+ ModelerConstants.DATA_FLOW_LITERAL);
+ dataFlowJson.addProperty(ModelerConstants.ID_PROPERTY, ""
+ + dataMappingConnection.getElementOid());
+
+ // TODO Needed!
+// if (dataMappingC.getDirection() == DirectionType.IN_LITERAL)
+// {
+// dataFlow.put(ModelerConstants.IN_DATA_MAPPING_PROPERTY, true);
+// dataFlow.put(ModelerConstants.OUT_DATA_MAPPING_PROPERTY, false);
+// }
+// else if (dataMapping.getDirection() == DirectionType.OUT_LITERAL)
+// {
+// dataFlow.put(ModelerConstants.IN_DATA_MAPPING_PROPERTY, false);
+// dataFlow.put(ModelerConstants.OUT_DATA_MAPPING_PROPERTY, true);
+// }
+// else
+// {
+// dataFlow.put(ModelerConstants.IN_DATA_MAPPING_PROPERTY, true);
+// dataFlow.put(ModelerConstants.OUT_DATA_MAPPING_PROPERTY, true);
+// }
+
+ dataFlowJson.addProperty(ModelerConstants.DATA_FULL_ID_PROPERTY, MBFacade.createFullId(ModelUtils.findContainingModel(dataMappingConnection.getDataSymbol().getData()),
+ dataMappingConnection.getDataSymbol().getData()));
+ dataFlowJson.addProperty(ModelerConstants.ACTIVITY_ID_PROPERTY,
+ dataMappingConnection.getActivitySymbol().getActivity().getId());
+ return connectionJson;
+ }
+
+ /**
+ *
* @param transitionConnection
* @return
*/
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_connection.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_connection.js
index 9d47e85..68a85f3 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_connection.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_connection.js
@@ -659,7 +659,7 @@ define(
} else if (this.isDataFlow()) {
this.path.attr({
"stroke" : m_constants.DATA_FLOW_COLOR,
- "stroke-dasharray" : ""
+ "stroke-dasharray" : "-"
});
if (this.modelElement.inDataMapping) {
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_dataSymbol.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_dataSymbol.js
index 11f1361..99b0d23 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_dataSymbol.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_dataSymbol.js
@@ -288,9 +288,9 @@ define(
*/
DataSymbol.prototype.refreshFromModelElement = function() {
var data = m_model.findData(this.dataFullId);
-
+ this.modelElement = data;
+
// Data mayno have been created yet
-
if (data != null) {
this.text.attr("text", data.name);
}
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js
index e8ec794..5bc63bd 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js
@@ -538,22 +538,12 @@ define(
// TODO is lastSymbol still needed
for ( var i = 0; i < obj.changes.added.length; i++) {
- if (null != this.lastSymbol) {
- if (null != this.lastSymbol.modelElement
- && null != obj.changes.added[i].modelElement) {
- this.lastSymbol.modelElement.oid = obj.changes.added[i].modelElement.oid;
- this.lastSymbol.oid = obj.changes.added[i].oid;
- } else {
- // If current symbol is modelElement of an
- // Symbol and already set, no need to set
- // anything
- if (null != this.lastSymbol.modelElement
- && this.lastSymbol.modelElement.oid == obj.changes.added[i].oid) {
- continue;
- } else {
- this.lastSymbol.oid = obj.changes.added[i].oid;
- }
- }
+ if ((null != this.lastSymbol && null != obj.changes.added[i].type)
+ && obj.changes.added[i].type
+ .match(this.lastSymbol.type)) {
+ this.lastSymbol
+ .applyChanges(obj.changes.added[i]);
+
}// For connections lastSymbol will be empty
else if (null != obj.changes.added[i].modelElement) {
// for connections , search by connectionId to