cpee 1.4.15 → 1.4.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/cockpit/js/instance.js +15 -6
  3. data/cockpit/js/wfadaptor.js +18 -3
  4. data/cockpit/themes/compact/theme.js +5 -3
  5. data/cockpit/themes/default/rngs/choose.rng +2 -2
  6. data/cockpit/themes/default/rngs/parallel.rng +2 -2
  7. data/cockpit/themes/default/theme.js +5 -3
  8. data/cockpit/themes/extended/theme.js +1042 -0
  9. data/cockpit/track.html +118 -0
  10. data/cpee.gemspec +1 -1
  11. data/lib/cpee/controller.rb +24 -8
  12. data/lib/cpee/implementation.rb +3 -6
  13. data/server/handlerwrappers/default.rb +1 -1
  14. data/server/resources/properties.init +5 -4
  15. data/server/resources/properties.schema.active +9 -1
  16. data/server/resources/properties.schema.finished +8 -0
  17. data/server/resources/properties.schema.inactive +8 -0
  18. data/tools/cpee +42 -19
  19. metadata +4 -109
  20. data/log/logs/1/test +0 -1
  21. data/log/logs/3b0cfe66-5a3d-43de-b5a1-d7b9386be65a.xes.yaml +0 -413
  22. data/server/instances/1/properties.xml +0 -62
  23. data/server/instances/10/notifications/182434032285ca1d06a8b6554b8889c8/consumer-secret +0 -1
  24. data/server/instances/10/notifications/182434032285ca1d06a8b6554b8889c8/producer-secret +0 -1
  25. data/server/instances/10/notifications/182434032285ca1d06a8b6554b8889c8/subscription.xml +0 -23
  26. data/server/instances/10/notifications/512a3785631a5245dbb45fa150ea72ed/consumer-secret +0 -1
  27. data/server/instances/10/notifications/512a3785631a5245dbb45fa150ea72ed/producer-secret +0 -1
  28. data/server/instances/10/notifications/512a3785631a5245dbb45fa150ea72ed/subscription.xml +0 -6
  29. data/server/instances/10/properties.xml +0 -187
  30. data/server/instances/11/properties.xml +0 -191
  31. data/server/instances/12/properties.xml +0 -191
  32. data/server/instances/13/properties.xml +0 -204
  33. data/server/instances/14/properties.xml +0 -31
  34. data/server/instances/15/properties.xml +0 -30
  35. data/server/instances/16/properties.xml +0 -29
  36. data/server/instances/17/properties.xml +0 -29
  37. data/server/instances/18/properties.xml +0 -31
  38. data/server/instances/19/properties.xml +0 -31
  39. data/server/instances/2/properties.xml +0 -31
  40. data/server/instances/20/properties.xml +0 -191
  41. data/server/instances/21/properties.xml +0 -156
  42. data/server/instances/22/properties.xml +0 -118
  43. data/server/instances/23/properties.xml +0 -118
  44. data/server/instances/24/properties.xml +0 -156
  45. data/server/instances/25/properties.xml +0 -156
  46. data/server/instances/26/properties.xml +0 -156
  47. data/server/instances/27/properties.xml +0 -140
  48. data/server/instances/28/properties.xml +0 -156
  49. data/server/instances/29/properties.xml +0 -156
  50. data/server/instances/3/properties.xml +0 -120
  51. data/server/instances/30/properties.xml +0 -354
  52. data/server/instances/31/properties.xml +0 -354
  53. data/server/instances/313/notifications/crisp/consumer-secret +0 -1
  54. data/server/instances/313/notifications/crisp/producer-secret +0 -1
  55. data/server/instances/313/notifications/crisp/subscription.xml +0 -7
  56. data/server/instances/313/notifications/logging/consumer-secret +0 -1
  57. data/server/instances/313/notifications/logging/producer-secret +0 -1
  58. data/server/instances/313/notifications/logging/subscription.xml +0 -7
  59. data/server/instances/313/notifications/logging_yaml/consumer-secret +0 -1
  60. data/server/instances/313/notifications/logging_yaml/producer-secret +0 -1
  61. data/server/instances/313/notifications/logging_yaml/subscription.xml +0 -7
  62. data/server/instances/313/properties.xml +0 -524
  63. data/server/instances/32/properties.xml +0 -628
  64. data/server/instances/33/properties.xml +0 -156
  65. data/server/instances/4/properties.xml +0 -114
  66. data/server/instances/5/properties.xml +0 -114
  67. data/server/instances/6/properties.xml +0 -206
  68. data/server/instances/662/notifications/crisp/consumer-secret +0 -1
  69. data/server/instances/662/notifications/crisp/producer-secret +0 -1
  70. data/server/instances/662/notifications/crisp/subscription.xml +0 -7
  71. data/server/instances/662/notifications/logging/consumer-secret +0 -1
  72. data/server/instances/662/notifications/logging/producer-secret +0 -1
  73. data/server/instances/662/notifications/logging/subscription.xml +0 -7
  74. data/server/instances/662/notifications/logging_yaml/consumer-secret +0 -1
  75. data/server/instances/662/notifications/logging_yaml/producer-secret +0 -1
  76. data/server/instances/662/notifications/logging_yaml/subscription.xml +0 -7
  77. data/server/instances/662/properties.xml +0 -427
  78. data/server/instances/663/properties.xml +0 -31
  79. data/server/instances/664/properties.xml +0 -425
  80. data/server/instances/665/properties.xml +0 -425
  81. data/server/instances/666/properties.xml +0 -427
  82. data/server/instances/667/properties.xml +0 -427
  83. data/server/instances/668/properties.xml +0 -425
  84. data/server/instances/669/properties.xml +0 -425
  85. data/server/instances/670/properties.xml +0 -31
  86. data/server/instances/671/properties.xml +0 -158
  87. data/server/instances/672/properties.xml +0 -199
  88. data/server/instances/673/properties.xml +0 -52
  89. data/server/instances/674/properties.xml +0 -75
  90. data/server/instances/675/notifications/10fa09a02f1a981a931ebe75d8cabe48/consumer-secret +0 -1
  91. data/server/instances/675/notifications/10fa09a02f1a981a931ebe75d8cabe48/producer-secret +0 -1
  92. data/server/instances/675/notifications/10fa09a02f1a981a931ebe75d8cabe48/subscription.xml +0 -6
  93. data/server/instances/675/properties.xml +0 -74
  94. data/server/instances/676/properties.xml +0 -76
  95. data/server/instances/677/properties.xml +0 -76
  96. data/server/instances/678/properties.xml +0 -74
  97. data/server/instances/679/properties.xml +0 -76
  98. data/server/instances/680/properties.xml +0 -76
  99. data/server/instances/681/properties.xml +0 -156
  100. data/server/instances/682/properties.xml +0 -156
  101. data/server/instances/683/properties.xml +0 -156
  102. data/server/instances/684/properties.xml +0 -156
  103. data/server/instances/685/properties.xml +0 -156
  104. data/server/instances/686/properties.xml +0 -156
  105. data/server/instances/687/properties.xml +0 -156
  106. data/server/instances/688/properties.xml +0 -118
  107. data/server/instances/689/properties.xml +0 -156
  108. data/server/instances/690/properties.xml +0 -156
  109. data/server/instances/691/properties.xml +0 -129
  110. data/server/instances/692/properties.xml +0 -31
  111. data/server/instances/693/properties.xml +0 -118
  112. data/server/instances/694/properties.xml +0 -118
  113. data/server/instances/695/properties.xml +0 -156
  114. data/server/instances/696/properties.xml +0 -156
  115. data/server/instances/697/notifications/ruleengine/consumer-secret +0 -1
  116. data/server/instances/697/notifications/ruleengine/producer-secret +0 -1
  117. data/server/instances/697/notifications/ruleengine/subscription.xml +0 -16
  118. data/server/instances/697/properties.xml +0 -156
  119. data/server/instances/698/notifications/ruleengine/consumer-secret +0 -1
  120. data/server/instances/698/notifications/ruleengine/producer-secret +0 -1
  121. data/server/instances/698/notifications/ruleengine/subscription.xml +0 -16
  122. data/server/instances/698/properties.xml +0 -31
  123. data/server/instances/7/properties.xml +0 -156
  124. data/server/instances/8/properties.xml +0 -118
  125. data/server/instances/9/properties.xml +0 -120
  126. data/server/server.pid +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b13f28d6d5cfedcbb895a4eb6540c4863185775ea7f9278987e5b33c69a6de44
