summaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
authorjiteshjha2016-06-13 18:25:54 +0530
committerjiteshjha2016-06-13 18:25:54 +0530
commit2053b161f367f53af23958030b64558d891f2cf4 (patch)
tree8ed7a995ee894290aab0fab034b49be73f9548ae /index.html
parent4dad64a53b4de5e3a91b979ffe72e62e652e0128 (diff)
downloadxcos-on-web-2053b161f367f53af23958030b64558d891f2cf4.tar.gz
xcos-on-web-2053b161f367f53af23958030b64558d891f2cf4.tar.bz2
xcos-on-web-2053b161f367f53af23958030b64558d891f2cf4.zip
better code
Diffstat (limited to 'index.html')
-rw-r--r--index.html39
1 files changed, 18 insertions, 21 deletions
diff --git a/index.html b/index.html
index 45ef043..1d8353f 100644
--- a/index.html
+++ b/index.html
@@ -107,44 +107,41 @@
/*
@jiteshjha, @pooja
- Needs to set a flag to check for dynamic style changes,
- that is, changes to styles on cells where the style was
- not explicitely changed using mxStyleChange
- graph.getView().updateStyle = true;
-
Overrides mxGraphModel.getStyle to return a specific style
- for edges that reflects their target terminal (in this case
- the strokeColor will be equal to the target's fillColor).
+ for edges that reflects their target terminal.
*/
- var previous = graph.model.getStyle;
graph.model.getStyle = function(cell) {
-
+ var style = null;
if (cell != null) {
- var style = previous.apply(this, arguments);
+ // Get style for the recently created mxCell.
+ style = mxGraphModel.prototype.getStyle.apply(this, arguments);
+
+ // If the mxCell is an edge and if it's a fully formed edge
if (this.isEdge(cell) && cell.source != null) {
var target = this.getTerminal(cell, false);
if (target != null) {
+
+ /* cell.name attribute defines the link name
+ so that it can be parsed in the XML during
+ XSLT transformation.
+ */
if (cell.source.value == "ExplicitOutputPort" || cell.source.value == "ExplicitInputPort") {
- style += ';strokeColor=' + 'blue';
- cell.edgeStyle = "ExplicitLink";
+ style += ';' + 'ExplicitLink';
+ cell.name = "ExplicitLink";
} else if (cell.source.value == "ImplicitOutputPort" || cell.source.value == "ImplicitInputPort") {
- style += ';strokeColor=' + 'blue';
- cell.edgeStyle = "ImplicitLink";
-
+ style += ';' + 'ImplicitLink';
+ cell.name = "ImplicitLink";
} else if (cell.source.value == "CommandPort" || cell.source.value == "ControlPort") {
- style += ';strokeColor=' + 'red';
- cell.edgeStyle = "CommandControlLink";
+ style += ';' + 'CommandControlLink';
+ cell.name = "CommandControlLink";
}
}
}
-
- return style;
}
-
- return null;
+ return style;
};