summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidharth Singh2012-09-14 02:57:41 (EDT)
committer Stephan Born2012-09-14 02:57:41 (EDT)
commit60441fba5c8f16c243b40a63a9707b30ece9739d (patch)
tree2e24c7b538ccdc6e46f767943b7ab07640671dea
parenta1881f40e3f137a9d079e199e828e679d5836a2b (diff)
downloadorg.eclipse.stardust.ui.web-60441fba5c8f16c243b40a63a9707b30ece9739d.zip
org.eclipse.stardust.ui.web-60441fba5c8f16c243b40a63a9707b30ece9739d.tar.gz
org.eclipse.stardust.ui.web-60441fba5c8f16c243b40a63a9707b30ece9739d.tar.bz2
CRNT-26001
1)Added code in m_dataSymbol.js for validateCreateConnection for DataSymbol 2)Added code in m_activitySymbol.js for validateCreateConnection for ActivitySymbol 3)Added check in validateCreateConnection in m_connection.js for ActivitySymbol and DataSymbol creation rules. git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@59195 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_activitySymbol.js102
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_connection.js98
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_dataSymbol.js59
-rw-r--r--web-modeler/src/main/resources/META-INF/xhtml/js/m_diagram.js22
4 files changed, 217 insertions, 64 deletions
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 73f68fe..fbcdecd 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
@@ -3,7 +3,7 @@
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors: SunGard CSA LLC - initial API and implementation and/or initial
* documentation
******************************************************************************/
@@ -68,7 +68,7 @@ define(
};
/**
- *
+ *
*/
function ActivitySymbol() {
var symbol = m_symbol.createSymbol();
@@ -111,14 +111,14 @@ define(
};
/**
- *
+ *
*/
ActivitySymbol.prototype.toString = function() {
return "Lightdust.ActivitySymbol";
};
/**
- *
+ *
*/
ActivitySymbol.prototype.initializeFromJson = function(lane) {
m_utils.inheritMethods(this.modelElement.prototype,
@@ -133,7 +133,7 @@ define(
};
/**
- *
+ *
*/
ActivitySymbol.prototype.createTransferObject = function() {
var transferObject = {};
@@ -156,7 +156,7 @@ define(
};
/**
- *
+ *
*/
ActivitySymbol.prototype.getPath = function(withId) {
var path = "/models/" + this.diagram.model.id
@@ -171,7 +171,7 @@ define(
};
/**
- *
+ *
*/
ActivitySymbol.prototype.createPrimitives = function() {
this.rectangle = m_canvasManager
@@ -250,7 +250,7 @@ define(
};
/**
- *
+ *
*/
ActivitySymbol.prototype.initializeEventHandling = function() {
this.subprocessMarkerIcon
@@ -269,7 +269,7 @@ define(
};
/**
- *
+ *
*/
ActivitySymbol.prototype.showPrimitives = function() {
this.rectangle.show();
@@ -278,7 +278,7 @@ define(
};
/**
- *
+ *
*/
ActivitySymbol.prototype.refreshFromModelElement = function() {
this.text.attr("text", this.modelElement.name);
@@ -313,11 +313,11 @@ define(
};
/**
- *
+ *
*/
ActivitySymbol.prototype.adjustPrimitives = function() {
this.hideGlow();
-
+
this.rectangle.animate({
"x" : this.x,
"y" : this.y,
@@ -412,7 +412,7 @@ define(
};
/**
- *
+ *
*/
ActivitySymbol.prototype.createFlyOutMenu = function() {
this
@@ -465,7 +465,7 @@ define(
};
/**
- *
+ *
*/
ActivitySymbol.prototype.highlight = function() {
this.rectangle.attr({
@@ -474,7 +474,7 @@ define(
};
/**
- *
+ *
*/
ActivitySymbol.prototype.dehighlight = function() {
this.rectangle.attr({
@@ -483,7 +483,7 @@ define(
};
/**
- *
+ *
*/
ActivitySymbol.prototype.switchToSubprocessActivity = function() {
this.icon.hide();
@@ -495,7 +495,7 @@ define(
};
/**
- *
+ *
*/
ActivitySymbol.prototype.switchToApplicationActivity = function() {
this.icon.hide();
@@ -507,14 +507,14 @@ define(
};
/**
- *
+ *
*/
ActivitySymbol.prototype.onComplete = function() {
this.onParentSymbolChange();
};
/*
- *
+ *
*/
ActivitySymbol.prototype.onParentSymbolChange = function() {
if ((this.modelElement.activityType == m_constants.MANUAL_ACTIVITY_TYPE || this.modelElement.activityType == m_constants.APPLICATION_ACTIVITY_TYPE)
@@ -524,14 +524,14 @@ define(
};
/**
- *
+ *
*/
ActivitySymbol.prototype.onSubprocessMarkerIconMouseMove = function() {
this.showPointerCursor();
};
/**
- *
+ *
*/
ActivitySymbol.prototype.onSubprocessMarkerIconClick = function() {
var model = m_model.findModel(m_model
@@ -545,10 +545,50 @@ define(
+ "&fullId=" + process.getFullId(), process
.getFullId());
};
+
+ /**
+ *
+ */
+ ActivitySymbol.prototype.validateCreateConnection = function() {
+ var outMappingActivity = new Array();
+ var inMappingActivity = new Array();
+ var i = 0;
+ var j = 0;
+ for ( var n in this.connections) {
+ var connection = this.connections[n];
+ if (connection.fromAnchorPoint.symbol.type == m_constants.ACTIVITY_SYMBOL
+ && connection.fromAnchorPoint.symbol.oid == this.oid) {
+ if ((null != connection.toAnchorPoint && null != connection.toAnchorPoint.symbol)
+ && connection.toAnchorPoint.symbol.type == m_constants.DATA_SYMBOL) {
+ // do nothing
+ } else {
+ outMappingActivity[i] = true;
+ i++;
+ }
+ } else if (null != connection.toAnchorPoint
+ && null != connection.toAnchorPoint.symbol) {
+ if (connection.fromAnchorPoint.symbol.type == m_constants.EVENT_SYMBOL) {
+ // do nothing
+ } else if (connection.fromAnchorPoint.symbol.type == m_constants.DATA_SYMBOL) {
+ // do nothing
+ } else {
+ inMappingActivity[j] = true;
+ j++;
+ }
+ }
+ }
+
+ if (outMappingActivity.length > 1
+ || inMappingActivity.length > 1) {
+ return false;
+ }
+ return true;
+ };
+
}
/**
- *
+ *
*/
function ActivitySymbol_connectToClosure() {
this.auxiliaryProperties.callbackScope.diagram
@@ -556,7 +596,7 @@ define(
}
/**
- *
+ *
*/
function ActivitySymbol_connectToActivityClosure() {
this.auxiliaryProperties.callbackScope.diagram
@@ -564,7 +604,7 @@ define(
}
/**
- *
+ *
*/
function ActivitySymbol_connectToGatewayClosure() {
this.auxiliaryProperties.callbackScope.diagram
@@ -572,7 +612,7 @@ define(
}
/**
- *
+ *
*/
function ActivitySymbol_connectToEndEventClosure() {
this.auxiliaryProperties.callbackScope.diagram
@@ -580,7 +620,7 @@ define(
}
/**
- *
+ *
*/
function ActivitySymbol_removeClosure() {
this.auxiliaryProperties.callbackScope
@@ -588,7 +628,7 @@ define(
}
/**
- *
+ *
*/
function ActivitySymbol_switchToSubprocessActivityClosure() {
this.auxiliaryProperties.callbackScope
@@ -596,7 +636,7 @@ define(
}
/**
- *
+ *
*/
function ActivitySymbol_switchToApplicationActivityClosure() {
this.auxiliaryProperties.callbackScope
@@ -604,7 +644,7 @@ define(
}
/**
- *
+ *
*/
function ActivitySymbol_subprocessMarkerIconMouseMoveClosure() {
this.auxiliaryProperties.callbackScope
@@ -612,7 +652,7 @@ define(
}
/**
- *
+ *
*/
function ActivitySymbol_subprocessMarkerIconClickClosure() {
this.auxiliaryProperties.callbackScope
@@ -620,7 +660,7 @@ define(
}
/**
- *
+ *
*/
function ActivitySymbol_updateGlow() {
this.auxiliaryProperties.callbackScope.removeGlow();
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 3d60913..34abac9 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
@@ -21,7 +21,7 @@ define(
connection.bind(diagram);
// Validate the connection rules for anchor Point
- if(connection.validateAnchorPoint(fromAnchorPoint)){
+ if(connection.validateCreateConnection(fromAnchorPoint)){
connection.setFirstAnchorPoint(fromAnchorPoint);
}else{
// reset the connection
@@ -314,7 +314,7 @@ define(
this.prepare();
}
- if (this.toAnchorPoint.symbol != null && this.validateAnchorPoint(this.fromAnchorPoint, this.toAnchorPoint)) {
+ if (this.toAnchorPoint.symbol != null && this.validateCreateConnection(this.fromAnchorPoint, this.toAnchorPoint)) {
// On Mouse move , the same connection is added again,
// so remove if present then add(update)
m_utils.removeItemFromArray(
@@ -1359,7 +1359,7 @@ define(
// connection array
m_utils.removeItemFromArray(
this.fromAnchorPoint.symbol.connections, this);
- if (this.toAnchorPoint.symbol) {
+ if (this.toAnchorPoint && this.toAnchorPoint.symbol) {
m_utils.removeItemFromArray(
this.toAnchorPoint.symbol.connections, this);
}
@@ -1373,7 +1373,7 @@ define(
while (n < this.primitives.length) {
this.primitives[n].remove();
- ++n;
+ n++;
}
};
/**
@@ -1421,7 +1421,7 @@ define(
/**
* Validate connection rules for symbols
*/
- Connection.prototype.validateAnchorPoint = function(
+ Connection.prototype.validateCreateConnection = function(
fromAnchorPoint, toAnchorPoint) {
m_messageDisplay.clear();
if (fromAnchorPoint.symbol.type == m_constants.EVENT_SYMBOL) {
@@ -1434,15 +1434,15 @@ define(
else if (null != toAnchorPoint
&& toAnchorPoint.symbol.type == m_constants.DATA_SYMBOL) {
m_messageDisplay
- .showErrorMessage("Data connections/associations are not supported for symbol.");
+ .showErrorMessage("Data connections/associations are not supported for this symbol.");
return false;
- }else if (null != toAnchorPoint
+ } else if (null != toAnchorPoint
&& toAnchorPoint.symbol.type == m_constants.EVENT_SYMBOL) {
m_messageDisplay
.showErrorMessage("Events can be connected only to activities and gateways.");
return false;
- }
- else if (!fromAnchorPoint.symbol.validateCreateConnection()) {
+ } else if (!fromAnchorPoint.symbol
+ .validateCreateConnection()) {
// Start Event can have only one OUT connection
m_messageDisplay
.showErrorMessage("No further connection allowed for this Event.");
@@ -1452,38 +1452,78 @@ define(
if (null != toAnchorPoint
&& (toAnchorPoint.symbol.type == m_constants.GATEWAY_SYMBOL || toAnchorPoint.symbol.type == m_constants.EVENT_SYMBOL)) {
m_messageDisplay
- .showErrorMessage("Data connections/associations are not supported for symbol.");
+ .showErrorMessage("Data associations are not supported for this symbol.");
+ return false;
+ } else if (null != toAnchorPoint
+ && (toAnchorPoint.symbol.type == m_constants.DATA_SYMBOL)) {
+ m_messageDisplay
+ .showErrorMessage("Data symbols can connect to activity only.");
+ } else if (!fromAnchorPoint.symbol
+ .validateCreateConnection()) {
+ m_messageDisplay
+ .showErrorMessage("No further IN Connection allowed with this activity.");
return false;
}
- }
- else if (fromAnchorPoint.symbol.type == m_constants.GATEWAY_SYMBOL) {
+ } else if (fromAnchorPoint.symbol.type == m_constants.ACTIVITY_SYMBOL) {
+ // Data symbol validation called
if (null != toAnchorPoint
- && toAnchorPoint.symbol.type == m_constants.DATA_SYMBOL) {
+ && (toAnchorPoint.symbol.type == m_constants.DATA_SYMBOL)) {
+ if (!toAnchorPoint.symbol
+ .validateCreateConnection()) {
+ m_messageDisplay
+ .showErrorMessage("No further OUT Connection allowed with this activity.");
+ }
+ } else if (!fromAnchorPoint.symbol
+ .validateCreateConnection()) {
m_messageDisplay
- .showErrorMessage("Data connections/associations are not supported for symbol.");
+ .showErrorMessage("No more connection allowed from this activity.");
return false;
}
- }
- else if ((toAnchorPoint != null && toAnchorPoint.symbol.type == m_constants.EVENT_SYMBOL)) {
- // Check for IN connections on Start Event
- if (toAnchorPoint.symbol.modelElement.eventType == m_constants.START_EVENT_TYPE) {
+ } else if (fromAnchorPoint.symbol.type == m_constants.GATEWAY_SYMBOL) {
+ if (null != toAnchorPoint
+ && toAnchorPoint.symbol.type == m_constants.DATA_SYMBOL) {
m_messageDisplay
- .showErrorMessage("Only out sequence flow connections are allowed on Start Events.");
+ .showErrorMessage("Data connections/associations are not supported for this symbol.");
return false;
- } else if (!toAnchorPoint.symbol.validateCreateConnection()) {
- // End Event can have only one IN connection
+ }
+ }
+ if (toAnchorPoint != null) {
+ if (toAnchorPoint.symbol.type == m_constants.EVENT_SYMBOL) {
+ // Check for IN connections on Start Event
+ if (toAnchorPoint.symbol.modelElement.eventType == m_constants.START_EVENT_TYPE) {
+ m_messageDisplay
+ .showErrorMessage("Only out sequence flow connections are allowed on Start Events.");
+ return false;
+ } else if (!toAnchorPoint.symbol
+ .validateCreateConnection()) {
+ // End Event can have only one IN connection
+ m_messageDisplay
+ .showErrorMessage("No more connection allowed to this Event.");
+ return false;
+ }
+ } else if (toAnchorPoint.symbol.type == m_constants.DATA_SYMBOL) {
+ if (!toAnchorPoint.symbol
+ .validateCreateConnection()) {
+ m_messageDisplay
+ .showErrorMessage("No more OUT Connection allowed to this activity.");
+ return false;
+ }
+ }/*else if (toAnchorPoint.symbol.type == m_constants.ACTIVITY_SYMBOL) {
+ if (!toAnchorPoint.symbol
+ .validateCreateConnection()) {
+ m_messageDisplay
+ .showErrorMessage("No more connections allowed to this symbol.");
+ return false;
+ }
+ }*/
+ // If Start and End symbol are same, show error
+ if (fromAnchorPoint.symbol.oid == toAnchorPoint.symbol.oid) {
m_messageDisplay
- .showErrorMessage("No further connection allowed for this Event.");
+ .showErrorMessage("A connection must connect two different symbols.");
return false;
}
}
- // If Start and End symbol are same, show error
- if (toAnchorPoint != null
- && fromAnchorPoint.symbol.oid == toAnchorPoint.symbol.oid) {
- m_messageDisplay
- .showErrorMessage("A connection must connect two different symbols.");
- return false;
- }
+
return true;
}
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 6cb8290..a72ca5c 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
@@ -305,6 +305,65 @@ define(
stroke : m_constants.DEFAULT_STROKE_COLOR
});
};
+
+ /**
+ *
+ */
+ DataSymbol.prototype.validateCreateConnection = function() {
+ var inMapping = new Array();
+ var outMapping = new Array();
+ var inOutMapping = new Array();
+ var i = 0;
+ var j = 0;
+ var z = 0;
+ for ( var n in this.connections) {
+ var connection = this.connections[n];
+ if (connection.oid > 0) {
+ if (connection.modelElement.inDataMapping
+ && connection.modelElement.outDataMapping) {
+ inOutMapping[z] = connection.fromAnchorPoint.symbol.oid;
+ z++;
+ } else if (connection.fromAnchorPoint.symbol.type == m_constants.ACTIVITY_SYMBOL) {
+ outMapping[i] = connection.fromAnchorPoint.symbol.oid;
+ i++;
+ } else if (null != connection.toAnchorPoint
+ && null != connection.toAnchorPoint.symbol) {
+ if (connection.toAnchorPoint.symbol.type == m_constants.ACTIVITY_SYMBOL) {
+ inMapping[j] = connection.toAnchorPoint.symbol.oid;
+ j++;
+ }
+ }
+ } else {
+ if (connection.fromAnchorPoint.symbol.type == m_constants.ACTIVITY_SYMBOL) {
+ if (-1 != jQuery.inArray(
+ connection.fromAnchorPoint.symbol.oid,
+ inOutMapping)) {
+ return false;
+ } else {
+ return (-1 == jQuery
+ .inArray(
+ connection.fromAnchorPoint.symbol.oid,
+ outMapping));
+ }
+ } else if (null != connection.toAnchorPoint
+ && null != connection.toAnchorPoint.symbol) {
+ if (-1 != jQuery.inArray(
+ connection.fromAnchorPoint.symbol.oid,
+ inOutMapping)) {
+ return false;
+ } else {
+ return (-1 == jQuery
+ .inArray(
+ connection.toAnchorPoint.symbol.oid,
+ inMapping));
+ }
+ }
+
+ }
+ }
+
+ return true;
+ };
}
/**
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 c2e1832..88fe212 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
@@ -1388,6 +1388,8 @@ define(
// Set dummy anchor point
this.currentConnection.setDummySecondAnchorPoint();
+ }else{
+ this.mode = this.NORMAL_MODE;
}
};
@@ -1425,19 +1427,25 @@ define(
if (this.flowOrientation == m_constants.DIAGRAM_FLOW_ORIENTATION_VERTICAL) {
this.newSymbol.prepare(startSymbol.x,
startSymbol.y + 200);
+ // Create connection if connectionValidation passes
this.currentConnection = m_connection.createConnection(
this, startSymbol.anchorPoints[2]);
if (null != this.currentConnection
- && this.currentConnection.validateAnchorPoint(
+ && this.currentConnection.validateCreateConnection(
this.currentConnection.fromAnchorPoint,
this.newSymbol.anchorPoints[0])) {
this.currentConnection.prepare();
this.currentConnection
.setSecondAnchorPointNoComplete(this.newSymbol.anchorPoints[0]);
} else {
+ // Remove the connection and symbol created, if
+ // validation fails
+ if (this.currentConnection) {
+ this.currentConnection.remove();
+ this.currentConnection
+ }
this.newSymbol.remove();
this.newSymbol = null;
- this.currentConnection = null;
}
} else {
this.newSymbol.prepare(startSymbol.x + 200,
@@ -1467,11 +1475,14 @@ define(
// Set dummy anchor point
if (this.currentConnection) {
this.currentConnection.setDummySecondAnchorPoint();
+ }else{
+ this.currentConnection = null;
+ this.mode = this.NORMAL_MODE;
}
} else {
// Validate if connection is allowed on current anchor
// point
- if (this.currentConnection.validateAnchorPoint(
+ if (this.currentConnection.validateCreateConnection(
this.currentConnection.fromAnchorPoint,
anchorPoint)) {
this.currentConnection
@@ -1483,6 +1494,9 @@ define(
}
this.currentConnection = null;
this.mode = this.NORMAL_MODE;
+ }else{
+ m_utils.removeItemFromArray(
+ this.currentConnection.toAnchorPoint.symbol.connections, this);
}
}
};
@@ -1588,7 +1602,7 @@ define(
.submitCommand(m_command
.createUpdateModelElementCommand(
this.currentTextPrimitive.auxiliaryProperties.callbackScope.diagram.modelId,
- this.currentTextPrimitive.auxiliaryProperties.callbackScope.oid,
+ this.currentTextPrimitive.auxiliaryProperties.callbackScope.modelElement.oid,
changes));
this.currentTextPrimitive.show();
this.symbolEditMode = false;