4
- data.tar.gz: ac3de30fe85b18f5672ab6de0afc9c6fe8a667026c4cd953fc3149ef056416bd
3
+ metadata.gz: 1c4ab772efbcd09a954265c0dfa57c5421986af3d2eb83c93a63d10888ecae3b
4
+ data.tar.gz: 9aadf410a77cd0ccaa953ede6245fb2cf8267db5ed3bf44e6b34b310b6209a26
5
5
  SHA512:
6
- metadata.gz: 9c93bebfe9e70e13b14f8605975660bb6e7832af57a04c662cdedfdfd66ebfc70e6717a8b43336d18df6b86ac8f23023e556676870a8a77859d89f4956ae4461
7
- data.tar.gz: af1e1fc3393cc605fd726954640607fe402794c8faad542c1866766667f7aa1c2ef09a0a5664f86abc04edf001b921c14625ba9285330e3a8263907f2522a66e
6
+ metadata.gz: 0c65df8421ae382688a59ca0b41cdf95a12c9b806ea8cbcbc82e7aca9c519df4b007a7f64f34df5adaf1c7c3480e329dee216554db09529974ad60df8495cbc2
7
+ data.tar.gz: e6e98a003d8fb24d1648c46eca4de49ccfd7cdfbfa2378aae4378ffcb5eff93f2fa7616686ecb365a62a464f5aaa1bd735962ae5e6517a47b1749a2598606d50
@@ -488,7 +488,7 @@ function monitor_instance_pos() {// {{{
488
488
  format_visual_clear();
489
489
  values.each(function(){
490
490
  var what = this.nodeName;
491
- format_visual_add(what,"passive");
491
+ format_visual_add(what,save['state'] == 'running' ? 'active' : 'passive');
492
492
  });
493
493
  }
494
494
  });
@@ -521,9 +521,8 @@ function monitor_instance_state_change(notification) { //{{{
521
521
 
522
522
  var but = "";
523
523
  if (notification == "ready" || notification == "stopped") {
524
- but = " ⇒ <button onclick='$(this).attr(\"disabled\",\"disabled\");start_instance();'>start</button> / <button onclick='$(this).attr(\"disabled\",\"disabled\");sim_instance();'>simulate</button>";
525
- }
526
- if (notification == "running") {
524
+ but = " ⇒ <button onclick='$(this).attr(\"disabled\",\"disabled\");start_instance();'>start</button> / <button onclick='$(this).attr(\"disabled\",\"disabled\");sim_instance();'>simulate</button> / <button onclick='aba_instance();'>abandon</button>";
525
+ } else if (notification == "running") {
527
526
  but = " ⇒ <button onclick='$(this).attr(\"disabled\",\"disabled\");stop_instance();'>stop</button>";
528
527
  }
529
528
 
@@ -547,12 +546,12 @@ function monitor_instance_pos_change(notification) {// {{{
547
546
  var parts = JSON.parse(notification);
548
547
  if (parts['unmark']) {
549
548
  $.each(parts['unmark'],function(a,b){
550
- format_visual_remove(b,"passive")
549
+ format_visual_remove(b.position,"passive")
551
550
  });
552
551
  }
553
552
  if (parts['at']) {
554
553
  $.each(parts['at'],function(a,b){
555
- format_visual_add(b,"passive")
554
+ format_visual_add(b.position,"passive")
556
555
  });
557
556
  }
558
557
  } // }}}
@@ -597,6 +596,16 @@ function sim_instance() {// {{{
597
596
  error: report_failure
598
597
  });
599
598
  }// }}}
