summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2012-10-11 03:20:19 (EDT)
committer Manik Kishore2012-10-11 03:20:19 (EDT)
commit484428099a95a0fbceb521280308256250baea57 (patch)
treebf4368a136a61d9071fea3c48d10b76e76013e48
parent503f4c9ff0c978c242852b587992c2b56aa18308 (diff)
downloadorg.eclipse.stardust.ui.web-484428099a95a0fbceb521280308256250baea57.zip
org.eclipse.stardust.ui.web-484428099a95a0fbceb521280308256250baea57.tar.gz
org.eclipse.stardust.ui.web-484428099a95a0fbceb521280308256250baea57.tar.bz2
CRNT-26452
toLaneTypeJson will return updated the x,y co-ordinates for swimlanes. Made changes to updateNodeSymbol in ModelElementUnmarshaller.java to update all lane symbols on widht/height change Added code to cache the symbols x,y co-ord on update, required for scenarios when some lane is minimized and current lane symbol x,y change happens. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@59923 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/ProcessChangeCommandHandler.java10
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementMarshaller.java2
-rw-r--r--web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/marshaling/ModelElementUnmarshaller.java42
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_activitySymbol.js10
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_dataSymbol.js3
-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_eventSymbol.js3
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_gatewaySymbol.js12
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_poolSymbol.js94
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_swimlaneSymbol.js38
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js62
11 files changed, 238 insertions, 41 deletions
diff --git a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/ProcessChangeCommandHandler.java b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/ProcessChangeCommandHandler.java
index 2251331..baa5acd 100644
--- a/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/ProcessChangeCommandHandler.java
+++ b/web-modeler/src/main/java/org/eclipse/stardust/ui/web/modeler/edit/model/element/ProcessChangeCommandHandler.java
@@ -91,10 +91,12 @@ public class ProcessChangeCommandHandler
laneSymbol.setElementOid(++maxOid);
laneSymbol.setId(ModelerConstants.DEF_LANE_ID);
laneSymbol.setName(ModelerConstants.DEF_LANE_NAME);
- laneSymbol.setXPos(10);
- laneSymbol.setYPos(10);
- laneSymbol.setWidth(480);
- laneSymbol.setHeight(580);
+ // Setting the x,y for default swimlane
+ //TODO - Move this code to javascript
+ laneSymbol.setXPos(12);
+ laneSymbol.setYPos(32);
+ laneSymbol.setWidth(poolSymbol.getWidth() - 20);
+ laneSymbol.setHeight(poolSymbol.getHeight() - 20);
laneSymbol.setOrientation(OrientationType.VERTICAL_LITERAL);
processDefinition.getDiagram().add(diagram);
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 6f62129..b641a7d 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
@@ -386,6 +386,8 @@ public abstract class ModelElementMarshaller implements ModelMarshaller
laneSymbol.getElementOid());
laneSymbolJson.addProperty(ModelerConstants.ID_PROPERTY, laneSymbol.getId());
laneSymbolJson.addProperty(ModelerConstants.NAME_PROPERTY, laneSymbol.getName());
+ laneSymbolJson.addProperty(ModelerConstants.X_PROPERTY, laneSymbol.getXPos());
+ laneSymbolJson.addProperty(ModelerConstants.Y_PROPERTY, laneSymbol.getYPos());
laneSymbolJson.addProperty(ModelerConstants.WIDTH_PROPERTY, laneSymbol.getWidth());
laneSymbolJson.addProperty(ModelerConstants.HEIGHT_PROPERTY, laneSymbol.getHeight());
laneSymbolJson.addProperty(ModelerConstants.TYPE_PROPERTY,
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 20ef85b..46b9963 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
@@ -806,27 +806,45 @@ public abstract class ModelElementUnmarshaller implements ModelUnmarshaller
nodeSymbol.setXPos(x - laneOffsetX);
nodeSymbol.setYPos(y - laneOffsetY);
- if (nodeSymbolJto.has(ModelerConstants.WIDTH_PROPERTY))
+ if (nodeSymbol instanceof LaneSymbol
+ && (nodeSymbolJto.has(ModelerConstants.WIDTH_PROPERTY) || nodeSymbolJto.has(ModelerConstants.HEIGHT_PROPERTY)))
{
+ PoolSymbol poolSymbol = (PoolSymbol) nodeSymbol.eContainer();
int width = extractInt(nodeSymbolJto, ModelerConstants.WIDTH_PROPERTY);
+ int widthOffset = width - nodeSymbol.getWidth();
nodeSymbol.setWidth(width);
- }
- if (nodeSymbolJto.has(ModelerConstants.HEIGHT_PROPERTY))
- {
- int height = extractInt(nodeSymbolJto, ModelerConstants.HEIGHT_PROPERTY);
- if (nodeSymbol instanceof LaneSymbol)
+
+ int height = 0;
+ if (nodeSymbolJto.has(ModelerConstants.HEIGHT_PROPERTY))
+ {
+ height = extractInt(nodeSymbolJto, ModelerConstants.HEIGHT_PROPERTY);
+ nodeSymbol.setHeight(height);
+ }
+
+ for (LaneSymbol lane : poolSymbol.getLanes())
{
- // For swimlane, all lanes height needs adjustment
- PoolSymbol poolSymbol = (PoolSymbol) nodeSymbol.eContainer();
- for (LaneSymbol lanes : poolSymbol.getLanes())
+ if (nodeSymbol.getElementOid() != lane.getElementOid()
+ && (lane.getXPos() > nodeSymbol.getXPos()))
{
- lanes.setHeight(height);
+ lane.setXPos(lane.getXPos() + widthOffset);
+ if (height > 0)
+ lane.setHeight(height);
}
}
- else
+ }
+ else
+ {
+ if (nodeSymbolJto.has(ModelerConstants.WIDTH_PROPERTY))
+ {
+ int width = extractInt(nodeSymbolJto, ModelerConstants.WIDTH_PROPERTY);
+ nodeSymbol.setWidth(width);
+ }
+ if (nodeSymbolJto.has(ModelerConstants.HEIGHT_PROPERTY))
+ {
+ int height = extractInt(nodeSymbolJto, ModelerConstants.HEIGHT_PROPERTY);
nodeSymbol.setHeight(height);
+ }
}
-
}
}
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_activitySymbol.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_activitySymbol.js
index 25a18cf..30ea333 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_activitySymbol.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_activitySymbol.js
@@ -349,6 +349,10 @@ define(
this.commentCountText.hide();
this.commentCountIcon.hide();
}
+
+ // Store the server side co-ord, required for moving symbol
+ // when other lane is minimized.
+ this.updateServerSideCoordinates();
};
/**
@@ -466,6 +470,9 @@ define(
* size decreases
*/
ActivitySymbol.prototype.adjustPrimitivesOnShrink = function() {
+ if (this.parentSymbol && this.parentSymbol.minimized) {
+ return;
+ }
if (this.text.getBBox().width > this.width) {
var words = this.text.attr("text");
m_utils.textWrap(this.text, this.width);
@@ -473,8 +480,9 @@ define(
if (this.icon.getBBox().width > this.width) {
this.icon.hide();
- } else
+ } else {
this.icon.show();
+ }
}
/**
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 dbf75ed..6161ea0 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
@@ -269,6 +269,9 @@ define(
this.text.attr("text", data.name);
this.modelElement = data;
}
+ // Store the server side co-ord, required for moving symbol
+ // when other lane is minimized.
+ this.updateServerSideCoordinates();
};
/**
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 039f694..966f4c3 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
@@ -678,6 +678,7 @@ define(
} else {
if (null == this.findSymbolByGuid(obj.changes.added[i].oid)) {
this.poolSymbol.laneSymbols.push(m_swimlaneSymbol.createSwimlaneSymbolFromJson(this, this.poolSymbol, obj.changes.added[i]));
+ this.poolSymbol.sortLanes();
this.poolSymbol.adjustChildSymbols();
}
}
@@ -727,6 +728,7 @@ define(
if (obj.changes.added[j].type == m_constants.SWIMLANE_SYMBOL) {
swimlane = m_swimlaneSymbol.createSwimlaneSymbolFromJson(this, this.poolSymbol, obj.changes.added[j]);
this.poolSymbol.laneSymbols.push(swimlane);
+ this.poolSymbol.sortLanes();
this.poolSymbol.adjustChildSymbols();
}
}
@@ -830,6 +832,7 @@ define(
}
}
+ this.poolSymbol.refreshDiagram();
this.animationDelay = 0;
this.animationEasing = null;
}
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_eventSymbol.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_eventSymbol.js
index c8a030a..c92c741 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_eventSymbol.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_eventSymbol.js
@@ -201,6 +201,9 @@ define(
m_constants.EVENT_STOP_STROKE_WIDTH);
this.image.attr("src", this.stopImageUrl);
}
+ // Store the server side co-ord, required for moving symbol
+ // when other lane is minimized.
+ this.updateServerSideCoordinates();
};
/**
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_gatewaySymbol.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_gatewaySymbol.js
index a010dcd..e97a3bd 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_gatewaySymbol.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_gatewaySymbol.js
@@ -400,6 +400,14 @@ define(
/**
*
*/
+ GatewaySymbol.prototype.showPrimitives = function() {
+ this.path.show();
+ this.refreshFromModelElement();
+ };
+
+ /**
+ *
+ */
GatewaySymbol.prototype.refreshFromModelElement = function() {
if (this.modelElement.gatewayType == m_constants.AND_GATEWAY_TYPE) {
this.andPath.show();
@@ -414,6 +422,10 @@ define(
this.xorPath.hide();
this.orCircle.show();
}
+
+ // Store the server side co-ord, required for moving symbol
+ // when other lane is minimized.
+ this.updateServerSideCoordinates();
};
GatewaySymbol.prototype.recalculateBoundingBox = function() {
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 44bfe21..3272d6d 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
@@ -376,6 +376,76 @@ define(
};
/**
+ * Sort the lanes based on oid, required on Undo of delete lanes
+ */
+ PoolSymbol.prototype.sortLanes = function() {
+ this.laneSymbols.sort(function(a, b) {
+ return $(a)[0].oid > $(b)[0].oid;
+ });
+ };
+
+ /**
+ * Calculate Lane Offset and adjust symbols for all lanes
+ */
+ PoolSymbol.prototype.updateLanesOffsetAndAdjustChild = function(
+ currentLane, minimize) {
+ for ( var n in this.laneSymbols) {
+ // For all lanes right to current lane, set the XOffset
+ // for width adjustment
+ if (this.laneSymbols[n] != currentLane
+ && this.laneSymbols[n].x > currentLane.x) {
+ if (minimize) {
+ this.laneSymbols[n].symbolXOffset += currentLane.cacheWidth
+ - currentLane.width;
+ // Move the lane to left when adjacent lane is
+ // minimized
+ this.laneSymbols[n].moveBy(
+ -this.laneSymbols[n].symbolXOffset, 0);
+ // Move the contained symbols
+ for ( var c in this.laneSymbols[n].containedSymbols) {
+ this.laneSymbols[n].containedSymbols[c]
+ .moveBy(
+ -this.laneSymbols[n].symbolXOffset,
+ 0);
+ }
+ } else {
+ if (this.laneSymbols[n].symbolXOffset > 0 ) {
+ // Reset the offset, when adjacant lane is
+ // maximized
+ this.laneSymbols[n].symbolXOffset -= (currentLane.cacheWidth - currentLane.width);
+ //Move the lane to right
+ this.laneSymbols[n].moveBy(
+ currentLane.cacheWidth
+ - currentLane.width, 0);
+ // Move the contained symbols to saved
+ // location
+ for ( var c in this.laneSymbols[n].containedSymbols) {
+ this.laneSymbols[n].containedSymbols[c]
+ .moveTo(
+ this.laneSymbols[n].containedSymbols[c].serverSideCoordinates.x
+ - this.laneSymbols[n].symbolXOffset,
+ this.laneSymbols[n].containedSymbols[c].serverSideCoordinates.y);
+
+ // TODO - Cache Anchor Points stored when lane is minimized, needs to be
+ // moved when adj lane is maximized and current lane is in minimized state
+ /* for(var m in this.laneSymbols[n].containedSymbols[c].anchorPoints){
+ if(this.laneSymbols[n].containedSymbols[c].anchorPoints[m].cacheX){
+ this.laneSymbols[n].containedSymbols[c].anchorPoints[m].cacheX += this.laneSymbols[n].symbolXOffset;
+ }
+ if(this.laneSymbols[n].containedSymbols[c].anchorPoints[m].cacheY){
+ this.laneSymbols[n].containedSymbols[c].anchorPoints[m].cacheY += this.laneSymbols[n].symbolXOffset;
+ }
+ }*/
+ }
+ }
+ }
+ }
+ this.laneSymbols[n].adjustGeometry();
+ }
+ };
+
+
+ /**
*
*/
PoolSymbol.prototype.adjustPrimitives = function(dX, dY) {
@@ -409,6 +479,22 @@ define(
/**
*
*/
+ PoolSymbol.prototype.refreshDiagram = function() {
+ for ( var n in this.laneSymbols) {
+ if (this.laneSymbols[n].symbolXOffset) {
+ this.laneSymbols[n].x = this.laneSymbols[n].serverSideCoordinates.x;
+ for ( var m in this.laneSymbols[n].containedSymbols) {
+ this.laneSymbols[n].containedSymbols[m].x = this.laneSymbols[n].containedSymbols[m].serverSideCoordinates.x;
+ this.laneSymbols[n].containedSymbols[m].adjustGeometry();
+ }
+ }
+ }
+ this.adjustChildSymbols();
+ };
+
+ /**
+ *
+ */
PoolSymbol.prototype.adjustChildSymbols = function() {
if (this.diagram.flowOrientation == m_constants.DIAGRAM_FLOW_ORIENTATION_VERTICAL) {
var currentX = this.x
@@ -434,7 +520,9 @@ define(
for ( var n in this.laneSymbols) {
var dX = currentX - this.laneSymbols[n].x;
- this.laneSymbols[n].x = currentX;
+ 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;
@@ -457,7 +545,9 @@ define(
this.laneSymbols[n].x = this.x
+ m_constants.POOL_SWIMLANE_TOP_BOX_HEIGHT
+ m_constants.POOL_SWIMLANE_MARGIN;
- this.laneSymbols[n].y = currentY;
+ if (dY != 0) {
+ this.laneSymbols[n].moveBy(0, dY);
+ }
currentY += this.laneSymbols[n].height;
currentY += m_constants.POOL_SWIMLANE_MARGIN;
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 f6e3abf..4a1d8bb 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
@@ -68,7 +68,8 @@ define(
this.minimizeIcon = null;
this.cacheWidth = 0;
this.maximizeIcon = null;
- this.laneMinimized = false;
+ this.minimized = false;
+ this.symbolXOffset = 0;
/**
* Binds all client-side aspects to the object (graphics
@@ -106,6 +107,7 @@ define(
this.text = null;
this.minimizeIcon = null;
this.maximizeIcon = null;
+ this.symbolXOffset = 0;
};
/**
@@ -471,33 +473,39 @@ define(
this.width = m_constants.LANE_MIN_WIDTH;
this.minimizeIcon.hide();
this.maximizeIcon.show();
+ this.parentSymbol.recalculateBoundingBox();
+ this.parentSymbol.adjustPrimitives();
+ this.parentSymbol.adjustAuxiliaryElements();
for ( var n in this.containedSymbols) {
this.containedSymbols[n].hide();
}
-
+ this.parentSymbol.updateLanesOffsetAndAdjustChild(this, true);
var str = this.text.attr("text");
if (str.length > 8) {
this.text.attr("text", str.substring(0, 8) + " ...");
}
- this.parentSymbol.recalculateBoundingBox();
- this.parentSymbol.adjustGeometry();
- this.laneMinimized = true;
+ this.minimized = true;
+ this.diagram.hideSnapLines();
};
/**
*
*/
SwimlaneSymbol.prototype.onMaximizeIconClick = function() {
+ this.parentSymbol.updateLanesOffsetAndAdjustChild(this, false);
this.width = this.cacheWidth;
this.maximizeIcon.hide();
this.minimizeIcon.show();
- this.laneMinimized = false;
+ this.minimized = false;
this.text.attr("text", this.name);
+ this.parentSymbol.recalculateBoundingBox();
+ this.parentSymbol.adjustPrimitives();
+ this.parentSymbol.adjustAuxiliaryElements();
for ( var n in this.containedSymbols) {
this.containedSymbols[n].show();
}
- this.parentSymbol.recalculateBoundingBox();
- this.parentSymbol.adjustGeometry();
+ this.refresh();
+ this.diagram.hideSnapLines();
};
/**
@@ -661,6 +669,9 @@ define(
this.text.attr("text", this.name);
}
this.participantName = this.text.attr("text");
+ // Store the server side co-ord, required for moving symbol
+ // when other lane is minimized.
+ this.updateServerSideCoordinates();
};
/**
@@ -927,23 +938,23 @@ define(
*/
SwimlaneSymbol.prototype.adjustToSymbolBoundaries = function(x,
y) {
- var left = this.x;
- var right = this.x + this.width;
+ var left = this.x + this.symbolXOffset;
+ var right = this.x + this.width + this.symbolXOffset;
var top = this.y;
var bottom = this.y + this.height;
var moveX=0;
var moveY=0;
var preAdjustmentPos = {
- x : this.x,
+ x : this.x + this.symbolXOffset,
y : this.y,
width : this.width,
height : this.height
}
for ( var n in this.containedSymbols) {
- left = Math.min(this.containedSymbols[n].x
+ left = Math.min(this.containedSymbols[n].x + this.symbolXOffset
- m_constants.POOL_SWIMLANE_MARGIN, left);
- right = Math.max(this.containedSymbols[n].x
+ right = Math.max(this.containedSymbols[n].x + this.symbolXOffset
+ this.containedSymbols[n].width
+ m_constants.POOL_SWIMLANE_MARGIN, right);
top = Math.min(this.containedSymbols[n].y
@@ -997,6 +1008,7 @@ define(
command.sync = true;
m_commandsController.submitCommand(command);
}
+ this.x -= this.symbolXOffset;
this.parentSymbol.recalculateBoundingBox();
this.parentSymbol.adjustGeometry();
};
diff --git a/web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js b/web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js
index 8a84ce2..c424ee7 100644
--- a/web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js
+++ b/web-modeler/src/main/resources/META-INF/xhtml/js/m_symbol.js
@@ -46,6 +46,7 @@ define(
this.dragStartX = 0;
this.dragStartY = 0;
this.visible = true;
+ this.serverSideCoordinates = null;
// Method initialization
@@ -145,6 +146,17 @@ define(
};
/**
+ * Store the server side co-ordinates, required to move the
+ * symbols from original point when some lane is minimized
+ */
+ Symbol.prototype.updateServerSideCoordinates = function() {
+ this.serverSideCoordinates = {
+ x : this.x,
+ y : this.y
+ };
+ };
+
+ /**
*
*/
Symbol.prototype.isContainerSymbol = function() {
@@ -171,7 +183,7 @@ define(
// If tried to add symbol outside Lane or when lane is
// minimized symbols cannot be added
if (this.parentSymbol == null
- || this.parentSymbol.laneMinimized) {
+ || this.parentSymbol.minimized) {
// TODO May make exception
m_messageDisplay
.showErrorMessage("Symbol can only be dropped inside a expanded lane.");
@@ -225,6 +237,12 @@ define(
Symbol.prototype.complete = function(sync) {
this.completeNoTransfer(this);
if (this.isCompleted()) {
+ // If any lane is minimized, symbolXOffset is added to
+ // store correct co-ord,
+ // as of state when all lane will be maximized
+ if (this.parentSymbol.symbolXOffset) {
+ this.x += this.parentSymbol.symbolXOffset;
+ }
this.createAndSubmitCreateCommand(sync);
}
@@ -372,9 +390,9 @@ define(
*/
Symbol.prototype.show = function() {
this.visible = true;
- this.showConnections();
- this.showPrimitives();
this.refreshFromModelElement();
+ this.showPrimitives();
+ this.showConnections();
this.showProximitySensor();
};
@@ -395,6 +413,7 @@ define(
if (this.parentSymbol.id == connectionStartLane.id) {
// When connection is from left to right
if (conn.toAnchorPoint.x > conn.fromAnchorPoint.x) {
+ conn.fromAnchorPoint.cacheX = conn.fromAnchorPoint.x;
conn.fromAnchorPoint.x = this.parentSymbol.x
+ this.parentSymbol.width;
@@ -405,6 +424,7 @@ define(
} else {
// When connection is from right to left
+ conn.fromAnchorPoint.cacheX = conn.fromAnchorPoint.x;
conn.fromAnchorPoint.x = this.parentSymbol.x;
this.cacheAnchorPointAndAdjust(
conn.fromAnchorPoint,
@@ -417,6 +437,7 @@ define(
else {
// When connection is from right to left
if (conn.fromAnchorPoint.x > conn.toAnchorPoint.x) {
+ conn.toAnchorPoint.cacheX = conn.toAnchorPoint.x;
conn.toAnchorPoint.x = this.parentSymbol.x
+ this.parentSymbol.width;
@@ -426,6 +447,7 @@ define(
conn.toAnchorPoint.orientation = m_constants.EAST;
} else {
+ conn.toAnchorPoint.cacheX = conn.toAnchorPoint.x;
conn.toAnchorPoint.x = connectionToLane.x;
this.cacheAnchorPointAndAdjust(
@@ -450,19 +472,22 @@ define(
currentAnchorPt.cacheOrientation = currentAnchorPt.orientation;
if (!currentAnchorPt.symbol.visible
&& !targetAnchorPt.symbol.visible) {
+ currentAnchorPt.cacheY = currentAnchorPt.y;
currentAnchorPt.y = targetAnchorPt.y;
} else {
// When the to orientation is south, we need to
// move the connection down
if (targetAnchorPt.orientation == m_constants.SOUTH) {
+ currentAnchorPt.cacheY = currentAnchorPt.y;
currentAnchorPt.y = targetAnchorPt.y
+ m_constants.CONNECTION_MINIMAL_SEGMENT_LENGTH;
} else if (targetAnchorPt.orientation == m_constants.NORTH) {
+ currentAnchorPt.cacheY = currentAnchorPt.y;
currentAnchorPt.y = targetAnchorPt.y
- m_constants.CONNECTION_MINIMAL_SEGMENT_LENGTH;
} else {
+ currentAnchorPt.cacheY = currentAnchorPt.y;
currentAnchorPt.y = targetAnchorPt.y;
-
}
}
@@ -475,17 +500,26 @@ define(
Symbol.prototype.showConnections = function() {
var n = 0;
for ( var n in this.connections) {
- this.connections[n].show();
if (this.connections[n].fromAnchorPoint.cacheOrientation != null
&& this.connections[n].fromAnchorPoint.symbol.visible) {
this.connections[n].fromAnchorPoint.orientation = this.connections[n].fromAnchorPoint.cacheOrientation;
+ if (this.connections[n].fromAnchorPoint.cacheX)
+ this.connections[n].fromAnchorPoint.x = this.connections[n].fromAnchorPoint.cacheX;
+ if (this.connections[n].fromAnchorPoint.cacheY)
+ this.connections[n].fromAnchorPoint.y = this.connections[n].fromAnchorPoint.cacheY;
this.connections[n].fromAnchorPoint.cacheOrientation = null;
}
if (this.connections[n].toAnchorPoint.cacheOrientation != null
&& this.connections[n].toAnchorPoint.symbol.visible) {
this.connections[n].toAnchorPoint.orientation = this.connections[n].toAnchorPoint.cacheOrientation;
+ if (this.connections[n].toAnchorPoint.cacheX)
+ this.connections[n].toAnchorPoint.x = this.connections[n].toAnchorPoint.cacheX;
+ if (this.connections[n].toAnchorPoint.cacheY)
+ this.connections[n].toAnchorPoint.y = this.connections[n].toAnchorPoint.cacheY;
this.connections[n].toAnchorPoint.cacheOrientation = null;
}
+ this.connections[n].reroute();
+ this.connections[n].show();
}
};
@@ -781,6 +815,15 @@ define(
/**
*
*/
+ Symbol.prototype.moveTo = function(x, y) {
+ this.x = x;
+ this.y = y;
+ this.moveBy(0, 0);
+ };
+
+ /**
+ *
+ */
Symbol.prototype.moveBy = function(dX, dY) {
this.x = this.x + dX;
this.y = this.y + dY;
@@ -806,7 +849,7 @@ define(
} else {
// If connection is visible and swimlane is minimize
if (this.connections[connection].visible
- && this.parentSymbol.laneMinimized) {
+ && this.parentSymbol.minimized) {
var fromAnchorPt = this.connections[connection].fromAnchorPoint;
var toAnchorPt = this.connections[connection].toAnchorPoint;
var fromAnchorParentLaneX = fromAnchorPt.symbol.parentSymbol.x;
@@ -948,7 +991,7 @@ define(
"oid" : this.oid
};
var newGeometry = {
- "x" : this.x,
+ "x" : this.x + this.parentSymbol.symbolXOffset,
"y" : this.y,
"parentSymbolId" : this.parentSymbol.id,
"type" : this.type
@@ -973,7 +1016,7 @@ define(
"oid" : this.oid
};
var newGeometry = {
- "x" : this.x,
+ "x" : this.x + this.parentSymbol.symbolXOffset,
"y" : this.y,
"parentSymbolId" : this.parentSymbol.id
};
@@ -1749,6 +1792,8 @@ define(
this.x = 0;
this.y = 0;
this.cacheOrientation = null;
+ this.cacheX = null;
+ this.cacheY = null;
this.graphics = m_canvasManager
.drawRectangle(
@@ -1794,7 +1839,6 @@ define(
AnchorPoint.prototype.moveTo = function(x, y) {
this.x = x;
this.y = y;
-
this.graphics.attr({
'x' : this.x - 0.5 * m_constants.DEFAULT_ANCHOR_WIDTH,
'y' : this.y - 0.5 * m_constants.DEFAULT_ANCHOR_HEIGHT