Name: cockpit/js/wfadaptor.cpee.js
| 1: | function create_header(value){ //{{{ |
| 2: | var tmp = $("#prop_template_header tr").clone(); |
| 3: | $('.header_value',tmp).text(value); |
| 4: | return tmp; |
| 5: | } //}}} |
| 6: | function create_sizer(){ //{{{ |
| 7: | var tmp = $("#prop_template_sizer tr").clone(); |
| 8: | return tmp; |
| 9: | } //}}} |
| 10: | function create_line(main,text){ //{{{ |
| 11: | var tmp = $("#prop_template_line tr").clone(); |
| 12: | $('.line_main',tmp).text(main); |
| 13: | $('.line_text',tmp).text(text); |
| 14: | return tmp; |
| 15: | } //}}} |
| 16: | function create_element(content,svgid){ //{{{ |
| 17: | var tmp = $("#prop_template_readonly tr").clone(); |
| 18: | $('.prop_name',tmp).text('Element'); |
| 19: | $('.prop_value',tmp).val(content); |
| 20: | $('.prop_value',tmp).addClass('pname_element'); |
| 21: | $('.prop_value',tmp).parent().append($("<input type='hidden' class='pname_svgid' value='" + svgid + "'>")); |
| 22: | return tmp; |
| 23: | } //}}} |
| 24: | function create_readonly_property(name,content){ //{{{ |
| 25: | var tmp = $("#prop_template_readonly tr").clone(); |
| 26: | $('.prop_name',tmp).text(name); |
| 27: | $('.prop_value',tmp).val(content); |
| 28: | $('.prop_value',tmp).addClass('pname_' + name.toLowerCase()); |
| 29: | return tmp; |
| 30: | } //}}} |
| 31: | function create_input_property(name,cls,content){ //{{{ |
| 32: | var tmp = $("#prop_template_input tr").clone(); |
| 33: | tmp.addClass(cls); |
| 34: | $('.prop_name',tmp).text(name); |
| 35: | $('.prop_value',tmp).val(content); |
| 36: | $('.prop_value',tmp).addClass('pname_' + name.toLowerCase()); |
| 37: | return tmp; |
| 38: | } //}}} |
| 39: | function create_select_property(name,cls,content,alts){ //{{{ |
| 40: | var tmp = $("#prop_template_select tr").clone(); |
| 41: | tmp.addClass(cls); |
| 42: | $('.prop_name',tmp).text(name); |
| 43: | $('.prop_value',tmp).addClass('pname_' + name.toLowerCase()); |
| 44: | $.each(alts,function(a,b){ |
| 45: | var o = $('<option value="' + b + '">' + b + '</option>'); |
| 46: | if (b == content) o.attr('selected','selected'); |
| 47: | $('.prop_value',tmp).append(o); |
| 48: | }); |
| 49: | return tmp; |
| 50: | } //}}} |
| 51: | function create_area_property(name,cls,content){ //{{{ |
| 52: | var tmp = $("#prop_template_area tr").clone(); |
| 53: | tmp.addClass(cls); |
| 54: | $('.prop_name',tmp).text(name); |
| 55: | $('.prop_value',tmp).addClass('pname_' + name.toLowerCase()); |
| 56: | $('.prop_value',tmp).text(content); |
| 57: | return tmp; |
| 58: | } //}}} |
| 59: | function create_input_pair(name,cls,content){ //{{{ |
| 60: | var tmp = $("#dat_template_pair tr").clone(); |
| 61: | tmp.addClass(cls); |
| 62: | $('.pair_name',tmp).val(name); |
| 63: | $('.pair_value',tmp).val(content); |
| 64: | return tmp; |
| 65: | } //}}} |
| 66: | |
| 67: | function CPEE(adaptor) { |
| 68: | this.adaptor = adaptor; |
| 69: | this.elements = elements = {}; |
| 70: | this.events = events = {}; |
| 71: | |
| 72: | this.noarrow = noarrow = ['alternative', 'otherwise']; |
| 73: | |
| 74: | // Events |
| 75: | this.events.mousedown = function(svgid, e, child, sibling) { // {{{ |
| 76: | if(e.button == 0) { // left-click |
| 77: | } else if(e.button == 1) { // middle-click |
| 78: | } else if(e.button == 2) { // right-click |
| 79: | var xml_node = adaptor.description.get_node_by_svg_id(svgid); |
| 80: | var group = null; |
| 81: | var menu = {}; |
| 82: | |
| 83: | if(child) { |
| 84: | group = elements[xml_node.get(0).tagName].description.permissible_children(xml_node); |
| 85: | if(group.length > 0) menu['Insert into'] = group; |
| 86: | } |
| 87: | if(sibling) { |
| 88: | group = elements[xml_node.parent().get(0).tagName].description.permissible_children(xml_node); |
| 89: | if(group.length > 0) menu['Insert after'] = group; |
| 90: | } |
| 91: | |
| 92: | if(xml_node.get(0).tagName != 'description' && !elements[xml_node.get(0).tagName].description.deleteable) |
| 93: | menu['Remove Element'] = [{'label': 'Actual Element', |
| 94: | 'function_call': adaptor.description.remove, |
| 95: | 'menu_icon': function() { |
| 96: | var icon = elements[xml_node.get(0).tagName].illustrator.svg(); |
| 97: | icon.children('.rfill').css({'fill':'red','fill-opacity':'0.5'}); |
| 98: | return icon; |
| 99: | }, |
| 100: | 'params': [null, xml_node]}]; |
| 101: | if($('> manipulate', xml_node).length > 0 && xml_node.get(0).tagName == 'call') { |
| 102: | menu['Remove Element'].push({'label': 'Remove Script Block', |
| 103: | 'function_call': adaptor.description.remove, |
| 104: | 'menu_icon': function() { |
| 105: | var icon = elements.callmanipulate.illustrator.svg(); |
| 106: | icon.children('.rfill:last').css({'fill':'red','fill-opacity':'0.5'}); |
| 107: | return icon; |
| 108: | }, |
| 109: | 'params': ['> manipulate', xml_node]}); |
| 110: | } |
| 111: | contextmenu(menu, e); |
| 112: | } |
| 113: | return false; |
| 114: | } // }}} |
| 115: | this.events.click = function(svgid, e) { // {{{ |
| 116: | if (adaptor.description.get_node_by_svg_id(svgid).length == 0) { |
| 117: | return; |
| 118: | } |
| 119: | |
| 120: | if ($('#state').text() != 'finished') |
| 121: | $('#main .tabbehind button').show(); |
| 122: | if ($('#main .tabbehind button').hasClass('highlight')) { |
| 123: | var check = confirm("Discard changes?"); |
| 124: | if (check) |
| 125: | $('#main .tabbehind button').removeClass('highlight'); |
| 126: | else |
| 127: | return; |
| 128: | } |
| 129: | |
| 130: | var visid = 'details'; |
| 131: | var tab = $('#dat_' + visid); |
| 132: | var node = adaptor.description.get_node_by_svg_id(svgid).get(0); |
| 133: | |
| 134: | tab.empty(); |
| 135: | tab.append(create_element(node.nodeName,svgid)); |
| 136: | switch(node.nodeName) { |
| 137: | case 'call': |
| 138: | tab.append(create_readonly_property('ID',$(node).attr('id'))); |
| 139: | tab.append(create_input_property('Endpoint','',$(node).attr('endpoint'))); |
| 140: | |
| 141: | if ($('manipulate',node).length > 0) |
| 142: | tab.append(create_area_property('Script','',format_text_skim($('manipulate',node).text()))); |
| 143: | |
| 144: | tab.append(create_header('Parameters:')); |
| 145: | |
| 146: | tab.append(create_input_property('Label','indent',$('parameters label',node).text())); |
| 147: | tab.append(create_input_property('Method','indent',$('parameters method',node).text())); |
| 148: | $.each($('parameters parameters *',node),function(){ |
| 149: | tab.append(create_input_pair(this.nodeName,'indent',$(this).text())); |
| 150: | }); |
| 151: | break; |
| 152: | case 'manipulate': |
| 153: | tab.append(create_readonly_property('ID',$(node).attr('id'))); |
| 154: | tab.append(create_area_property('Script','',format_text_skim($(node).text()))); |
| 155: | break; |
| 156: | case 'loop': |
| 157: | if ($(node).attr('pre_test') != undefined) |
| 158: | var mode = 'pre_test'; |
| 159: | if ($(node).attr('post_test') != undefined) |
| 160: | var mode = 'post_test'; |
| 161: | tab.append(create_select_property('Mode','',mode,['post_test','pre_test'])); |
| 162: | tab.append(create_input_property('Condition','',$(node).attr(mode))); |
| 163: | break; |
| 164: | case 'choose': |
| 165: | var mode = ($(node).attr('mode') == 'inclusive' || $(node).attr('mode') == undefined ? 'inclusive' : 'exclusive') |
| 166: | tab.append(create_select_property('Mode','',mode,['exclusive','inclusive'])); |
| 167: | break; |
| 168: | case 'alternative': |
| 169: | tab.append(create_input_property('Condition','',$(node).attr('condition'))); |
| 170: | break; |
| 171: | case 'critical': |
| 172: | var sid = ($(node).attr('sid') == '' ? 'section' : $(node).attr('sid')); |
| 173: | tab.append(create_input_property('SID','',sid)); |
| 174: | tab.append(create_line('Hint','Identical SID\'s shared by between differnt "critical" elements define mutual exclusive areas')); |
| 175: | break; |
| 176: | case 'parallel': |
| 177: | var wait = ($(node).attr('wait') == '' || $(node).attr('wait') == undefined ? '-1' : $(node).attr('wait')); |
| 178: | tab.append(create_input_property('Wait','',wait)); |
| 179: | tab.append(create_line('Hint','-1 to wait for all branches')); |
| 180: | break; |
| 181: | case 'parallel_branch': |
| 182: | tab.append(create_input_property('Pass to branch','',$(node).attr('pass'))); |
| 183: | tab.append(create_input_property('Local scope','',$(node).attr('local'))); |
| 184: | break; |
| 185: | // TODO group |
| 186: | } |
| 187: | // add the sizer in order for colspan to work |
| 188: | tab.append(create_sizer()); |
| 189: | save['details'] = serialize_details(tab).serializeXML(); |
| 190: | } // }}} |
| 191: | this.events.dblclick = function(svgid, e) { // {{{ |
| 192: | } // }}} |
| 193: | this.events.mouseover = function(svgid, e) { // {{{ |
| 194: | $('.tile[element-id = "' + svgid + '"]').css('display','block'); |
| 195: | return false; |
| 196: | } // }}} |
| 197: | this.events.mouseout = function(svgid, e) { // {{{ |
| 198: | $('.tile[element-id = "' + svgid + '"]').css('display','none'); |
| 199: | return false; |
| 200: | } // }}} |
| 201: | this.events.dragstart = function (svgid, e) { //{{{ |
| 202: | } //}}} |
| 203: | |
| 204: | // Abstract Elements (they only have an illustrator) |
| 205: | this.elements.callinjection = { /*{{{*/ |
| 206: | 'illustrator': {//{{{ |
| 207: | 'type' : 'abstract', |
| 208: | 'svg': function() { |
| 209: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 210: | '<circle cx="15" cy="15" r="14" class="rfill stand"/>' + |
| 211: | '<text transform="translate(15,21)" class="normal">c</text>' + |
| 212: | '<circle cx="28" cy="27" r="9" class="rfill stand"/>' + |
| 213: | '<text transform="translate(28,31)" class="small">i</text>' + |
| 214: | '</svg>'); |
| 215: | } |
| 216: | },//}}} |
| 217: | 'description' : {//{{{ |
| 218: | 'create': function(target) { |
| 219: | var node = null; |
| 220: | node = $X('<call id="' + adaptor.description.get_free_id() + '" endpoint="" xmlns="http://this.org/ns/description/1.0"><parameters><label></label><method>post</method><parameters/></parameters><manipulate output="result"/></call>'); |
| 221: | return node; |
| 222: | }, |
| 223: | 'permissible_children': function(node) { |
| 224: | if(node.children('manipulate').lenght < 1) |
| 225: | return [ |
| 226: | {'label': 'Script Block', |
| 227: | 'function_call': adaptor.description.insert_last_into, |
| 228: | 'menu_icon': elements.callmanipulate.illustrator.svg, |
| 229: | 'params': [adaptor.description.elements.manipulate.create, node]} |
| 230: | ]; |
| 231: | return []; |
| 232: | } |
| 233: | },//}}} |
| 234: | 'adaptor' : {//{{{ |
| 235: | 'mousedown': function (node, e) { |
| 236: | events.mousedown(node,e,true, true); |
| 237: | }, |
| 238: | 'click': events.click, |
| 239: | }//}}} |
| 240: | }; /*}}}*/ |
| 241: | this.elements.callcorrelation = { /*{{{*/ |
| 242: | 'illustrator': {//{{{ |
| 243: | 'type' : 'abstract', |
| 244: | 'svg': function() { |
| 245: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 246: | '<rect x="1" y="1" width="28" height="28" rx="4" class="rfill stand"/>' + |
| 247: | '<path transform="scale(0.7) translate(12, 2)" class="stand" style="fill:#000000;" d="m 19.511059,31.248618 0,-23.6413153 -3.940219,0 0,15.7608793 -7.8804404,-7.88044 0,7.88044 -7.88043943,-7.88044 0,15.760876 z"/>' + |
| 248: | '<circle cx="28" cy="27" r="9" class="rfill stand"/>' + |
| 249: | '<text transform="translate(28,31)" class="small">c</text>' + |
| 250: | '</svg>'); |
| 251: | } |
| 252: | },//}}} |
| 253: | 'description' : {//{{{ |
| 254: | 'create': function(target) { |
| 255: | var node = null; |
| 256: | node = $X('<call id="' + adaptor.description.get_free_id() + '" endpoint="correlation" xmlns="http://this.org/ns/description/1.0"><parameters><label></label><method>post</method><parameters/></parameters><manipulate output="result"/></call>'); |
| 257: | return node; |
| 258: | }, |
| 259: | 'permissible_children': function(node) { |
| 260: | if(node.children('manipulate').lenght < 1) |
| 261: | return [ |
| 262: | {'label': 'Script Block', |
| 263: | 'function_call': adaptor.description.insert_last_into, |
| 264: | 'menu_icon': elements.callmanipulate.illustrator.svg, |
| 265: | 'params': [adaptor.description.elements.manipulate.create, node]} |
| 266: | ]; |
| 267: | return []; |
| 268: | } |
| 269: | },//}}} |
| 270: | 'adaptor' : {//{{{ |
| 271: | 'mousedown': function (node, e) { |
| 272: | events.mousedown(node,e,true, true); |
| 273: | }, |
| 274: | 'click': events.click, |
| 275: | }//}}} |
| 276: | }; /*}}}*/ |
| 277: | this.elements.callinstantiation = { /*{{{*/ |
| 278: | 'illustrator': {//{{{ |
| 279: | 'type' : 'abstract', |
| 280: | 'svg': function() { |
| 281: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 282: | '<rect x="1" y="1" width="28" height="28" rx="4" class="rfill stand"/>' + |
| 283: | '<path transform="scale(0.7) translate(12, 2)" class="stand" style="fill:#000000;" d="m 19.511059,31.248618 0,-23.6413153 -3.940219,0 0,15.7608793 -7.8804404,-7.88044 0,7.88044 -7.88043943,-7.88044 0,15.760876 z"/>' + |
| 284: | '<circle cx="28" cy="27" r="9" class="rfill stand"/>' + |
| 285: | '<text transform="translate(28,32)" class="small">i</text>' + |
| 286: | '</svg>'); |
| 287: | } |
| 288: | },//}}} |
| 289: | 'description' : {//{{{ |
| 290: | 'create': function(target) { |
| 291: | var node = null; |
| 292: | node = $X('<call id="' + adaptor.description.get_free_id() + '" endpoint="instantiate" xmlns="http://this.org/ns/description/1.0"><parameters><label></label><method>post</method><parameters/></parameters><manipulate output="result"/></call>'); |
| 293: | return node; |
| 294: | }, |
| 295: | 'permissible_children': function(node) { |
| 296: | if(node.children('manipulate').lenght < 1) |
| 297: | return [ |
| 298: | {'label': 'Script Block', |
| 299: | 'function_call': adaptor.description.insert_last_into, |
| 300: | 'menu_icon': elements.callmanipulate.illustrator.svg, |
| 301: | 'params': [adaptor.description.elements.manipulate.create, node]} |
| 302: | ]; |
| 303: | return []; |
| 304: | } |
| 305: | },//}}} |
| 306: | 'adaptor' : {//{{{ |
| 307: | 'mousedown': function (node, e) { |
| 308: | events.mousedown(node,e,true, true); |
| 309: | }, |
| 310: | 'click': events.click, |
| 311: | }//}}} |
| 312: | }; /*}}}*/ |
| 313: | this.elements.callmanipulate = { /*{{{*/ |
| 314: | 'illustrator': {//{{{ |
| 315: | 'type' : 'abstract', |
| 316: | 'svg': function() { |
| 317: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 318: | '<rect x="1" y="1" width="28" height="28" rx="4" class="rfill stand"/>' + |
| 319: | '<path transform="scale(0.7) translate(12, 2)" class="stand" style="fill:#000000;" d="m 19.511059,31.248618 0,-23.6413153 -3.940219,0 0,15.7608793 -7.8804404,-7.88044 0,7.88044 -7.88043943,-7.88044 0,15.760876 z"/>' + |
| 320: | '<circle cx="28" cy="27" r="9" class="rfill stand"/>' + |
| 321: | '<text transform="translate(28,31)" class="small">s</text>' + |
| 322: | '</svg>'); |
| 323: | } |
| 324: | },//}}} |
| 325: | 'description' : {//{{{ |
| 326: | 'create': function(target) { |
| 327: | var node = null; |
| 328: | node = $X('<call id="' + adaptor.description.get_free_id() + '" endpoint="" xmlns="http://this.org/ns/description/1.0"><parameters><label></label><method>post</method><parameters/></parameters><manipulate output="result"/></call>'); |
| 329: | return node; |
| 330: | }, |
| 331: | 'permissible_children': function(node) { |
| 332: | if(node.children('manipulate').lenght < 1) |
| 333: | return [ |
| 334: | {'label': 'Script Block', |
| 335: | 'function_call': adaptor.description.insert_last_into, |
| 336: | 'menu_icon': elements.callmanipulate.illustrator.svg, |
| 337: | 'params': [adaptor.description.elements.manipulate.create, node]} |
| 338: | ]; |
| 339: | return []; |
| 340: | } |
| 341: | },//}}} |
| 342: | 'adaptor' : {//{{{ |
| 343: | 'mousedown': function (node, e) { |
| 344: | events.mousedown(node,e,true, true); |
| 345: | }, |
| 346: | 'click': events.click, |
| 347: | }//}}} |
| 348: | }; /*}}}*/ |
| 349: | this.elements.choose_inclusive = { /*{{{*/ |
| 350: | 'illustrator': {//{{{ |
| 351: | 'type' : 'abstract', |
| 352: | 'svg': function() { |
| 353: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 354: | '<rect transform="rotate(45,14,12)" x="7" y="3" width="21" height="21" class="stand"/>' + |
| 355: | '<circle cx="15.5" cy="15.5" r="7" class="stand"/>' + |
| 356: | '</svg>'); |
| 357: | } |
| 358: | },//}}} |
| 359: | }; /*}}}*/ |
| 360: | this.elements.choose_exclusive = { /*{{{*/ |
| 361: | 'illustrator': {//{{{ |
| 362: | 'type' : 'abstract', |
| 363: | 'svg': function() { |
| 364: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 365: | '<rect transform="rotate(45,14,12)" x="7" y="3" width="21" height="21" class="stand"/>' + |
| 366: | '<line x1="10.5" y1="20.5" x2="20.5" y2="10.5" class="stand"/>' + |
| 367: | '<line x1="10.5" y1="10.5" x2="20.5" y2="20.5" class="stand"/>' + |
| 368: | '</svg>'); |
| 369: | } |
| 370: | },//}}} |
| 371: | }; /*}}}*/ |
| 372: | |
| 373: | // Primitive Elements |
| 374: | this.elements.call = { /*{{{*/ |
| 375: | 'illustrator': {//{{{ |
| 376: | 'type' : 'primitive', |
| 377: | 'endnodes' : 'this', |
| 378: | 'resolve_symbol' : function(node) { |
| 379: | if($(node).attr('endpoint') == 'instantiation') { |
| 380: | return 'callinstantiation'; |
| 381: | } else if($(node).attr('endpoint') == 'correlation') { |
| 382: | return 'callcorrelation'; |
| 383: | } else if($('parameters > service', node).length > 0) { |
| 384: | return 'callinjection'; |
| 385: | } else if($('manipulate', node).length > 0) { |
| 386: | return 'callmanipulate'; |
| 387: | } else { |
| 388: | return'call'; |
| 389: | } |
| 390: | }, |
| 391: | 'svg': function() { |
| 392: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 393: | '<rect x="1" y="1" width="28" height="28" rx="4" class="rfill stand"/>' + |
| 394: | '<path transform="scale(0.7) translate(12, 2)" class="stand" style="fill:#000000;" d="m 19.511059,31.248618 0,-23.6413153 -3.940219,0 0,15.7608793 -7.8804404,-7.88044 0,7.88044 -7.88043943,-7.88044 0,15.760876 z"/>' + |
| 395: | '</svg>'); |
| 396: | } |
| 397: | },//}}} |
| 398: | 'description' : {//{{{ |
| 399: | 'create': function(target) { |
| 400: | var node = $X('<call id="' + adaptor.description.get_free_id() + '" endpoint="" xmlns="http://cpee.org/ns/description/1.0"/>'); |
| 401: | node.append($X('<parameters xmlns="http://cpee.org/ns/description/1.0"><label></label><method>post</method><parameters/></parameters>')); |
| 402: | return node; |
| 403: | }, |
| 404: | 'permissible_children': function(node) { |
| 405: | if(node.children('manipulate').length < 1) |
| 406: | return [ |
| 407: | {'label': 'Script Block', |
| 408: | 'function_call': adaptor.description.insert_last_into, |
| 409: | 'menu_icon': elements.callmanipulate.illustrator.svg, |
| 410: | 'params': [adaptor.description.elements.manipulate.create, node]} |
| 411: | ]; |
| 412: | return []; |
| 413: | } |
| 414: | },//}}} |
| 415: | 'adaptor' : {//{{{ |
| 416: | 'mousedown': function (node, e) { |
| 417: | events.mousedown(node,e,true, true); |
| 418: | }, |
| 419: | 'click': events.click, |
| 420: | 'dragstart': events.dragstart, |
| 421: | }//}}} |
| 422: | }; /*}}}*/ |
| 423: | this.elements.manipulate = { /*{{{*/ |
| 424: | 'illustrator': {//{{{ |
| 425: | 'type' : 'primitive', |
| 426: | 'endnodes' : 'this', |
| 427: | 'svg': function() { |
| 428: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 429: | '<rect x="1" y="1" width="28" height="28" rx="4" class="rfill stand"/>' + |
| 430: | '<text transform="translate(15,21)" class="normal">s</text>' + |
| 431: | '</svg>'); |
| 432: | } |
| 433: | },//}}} |
| 434: | 'description' : {//{{{ |
| 435: | 'create': function(target) { |
| 436: | var node = $X('<manipulate id="' + adaptor.description.get_free_id() + '" xmlns="http://cpee.org/ns/description/1.0"/>'); |
| 437: | return node; |
| 438: | }, |
| 439: | 'permissible_children': function(node) { |
| 440: | return []; |
| 441: | } |
| 442: | },//}}} |
| 443: | 'adaptor' : {//{{{ |
| 444: | 'mousedown': function (node, e) { |
| 445: | events.mousedown(node,e,false, true); |
| 446: | }, |
| 447: | 'click': events.click, |
| 448: | }//}}} |
| 449: | }; /*}}}*/ |
| 450: | this.elements.escape = { /*{{{*/ |
| 451: | 'illustrator': {//{{{ |
| 452: | 'type' : 'primitive', |
| 453: | 'endnodes' : 'this', |
| 454: | 'svg': function() { |
| 455: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 456: | '<circle cx="15" cy="15" r="14" class="stand"/>' + |
| 457: | '<circle cx="15" cy="15" r="11" class="stand"/>' + |
| 458: | '<polygon points="10.5,20.5 15,8.5 20.5,20.5 15,15.5 10.5,20.5" class="black"/>' + |
| 459: | '</svg>'); |
| 460: | } |
| 461: | },//}}} |
| 462: | 'description' : {//{{{ |
| 463: | 'create': function(target) { |
| 464: | var node = $X('<escape xmlns="http://cpee.org/ns/description/1.0"/>'); |
| 465: | return node; |
| 466: | }, |
| 467: | 'permissible_children': function(node) { |
| 468: | return []; |
| 469: | } |
| 470: | },//}}} |
| 471: | 'adaptor' : {//{{{ |
| 472: | 'mousedown': function (node, e) { |
| 473: | events.mousedown(node,e,false, true); |
| 474: | }, |
| 475: | 'click': events.click, |
| 476: | }//}}} |
| 477: | }; /*}}}*/ |
| 478: | |
| 479: | // Complex Elements |
| 480: | this.elements.choose = { /*{{{*/ |
| 481: | 'illustrator': {//{{{ |
| 482: | 'type' : 'complex', |
| 483: | 'endnodes' : 'aggregate', |
| 484: | 'closeblock': false, |
| 485: | 'expansion' : function(node) { |
| 486: | return 'horizontal'; |
| 487: | }, |
| 488: | 'resolve_symbol' : function(node) { |
| 489: | if($(node).attr('mode') == 'exclusive') { |
| 490: | return 'choose_exclusive'; |
| 491: | } else { |
| 492: | return 'choose_inclusive'; |
| 493: | } |
| 494: | }, |
| 495: | 'col_shift' : function(node) { |
| 496: | return false; |
| 497: | }, |
| 498: | 'svg': function() { |
| 499: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 500: | '<rect transform="rotate(45,14,12)" x="7" y="3" width="21" height="21" class="stand"/>' + |
| 501: | '<circle cx="15.5" cy="15.5" r="7" class="stand"/>' + |
| 502: | '</svg>'); |
| 503: | } |
| 504: | },//}}} |
| 505: | 'description' : {//{{{ |
| 506: | 'create': function(target) { |
| 507: | var node = $X('<choose mode="exclusive" xmlns="http://cpee.org/ns/description/1.0"><otherwise/></choose>'); |
| 508: | return node; |
| 509: | }, |
| 510: | 'permissible_children': function(node) { |
| 511: | var func = null; |
| 512: | if(node.get(0).tagName == 'choose') { func = adaptor.description.insert_first_into } |
| 513: | else { func = adaptor.description.insert_after } |
| 514: | if(node.children('parallel_branch').length > 0) { |
| 515: | return [{'label': 'Parallel Branch', |
| 516: | 'function_call': func, |
| 517: | 'menu_icon': elements.parallel_branch.illustrator.svg, |
| 518: | 'params': [adaptor.description.elements.parallel_branch.create, node]}]; |
| 519: | } |
| 520: | var childs = [{'label': 'Alternative', |
| 521: | 'function_call': func, |
| 522: | 'menu_icon': elements.alternative.illustrator.svg, |
| 523: | 'params': [adaptor.description.elements.alternative.create, node]}]; |
| 524: | if((node.children('otherwise').length == 0) && node.parents('parallel').length == node.parents('parallel_branch').length) |
| 525: | childs.push({'label': 'Otherwise', |
| 526: | 'function_call': func, |
| 527: | 'menu_icon': elements.otherwise.illustrator.svg, |
| 528: | 'params': [adaptor.description.elements.otherwise.create, node]}); |
| 529: | if(node.parents('parallel').length > node.parents('parallel_branch').length) |
| 530: | childs.push({'label': 'Parallel Branch', |
| 531: | 'function_call': func, |
| 532: | 'menu_icon': elements.parallel_branch.illustrator.svg, |
| 533: | 'params': [adaptor.description.elements.parallel_branch.create, node]}); |
| 534: | return childs; |
| 535: | } |
| 536: | },//}}} |
| 537: | 'adaptor' : {//{{{ |
| 538: | 'mousedown': function (node, e) { |
| 539: | events.mousedown(node,e,true, true); |
| 540: | }, |
| 541: | 'click': events.click, |
| 542: | 'dblclick': events.dblclick, |
| 543: | 'mouseover': events.mouseover, |
| 544: | 'mouseout': events.mouseout, |
| 545: | }//}}} |
| 546: | }; /*}}}*/ |
| 547: | this.elements.otherwise = { /*{{{*/ |
| 548: | 'illustrator': {//{{{ |
| 549: | 'type' : 'complex', |
| 550: | 'endnodes' : 'passthrough', |
| 551: | 'closeblock': false, |
| 552: | 'expansion' : function(node) { |
| 553: | return 'vertical'; |
| 554: | }, |
| 555: | 'col_shift' : function(node) { |
| 556: | return false; |
| 557: | }, |
| 558: | 'svg': function() { |
| 559: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 560: | '<circle cx="15" cy="15" r="9" class="standtrans"/>' + |
| 561: | '<line x1="9" y1="21" x2="21" y2="9" class="stand"/>' + |
| 562: | '</svg>'); |
| 563: | } |
| 564: | },//}}} |
| 565: | 'description' : {//{{{ |
| 566: | 'create': function(target) { |
| 567: | var node = $X('<otherwise xmlns="http://cpee.org/ns/description/1.0"/>'); |
| 568: | return node; |
| 569: | }, |
| 570: | 'deleteable': true, |
| 571: | 'permissible_children': function(node) { |
| 572: | var func = null; |
| 573: | var childs = null; |
| 574: | if(node.get(0).tagName == 'otherwise') { func = adaptor.description.insert_first_into } |
| 575: | else { func = adaptor.description.insert_after } |
| 576: | return [ |
| 577: | {'label': 'Service Call with Script Block', |
| 578: | 'function_call': func, |
| 579: | 'menu_icon': elements.callmanipulate.illustrator.svg, |
| 580: | 'params': [adaptor.description.elements.callmanipulate.create, node]}, |
| 581: | {'label': 'Service Call', |
| 582: | 'function_call': func, |
| 583: | 'menu_icon': elements.call.illustrator.svg, |
| 584: | 'params': [adaptor.description.elements.call.create, node]}, |
| 585: | {'label': 'Script', |
| 586: | 'function_call': func, |
| 587: | 'menu_icon': elements.manipulate.illustrator.svg, |
| 588: | 'params': [adaptor.description.elements.manipulate.create, node]}, |
| 589: | {'label': 'Parallel', |
| 590: | 'function_call': func, |
| 591: | 'menu_icon': elements.parallel.illustrator.svg, |
| 592: | 'params': [adaptor.description.elements.parallel.create, node]}, |
| 593: | {'label': 'Choose', |
| 594: | 'function_call': func, |
| 595: | 'menu_icon': elements.choose.illustrator.svg, |
| 596: | 'params': [adaptor.description.elements.choose.create, node]}, |
| 597: | {'label': 'Loop', |
| 598: | 'function_call': func, |
| 599: | 'menu_icon': elements.loop.illustrator.svg, |
| 600: | 'params': [adaptor.description.elements.loop.create, node]}, |
| 601: | {'label': 'Critical', |
| 602: | 'function_call': func, |
| 603: | 'menu_icon': elements.critical.illustrator.svg, |
| 604: | 'params': [adaptor.description.elements.critical.create, node]} |
| 605: | ]; |
| 606: | } |
| 607: | },//}}} |
| 608: | 'adaptor' : {//{{{ |
| 609: | 'mousedown': function (node, e) { |
| 610: | events.mousedown(node,e,true, false); |
| 611: | }, |
| 612: | 'click': events.click, |
| 613: | 'dblclick': events.dblclick, |
| 614: | 'mouseover': events.mouseover, |
| 615: | 'mouseout': events.mouseout, |
| 616: | }//}}} |
| 617: | }; /*}}}*/ |
| 618: | this.elements.alternative = { /*{{{*/ |
| 619: | 'illustrator': {//{{{ |
| 620: | 'type' : 'complex', |
| 621: | 'endnodes' : 'passthrough', |
| 622: | 'closeblock':false, |
| 623: | 'expansion' : function(node) { |
| 624: | return 'vertical'; |
| 625: | }, |
| 626: | 'col_shift' : function(node) { |
| 627: | return false; |
| 628: | }, |
| 629: | 'svg': function() { |
| 630: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 631: | '<circle cx="15" cy="15" r="14" class="standwithout"/>' + |
| 632: | '<text transform="translate(15,20)" class="normal">{..}</text>' + |
| 633: | '</svg>'); |
| 634: | } |
| 635: | },//}}} |
| 636: | 'description' : {//{{{ |
| 637: | 'create': function(target) { |
| 638: | var node = $X('<alternative condition="" xmlns="http://cpee.org/ns/description/1.0"/>'); |
| 639: | return node; |
| 640: | }, |
| 641: | 'permissible_children': function(node) { |
| 642: | if(node.get(0).tagName == 'alternative') { func = adaptor.description.insert_first_into } |
| 643: | else { func = adaptor.description.insert_after } |
| 644: | if(node.parents('parallel').length > node.parents('parallel_branch').length && node.get(0).tagName == 'alternative') |
| 645: | return [{'label': 'Parallel Branch', |
| 646: | 'function_call': func, |
| 647: | 'menu_icon': elements.parallel_branch.illustrator.svg, |
| 648: | 'params': [adaptor.description.elements.parallel_branch.create, node]}]; |
| 649: | return [ |
| 650: | {'label': 'Service Call with Script Block', |
| 651: | 'function_call': func, |
| 652: | 'menu_icon': elements.callmanipulate.illustrator.svg, |
| 653: | 'params': [adaptor.description.elements.callmanipulate.create, node]}, |
| 654: | {'label': 'Service Call', |
| 655: | 'function_call': func, |
| 656: | 'menu_icon': elements.call.illustrator.svg, |
| 657: | 'params': [adaptor.description.elements.call.create, node]}, |
| 658: | {'label': 'Script', |
| 659: | 'function_call': func, |
| 660: | 'menu_icon': elements.manipulate.illustrator.svg, |
| 661: | 'params': [adaptor.description.elements.manipulate.create, node]}, |
| 662: | {'label': 'Parallel', |
| 663: | 'function_call': func, |
| 664: | 'menu_icon': elements.parallel.illustrator.svg, |
| 665: | 'params': [adaptor.description.elements.parallel.create, node]}, |
| 666: | {'label': 'Choose', |
| 667: | 'function_call': func, |
| 668: | 'menu_icon': elements.choose.illustrator.svg, |
| 669: | 'params': [adaptor.description.elements.choose.create, node]}, |
| 670: | {'label': 'Loop', |
| 671: | 'function_call': func, |
| 672: | 'menu_icon': elements.loop.illustrator.svg, |
| 673: | 'params': [adaptor.description.elements.loop.create, node]}, |
| 674: | {'label': 'Critical', |
| 675: | 'function_call': func, |
| 676: | 'menu_icon': elements.critical.illustrator.svg, |
| 677: | 'params': [adaptor.description.elements.critical.create, node]} |
| 678: | ]; |
| 679: | } |
| 680: | },//}}} |
| 681: | 'adaptor' : {//{{{ |
| 682: | 'mousedown': function (node, e) { |
| 683: | events.mousedown(node,e,true, false); |
| 684: | }, |
| 685: | 'click': events.click, |
| 686: | 'dblclick': events.dblclick, |
| 687: | 'mouseover': events.mouseover, |
| 688: | 'mouseout': events.mouseout, |
| 689: | }//}}} |
| 690: | }; /*}}}*/ |
| 691: | this.elements.loop = { /*{{{*/ |
| 692: | 'illustrator': {//{{{ |
| 693: | 'type' : 'complex', |
| 694: | 'endnodes' : 'this', |
| 695: | 'closeblock' : true, |
| 696: | 'expansion' : function(node) { |
| 697: | return 'vertical'; |
| 698: | }, |
| 699: | 'col_shift' : function(node) { |
| 700: | return true; |
| 701: | }, |
| 702: | 'svg': function() { |
| 703: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 704: | '<rect transform="rotate(45,14,12)" x="7" y="3" width="21" height="21" class="stand"/>' + |
| 705: | '<line x1="10.5" y1="20.5" x2="20.5" y2="10.5" class="stand"/>' + |
| 706: | '<line x1="10.5" y1="10.5" x2="20.5" y2="20.5" class="stand"/>' + |
| 707: | '</svg>'); |
| 708: | } |
| 709: | },// }}} |
| 710: | 'description' : {//{{{ |
| 711: | 'create': function(target) { |
| 712: | var node = $X('<loop pre_test="" xmlns="http://cpee.org/ns/description/1.0"/>'); |
| 713: | return node; |
| 714: | }, |
| 715: | 'permissible_children': function(node) { |
| 716: | var func = null; |
| 717: | if(node.get(0).tagName == 'loop') { func = adaptor.description.insert_first_into } |
| 718: | else { func = adaptor.description.insert_after } |
| 719: | var childs = [ |
| 720: | {'label': 'Service Call with Script Block', |
| 721: | 'function_call': func, |
| 722: | 'menu_icon': elements.callmanipulate.illustrator.svg, |
| 723: | 'params': [adaptor.description.elements.callmanipulate.create, node]}, |
| 724: | {'label': 'Service Call', |
| 725: | 'function_call': func, |
| 726: | 'menu_icon': elements.call.illustrator.svg, |
| 727: | 'params': [adaptor.description.elements.call.create, node]}, |
| 728: | {'label': 'Manipulate', |
| 729: | 'function_call': func, |
| 730: | 'menu_icon': elements.manipulate.illustrator.svg, |
| 731: | 'params': [adaptor.description.elements.manipulate.create, node]}, |
| 732: | {'label': 'Choose', |
| 733: | 'function_call': func, |
| 734: | 'menu_icon': elements.choose.illustrator.svg, |
| 735: | 'params': [adaptor.description.elements.choose.create, node]}, |
| 736: | {'label': 'Loop', |
| 737: | 'function_call': func, |
| 738: | 'menu_icon': elements.loop.illustrator.svg, |
| 739: | 'params': [adaptor.description.elements.loop.create, node]}, |
| 740: | {'label': 'Critical', |
| 741: | 'function_call': func, |
| 742: | 'menu_icon': elements.critical.illustrator.svg, |
| 743: | 'params': [adaptor.description.elements.critical.create, node]} |
| 744: | ]; |
| 745: | if(node.parent('parallel').length > node.parent('parallel_branch').length) { |
| 746: | childs.push({'label': 'Parallel Branch', |
| 747: | 'function_call': func, |
| 748: | 'menu_icon': elements.parallel_branch.illustrator.svg, |
| 749: | 'params': [adaptor.description.elements.parallel_branch.create, node]} |
| 750: | ); |
| 751: | } else { |
| 752: | childs.push({'label': 'Parallel', |
| 753: | 'function_call': func, |
| 754: | 'menu_icon': elements.parallel.illustrator.svg, |
| 755: | 'params': [adaptor.description.elements.parallel.create, node]} |
| 756: | ); |
| 757: | } |
| 758: | return childs; |
| 759: | } |
| 760: | },//}}} |
| 761: | 'adaptor' : {//{{{ |
| 762: | 'mousedown': function (node, e) { |
| 763: | events.mousedown(node,e,true, true); |
| 764: | }, |
| 765: | 'click': events.click, |
| 766: | 'dblclick': events.dblclick, |
| 767: | 'mouseover': events.mouseover, |
| 768: | 'mouseout': events.mouseout, |
| 769: | }//}}} |
| 770: | }; /*}}}*/ |
| 771: | this.elements.parallel = { /*{{{*/ |
| 772: | 'illustrator': {//{{{ |
| 773: | 'type' : 'complex', |
| 774: | 'endnodes' : 'this', |
| 775: | 'closeblock' : false, |
| 776: | 'border': true, |
| 777: | 'expansion' : function(node) { |
| 778: | // check if any sibling other than 'parallel_branch' is present |
| 779: | if($(node).children(':not(parallel_branch)').length > 0) return 'vertical'; |
| 780: | return 'horizontal'; |
| 781: | }, |
| 782: | 'col_shift' : function(node) { |
| 783: | return true; |
| 784: | }, |
| 785: | 'svg': function() { |
| 786: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 787: | '<rect transform="rotate(45,14,12)" x="7" y="3" width="21" height="21" class="stand"/>' + |
| 788: | '<text transform="translate(12,25)" class="normallarge">+</text>' + |
| 789: | '<text transform="translate(18,16)" class="small">=</text>' + |
| 790: | '</svg>'); |
| 791: | } |
| 792: | },//}}} |
| 793: | 'description' : {//{{{ |
| 794: | 'create': function(target) { |
| 795: | var node = $X('<parallel xmlns="http://cpee.org/ns/description/1.0"/>'); |
| 796: | return node; |
| 797: | }, |
| 798: | 'permissible_children': function(node) { |
| 799: | var childs = [ |
| 800: | {'label': 'Service Call with Script Block', |
| 801: | 'function_call': adaptor.description.insert_last_into, |
| 802: | 'menu_icon': elements.callmanipulate.illustrator.svg, |
| 803: | 'params': [adaptor.description.elements.callmanipulate.create, node]}, |
| 804: | {'label': 'Service Call', |
| 805: | 'function_call': adaptor.description.insert_last_into, |
| 806: | 'menu_icon': elements.call.illustrator.svg, |
| 807: | 'params': [adaptor.description.elements.call.create, node]}, |
| 808: | {'label': 'Manipulate', |
| 809: | 'function_call': adaptor.description.insert_last_into, |
| 810: | 'menu_icon': elements.manipulate.illustrator.svg, |
| 811: | 'params': [adaptor.description.elements.manipulate.create, node]}, |
| 812: | {'label': 'Choose', |
| 813: | 'function_call': adaptor.description.insert_last_into, |
| 814: | 'menu_icon': elements.choose.illustrator.svg, |
| 815: | 'params': [adaptor.description.elements.choose.create, node]}, |
| 816: | {'label': 'Loop', |
| 817: | 'function_call': adaptor.description.insert_last_into, |
| 818: | 'menu_icon': elements.loop.illustrator.svg, |
| 819: | 'params': [adaptor.description.elements.loop.create, node]}, |
| 820: | {'label': 'Critical', |
| 821: | 'function_call': adaptor.description.insert_last_into, |
| 822: | 'menu_icon': elements.critical.illustrator.svg, |
| 823: | 'params': [adaptor.description.elements.critical.create, node]}, |
| 824: | {'label': 'Parallel Branch', |
| 825: | 'function_call': adaptor.description.insert_last_into, |
| 826: | 'menu_icon': elements.parallel_branch.illustrator.svg, |
| 827: | 'params': [adaptor.description.elements.parallel_branch.create, node]} |
| 828: | ]; |
| 829: | if(node.get(0).tagName != 'parallel') |
| 830: | childs.push({'label': 'Parallel', |
| 831: | 'function_call': adaptor.description.insert_last_into, |
| 832: | 'menu_icon': elements.parallel.illustrator.svg, |
| 833: | 'params': [adaptor.description.elements.parallel.create, node]}); |
| 834: | return childs; |
| 835: | } |
| 836: | },//}}} |
| 837: | 'adaptor' : {//{{{ |
| 838: | 'mousedown': function (node, e) { |
| 839: | events.mousedown(node,e,true, true); |
| 840: | }, |
| 841: | 'click': events.click, |
| 842: | 'dblclick': events.dblclick, |
| 843: | 'mouseover': events.mouseover, |
| 844: | 'mouseout': events.mouseout, |
| 845: | }//}}} |
| 846: | }; /*}}}*/ |
| 847: | this.elements.parallel_branch = { /*{{{*/ |
| 848: | 'illustrator': {//{{{ |
| 849: | 'type' : 'complex', |
| 850: | 'endnodes' : 'this', |
| 851: | 'closeblock' : false, |
| 852: | 'expansion' : function(node) { |
| 853: | return 'vertical'; |
| 854: | }, |
| 855: | 'col_shift' : function(node) { |
| 856: | if(node.parentNode.tagName == 'choose') return false; |
| 857: | if($(node).parents('parallel').first().children(':not(parallel_branch)').length > 0) return true; |
| 858: | return false; |
| 859: | }, |
| 860: | 'svg': function() { |
| 861: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 862: | '<rect transform="rotate(45,14,12)" x="7" y="3" width="21" height="21" class="stand"/>' + |
| 863: | '<text transform="translate(15,20)" class="small">+|</text>' + |
| 864: | '</svg>'); |
| 865: | } |
| 866: | },//}}} |
| 867: | 'description' : {//{{{ |
| 868: | 'create': function(target) { |
| 869: | var node = $X('<parallel_branch xmlns="http://cpee.org/ns/description/1.0"/>'); |
| 870: | return node; |
| 871: | }, |
| 872: | 'permissible_children': function(node) { |
| 873: | var func = null; |
| 874: | var childs = null; |
| 875: | if(node.get(0).tagName == 'parallel_branch') { func = adaptor.description.insert_first_into } |
| 876: | else { func = adaptor.description.insert_after } |
| 877: | childs = [ |
| 878: | {'label': 'Service Call with Script Block', |
| 879: | 'function_call': func, |
| 880: | 'menu_icon': elements.callmanipulate.illustrator.svg, |
| 881: | 'params': [adaptor.description.elements.callmanipulate.create, node]}, |
| 882: | {'label': 'Service Call', |
| 883: | 'function_call': func, |
| 884: | 'menu_icon': elements.call.illustrator.svg, |
| 885: | 'params': [adaptor.description.elements.call.create, node]}, |
| 886: | {'label': 'Script', |
| 887: | 'function_call': func, |
| 888: | 'menu_icon': elements.manipulate.illustrator.svg, |
| 889: | 'params': [adaptor.description.elements.manipulate.create, node]}, |
| 890: | {'label': 'Parallel', |
| 891: | 'function_call': func, |
| 892: | 'menu_icon': elements.parallel.illustrator.svg, |
| 893: | 'params': [adaptor.description.elements.parallel.create, node]}, |
| 894: | {'label': 'Choose', |
| 895: | 'function_call': func, |
| 896: | 'menu_icon': elements.choose.illustrator.svg, |
| 897: | 'params': [adaptor.description.elements.choose.create, node]}, |
| 898: | {'label': 'Loop', |
| 899: | 'function_call': func, |
| 900: | 'menu_icon': elements.loop.illustrator.svg, |
| 901: | 'params': [adaptor.description.elements.loop.create, node]}, |
| 902: | {'label': 'Critical', |
| 903: | 'function_call': func, |
| 904: | 'menu_icon': elements.critical.illustrator.svg, |
| 905: | 'params': [adaptor.description.elements.critical.create, node]}, |
| 906: | ]; |
| 907: | if(node.parents('choose').length > node.parents('alternative, otherwise').length && node.get(0).tagName == 'parallel_branch') { |
| 908: | return [{'label': 'Alternative', |
| 909: | 'function_call': func, |
| 910: | 'menu_icon': elements.alternative.illustrator.svg, |
| 911: | 'params': [adaptor.description.elements.alternative.create, node]}]; |
| 912: | } |
| 913: | return childs; |
| 914: | } |
| 915: | },//}}} |
| 916: | 'adaptor' : {//{{{ |
| 917: | 'mousedown': function (node, e) { |
| 918: | events.mousedown(node,e,true, false); |
| 919: | }, |
| 920: | 'click': events.click, |
| 921: | 'dblclick': events.dblclick, |
| 922: | 'mouseover': events.mouseover, |
| 923: | 'mouseout': events.mouseout, |
| 924: | }//}}} |
| 925: | }; /*}}}*/ |
| 926: | this.elements.critical = { /*{{{*/ |
| 927: | 'illustrator': {//{{{ |
| 928: | 'type' : 'complex', |
| 929: | 'endnodes' : 'aggregate', |
| 930: | 'closeblock' : false, |
| 931: | 'border': true, |
| 932: | 'expansion' : function(node) { |
| 933: | return 'vertical'; |
| 934: | }, |
| 935: | 'col_shift' : function(node) { |
| 936: | return true; |
| 937: | }, |
| 938: | 'svg': function() { |
| 939: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 940: | '<circle cx="15" cy="15" r="14" class="stand"/>' + |
| 941: | '<text transform="translate(15,21)" class="normal">⚠</text>' + |
| 942: | '</svg>'); |
| 943: | } |
| 944: | },//}}} |
| 945: | 'description' : {//{{{ |
| 946: | 'create': function(target) { |
| 947: | var node = $X('<critical sid="section" xmlns="http://cpee.org/ns/description/1.0"/>'); |
| 948: | return node; |
| 949: | }, |
| 950: | 'permissible_children': function(node) { |
| 951: | var func = null; |
| 952: | if(node.get(0).tagName == 'critical') { func = adaptor.description.insert_first_into } |
| 953: | else { func = adaptor.description.insert_after } |
| 954: | return [ |
| 955: | {'label': 'Service Call with Script Block', |
| 956: | 'function_call': func, |
| 957: | 'menu_icon': elements.callmanipulate.illustrator.svg, |
| 958: | 'params': [adaptor.description.elements.callmanipulate.create, node]}, |
| 959: | {'label': 'Service Call', |
| 960: | 'function_call': func, |
| 961: | 'menu_icon': elements.call.illustrator.svg, |
| 962: | 'params': [adaptor.description.elements.call.create, node]}, |
| 963: | {'label': 'Script', |
| 964: | 'function_call': func, |
| 965: | 'menu_icon': elements.manipulate.illustrator.svg, |
| 966: | 'params': [adaptor.description.elements.manipulate.create, node]}, |
| 967: | {'label': 'Parallel', |
| 968: | 'function_call': func, |
| 969: | 'menu_icon': elements.parallel.illustrator.svg, |
| 970: | 'params': [adaptor.description.elements.parallel.create, node]}, |
| 971: | {'label': 'Choose', |
| 972: | 'function_call': func, |
| 973: | 'menu_icon': elements.choose.illustrator.svg, |
| 974: | 'params': [adaptor.description.elements.choose.create, node]}, |
| 975: | {'label': 'Loop', |
| 976: | 'function_call': func, |
| 977: | 'menu_icon': elements.loop.illustrator.svg, |
| 978: | 'params': [adaptor.description.elements.loop.create, node]}, |
| 979: | {'label': 'Critical', |
| 980: | 'function_call': func, |
| 981: | 'menu_icon': elements.critical.illustrator.svg, |
| 982: | 'params': [adaptor.description.elements.critical.create, node]}, |
| 983: | ]; |
| 984: | } |
| 985: | },//}}} |
| 986: | 'adaptor' : {//{{{ |
| 987: | 'mousedown': function (node, e) { |
| 988: | events.mousedown(node,e,true, true); |
| 989: | }, |
| 990: | 'click': events.click, |
| 991: | 'dblclick': events.dblclick, |
| 992: | 'mouseover': events.mouseover, |
| 993: | 'mouseout': events.mouseout, |
| 994: | }//}}} |
| 995: | }; /*}}}*/ |
| 996: | this.elements.group = { /*{{{*/ |
| 997: | 'illustrator': {//{{{ |
| 998: | 'type' : 'complex', |
| 999: | 'endnodes' : 'aggregate', |
| 1000: | 'closeblock' : false, |
| 1001: | 'border': 'injectiongroup', // other value than true,false inidcates the used class for the svg-object |
| 1002: | 'expansion' : function(node) { |
| 1003: | return 'vertical'; |
| 1004: | }, |
| 1005: | 'col_shift' : function(node) { |
| 1006: | return true; |
| 1007: | }, |
| 1008: | 'svg': function() { |
| 1009: | return false; |
| 1010: | } |
| 1011: | },//}}} |
| 1012: | 'description' : {//{{{ |
| 1013: | 'create': function(target) { |
| 1014: | var node = $X('<group xmlns="http://cpee.org/ns/description/1.0"/>'); |
| 1015: | return node; |
| 1016: | }, |
| 1017: | 'permissible_children': function(node) { |
| 1018: | var func = null; |
| 1019: | if(node.get(0).tagName == 'group') { func = adaptor.description.insert_first_into } |
| 1020: | else { func = adaptor.description.insert_after } |
| 1021: | return [ |
| 1022: | ]; |
| 1023: | } |
| 1024: | },//}}} |
| 1025: | 'adaptor' : {//{{{ |
| 1026: | 'mousedown': function (node, e) { |
| 1027: | events.mousedown(node,e,true, true); |
| 1028: | }, |
| 1029: | 'click': events.click, |
| 1030: | 'dblclick': events.dblclick, |
| 1031: | 'mouseover': events.mouseover, |
| 1032: | 'mouseout': events.mouseout, |
| 1033: | }//}}} |
| 1034: | }; /*}}}*/ |
| 1035: | this.elements.start = this.elements.description = { /*{{{*/ |
| 1036: | 'illustrator': {//{{{ |
| 1037: | 'type' : 'description', |
| 1038: | 'endnodes' : 'passthrough', |
| 1039: | 'closeblock' : false, |
| 1040: | 'expansion' : function(node) { |
| 1041: | return 'vertical'; |
| 1042: | }, |
| 1043: | 'col_shift' : function(node) { |
| 1044: | return true; |
| 1045: | }, |
| 1046: | 'svg': function() { |
| 1047: | return $X('<svg class="clickable" xmlns="http://www.w3.org/2000/svg">' + |
| 1048: | '<circle cx="15" cy="15" r="14" class="stand"/>' + |
| 1049: | '</svg>'); |
| 1050: | } |
| 1051: | },//}}} |
| 1052: | 'description' : {//{{{ |
| 1053: | 'permissible_children': function(node) { |
| 1054: | var func = null; |
| 1055: | if(node.get(0).tagName == 'description') { func = adaptor.description.insert_first_into } |
| 1056: | else { func = adaptor.description.insert_after } |
| 1057: | return [ |
| 1058: | {'label': 'Service Call with Script Block', |
| 1059: | 'function_call': func, |
| 1060: | 'menu_icon': elements.callmanipulate.illustrator.svg, |
| 1061: | 'params': [adaptor.description.elements.callmanipulate.create, node]}, |
| 1062: | {'label': 'Service Call', |
| 1063: | 'function_call': func, |
| 1064: | 'menu_icon': elements.call.illustrator.svg, |
| 1065: | 'params': [adaptor.description.elements.call.create, node]}, |
| 1066: | {'label': 'Script Task', |
| 1067: | 'function_call': func, |
| 1068: | 'menu_icon': elements.manipulate.illustrator.svg, |
| 1069: | 'params': [adaptor.description.elements.manipulate.create, node]}, |
| 1070: | {'label': 'Parallel', |
| 1071: | 'function_call': func, |
| 1072: | 'menu_icon': elements.parallel.illustrator.svg, |
| 1073: | 'params': [adaptor.description.elements.parallel.create, node]}, |
| 1074: | {'label': 'Choose', |
| 1075: | 'function_call': func, |
| 1076: | 'menu_icon': elements.choose.illustrator.svg, |
| 1077: | 'params': [adaptor.description.elements.choose.create, node]}, |
| 1078: | {'label': 'Loop', |
| 1079: | 'function_call': func, |
| 1080: | 'menu_icon': elements.loop.illustrator.svg, |
| 1081: | 'params': [adaptor.description.elements.loop.create, node]}, |
| 1082: | {'label': 'Critical', |
| 1083: | 'function_call': func, |
| 1084: | 'menu_icon': elements.critical.illustrator.svg, |
| 1085: | 'params': [adaptor.description.elements.critical.create, node]} |
| 1086: | ]; |
| 1087: | } |
| 1088: | },//}}} |
| 1089: | 'adaptor' : {//{{{ |
| 1090: | 'mousedown': function (node, e) { |
| 1091: | events.mousedown(node,e,true, false); |
| 1092: | }, |
| 1093: | 'click': events.click, |
| 1094: | 'dblclick': events.dblclick, |
| 1095: | 'mouseover': events.mouseover, |
| 1096: | 'mouseout': events.mouseout, |
| 1097: | }//}}} |
| 1098: | }; /*}}}*/ |
| 1099: | .5} |
