summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiteshjha2016-06-16 23:57:17 +0530
committerjiteshjha2016-06-16 23:57:17 +0530
commitfd4e61c86972dec0dba3d6f1c32ce88882e26153 (patch)
tree317ee8ce4e847049093b12f7a1ffb391c19de774
parentdac5704fb08e2f5a3cb6167c2ec0daf93e8309b6 (diff)
downloadxcos-on-web-fd4e61c86972dec0dba3d6f1c32ce88882e26153.tar.gz
xcos-on-web-fd4e61c86972dec0dba3d6f1c32ce88882e26153.tar.bz2
xcos-on-web-fd4e61c86972dec0dba3d6f1c32ce88882e26153.zip
Few changes
-rw-r--r--index.html57
1 files changed, 29 insertions, 28 deletions
diff --git a/index.html b/index.html
index 7e9d940..a8ca32c 100644
--- a/index.html
+++ b/index.html
@@ -269,36 +269,37 @@
edgeSource = edgeSource.source;
}
- if (!(((edgeSource.value == "ExplicitOutputPort" && target.value == "ExplicitInputPort") ||
- (edgeSource.value == "ExplicitInputPort" && target.value == "ExplicitOutputPort") ||
- (edgeSource.value == "ImplicitOutputPort" && target.value == "ImplicitInputPort") ||
- (edgeSource.value == "ImplicitInputPort" && target.value == "ImplicitOutputPort") ||
- (edgeSource.value == "CommandPort" && target.value == "ControlPort") ||
- (edgeSource.value == "ControlPort" && target.value == "CommandPort")) &&
- ((edgeSource.getEdgeCount() == 0 && edgeSource.isVertex() == true &&
- target.getEdgeCount() == 0 && target.isVertex() == true) ||
- (edgeSource.getEdgeCount() <= 1 && source.isEdge() == true ))
- )) {
- if (!(edgeSource.getEdgeCount() == 0 && edgeSource.isVertex() == true &&
- target.getEdgeCount() == 0 && target.isVertex() == true)) {
- alert("Port is already connected, please select an please select an unconnected port or a valid link");
- } else if (edgeSource.value == "ImplicitInputPort") {
- alert("Implicit data input port must be connected to implicit data output port");
- } else if (edgeSource.value == "ImplicitOutputPort") {
- alert("Implicit data output port must be connected to implicit data input port");
- } else if (edgeSource.value == "ExplicitOutputPort") {
- alert("Explicit data output port must be connected to explicit data input port");
- } else if (edgeSource.value == "ExplicitInputPort") {
- alert("Explicit data input port must be connected to explicit data output port");
- } else if (edgeSource.value = "ControlPort") {
- alert("Control port must be connected to command port");
- } else if (edgeSource.value = "CommandPort") {
- alert("Command port must be connected to control port");
- }
-
- // If the edge violates any port constraints, return null.
+ // If the edge violates any port constraints, return null.
+ if(!((edgeSource.getEdgeCount() == 0 && edgeSource.isVertex() &&
+ target.getEdgeCount() == 0 && target.isVertex()) ||
+ (edgeSource.getEdgeCount() <= 1 && source.isEdge()))) {
+ alert("Port is already connected, please select an please select an unconnected port or a valid link");
return null;
}
+ else if(edgeSource.value == "ExplicitOutputPort" && target.value != "ExplicitInputPort") {
+ alert("Explicit data output port must be connected to explicit data input port");
+ return null;
+ }
+ else if(edgeSource.value == "ExplicitInputPort" && target.value != "ExplicitOutputPort") {
+ alert("Explicit data input port must be connected to explicit data output port");
+ return null;
+ }
+ else if(edgeSource.value == "ImplicitOutputPort" && target.value != "ImplicitInputPort") {
+ alert("Implicit data output port must be connected to implicit data input port");
+ return null;
+ }
+ else if(edgeSource.value == "ImplicitInputPort" && target.value != "ImplicitOutputPort") {
+ alert("Implicit data input port must be connected to implicit data output port");
+ return null;
+ }
+ else if(edgeSource.value == "CommandPort" && target.value != "ControlPort") {
+ alert("Command port must be connected to control port");
+ return null;
+ }
+ else if(edgeSource.value == "ControlPort" && target.value != "CommandPort") {
+ alert("Control port must be connected to command port");
+ return null;
+ }
// If the edge is legit, return the edge.
return mxGraph.prototype.addEdge.apply(this, arguments);