599
+ function aba_instance() {// {{{
600
+ monitor_instance_state_change('abandoned');
601
+ var url = $('body').attr('current-instance');
602
+ $.ajax({
603
+ type: "PUT",
604
+ url: url + "/properties/values/state",
605
+ data: ({value: "abandoned"}),
606
+ error: report_failure
607
+ });
608
+ }// }}}
600
609
  function stop_instance() {// {{{
601
610
  var url = $('body').attr('current-instance');
602
611
  $.ajax({
@@ -194,7 +194,18 @@ function WfIllustrator(wf_adaptor) { // View {{{
194
194
  // Helper Functions {{{
195
195
  var draw_label = this.draw.draw_label = function (tname, id, label, row, col, group) { // {{{
196
196
  var g = $X('<text class="label" transform="translate(' + String((col*self.width)-((self.width*0.39))) + ',' + String(row*self.height+20-((self.height*0.74))) + ')" xmlns="http://www.w3.org/2000/svg"></text>');
197
- g.text((label != '' ? '◤ ' : '') + label);
197
+ var spli = $(label.split(/\n/));
198
+ spli.each(function(k,v) {
199
+ var tspan = $X('<tspan x="0" dy="' + (spli.length > 1 ? '-7' : '0') + '" xmlns="http://www.w3.org/2000/svg"></tspan>');
200
+ if (k == 0) {
201
+ tspan.text((label != '' ? '◤ ' : '') + v);
202
+ } else {
203
+ tspan.text(v);
204
+ tspan.attr('dy','15');
205
+ tspan.attr('dx','15');
206
+ }
207
+ g.append(tspan);
208
+ });
198
209
  bind_event(g,tname);
199
210
  if(group) { group.find('g.element[element-id=' + id + ']').append(g); }
200
211
  else {self.svg.container.children('g:first').append(g);}
@@ -293,7 +304,7 @@ function WfIllustrator(wf_adaptor) { // View {{{
293
304
  );
294
305
  }
295
306
  }
296
- // Seems to solve injection groups-line problem, but I guess it will caus problem when collapsing elements
307
+ // Seems to solve injection groups-line problem, but I guess it will cause problem when collapsing elements
297
308
  //if(group) {group.prepend(line);}
298
309
  //else
299
310
  {self.svg.container.append(line);}
@@ -575,7 +586,11 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
575
586
  // }}}
576
587
  // Calculate Connection {{{
577
588
  if(illustrator.elements[tname] != undefined && illustrator.elements[tname].closeblock) { // Close Block if element e.g. loop
578
- for(node in block.endnodes) illustrator.draw.draw_connection(group, block.endnodes[node], pos, block.max.row+1, block.endnodes.length, true);
589
+ for(node in block.endnodes) {
590
+ if (!block.endnodes[node].final) {
591
+ illustrator.draw.draw_connection(group, block.endnodes[node], pos, block.max.row+1, block.endnodes.length, true);
592
+ }
593
+ }
579
594
  }
580
595
  if(illustrator.elements[tname] != undefined && illustrator.elements[tname].endnodes != 'this') {
581
596
  for(i in block.endnodes) endnodes.push(block.endnodes[i]); // collects all endpoints from different childs e.g. alternatives from choose
@@ -66,7 +66,7 @@ function WFAdaptorManifestation(adaptor) {
66
66
  var schema = save['endpoints_cache'][$(node).attr('endpoint')].schema.documentElement;
67
67
  $(rng).find(' > element[name="parameters"] > element[name="arguments"]').replaceWith($(schema).clone());
68
68
  }
69
- save['details'] = new RelaxNGui(rng,tab,self.adaptor.description.context_eval);
69
+ save['details'] = new RelaxNGui(rng,tab,self.adaptor.description.context_eval,true);
70
70
  save['details'].content(node);
71
71
  format_visual_forms();
72
72
  }
@@ -161,7 +161,7 @@ function WFAdaptorManifestation(adaptor) {
161
161
  'params': ['> finalize, > update', xml_node]
162
162
  });
163
163
  }
164
- if (xml_node.get(0).tagName == "call") {
164
+ if (xml_node.get(0).tagName == "call" || xml_node.get(0).tagName == "manipulate") {
165
165
  var icon = self.elements.call.illustrator.svg.clone();
166
166
  icon.children('g.replace').addClass('active');
167
167
  var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
@@ -236,7 +236,9 @@ function WFAdaptorManifestation(adaptor) {
236
236
  'type': 'primitive',
237
237
  'illustrator': {//{{{
238
238
  'endnodes': 'this',
239
- 'label': function(node){ return $('> label',$(node).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,''); },
239
+ 'label': function(node){
240
+ return $('> label',$(node).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,'');
241
+ },
240
242
  'info': function(node){ return { 'element-endpoint': $(node).attr('endpoint') }; },
241
243
  'resolve_symbol': function(node) {
242
244
  if($('finalize,update', node).length > 0) {
@@ -5,8 +5,8 @@
5
5
  <value>inclusive</value>
6
6
  </choice>
7
7
  </attribute>
8
- <element name="alternative">
8
+ <element rngui:ignore="true" name="alternative">
9
9
  <attribute name="condition"><data type="string"/></attribute>
10
10
  </element>
11
- <element name="otherwise"/>
11
+ <element rngui:ignore="true" name="otherwise"/>
12
12
  </element>
@@ -2,11 +2,11 @@
2
2
  <attribute name="wait" rngui:label="Wait" rngui:default="-1" rngui:hint="-1 to wait for all branches.">
3
3
  <data type="integer"/>
4
4
  </attribute>
5
- <element name="parallel_branch">
5
+ <element rngui:ignore="true" name="parallel_branch">
6
6
  <attribute name="pass"><data type="string"/></attribute>
7
7
  <attribute name="local"><data type="string"/></attribute>
8
8
  </element>
9
- <element name="parallel_branch">
9
+ <element rngui:ignore="true" name="parallel_branch">
10
10
  <attribute name="pass"><data type="string"/></attribute>
11
11
  <attribute name="local"><data type="string"/></attribute>
12
12
  </element>
@@ -66,7 +66,7 @@ function WFAdaptorManifestation(adaptor) {
66
66
  var schema = save['endpoints_cache'][$(node).attr('endpoint')].schema.documentElement;
67
67
  $(rng).find(' > element[name="parameters"] > element[name="arguments"]').replaceWith($(schema).clone());
68
68
  }
69
- save['details'] = new RelaxNGui(rng,tab,self.adaptor.description.context_eval);
69
+ save['details'] = new RelaxNGui(rng,tab,self.adaptor.description.context_eval,true);
70
70
  save['details'].content(node);
71
71
  format_visual_forms();
72
72
  }
@@ -161,7 +161,7 @@ function WFAdaptorManifestation(adaptor) {
161
161
  'params': ['> finalize, > update', xml_node]
162
162
  });
163
163
  }
164
- if (xml_node.get(0).tagName == "call") {
164
+ if (xml_node.get(0).tagName == "call" || xml_node.get(0).tagName == "manipulate") {
165
165
  var icon = self.elements.call.illustrator.svg.clone();
166
166
  icon.children('g.replace').addClass('active');
167
167
  var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
@@ -236,7 +236,9 @@ function WFAdaptorManifestation(adaptor) {
236
236
  'type': 'primitive',
237
237
  'illustrator': {//{{{
238
238
  'endnodes': 'this',
239
- 'label': function(node){ return $('> label',$(node).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,''); },
239
+ 'label': function(node){
240
+ return $('> label',$(node).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,'');
241
+ },
240
242
  'info': function(node){ return { 'element-endpoint': $(node).attr('endpoint') }; },
241
243
  'resolve_symbol': function(node) {
242
244
  if($('finalize,update', node).length > 0) {
@@ -0,0 +1,1042 @@
1
+ function WFAdaptorManifestation(adaptor) {
2
+ var self = this;
3
+
4
+ this.adaptor = adaptor;
5
+ this.resources = {};
6
+ this.elements = {};
7
+ this.events = {};
8
+ this.compact = false;
9
+ this.endpoints = {};
10
+
11
+ this.noarrow = ['alternative', 'otherwise'];
12
+
13
+ //{{{ transform the details data to description parts based on rng
14
+ this.source = function(base,opts) {
15
+ if (base[0].namespaceURI == "http://relaxng.org/ns/structure/1.0") {
16
+ $('#relaxngworker').empty();
17
+ var rngw = new RelaxNGui(base,$('#relaxngworker'),self.adaptor.description.context_eval);
18
+ var nnew = $(rngw.save().documentElement);
19
+ nnew.attr('trans-xmlns','http://cpee.org/ns/description/1.0');
20
+ var ntxt = nnew.serializeXML();
21
+ ntxt = ntxt.replace(/trans-xmlns/,'xmlns');
22
+
23
+ return($X(ntxt));
24
+ } else {
25
+ if (opts && opts == 'clone') {
26
+ base = base.clone();
27
+ if (base.attr('id')) {
28
+ base.attr('id',self.adaptor.description.get_free_id());
29
+ }
30
+ base.find('*[id]').each(function(k,v){
31
+ $(v).attr('id',self.adaptor.description.get_free_id(base));
32
+ });
33
+ }
34
+ return base;
35
+ }
36
+ }; //}}}
37
+ //{{{ Return the svgid for the clicked task
38
+ this.clicked = function(){
39
+ var svgid = 'unknown';
40
+ _.each(self.adaptor.illustrator.get_elements(),function(value,key) {
41
+ if ($(value).hasClass('clicked')) {
42
+ svgid = $(value).attr('element-id');
43
+ }
44
+ });
45
+ return svgid;
46
+ }; //}}}
47
+ //{{{ Return the svgids for all marked tasks
48
+ this.marked = function(){
49
+ var svgid = [];
50
+ _.each(self.adaptor.illustrator.get_elements(),function(value,key) {
51
+ if ($(value).hasClass('marked')) {
52
+ svgid.push($(value).attr('element-id'));
53
+ }
54
+ });
55
+ return svgid;
56
+ }; //}}}
57
+ //{{{ Render the details from rng (right hand side of graph tab)
58
+ this.update_details = function(svgid){
59
+ var tab = $('#dat_details');
60
+ var node = self.adaptor.description.get_node_by_svg_id(svgid).get(0);
61
+ tab.empty();
62
+ if (self.adaptor.description.elements[$(node).attr('svg-subtype')]) {
63
+ save['details_target'] = { 'svgid': svgid, 'model': self.adaptor.description };
64
+ var rng = self.adaptor.description.elements[$(node).attr('svg-subtype')].clone();
65
+ if (save['endpoints_cache'][$(node).attr('endpoint')] && save['endpoints_cache'][$(node).attr('endpoint')].schema) {
66
+ var schema = save['endpoints_cache'][$(node).attr('endpoint')].schema.documentElement;
67
+ $(rng).find(' > element[name="parameters"] > element[name="arguments"]').replaceWith($(schema).clone());
68
+ }
69
+ save['details'] = new RelaxNGui(rng,tab,self.adaptor.description.context_eval,true);
70
+ save['details'].content(node);
71
+ format_visual_forms();
72
+ }
73
+ }; //}}}
74
+
75
+ function copyOrMove(menu,group,xml_node,mode) { //{{{
76
+ var markymark = self.marked();
77
+ var check1 = [];
78
+ var check2 = [];
79
+ $(markymark).each(function(key,svgid){
80
+ var node = self.adaptor.description.get_node_by_svg_id(svgid);
81
+ check1.push($(node).attr('svg-type'));
82
+ });
83
+ $(group).each(function(key,value){
84
+ check2.push(value.type);
85
+ });
86
+
87
+ if (markymark.length > 0 && _.uniq(check1).length == _.intersection(check1,check2).length) {
88
+ var nodes = [];
89
+ $(markymark).each(function(key,svgid){
90
+ var node = self.adaptor.description.get_node_by_svg_id(svgid);
91
+ nodes.unshift(node);
92
+ });
93
+
94
+ var iconm = self.resources['arrow'].clone();
95
+ var iconc = self.resources['arrow'].clone();
96
+ iconm.children('.rfill').addClass('menu');
97
+ menu.push(
98
+ {
99
+ 'label': '<em>Move Marked Elements</em>',
100
+ 'function_call': mode,
101
+ 'menu_icon': iconm,
102
+ 'type': undefined,
103
+ 'params': [nodes, xml_node]
104
+ },
105
+ {
106
+ 'label': '<em>Copy Marked Elements</em>',
107
+ 'function_call': mode,
108
+ 'menu_icon': iconc,
109
+ 'type': undefined,
110
+ 'params': [nodes, xml_node, 'clone']
111
+ }
112
+ );
113
+ }
114
+ } //}}}
115
+
116
+ // Events
117
+ this.events.mousedown = function(svgid, e, child, sibling) { // {{{
118
+ if(e.button == 0) { // left-click
119
+ } else if(e.button == 1) { // middle-click
120
+ } else if(e.button == 2) { // right-click
121
+ if (save['state'] != "ready" && save['state'] != "stopped") { return false; }
122
+
123
+ var xml_node = self.adaptor.description.get_node_by_svg_id(svgid);
124
+ var group = null;
125
+ var menu = {};
126
+
127
+ if (child) {
128
+ group = self.elements[xml_node.get(0).tagName].permissible_children(xml_node,'into');
129
+ if(group.length > 0) {
130
+ menu['Insert into'] = group;
131
+ copyOrMove(menu['Insert into'],group,xml_node,self.adaptor.description.insert_first_into);
132
+ }
133
+ }
134
+ if (sibling) {
135
+ group = self.elements[xml_node.parent().get(0).tagName].permissible_children(xml_node,'after');
136
+ if(group.length > 0) {
137
+ menu['Insert after'] = group;
138
+ copyOrMove(menu['Insert after'],group,xml_node,self.adaptor.description.insert_after);
139
+ }
140
+ }
141
+
142
+ if(xml_node.get(0).tagName != 'description' && !self.elements[xml_node.get(0).tagName].neverdelete) {
143
+ var icon = self.elements[xml_node.get(0).tagName].illustrator.svg.clone();
144
+ icon.children('.rfill').addClass('menu');
145
+ menu['Delete'] = [{
146
+ 'label': 'Remove Element',
147
+ 'function_call': self.adaptor.description.remove,
148
+ 'menu_icon': icon,
149
+ 'type': undefined,
150
+ 'params': [null, xml_node]
151
+ }];
152
+ }
153
+ if($('> finalize, > update', xml_node).length > 0 && xml_node.get(0).tagName == 'call') {
154
+ var icon = self.elements.callmanipulate.illustrator.svg.clone();
155
+ icon.children('.rfill:last').addClass('menu');
156
+ menu['Delete'].push({
157
+ 'label': 'Remove Scripts',
158
+ 'function_call': self.adaptor.description.remove,
159
+ 'menu_icon': icon,
160
+ 'type': undefined,
161
+ 'params': ['> finalize, > update', xml_node]
162
+ });
163
+ }
164
+ if (xml_node.get(0).tagName == "call" || xml_node.get(0).tagName == "manipulate") {
165
+ var icon = self.elements.call.illustrator.svg.clone();
166
+ icon.children('g.replace').addClass('active');
167
+ var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
168
+ if (vtarget.length > 0) {
169
+ if (vtarget.parents('g.activities.passive, g.activities.active').length > 0) {
170
+ menu['Position'] = [{
171
+ 'label': 'No Execution from here',
172
+ 'function_call': del_ui_pos,
173
+ 'menu_icon': icon,
174
+ 'type': undefined,
175
+ 'params': xml_node
176
+ }];
177
+ } else {
178
+ menu['Position'] = [{
179
+ 'label': 'Execute from here',
180
+ 'function_call': add_ui_pos,
181
+ 'menu_icon': icon,
182
+ 'type': undefined,
183
+ 'params': xml_node
184
+ }];
185
+ }
186
+ }
187
+ }
188
+ new CustomMenu(e).contextmenu(menu);
189
+ }
190
+ return false;
191
+ } // }}}
192
+ this.events.click = function(svgid, e) { // {{{
193
+ if (self.adaptor.description.get_node_by_svg_id(svgid).length == 0) {
194
+ return;
195
+ }
196
+
197
+ self.adaptor.illustrator.get_elements().removeClass('clicked');
198
+
199
+ if (e && e.ctrlKey) {
200
+ if (save['state'] != "ready" && save['state'] != "stopped") { return false; }
201
+ var tab = $('#dat_details');
202
+ tab.empty();
203
+ var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
204
+ if (vtarget.length > 0) {
205
+ vtarget.parents('g.element[element-id]').toggleClass('marked');
206
+ }
207
+ } else {
208
+ self.adaptor.illustrator.get_elements().removeClass('marked');
209
+
210
+ var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
211
+ if (vtarget.length > 0) {
212
+ vtarget.parents('g.element[element-id]').addClass('clicked');
213
+ }
214
+
215
+ self.update_details(svgid);
216
+ }
217
+ } // }}}
218
+ this.events.dblclick = function(svgid, e) { // {{{
219
+ } // }}}
220
+ this.events.mouseover = function(svgid, e) { // {{{
221
+ $('.tile[element-id = "' + svgid + '"]').css('display','block');
222
+ return false;
223
+ } // }}}
224
+ this.events.mouseout = function(svgid, e) { // {{{
225
+ $('.tile[element-id = "' + svgid + '"]').css('display','none');
226
+ return false;
227
+ } // }}}
228
+ this.events.dragstart = function (svgid, e) { //{{{
229
+ } //}}}
230
+
231
+ // other resources
232
+ this.resources.arrow = self.adaptor.theme_dir + 'symbols/arrow.svg';
233
+
234
+ // Primitive Elements
235
+ this.elements.call = { /*{{{*/
236
+ 'type': 'primitive',
237
+ 'illustrator': {//{{{
238
+ 'endnodes': 'this',
239
+ 'label': function(node){
240
+ var lid = $(node).attr('id');
241
+ var lnd = $(node).attr('endpoint');
242
+ return lid + ': ' + lnd + '\n' + $('> label',$(node).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,'');
243
+ },
244
+ 'info': function(node){ return { 'element-endpoint': $(node).attr('endpoint') }; },
245
+ 'resolve_symbol': function(node) {
246
+ if($('finalize,update', node).length > 0) {
247
+ return 'callmanipulate';
248
+ } else {
249
+ return 'call';
250
+ }
251
+ },
252
+ 'svg': self.adaptor.theme_dir + 'symbols/call.svg'
253
+ },//}}}
254
+ 'description': self.adaptor.theme_dir + 'rngs/call.rng',
255
+ 'permissible_children': function(node,mode) { //{{{
256
+ if(node.children('finalize,update').length < 1)
257
+ return [
258
+ {'label': 'Scripts',
259
+ 'function_call': self.adaptor.description.insert_last_into,
260
+ 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
261
+ 'type': undefined,
262
+ 'params': [self.adaptor.description.elements.scripts, node]}
263
+ ];
264
+ return [];
265
+ }, //}}}
266
+ 'adaptor': {//{{{
267
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
268
+ 'click': self.events.click,
269
+ 'dragstart': self.events.dragstart,
270
+ }//}}}
271
+ }; /*}}}*/
272
+ this.elements.manipulate = { /*{{{*/
273
+ 'type': 'primitive',
274
+ 'illustrator': {//{{{
275
+ 'endnodes': 'this',
276
+ 'label': function(node){
277
+ var lid = $(node).attr('id');
278
+ var lab = $(node).attr('label');
279
+ if (lab) {
280
+ return lid + '\n' + lab.replace(/^['"]/,'').replace(/['"]$/,'');
281
+ } else {
282
+ return "";
283
+ }
284
+ },
285
+ 'svg': self.adaptor.theme_dir + 'symbols/manipulate.svg'
286
+ },//}}}
287
+ 'description': self.adaptor.theme_dir + 'rngs/manipulate.rng',
288
+ 'permissible_children': function(node,mode) { //{{{
289
+ return [];
290
+ }, //}}}
291
+ 'adaptor': {//{{{
292
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,false,true); },
293
+ 'click': self.events.click,
294
+ }//}}}
295
+ }; /*}}}*/
296
+ this.elements.escape = { /*{{{*/
297
+ 'type': 'primitive',
298
+ 'illustrator': {//{{{
299
+ 'endnodes': 'this',
300
+ 'svg': self.adaptor.theme_dir + 'symbols/escape.svg'
301
+ },//}}}
302
+ 'description': self.adaptor.theme_dir + 'rngs/escape.rng',
303
+ 'permissible_children': function(node,mode) { //{{{
304
+ return [];
305
+ }, //}}}
306
+ 'adaptor': {//{{{
307
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,false,true); },
308
+ 'click': self.events.click,
309
+ }//}}}
310
+ }; /*}}}*/
311
+ this.elements.stop = { /*{{{*/
312
+ 'type': 'primitive',
313
+ 'illustrator': {//{{{
314
+ 'endnodes': 'this',
315
+ 'svg': self.adaptor.theme_dir + 'symbols/stop.svg'
316
+ },//}}}
317
+ 'description': self.adaptor.theme_dir + 'rngs/stop.rng',
318
+ 'permissible_children': function(node,mode) { //{{{
319
+ return [];
320
+ }, //}}}
321
+ 'adaptor': {//{{{
322
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,false,true); },
323
+ 'click': self.events.click,
324
+ }//}}}
325
+ }; /*}}}*/
326
+ this.elements.terminate = { /*{{{*/
327
+ 'type': 'primitive',
328
+ 'illustrator': {//{{{
329
+ 'endnodes': 'this',
330
+ 'final': true,
331
+ 'svg': self.adaptor.theme_dir + 'symbols/terminate.svg'
332
+ },//}}}
333
+ 'description': self.adaptor.theme_dir + 'rngs/terminate.rng',
334
+ 'permissible_children': function(node,mode) { //{{{
335
+ return [];
336
+ }, //}}}
337
+ 'adaptor': {//{{{
338
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,false,true); },
339
+ 'click': self.events.click,
340
+ }//}}}
341
+ }; /*}}}*/
342
+
343
+ // Complex Elements
344
+ this.elements.choose = { /*{{{*/
345
+ 'type': 'complex',
346
+ 'illustrator': {//{{{
347
+ 'label': function(node){return $(node).attr('mode') == 'exclusive' ? 'exclusive' : 'inclusive' },
348
+ 'endnodes': 'aggregate',
349
+ 'closeblock': false,
350
+ 'expansion': function(node) {
351
+ return 'horizontal';
352
+ },
353
+ 'resolve_symbol': function(node) {
354
+ if($(node).attr('mode') == 'exclusive') {
355
+ return 'choose_exclusive';
356
+ } else {
357
+ return 'choose_inclusive';
358
+ }
359
+ },
360
+ 'col_shift': function(node) {
361
+ return false;
362
+ },
363
+ 'svg': self.adaptor.theme_dir + 'symbols/choose.svg'
364
+ },//}}}
365
+ 'description': self.adaptor.theme_dir + 'rngs/choose.rng',
366
+ 'permissible_children': function(node,mode) { //{{{
367
+ var func = null;
368
+ if (mode == 'into') { func = self.adaptor.description.insert_first_into }
369
+ else { func = self.adaptor.description.insert_after }
370
+ if(node.children('parallel_branch').length > 0) {
371
+ return [{'label': 'Parallel Branch',
372
+ 'function_call': func,
373
+ 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
374
+ 'type': 'parallel_branch',
375
+ 'params': [self.adaptor.description.elements.parallel_branch, node]}];
376
+ }
377
+ var childs = [{'label': 'Alternative',
378
+ 'function_call': func,
379
+ 'menu_icon': self.elements.alternative.illustrator.svg.clone(),
380
+ 'type': 'alternative',
381
+ 'params': [self.adaptor.description.elements.alternative, node]}];
382
+ if((node.children('otherwise').length == 0) && node.parents('parallel').length == node.parents('parallel_branch').length)
383
+ childs.push({'label': 'Otherwise',
384
+ 'function_call': self.adaptor.description.insert_last_into,
385
+ 'menu_icon': self.elements.otherwise.illustrator.svg.clone(),
386
+ 'type': 'otherwise',
387
+ 'params': [self.adaptor.description.elements.otherwise, node]});
388
+ if(node.parents('parallel').length > node.parents('parallel_branch').length)
389
+ childs.push({'label': 'Parallel Branch',
390
+ 'function_call': func,
391
+ 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
392
+ 'type': 'parallel_branch',
393
+ 'params': [self.adaptor.description.elements.parallel_branch, node]});
394
+ return childs;
395
+ }, //}}}
396
+ 'adaptor': {//{{{
397
+ 'mousedown': function (node,e) {
398
+ self.events.mousedown(node,e,true,true);
399
+ },
400
+ 'click': self.events.click,
401
+ 'dblclick': self.events.dblclick,
402
+ 'mouseover': self.events.mouseover,
403
+ 'mouseout': self.events.mouseout,
404
+ }//}}}
405
+ }; /*}}}*/
406
+ this.elements.otherwise = { /*{{{*/
407
+ 'type': 'complex',
408
+ 'illustrator': {//{{{
409
+ 'endnodes': 'passthrough',
410
+ 'closeblock': false,
411
+ 'expansion': function(node) {
412
+ return 'vertical';
413
+ },
414
+ 'col_shift': function(node) {
415
+ return false;
416
+ },
417
+ 'svg': self.adaptor.theme_dir + 'symbols/otherwise.svg'
418
+ },//}}}
419
+ 'description': self.adaptor.theme_dir + 'rngs/otherwise.rng',
420
+ 'neverdelete': true,
421
+ 'permissible_children': function(node,mode) { //{{{
422
+ var func = null;
423
+ var childs = null;
424
+ if (mode == 'into') { func = self.adaptor.description.insert_first_into }
425
+ else { func = self.adaptor.description.insert_after }
426
+ return [
427
+ {'label': 'Service Call with Scripts',
428
+ 'function_call': func,
429
+ 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
430
+ 'type': 'callmanipulate',
431
+ 'params': [self.adaptor.description.elements.callmanipulate, node]},
432
+ {'label': 'Service Call',
433
+ 'function_call': func,
434
+ 'menu_icon': self.elements.call.illustrator.svg.clone(),
435
+ 'type': 'call',
436
+ 'params': [self.adaptor.description.elements.call, node]},
437
+ {'label': 'Script',
438
+ 'function_call': func,
439
+ 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
440
+ 'type': 'manipulate',
441
+ 'params': [self.adaptor.description.elements.manipulate, node]},
442
+ {'label': 'Parallel',
443
+ 'function_call': func,
444
+ 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
445
+ 'type': 'parallel',
446
+ 'params': [self.adaptor.description.elements.parallel, node]},
447
+ {'label': 'Decision',
448
+ 'function_call': func,
449
+ 'menu_icon': self.elements.choose.illustrator.svg.clone(),
450
+ 'type': 'choose',
451
+ 'params': [self.adaptor.description.elements.choose, node]},
452
+ {'label': 'Loop',
453
+ 'function_call': func,
454
+ 'menu_icon': self.elements.loop.illustrator.svg.clone(),
455
+ 'type': 'loop',
456
+ 'params': [self.adaptor.description.elements.loop, node]},
457
+ {'label': 'Terminate',
458
+ 'function_call': func,
459
+ 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
460
+ 'type': 'terminate',
461
+ 'params': [self.adaptor.description.elements.terminate, node]},
462
+ {'label': 'Stop',
463
+ 'function_call': func,
464
+ 'menu_icon': self.elements.stop.illustrator.svg.clone(),
465
+ 'type': 'stop',
466
+ 'params': [self.adaptor.description.elements.stop, node]},
467
+ {'label': 'Critical',
468
+ 'function_call': func,
469
+ 'menu_icon': self.elements.critical.illustrator.svg.clone(),
470
+ 'type': 'critical',
471
+ 'params': [self.adaptor.description.elements.critical, node]}
472
+ ];
473
+ }, //}}}
474
+ 'adaptor': {//{{{
475
+ 'mousedown': function (node,e) {
476
+ self.events.mousedown(node,e,true,false);
477
+ },
478
+ 'click': self.events.click,
479
+ 'dblclick': self.events.dblclick,
480
+ 'mouseover': self.events.mouseover,
481
+ 'mouseout': self.events.mouseout,
482
+ }//}}}
483
+ }; /*}}}*/
484
+ this.elements.alternative = { /*{{{*/
485
+ 'type': 'complex',
486
+ 'illustrator': {//{{{
487
+ 'label': function(node){return $(node).attr('condition')},
488
+ 'endnodes': 'passthrough',
489
+ 'closeblock':false,
490
+ 'expansion': function(node) {
491
+ return 'vertical';
492
+ },
493
+ 'col_shift': function(node) {
494
+ return false;
495
+ },
496
+ 'svg': self.adaptor.theme_dir + 'symbols/alternative.svg'
497
+ },//}}}
498
+ 'description': self.adaptor.theme_dir + 'rngs/alternative.rng',
499
+ 'permissible_children': function(node,mode) { //{{{
500
+ if (mode == 'into') { func = self.adaptor.description.insert_first_into }
501
+ else { func = self.adaptor.description.insert_after }
502
+ if(node.parents('parallel').length > node.parents('parallel_branch').length && node.get(0).tagName == 'alternative') {
503
+ return [{'label': 'Parallel Branch',
504
+ 'function_call': func,
505
+ 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
506
+ 'type': 'parallel_branch',
507
+ 'params': [self.adaptor.description.elements.parallel_branch, node]}];
508
+ }
509
+ return [
510
+ {'label': 'Service Call with Scripts',
511
+ 'function_call': func,
512
+ 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
513
+ 'type': 'callmanipulate',
514
+ 'params': [self.adaptor.description.elements.callmanipulate, node]},
515
+ {'label': 'Service Call',
516
+ 'function_call': func,
517
+ 'menu_icon': self.elements.call.illustrator.svg.clone(),
518
+ 'type': 'call',
519
+ 'params': [self.adaptor.description.elements.call, node]},
520
+ {'label': 'Script',
521
+ 'function_call': func,
522
+ 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
523
+ 'type': 'manipulate',
524
+ 'params': [self.adaptor.description.elements.manipulate, node]},
525
+ {'label': 'Parallel',
526
+ 'function_call': func,
527
+ 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
528
+ 'type': 'parallel',
529
+ 'params': [self.adaptor.description.elements.parallel, node]},
530
+ {'label': 'Decision',
531
+ 'function_call': func,
532
+ 'menu_icon': self.elements.choose.illustrator.svg.clone(),
533
+ 'type': 'choose',
534
+ 'params': [self.adaptor.description.elements.choose, node]},
535
+ {'label': 'Loop',
536
+ 'function_call': func,
537
+ 'menu_icon': self.elements.loop.illustrator.svg.clone(),
538
+ 'type': 'loop',
539
+ 'params': [self.adaptor.description.elements.loop, node]},
540
+ {'label': 'Terminate',
541
+ 'function_call': func,
542
+ 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
543
+ 'type': 'terminate',
544
+ 'params': [self.adaptor.description.elements.terminate, node]},
545
+ {'label': 'Stop',
546
+ 'function_call': func,
547
+ 'menu_icon': self.elements.stop.illustrator.svg.clone(),
548
+ 'type': 'stop',
549
+ 'params': [self.adaptor.description.elements.stop, node]},
550
+ {'label': 'Critical',
551
+ 'function_call': func,
552
+ 'menu_icon': self.elements.critical.illustrator.svg.clone(),
553
+ 'type': 'critical',
554
+ 'params': [self.adaptor.description.elements.critical, node]}
555
+ ];
556
+ }, //}}}
557
+ 'adaptor': {//{{{
558
+ 'mousedown': function (node,e) {
559
+ self.events.mousedown(node,e,true,false);
560
+ },
561
+ 'click': self.events.click,
562
+ 'dblclick': self.events.dblclick,
563
+ 'mouseover': self.events.mouseover,
564
+ 'mouseout': self.events.mouseout,
565
+ }//}}}
566
+ }; /*}}}*/
567
+ this.elements.loop = { /*{{{*/
568
+ 'type': 'complex',
569
+ 'illustrator': {//{{{
570
+ 'label': function(node){return $(node).attr('condition') + ($(node).attr('mode') == 'pre_test' ? ' (⭱)' : ' (⭳)') },
571
+ 'endnodes': 'this',
572
+ 'closeblock': true,
573
+ 'expansion': function(node) {
574
+ return 'vertical';
575
+ },
576
+ 'col_shift': function(node) {
577
+ return true;
578
+ },
579
+ 'svg': self.adaptor.theme_dir + 'symbols/loop.svg'
580
+ },// }}}
581
+ 'description': self.adaptor.theme_dir + 'rngs/loop.rng',
582
+ 'permissible_children': function(node,mode) { //{{{
583
+ var func = null;
584
+ if (mode == 'into') { func = self.adaptor.description.insert_first_into }
585
+ else { func = self.adaptor.description.insert_after }
586
+ var childs = [
587
+ {'label': 'Service Call with Scripts',
588
+ 'function_call': func,
589
+ 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
590
+ 'type': 'callmanipulate',
591
+ 'params': [self.adaptor.description.elements.callmanipulate, node]},
592
+ {'label': 'Service Call',
593
+ 'function_call': func,
594
+ 'menu_icon': self.elements.call.illustrator.svg.clone(),
595
+ 'type': 'call',
596
+ 'params': [self.adaptor.description.elements.call, node]},
597
+ {'label': 'Manipulate',
598
+ 'function_call': func,
599
+ 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
600
+ 'type': 'manipulate',
601
+ 'params': [self.adaptor.description.elements.manipulate, node]},
602
+ {'label': 'Decision',
603
+ 'function_call': func,
604
+ 'menu_icon': self.elements.choose.illustrator.svg.clone(),
605
+ 'type': 'choose',
606
+ 'params': [self.adaptor.description.elements.choose, node]},
607
+ {'label': 'Loop',
608
+ 'function_call': func,
609
+ 'menu_icon': self.elements.loop.illustrator.svg.clone(),
610
+ 'type': 'loop',
611
+ 'params': [self.adaptor.description.elements.loop, node]},
612
+ {'label': 'Terminate',
613
+ 'function_call': func,
614
+ 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
615
+ 'type': 'terminate',
616
+ 'params': [self.adaptor.description.elements.terminate, node]},
617
+ {'label': 'Stop',
618
+ 'function_call': func,
619
+ 'menu_icon': self.elements.stop.illustrator.svg.clone(),
620
+ 'type': 'stop',
621
+ 'params': [self.adaptor.description.elements.stop, node]},
622
+ {'label': 'Critical',
623
+ 'function_call': func,
624
+ 'menu_icon': self.elements.critical.illustrator.svg.clone(),
625
+ 'type': 'critical',
626
+ 'params': [self.adaptor.description.elements.critical, node]}
627
+ ];
628
+ if(node.parent('parallel').length > node.parent('parallel_branch').length) {
629
+ childs.push({'label': 'Parallel Branch',
630
+ 'function_call': func,
631
+ 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
632
+ 'type': 'parallel_branch',
633
+ 'params': [self.adaptor.description.elements.parallel_branch, node]}
634
+ );
635
+ } else {
636
+ childs.push({'label': 'Parallel',
637
+ 'function_call': func,
638
+ 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
639
+ 'type': 'parallel',
640
+ 'params': [self.adaptor.description.elements.parallel, node]}
641
+ );
642
+ }
643
+ return childs;
644
+ }, //}}}
645
+ 'adaptor': {//{{{
646
+ 'mousedown': function (node,e) {
647
+ self.events.mousedown(node,e,true,true);
648
+ },
649
+ 'click': self.events.click,
650
+ 'dblclick': self.events.dblclick,
651
+ 'mouseover': self.events.mouseover,
652
+ 'mouseout': self.events.mouseout,
653
+ }//}}}
654
+ }; /*}}}*/
655
+ this.elements.parallel = { /*{{{*/
656
+ 'type': 'complex',
657
+ 'illustrator': {//{{{
658
+ 'endnodes': 'this',
659
+ 'closeblock': false,
660
+ 'border': true,
661
+ 'expansion': function(node) {
662
+ // check if any sibling other than 'parallel_branch' is present
663
+ if($(node).children(':not(parallel_branch)').length > 0) return 'vertical';
664
+ return 'horizontal';
665
+ },
666
+ 'col_shift': function(node) {
667
+ return true;
668
+ },
669
+ 'svg': self.adaptor.theme_dir + 'symbols/parallel.svg'
670
+ },//}}}
671
+ 'description': self.adaptor.theme_dir + 'rngs/parallel.rng',
672
+ 'permissible_children': function(node,mode) { //{{{
673
+ var childs = [
674
+ {'label': 'Service Call with Scripts',
675
+ 'function_call': self.adaptor.description.insert_last_into,
676
+ 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
677
+ 'type': 'callmanipulate',
678
+ 'params': [self.adaptor.description.elements.callmanipulate, node]},
679
+ {'label': 'Service Call',
680
+ 'function_call': self.adaptor.description.insert_last_into,
681
+ 'menu_icon': self.elements.call.illustrator.svg.clone(),
682
+ 'type': 'call',
683
+ 'params': [self.adaptor.description.elements.call, node]},
684
+ {'label': 'Manipulate',
685
+ 'function_call': self.adaptor.description.insert_last_into,
686
+ 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
687
+ 'type': 'manipulate',
688
+ 'params': [self.adaptor.description.elements.manipulate, node]},
689
+ {'label': 'Decision',
690
+ 'function_call': self.adaptor.description.insert_last_into,
691
+ 'menu_icon': self.elements.choose.illustrator.svg.clone(),
692
+ 'type': 'choose',
693
+ 'params': [self.adaptor.description.elements.choose, node]},
694
+ {'label': 'Loop',
695
+ 'function_call': self.adaptor.description.insert_last_into,
696
+ 'menu_icon': self.elements.loop.illustrator.svg.clone(),
697
+ 'type': 'loop',
698
+ 'params': [self.adaptor.description.elements.loop, node]},
699
+ {'label': 'Terminate',
700
+ 'function_call': self.adaptor.description.insert_last_into,
701
+ 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
702
+ 'type': 'terminate',
703
+ 'params': [self.adaptor.description.elements.terminate, node]},
704
+ {'label': 'Stop',
705
+ 'function_call': self.adaptor.description.insert_last_into,
706
+ 'menu_icon': self.elements.stop.illustrator.svg.clone(),
707
+ 'type': 'stop',
708
+ 'params': [self.adaptor.description.elements.stop, node]},
709
+ {'label': 'Critical',
710
+ 'function_call': self.adaptor.description.insert_last_into,
711
+ 'menu_icon': self.elements.critical.illustrator.svg.clone(),
712
+ 'type': 'critical',
713
+ 'params': [self.adaptor.description.elements.critical, node]},
714
+ {'label': 'Parallel Branch',
715
+ 'function_call': self.adaptor.description.insert_last_into,
716
+ 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
717
+ 'type': 'parallel_branch',
718
+ 'params': [self.adaptor.description.elements.parallel_branch, node]}
719
+ ];
720
+ if(node.get(0).tagName != 'parallel')
721
+ childs.push({'label': 'Parallel',
722
+ 'function_call': self.adaptor.description.insert_last_into,
723
+ 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
724
+ 'type': 'parallel',
725
+ 'params': [self.adaptor.description.elements.parallel, node]});
726
+ return childs;
727
+ }, //}}}
728
+ 'adaptor': {//{{{
729
+ 'mousedown': function (node,e) {
730
+ self.events.mousedown(node,e,true,true);
731
+ },
732
+ 'click': self.events.click,
733
+ 'dblclick': self.events.dblclick,
734
+ 'mouseover': self.events.mouseover,
735
+ 'mouseout': self.events.mouseout,
736
+ }//}}}
737
+ }; /*}}}*/
738
+ this.elements.parallel_branch = { /*{{{*/
739
+ 'type': 'complex',
740
+ 'illustrator': {//{{{
741
+ 'endnodes': 'this',
742
+ 'closeblock': false,
743
+ 'expansion': function(node) {
744
+ return 'vertical';
745
+ },
746
+ 'col_shift': function(node) {
747
+ if(node.parentNode.tagName == 'choose') return false;
748
+ if($(node).parents('parallel').first().children(':not(parallel_branch)').length > 0) return true;
749
+ return false;
750
+ },
751
+ 'svg': self.adaptor.theme_dir + 'symbols/parallel_branch.svg'
752
+ },//}}}
753
+ 'description': self.adaptor.theme_dir + 'rngs/parallel_branch.rng',
754
+ 'permissible_children': function(node,mode) { //{{{
755
+ var func = null;
756
+ var childs = null;
757
+ if (mode == 'into') { func = self.adaptor.description.insert_first_into }
758
+ else { func = self.adaptor.description.insert_after }
759
+ childs = [
760
+ {'label': 'Service Call with Scripts',
761
+ 'function_call': func,
762
+ 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
763
+ 'type': 'callmanipulate',
764
+ 'params': [self.adaptor.description.elements.callmanipulate, node]},
765
+ {'label': 'Service Call',
766
+ 'function_call': func,
767
+ 'menu_icon': self.elements.call.illustrator.svg.clone(),
768
+ 'type': 'call',
769
+ 'params': [self.adaptor.description.elements.call, node]},
770
+ {'label': 'Script',
771
+ 'function_call': func,
772
+ 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
773
+ 'type': 'manipulate',
774
+ 'params': [self.adaptor.description.elements.manipulate, node]},
775
+ {'label': 'Parallel',
776
+ 'function_call': func,
777
+ 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
778
+ 'type': 'parallel',
779
+ 'params': [self.adaptor.description.elements.parallel, node]},
780
+ {'label': 'Decision',
781
+ 'function_call': func,
782
+ 'menu_icon': self.elements.choose.illustrator.svg.clone(),
783
+ 'type': 'choose',
784
+ 'params': [self.adaptor.description.elements.choose, node]},
785
+ {'label': 'Loop',
786
+ 'function_call': func,
787
+ 'menu_icon': self.elements.loop.illustrator.svg.clone(),
788
+ 'type': 'loop',
789
+ 'params': [self.adaptor.description.elements.loop, node]},
790
+ {'label': 'Terminate',
791
+ 'function_call': func,
792
+ 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
793
+ 'type': 'terminate',
794
+ 'params': [self.adaptor.description.elements.terminate, node]},
795
+ {'label': 'Stop',
796
+ 'function_call': func,
797
+ 'menu_icon': self.elements.stop.illustrator.svg.clone(),
798
+ 'type': 'stop',
799
+ 'params': [self.adaptor.description.elements.stop, node]},
800
+ {'label': 'Critical',
801
+ 'function_call': func,
802
+ 'menu_icon': self.elements.critical.illustrator.svg.clone(),
803
+ 'type': 'critical',
804
+ 'params': [self.adaptor.description.elements.critical, node]},
805
+ ];
806
+ if(node.parents('choose').length > node.parents('alternative, otherwise').length && node.get(0).tagName == 'parallel_branch') {
807
+ return [{'label': 'Alternative',
808
+ 'function_call': func,
809
+ 'menu_icon': self.elements.alternative.illustrator.svg.clone(),
810
+ 'type': 'alternative',
811
+ 'params': [self.adaptor.description.elements.alternative, node]}];
812
+ }
813
+ return childs;
814
+ }, //}}}
815
+ 'adaptor': {//{{{
816
+ 'mousedown': function (node,e) {
817
+ self.events.mousedown(node,e,true,false);
818
+ },
819
+ 'click': self.events.click,
820
+ 'dblclick': self.events.dblclick,
821
+ 'mouseover': self.events.mouseover,
822
+ 'mouseout': self.events.mouseout,
823
+ }//}}}
824
+ }; /*}}}*/
825
+ this.elements.critical = { /*{{{*/
826
+ 'type': 'complex',
827
+ 'illustrator': {//{{{
828
+ 'endnodes': 'aggregate',
829
+ 'closeblock': false,
830
+ 'border': true,
831
+ 'expansion': function(node) {
832
+ return 'vertical';
833
+ },
834
+ 'col_shift': function(node) {
835
+ return true;
836
+ },
837
+ 'svg': self.adaptor.theme_dir + 'symbols/critical.svg'
838
+ },//}}}
839
+ 'description': self.adaptor.theme_dir + 'rngs/critical.rng',
840
+ 'permissible_children': function(node,mode) { //{{{
841
+ var func = null;
842
+ if (mode == 'into') { func = self.adaptor.description.insert_first_into }
843
+ else { func = self.adaptor.description.insert_after }
844
+ return [
845
+ {'label': 'Service Call with Scripts',
846
+ 'function_call': func,
847
+ 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
848
+ 'type': 'callmanipulate',
849
+ 'params': [self.adaptor.description.elements.callmanipulate, node]},
850
+ {'label': 'Service Call',
851
+ 'function_call': func,
852
+ 'menu_icon': self.elements.call.illustrator.svg.clone(),
853
+ 'type': 'call',
854
+ 'params': [self.adaptor.description.elements.call, node]},
855
+ {'label': 'Script',
856
+ 'function_call': func,
857
+ 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
858
+ 'type': 'manipulate',
859
+ 'params': [self.adaptor.description.elements.manipulate, node]},
860
+ {'label': 'Parallel',
861
+ 'function_call': func,
862
+ 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
863
+ 'type': 'parallel',
864
+ 'params': [self.adaptor.description.elements.parallel, node]},
865
+ {'label': 'Decision',
866
+ 'function_call': func,
867
+ 'menu_icon': self.elements.choose.illustrator.svg.clone(),
868
+ 'type': 'choose',
869
+ 'params': [self.adaptor.description.elements.choose, node]},
870
+ {'label': 'Loop',
871
+ 'function_call': func,
872
+ 'menu_icon': self.elements.loop.illustrator.svg.clone(),
873
+ 'type': 'loop',
874
+ 'params': [self.adaptor.description.elements.loop, node]},
875
+ {'label': 'Terminate',
876
+ 'function_call': func,
877
+ 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
878
+ 'type': 'terminate',
879
+ 'params': [self.adaptor.description.elements.terminate, node]},
880
+ {'label': 'Stop',
881
+ 'function_call': func,
882
+ 'menu_icon': self.elements.stop.illustrator.svg.clone(),
883
+ 'type': 'stop',
884
+ 'params': [self.adaptor.description.elements.stop, node]},
885
+ {'label': 'Critical',
886
+ 'function_call': func,
887
+ 'menu_icon': self.elements.critical.illustrator.svg.clone(),
888
+ 'type': 'critical',
889
+ 'params': [self.adaptor.description.elements.critical, node]},
890
+ ];
891
+ }, //}}}
892
+ 'adaptor': {//{{{
893
+ 'mousedown': function (node,e) {
894
+ self.events.mousedown(node,e,true,true);
895
+ },
896
+ 'click': self.events.click,
897
+ 'dblclick': self.events.dblclick,
898
+ 'mouseover': self.events.mouseover,
899
+ 'mouseout': self.events.mouseout,
900
+ }//}}}
901
+ }; /*}}}*/
902
+ this.elements.group = { /*{{{*/
903
+ 'type': 'complex',
904
+ 'illustrator': {//{{{
905
+ 'endnodes': 'aggregate',
906
+ 'closeblock': false,
907
+ 'border': 'injectiongroup', // other value than true,false inidcates the used class for the svg-object
908
+ 'expansion': function(node) {
909
+ return 'vertical';
910
+ },
911
+ 'col_shift': function(node) {
912
+ return true;
913
+ },
914
+ 'svg': null
915
+ },//}}}
916
+ 'description': self.adaptor.theme_dir + 'rngs/group.rng',
917
+ 'permissible_children': function(node,mode) { //{{{
918
+ var func = null;
919
+ if (mode == 'into') { func = self.adaptor.description.insert_first_into }
920
+ else { func = self.adaptor.description.insert_after }
921
+ return [
922
+ ];
923
+ }, //}}}
924
+ 'adaptor': {//{{{
925
+ 'mousedown': function (node,e) {
926
+ self.events.mousedown(node,e,true,true);
927
+ },
928
+ 'click': self.events.click,
929
+ 'dblclick': self.events.dblclick,
930
+ 'mouseover': self.events.mouseover,
931
+ 'mouseout': self.events.mouseout,
932
+ }//}}}
933
+ }; /*}}}*/
934
+ this.elements.start = this.elements.description = { /*{{{*/
935
+ 'type': 'description',
936
+ 'illustrator': {//{{{
937
+ 'endnodes': 'passthrough',
938
+ 'closeblock': false,
939
+ 'expansion': function(node) {
940
+ return 'vertical';
941
+ },
942
+ 'col_shift': function(node) {
943
+ return true;
944
+ },
945
+ 'svg': self.adaptor.theme_dir + 'symbols/start.svg'
946
+ },//}}}
947
+ 'description': null,
948
+ 'permissible_children': function(node,mode) { //{{{
949
+ var func = null;
950
+ if (mode == 'into') { func = self.adaptor.description.insert_first_into }
951
+ else { func = self.adaptor.description.insert_after }
952
+ return [
953
+ {'label': 'Service Call with Scripts',
954
+ 'function_call': func,
955
+ 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
956
+ 'type': 'callmanipulate',
957
+ 'params': [self.adaptor.description.elements.callmanipulate, node]},
958
+ {'label': 'Service Call',
959
+ 'function_call': func,
960
+ 'menu_icon': self.elements.call.illustrator.svg.clone(),
961
+ 'type': 'call',
962
+ 'params': [self.adaptor.description.elements.call, node]},
963
+ {'label': 'Script Task',
964
+ 'function_call': func,
965
+ 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
966
+ 'type': 'manipulate',
967
+ 'params': [self.adaptor.description.elements.manipulate, node]},
968
+ {'label': 'Parallel',
969
+ 'function_call': func,
970
+ 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
971
+ 'type': 'parallel',
972
+ 'params': [self.adaptor.description.elements.parallel, node]},
973
+ {'label': 'Decision',
974
+ 'function_call': func,
975
+ 'menu_icon': self.elements.choose.illustrator.svg.clone(),
976
+ 'type': 'choose',
977
+ 'params': [self.adaptor.description.elements.choose, node]},
978
+ {'label': 'Loop',
979
+ 'function_call': func,
980
+ 'menu_icon': self.elements.loop.illustrator.svg.clone(),
981
+ 'type': 'loop',
982
+ 'params': [self.adaptor.description.elements.loop, node]},
983
+ {'label': 'Terminate',
984
+ 'function_call': func,
985
+ 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
986
+ 'type': 'terminate',
987
+ 'params': [self.adaptor.description.elements.terminate, node]},
988
+ {'label': 'Stop',
989
+ 'function_call': func,
990
+ 'menu_icon': self.elements.stop.illustrator.svg.clone(),
991
+ 'type': 'stop',
992
+ 'params': [self.adaptor.description.elements.stop, node]},
993
+ {'label': 'Critical',
994
+ 'function_call': func,
995
+ 'menu_icon': self.elements.critical.illustrator.svg.clone(),
996
+ 'type': 'critical',
997
+ 'params': [self.adaptor.description.elements.critical, node]}
998
+ ];
999
+ }, //}}}
1000
+ 'adaptor': {//{{{
1001
+ 'mousedown': function (node,e) {
1002
+ self.events.mousedown(node,e,true,false);
1003
+ },
1004
+ 'click': self.events.click,
1005
+ 'dblclick': self.events.dblclick,
1006
+ 'mouseover': self.events.mouseover,
1007
+ 'mouseout': self.events.mouseout,
1008
+ }//}}}
1009
+ }; /*}}}*/
1010
+
1011
+ // Abstract Elements
1012
+ // * they may only have an illustrator (or other parts)
1013
+ // * they HAVE TO have a parent
1014
+ this.elements.callmanipulate = { /*{{{*/
1015
+ 'type': 'abstract',
1016
+ 'parent': 'call',
1017
+ 'description': self.adaptor.theme_dir + 'rngs/callmanipulate.rng',
1018
+ 'illustrator': {//{{{
1019
+ 'label': function(node){return $('> label',$(node).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,'')},
1020
+ 'info': function(node){ return { 'element-endpoint': $(node).attr('endpoint') }; },
1021
+ 'svg': self.adaptor.theme_dir + 'symbols/callmanipulate.svg'
1022
+ },//}}}
1023
+ }; /*}}}*/
1024
+ this.elements.choose_inclusive = { /*{{{*/
1025
+ 'type': 'abstract',
1026
+ 'parent': 'choose',
1027
+ 'illustrator': {//{{{
1028
+ 'svg': self.adaptor.theme_dir + 'symbols/choose_inclusive.svg'
1029
+ },//}}}
1030
+ }; /*}}}*/
1031
+ this.elements.choose_exclusive = { /*{{{*/
1032
+ 'type': 'abstract',
1033
+ 'parent': 'choose',
1034
+ 'illustrator': {//{{{
1035
+ 'svg': self.adaptor.theme_dir + 'symbols/choose_exclusive.svg'
1036
+ },//}}}
1037
+ }; /*}}}*/
1038
+ this.elements.scripts = { /*{{{*/
1039
+ 'type': 'abstract',
1040
+ 'description': [self.adaptor.theme_dir + 'rngs/update.rng',self.adaptor.theme_dir + 'rngs/finalize.rng']
1041
+ }; /*}}}*/
1042
+ }