| author | Sidharth Singh | 2012-10-17 06:08:00 (EDT) |
|---|---|---|
| committer | Manik Kishore | 2012-10-17 06:08:00 (EDT) |
| commit | f398e2f086a142fc535632bef9de75bb8f273361 (patch) (side-by-side diff) | |
| tree | 63facb28a4ea4b94c1075672a491233d5f903a6e | |
| parent | e4904b2788c5076f4a9f0367a681953f0d74d346 (diff) | |
| download | org.eclipse.stardust.ui.web-f398e2f086a142fc535632bef9de75bb8f273361.zip org.eclipse.stardust.ui.web-f398e2f086a142fc535632bef9de75bb8f273361.tar.gz org.eclipse.stardust.ui.web-f398e2f086a142fc535632bef9de75bb8f273361.tar.bz2 | |
CRNT-26662
1)ModelElementUnmarshaller.java.
Made changes to updateNodeSymbol to update the childSymbols when lane x,y changes
Added method updateChildSymbolCoordinates
2)made changes to logic of adjustToSymbolBoundaries and stetchStop in m_swimlaneSymbol.js
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@60100 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
| -rw-r--r-- | web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementUnmarshaller.java | 71 | ||||
| -rw-r--r-- | web-modeler/src/main/resources/META-INF/xhtml/js/m_swimlaneSymbol.js | 39 |
2 files changed, 92 insertions, 18 deletions
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementUnmarshaller.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementUnmarshaller.java index 23701e3..e841a42 100644 --- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementUnmarshaller.java +++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementUnmarshaller.java @@ -46,6 +46,7 @@ import org.eclipse.stardust.model.xpdl.carnot.ConditionalPerformerType; import org.eclipse.stardust.model.xpdl.carnot.DataMappingConnectionType; import org.eclipse.stardust.model.xpdl.carnot.DataMappingType; import org.eclipse.stardust.model.xpdl.carnot.DataPathType; +import org.eclipse.stardust.model.xpdl.carnot.DataSymbolType; import org.eclipse.stardust.model.xpdl.carnot.DataType; import org.eclipse.stardust.model.xpdl.carnot.DescriptionType; import org.eclipse.stardust.model.xpdl.carnot.DirectionType; @@ -827,26 +828,55 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller if (nodeSymbol instanceof LaneSymbol && (nodeSymbolJto.has(ModelerConstants.WIDTH_PROPERTY) || nodeSymbolJto.has(ModelerConstants.HEIGHT_PROPERTY))) { + int xOffset = 0, yOffset = 0; + int height = 0; + int heightOffset = 0; PoolSymbol poolSymbol = (PoolSymbol) nodeSymbol.eContainer(); + // Update the width of current Lane. int width = extractInt(nodeSymbolJto, ModelerConstants.WIDTH_PROPERTY); + // Calculate widthOffset required to adjust other swimlanes int widthOffset = width - nodeSymbol.getWidth(); nodeSymbol.setWidth(width); - int height = 0; + // Update the height of current Lane. if (nodeSymbolJto.has(ModelerConstants.HEIGHT_PROPERTY)) { height = extractInt(nodeSymbolJto, ModelerConstants.HEIGHT_PROPERTY); + heightOffset = height - nodeSymbol.getHeight(); nodeSymbol.setHeight(height); } + // Update the child symbol co-ordinates wrt parent(lane) + if (nodeSymbolJto.has(ModelerConstants.X_OFFSET)) + xOffset = nodeSymbolJto.get(ModelerConstants.X_OFFSET).getAsInt(); + if (nodeSymbolJto.has(ModelerConstants.Y_OFFSET)) + yOffset = nodeSymbolJto.get(ModelerConstants.Y_OFFSET).getAsInt(); + + if (xOffset != 0) + { + updateChildSymbolCoordinates((LaneSymbol) nodeSymbol, xOffset, 0); + } + if (yOffset != 0) + { + updateChildSymbolCoordinates((LaneSymbol) nodeSymbol, 0, yOffset); + } + + // Update other swimlane width/height for (LaneSymbol lane : poolSymbol.getLanes()) { - if (nodeSymbol.getElementOid() != lane.getElementOid() - && (lane.getXPos() > nodeSymbol.getXPos())) + if (nodeSymbol.getElementOid() != lane.getElementOid()) { - lane.setXPos(lane.getXPos() + widthOffset); - if (height > 0) + if ((lane.getXPos() > nodeSymbol.getXPos() && widthOffset != 0)) + { + lane.setXPos(lane.getXPos() + widthOffset); + } + if (heightOffset != 0) + { lane.setHeight(height); + // if symbol on currentLane(nodeSymbol) is moved , adjustment on + // other lane symbol is required + updateChildSymbolCoordinates(lane, 0, yOffset); + } } } } @@ -867,6 +897,37 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller } /** + * Update the x,y co-ordinates of symbols contained in the lane + * + * @param laneSymbol + * @param xOffset + * @param yOffset + */ + private void updateChildSymbolCoordinates(LaneSymbol laneSymbol, int xOffset, int yOffset) + { + for (ActivitySymbolType activitySymbol : laneSymbol.getActivitySymbol()) + { + activitySymbol.setXPos(activitySymbol.getXPos() + xOffset); + activitySymbol.setYPos(activitySymbol.getYPos() + yOffset); + } + for (StartEventSymbol startSymbol : laneSymbol.getStartEventSymbols()) + { + startSymbol.setXPos(startSymbol.getXPos() + xOffset); + startSymbol.setYPos(startSymbol.getYPos() + yOffset); + } + for (EndEventSymbol endSymbol : laneSymbol.getEndEventSymbols()) + { + endSymbol.setXPos(endSymbol.getXPos() + xOffset); + endSymbol.setYPos(endSymbol.getYPos() + yOffset); + } + for (DataSymbolType dataSymbol : laneSymbol.getDataSymbol()) + { + dataSymbol.setXPos(dataSymbol.getXPos() + xOffset); + dataSymbol.setYPos(dataSymbol.getYPos() + yOffset); + } + } + + /** * * @param activitySymbol * @param gatewaySymbolJson diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_swimlaneSymbol.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_swimlaneSymbol.js index 28a0a54..367d40e 100644 --- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_swimlaneSymbol.js +++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_swimlaneSymbol.js @@ -853,11 +853,21 @@ define( } else {
this.text.attr("text", this.name);
}
- if (parseInt(this.height) != parseInt(this.preDragState.height)) {
- for (var i = 0; i < this.parentSymbol.laneSymbols.length; i++) {
- this.parentSymbol.laneSymbols[i].height = this.height;
- this.parentSymbol.laneSymbols[i].adjustGeometry();
- }
+
+ var moveX, moveY = 0;
+ if (this.preDragState.x < this.x) {
+ moveX = this.preDragState.x - this.x;
+ this.x = this.preDragState.x;
+ } else if (this.preDragState.x > this.x) {
+ moveX = this.preDragState.x - this.x;
+ this.x = this.preDragState.x;
+ }
+ if (this.preDragState.y < this.y) {
+ moveY = this.preDragState.y - this.y;
+ this.y = this.preDragState.y;
+ } else if (this.preDragState.y > this.y) {
+ moveY = this.preDragState.y - this.y;
+ this.y = this.preDragState.y;
}
this.parentSymbol.recalculateBoundingBox();
this.parentSymbol.adjustGeometry();
@@ -866,8 +876,11 @@ define( x : this.x,
y : this.y,
width : this.width,
- height : this.height
+ height : this.height,
+ xOffset : moveX,
+ yOffset : moveY
};
+
var command = m_command
.createUpdateModelElementCommand(
this.diagram.modelId, this.oid, changes);
@@ -975,9 +988,7 @@ define( if (parseInt(preAdjustmentPos.y) > (parseInt(y))
&& parseInt(this.height) > parseInt(preAdjustmentPos.height
.valueOf())) {
- moveY = this.height
- + m_constants.POOL_SWIMLANE_TOP_BOX_HEIGHT
- - parseInt(preAdjustmentPos.height);
+ moveY = this.height - parseInt(preAdjustmentPos.height);
}else if (this.y < preAdjustmentPos.y
&& this.height > preAdjustmentPos.height) {
@@ -991,8 +1002,7 @@ define( if (parseInt(preAdjustmentPos.x) > (parseInt(x))
&& parseInt(this.width) > parseInt(preAdjustmentPos.width
.valueOf())) {
- moveX = this.width + m_constants.POOL_SWIMLANE_MARGIN
- - parseInt(preAdjustmentPos.width);
+ moveX = this.width - parseInt(preAdjustmentPos.width);
}else if (this.x < preAdjustmentPos.x
&& this.width > preAdjustmentPos.width) {
@@ -1008,13 +1018,16 @@ define( if (preAdjustmentPos.width != this.width
|| preAdjustmentPos.height != this.height) {
-
var changes = {
x : this.x,
y : this.y,
width : this.width,
- height : this.height
+ height : this.height,
+ xOffset : moveX,
+ yOffset : moveY
};
+
+ this.parentSymbol.adjustGeometry();
var command = m_command
.createUpdateModelElementCommand(
this.diagram.modelId, this.oid, changes);
|

