summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2012-11-06 07:51:22 (EST)
committerSven Rottstock2012-11-14 09:20:35 (EST)
commit455f293364d0337e23d33c567caa9a088d3a3079 (patch)
tree4affbe8487e349c36d49b39d04a3db17a82fe74b
parent3a27d41c8f7a5fcfccd474dc1785043c568e0598 (diff)
downloadorg.eclipse.stardust.ui.web-455f293364d0337e23d33c567caa9a088d3a3079.zip
org.eclipse.stardust.ui.web-455f293364d0337e23d33c567caa9a088d3a3079.tar.gz
org.eclipse.stardust.ui.web-455f293364d0337e23d33c567caa9a088d3a3079.tar.bz2
CRNT-25432
Added code to sort the lanes in toProcessDefinitionDiagram in ModelElementMarshaller.java Made changes in m_poolSymbol.js adjustChildSymbols to adjust lane Y margin. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@60603 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementMarshaller.java59
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js3
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_poolSymbol.js18
3 files changed, 47 insertions, 33 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 1cb1cb8..399024f 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
@@ -3,6 +3,7 @@ package org.eclipse.stardust.ui.web.modeler.marshaling;
import static org.eclipse.stardust.ui.web.modeler.marshaling.GsonUtils.extractInt;
import static org.eclipse.stardust.ui.web.modeler.marshaling.GsonUtils.extractString;
+import java.util.Comparator;
import java.util.List;
import org.eclipse.emf.common.util.EList;
@@ -67,9 +68,11 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
+import static org.eclipse.emf.common.util.ECollections.sort;
+
/**
* IPP XPDL marshaller.
- *
+ *
* @author Marc.Gille
* @author Robert Sauer
*/
@@ -84,7 +87,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
private JsonMarshaller jsonIo = new JsonMarshaller();
/**
- *
+ *
* @param modelElement
* @return
*/
@@ -367,12 +370,12 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
return processJson;
}
-
+
/**
* To resolve inconsistency between Access Point and
- *
+ *
* TODO Review and move to Facade
- *
+ *
* @param type
* @return
*/
@@ -397,7 +400,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
}
/**
- *
+ *
* @param laneSymbol
* @return
*/
@@ -467,6 +470,16 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
JsonArray laneSymbols = new JsonArray();
poolSymbolJson.add(ModelerConstants.LANE_SYMBOLS, laneSymbols);
+ // Sort the lane Symbols based on 'X' co-ordinates
+ sort(poolSymbol.getChildLanes(), new Comparator<LaneSymbol>()
+ {
+ @Override
+ public int compare(LaneSymbol o1, LaneSymbol o2)
+ {
+ return (int) ((int) o1.getXPos() - (int) o2.getXPos());
+ }
+ });
+
for (LaneSymbol laneSymbol : poolSymbol.getChildLanes())
{
JsonObject laneSymbolJson = new JsonObject();
@@ -608,7 +621,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
}
/**
- *
+ *
* @param activity
* @return
*/
@@ -787,7 +800,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
}
/**
- *
+ *
* @param activitySymbol
* @return
*/
@@ -875,7 +888,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
}
/**
- *
+ *
* @param startEventSymbol
* @return
*/
@@ -929,7 +942,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
}
/**
- *
+ *
* @param startEventSymbol
* @return
*/
@@ -981,7 +994,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
}
/**
- *
+ *
* @param data
* @return
*/
@@ -1100,7 +1113,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
}
/**
- *
+ *
* @param startEventSymbol
* @return
*/
@@ -1451,7 +1464,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
}
/**
- *
+ *
* @param annotationSymbol
* @return
*/
@@ -1500,7 +1513,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
}
/**
- *
+ *
* @param dataMappingConnection
* @return
*/
@@ -1625,7 +1638,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
}
/**
- *
+ *
* @param transitionConnection
* @return
*/
@@ -1767,7 +1780,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
}
/**
- *
+ *
* @param transitionConnection
* @return
*/
@@ -2101,7 +2114,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
}
/**
- *
+ *
* @param orientation
* @return
*/
@@ -2132,7 +2145,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
}
/**
- *
+ *
* @param modelElementJson
* @param element
*/
@@ -2152,7 +2165,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
}
/**
- *
+ *
* @param element
* @param json
* @throws JSONException
@@ -2186,7 +2199,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
"carnot:engine:type"))
{
// For Access Points
-
+
// TODO Very ugly storage
json.addProperty(ModelerConstants.PRIMITIVE_DATA_TYPE_PROPERTY,
@@ -2196,7 +2209,7 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
"carnot:engine:dataType"))
{
// For Access Points
-
+
// TODO Very ugly storage
String encodedId = getModelBuilderFacade().getAttributeValue(attribute);
@@ -2232,9 +2245,9 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
}
/**
- *
+ *
* TODO From DynamicConnectionCommand. Refactor?
- *
+ *
* @param activity
* @return
*/
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 6375e3a..71f73fb 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
@@ -797,8 +797,7 @@ define(
m_utils.debug("Changed symbol to:");
m_utils.debug(symbol);
symbol.refresh();
- if ((command.isUndo || command.isRedo)
- && symbol.type == m_constants.SWIMLANE_SYMBOL) {
+ if (symbol.type == m_constants.SWIMLANE_SYMBOL) {
// When swimlane co-ordinates change in Undo/Redo,
// PoolSymbol needs adjustment.
symbol.parentSymbol
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_poolSymbol.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_poolSymbol.js
index 05a3a6c..63fe4da 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_poolSymbol.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_poolSymbol.js
@@ -524,6 +524,8 @@ define(
*
*/
PoolSymbol.prototype.adjustChildSymbols = function() {
+ var topMargin = m_constants.POOL_SWIMLANE_TOP_BOX_HEIGHT
+ + m_constants.POOL_SWIMLANE_MARGIN;
if (this.diagram.flowOrientation == m_constants.DIAGRAM_FLOW_ORIENTATION_VERTICAL) {
var currentX = this.x
+ m_constants.POOL_SWIMLANE_MARGIN;
@@ -548,17 +550,19 @@ define(
for ( var n in this.laneSymbols) {
var dX = currentX - this.laneSymbols[n].x;
+ var laneYMargin = topMargin - this.laneSymbols[n].y
if (dX != 0) {
this.laneSymbols[n].moveBy(dX, 0);
}
- this.laneSymbols[n].y = this.y
- + m_constants.POOL_SWIMLANE_TOP_BOX_HEIGHT
- + m_constants.POOL_SWIMLANE_MARGIN;
+ if (laneYMargin > 0) {
+ this.laneSymbols[n].moveBy(0, laneYMargin);
+ }
currentX += this.laneSymbols[n].width;
currentX += m_constants.POOL_SWIMLANE_MARGIN;
- for (var c in this.laneSymbols[n].containedSymbols) {
- this.laneSymbols[n].containedSymbols[c].moveBy(dX, dY);
+ for ( var c in this.laneSymbols[n].containedSymbols) {
+ this.laneSymbols[n].containedSymbols[c].moveBy(
+ dX, dY);
}
this.laneSymbols[n].adjustGeometry();
@@ -570,9 +574,7 @@ define(
for ( var n in this.laneSymbols) {
var dY = currentY - this.laneSymbols[n].y;
- this.laneSymbols[n].x = this.x
- + m_constants.POOL_SWIMLANE_TOP_BOX_HEIGHT
- + m_constants.POOL_SWIMLANE_MARGIN;
+ this.laneSymbols[n].x = this.x + topMargin;
if (dY != 0) {
this.laneSymbols[n].moveBy(0, dY);
}