diff options
author | jiteshjha | 2016-06-13 18:25:54 +0530 |
---|---|---|
committer | jiteshjha | 2016-06-13 18:25:54 +0530 |
commit | 2053b161f367f53af23958030b64558d891f2cf4 (patch) | |
tree | 8ed7a995ee894290aab0fab034b49be73f9548ae /index.html | |
parent | 4dad64a53b4de5e3a91b979ffe72e62e652e0128 (diff) | |
download | xcos-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.html | 39 |
1 files changed, 18 insertions, 21 deletions
@@ -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; }; |