cpee 1.3.223 → 1.3.224

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/cockpit/css/ui.css +14 -14
  3. data/cockpit/css/wfadaptor.css +50 -0
  4. data/cockpit/graph.html +116 -0
  5. data/cockpit/index.html +41 -41
  6. data/cockpit/js/instance.js +15 -5
  7. data/cockpit/js/ui.js +5 -11
  8. data/cockpit/js/wfadaptor.js +20 -7
  9. data/cockpit/themes/{labels → compact}/theme.js +199 -48
  10. data/cockpit/themes/default/rngs/call.rng +26 -0
  11. data/cockpit/themes/default/rngs/callmanipulate.rng +29 -0
  12. data/cockpit/themes/default/rngs/manipulate.rng +3 -0
  13. data/cockpit/themes/default/symbols/alternative.svg +1 -1
  14. data/cockpit/themes/default/symbols/arrow.svg +3 -0
  15. data/cockpit/themes/default/symbols/call.svg +1 -1
  16. data/cockpit/themes/default/symbols/callcorrelationreceive.svg +1 -1
  17. data/cockpit/themes/default/symbols/callcorrelationsend.svg +2 -2
  18. data/cockpit/themes/default/symbols/callinstantiation.svg +1 -1
  19. data/cockpit/themes/default/symbols/callmanipulate.svg +1 -1
  20. data/cockpit/themes/default/symbols/callmanipulateworklist.svg +2 -2
  21. data/cockpit/themes/default/symbols/callworklist.svg +1 -1
  22. data/cockpit/themes/default/symbols/choose.svg +1 -1
  23. data/cockpit/themes/default/symbols/choose_exclusive.svg +1 -1
  24. data/cockpit/themes/default/symbols/choose_inclusive.svg +1 -1
  25. data/cockpit/themes/default/symbols/critical.svg +2 -2
  26. data/cockpit/themes/default/symbols/escape.svg +1 -1
  27. data/cockpit/themes/default/symbols/loop.svg +1 -1
  28. data/cockpit/themes/default/symbols/manipulate.svg +1 -1
  29. data/cockpit/themes/default/symbols/otherwise.svg +1 -1
  30. data/cockpit/themes/default/symbols/parallel.svg +1 -1
  31. data/cockpit/themes/default/symbols/parallel_branch.svg +1 -1
  32. data/cockpit/themes/default/symbols/scripts.svg +1 -1
  33. data/cockpit/themes/default/theme.js +198 -57
  34. data/cockpit/themes/lego/theme.js +459 -400
  35. data/cockpit/themes/promise/theme.js +459 -400
  36. data/cpee.gemspec +1 -1
  37. data/server/resources/transformation_dslx.xsl +98 -0
  38. metadata +5 -67
  39. data/cockpit/themes/adventure/rngs/alternative.rng +0 -5
  40. data/cockpit/themes/adventure/rngs/call.rng +0 -29
  41. data/cockpit/themes/adventure/rngs/callmanipulate.rng +0 -41
  42. data/cockpit/themes/adventure/rngs/choose.rng +0 -8
  43. data/cockpit/themes/adventure/rngs/critical.rng +0 -5
  44. data/cockpit/themes/adventure/rngs/escape.rng +0 -1
  45. data/cockpit/themes/adventure/rngs/finalize.rng +0 -6
  46. data/cockpit/themes/adventure/rngs/group.rng +0 -3
  47. data/cockpit/themes/adventure/rngs/loop.rng +0 -11
  48. data/cockpit/themes/adventure/rngs/manipulate.rng +0 -6
  49. data/cockpit/themes/adventure/rngs/otherwise.rng +0 -1
  50. data/cockpit/themes/adventure/rngs/parallel.rng +0 -5
  51. data/cockpit/themes/adventure/rngs/parallel_branch.rng +0 -8
  52. data/cockpit/themes/adventure/rngs/update.rng +0 -6
  53. data/cockpit/themes/adventure/symbols/alternative.svg +0 -4
  54. data/cockpit/themes/adventure/symbols/call.svg +0 -4
  55. data/cockpit/themes/adventure/symbols/callmanipulate.svg +0 -6
  56. data/cockpit/themes/adventure/symbols/choose.svg +0 -5
  57. data/cockpit/themes/adventure/symbols/choose_exclusive.svg +0 -5
  58. data/cockpit/themes/adventure/symbols/choose_inclusive.svg +0 -4
  59. data/cockpit/themes/adventure/symbols/critical.svg +0 -4
  60. data/cockpit/themes/adventure/symbols/escape.svg +0 -5
  61. data/cockpit/themes/adventure/symbols/loop.svg +0 -5
  62. data/cockpit/themes/adventure/symbols/manipulate.svg +0 -4
  63. data/cockpit/themes/adventure/symbols/otherwise.svg +0 -4
  64. data/cockpit/themes/adventure/symbols/parallel.svg +0 -5
  65. data/cockpit/themes/adventure/symbols/parallel_branch.svg +0 -4
  66. data/cockpit/themes/adventure/symbols/scripts.svg +0 -4
  67. data/cockpit/themes/adventure/symbols/start.svg +0 -3
  68. data/cockpit/themes/adventure/theme.js +0 -739
  69. data/cockpit/themes/labels/rngs/alternative.rng +0 -5
  70. data/cockpit/themes/labels/rngs/call.rng +0 -32
  71. data/cockpit/themes/labels/rngs/callmanipulate.rng +0 -47
  72. data/cockpit/themes/labels/rngs/choose.rng +0 -8
  73. data/cockpit/themes/labels/rngs/critical.rng +0 -5
  74. data/cockpit/themes/labels/rngs/escape.rng +0 -1
  75. data/cockpit/themes/labels/rngs/finalize.rng +0 -6
  76. data/cockpit/themes/labels/rngs/group.rng +0 -3
  77. data/cockpit/themes/labels/rngs/loop.rng +0 -11
  78. data/cockpit/themes/labels/rngs/manipulate.rng +0 -6
  79. data/cockpit/themes/labels/rngs/otherwise.rng +0 -1
  80. data/cockpit/themes/labels/rngs/parallel.rng +0 -5
  81. data/cockpit/themes/labels/rngs/parallel_branch.rng +0 -8
  82. data/cockpit/themes/labels/rngs/update.rng +0 -6
  83. data/cockpit/themes/labels/symbols/alternative.svg +0 -4
  84. data/cockpit/themes/labels/symbols/call.svg +0 -4
  85. data/cockpit/themes/labels/symbols/callcorrelationreceive.svg +0 -6
  86. data/cockpit/themes/labels/symbols/callcorrelationsend.svg +0 -6
  87. data/cockpit/themes/labels/symbols/callinstantiation.svg +0 -3
  88. data/cockpit/themes/labels/symbols/callmanipulate.svg +0 -6
  89. data/cockpit/themes/labels/symbols/callmanipulateworklist.svg +0 -6
  90. data/cockpit/themes/labels/symbols/callworklist.svg +0 -4
  91. data/cockpit/themes/labels/symbols/choose.svg +0 -5
  92. data/cockpit/themes/labels/symbols/choose_exclusive.svg +0 -5
  93. data/cockpit/themes/labels/symbols/choose_inclusive.svg +0 -4
  94. data/cockpit/themes/labels/symbols/critical.svg +0 -4
  95. data/cockpit/themes/labels/symbols/escape.svg +0 -5
  96. data/cockpit/themes/labels/symbols/loop.svg +0 -5
  97. data/cockpit/themes/labels/symbols/manipulate.svg +0 -4
  98. data/cockpit/themes/labels/symbols/otherwise.svg +0 -4
  99. data/cockpit/themes/labels/symbols/parallel.svg +0 -5
  100. data/cockpit/themes/labels/symbols/parallel_branch.svg +0 -4
  101. data/cockpit/themes/labels/symbols/scripts.svg +0 -4
  102. data/cockpit/themes/labels/symbols/start.svg +0 -3
@@ -1,84 +1,106 @@
1
1
  function WFAdaptorManifestation(adaptor) {
2
+ var self = this;
3
+
2
4
  this.adaptor = adaptor;
3
- this.elements = elements = {};
4
- this.events = events = {};
5
+ this.elements = {};
6
+ this.events = {};
7
+ this.compact = false;
5
8
 
6
- this.noarrow = noarrow = ['alternative', 'otherwise'];
7
- this.description_extract = function(rng) {
8
- return new RelaxNGui(rng,null).example();
9
- }
9
+ this.noarrow = ['alternative', 'otherwise'];
10
+ this.source = function(rng) {
11
+ $('#relaxngworker').empty();
12
+ var rngw = new RelaxNGui(rng,$('#relaxngworker'),self.adaptor.description.context_eval);
13
+ var nnew = $(rngw.save().documentElement);
14
+ nnew.attr('trans-xmlns','http://cpee.org/ns/description/1.0');
15
+ var ntxt = nnew.serializeXML();
16
+ ntxt = ntxt.replace(/trans-xmlns/,'xmlns');
17
+
18
+ return($X(ntxt));
19
+ };
20
+ this.clicked = function(){
21
+ var svgid = 'unknown';
22
+ _.each(self.adaptor.illustrator.get_elements(),function(value,key) {
23
+ if ($(value).hasClass('clicked')) {
24
+ svgid = $(value).attr('element-id');
25
+ }
26
+ });
27
+ return svgid;
28
+ };
10
29
 
11
30
  // Events
12
31
  this.events.mousedown = function(svgid, e, child, sibling) { // {{{
13
32
  if(e.button == 0) { // left-click
14
33
  } else if(e.button == 1) { // middle-click
15
34
  } else if(e.button == 2) { // right-click
16
- var xml_node = adaptor.description.get_node_by_svg_id(svgid);
35
+ var xml_node = self.adaptor.description.get_node_by_svg_id(svgid);
17
36
  var group = null;
18
37
  var menu = {};
19
38
 
20
- if(child) {
21
- group = elements[xml_node.get(0).tagName].permissible_children(xml_node);
39
+ if (child) {
40
+ group = self.elements[xml_node.get(0).tagName].permissible_children(xml_node,'into');
22
41
  if(group.length > 0) menu['Insert into'] = group;
23
42
  }
24
- if(sibling) {
25
- group = elements[xml_node.parent().get(0).tagName].permissible_children(xml_node);
43
+ if (sibling) {
44
+ group = self.elements[xml_node.parent().get(0).tagName].permissible_children(xml_node,'after');
26
45
  if(group.length > 0) menu['Insert after'] = group;
27
46
  }
28
47
 
29
- if(xml_node.get(0).tagName != 'description' && !elements[xml_node.get(0).tagName].neverdelete)
30
- menu['Remove Element'] = [{'label': 'Actual Element',
31
- 'function_call': adaptor.description.remove,
32
- 'menu_icon': function() {
33
- var icon = elements[xml_node.get(0).tagName].illustrator.svg();
34
- icon.children('.rfill').css({'fill':'red','fill-opacity':'0.5'});
35
- return icon;
36
- },
37
- 'params': [null, xml_node]}];
38
- if($('> manipulate', xml_node).length > 0 && xml_node.get(0).tagName == 'call') {
39
- menu['Remove Element'].push({'label': 'Remove Scripts',
40
- 'function_call': adaptor.description.remove,
41
- 'menu_icon': function() {
42
- var icon = elements.callmanipulate.illustrator.svg();
43
- icon.children('.rfill:last').css({'fill':'red','fill-opacity':'0.5'});
44
- return icon;
45
- },
46
- 'params': ['> manipulate', xml_node]});
48
+ if(xml_node.get(0).tagName != 'description' && !self.elements[xml_node.get(0).tagName].neverdelete) {
49
+ var icon = self.elements[xml_node.get(0).tagName].illustrator.svg.clone();
50
+ icon.children('.rfill').css({'fill':'#ff7f7f','fill-opacity':'1'});
51
+ menu['Delete'] = [{
52
+ 'label': 'Remove Element',
53
+ 'function_call': self.adaptor.description.remove,
54
+ 'menu_icon': icon,
55
+ 'params': [null, xml_node]
56
+ }];
57
+ }
58
+ if($('> finalize, > update', xml_node).length > 0 && xml_node.get(0).tagName == 'call') {
59
+ var icon = self.elements.callmanipulate.illustrator.svg.clone();
60
+ icon.children('.rfill:last').css({'fill':'#ff7f7f','fill-opacity':'1'});
61
+ menu['Delete'].push({
62
+ 'label': 'Remove Scripts',
63
+ 'function_call': self.adaptor.description.remove,
64
+ 'menu_icon': icon,
65
+ 'params': ['> finalize, > update', xml_node]
66
+ });
47
67
  }
48
68
  new CustomMenu(e).contextmenu(menu);
49
69
  }
50
70
  return false;
51
71
  } // }}}
52
72
  this.events.click = function(svgid, e) { // {{{
53
- if (adaptor.description.get_node_by_svg_id(svgid).length == 0) {
73
+ if (self.adaptor.description.get_node_by_svg_id(svgid).length == 0) {
54
74
  return;
55
75
  }
56
76
 
57
- if ($('#state').text() != 'finished')
58
- $('#main ui-behind button').show();
59
- if ($('#main ui-behind button').hasClass('highlight')) {
60
- var check = confirm("Discard changes?");
61
- if (check)
62
- $('#main ui-behind button').removeClass('highlight');
63
- else
64
- return;
65
- }
66
-
67
77
  var visid = 'details';
68
78
  var tab = $('#dat_' + visid);
69
- var node = adaptor.description.get_node_by_svg_id(svgid).get(0);
79
+ tab.empty();
70
80
 
71
- save[visid + '_target'] = { 'svgid': svgid, 'model': adaptor.description };
81
+ self.adaptor.illustrator.get_elements().removeClass('clicked');
72
82
 
73
- tab.empty();
74
- $.ajax({
75
- type: "GET",
76
- url: adaptor.theme_dir + "rngs/" + node.nodeName + ".rng",
77
- success: function(rng){
78
- save[visid] = new RelaxNGui(rng,tab);
79
- save[visid].content(node,adaptor.description.context_eval);
83
+ if (e && e.ctrlKey) {
84
+ var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
85
+ if (vtarget.length > 0) {
86
+ vtarget.parents('g.element[element-id]').toggleClass('marked');
80
87
  }
81
- });
88
+ } else {
89
+ self.adaptor.illustrator.get_elements().removeClass('marked');
90
+
91
+ var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
92
+ if (vtarget.length > 0) {
93
+ vtarget.parents('g.element[element-id]').addClass('clicked');
94
+ }
95
+
96
+ var node = self.adaptor.description.get_node_by_svg_id(svgid).get(0);
97
+
98
+ if (self.adaptor.description.elements[$(node).attr('svg-type')]) {
99
+ save[visid + '_target'] = { 'svgid': svgid, 'model': self.adaptor.description };
100
+ save[visid] = new RelaxNGui(self.adaptor.description.elements[$(node).attr('svg-type')],tab,self.adaptor.description.context_eval);
101
+ save[visid].content(node);
102
+ }
103
+ }
82
104
  } // }}}
83
105
  this.events.dblclick = function(svgid, e) { // {{{
84
106
  } // }}}
@@ -93,42 +115,23 @@ function WFAdaptorManifestation(adaptor) {
93
115
  this.events.dragstart = function (svgid, e) { //{{{
94
116
  } //}}}
95
117
 
96
- // Abstract Elements (they only have an illustrator)
97
- this.elements.callmanipulate = { /*{{{*/
98
- 'illustrator': {//{{{
99
- 'type' : 'abstract',
100
- 'svg': adaptor.theme_dir + 'symbols/callmanipulate.svg'
101
- },//}}}
102
- }; /*}}}*/
103
- this.elements.choose_inclusive = { /*{{{*/
104
- 'illustrator': {//{{{
105
- 'type' : 'abstract',
106
- 'svg': adaptor.theme_dir + 'symbols/choose_inclusive.svg'
107
- },//}}}
108
- }; /*}}}*/
109
- this.elements.choose_exclusive = { /*{{{*/
110
- 'illustrator': {//{{{
111
- 'type' : 'abstract',
112
- 'svg': adaptor.theme_dir + 'symbols/choose_exclusive.svg'
113
- },//}}}
114
- }; /*}}}*/
115
- this.elements.callpreminder = { /*{{{*/
116
- 'illustrator': {//{{{
117
- 'type' : 'abstract',
118
- 'svg': adaptor.theme_dir + 'symbols/preminder.svg'
119
- },//}}}
120
- }; /*}}}*/
121
-
122
118
  // Primitive Elements
123
119
  this.elements.call = { /*{{{*/
120
+ 'type': 'primitive',
124
121
  'illustrator': {//{{{
125
- 'type' : 'primitive',
126
- 'endnodes' : 'this',
127
- 'resolve_symbol' : function(node) {
128
- if($(node).attr('endpoint') == 'instantiation') {
122
+ 'endnodes': 'this',
123
+ 'label': function(node){return $('label',$(node).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,'')},
124
+ 'resolve_symbol': function(node) {
125
+ if($(node).attr('endpoint').match(/^instantiation/)) {
129
126
  return 'callinstantiation';
130
- } else if($(node).attr('endpoint') == 'preminder1' || $(node).attr('endpoint') == 'preminder2' ) {
131
- return 'callpreminder';
127
+ } else if($(node).attr('endpoint').match(/^correlation_send/)) {
128
+ return 'callcorrelationsend';
129
+ } else if($(node).attr('endpoint').match(/^correlation_receive/)) {
130
+ return 'callcorrelationreceive';
131
+ } else if($(node).attr('endpoint').match(/^worklist/) && $('finalize,update', node).length > 0) {
132
+ return 'callmanipulateworklist';
133
+ } else if($(node).attr('endpoint').match(/^worklist/)) {
134
+ return 'callworklist';
132
135
  } else if($('parameters > service', node).length > 0) {
133
136
  return 'callinjection';
134
137
  } else if($('finalize,update', node).length > 0) {
@@ -137,606 +140,662 @@ function WFAdaptorManifestation(adaptor) {
137
140
  return'call';
138
141
  }
139
142
  },
140
- 'svg': adaptor.theme_dir + 'symbols/call.svg'
143
+ 'svg': self.adaptor.theme_dir + 'symbols/call.svg'
141
144
  },//}}}
142
- 'description': '<call id="###" endpoint="" xmlns="http://cpee.org/ns/description/1.0"><parameters xmlns="http://cpee.org/ns/description/1.0"><label>""</label><method>:post</method><parameters/></parameters></call>',
143
- 'permissible_children': function(node) { //{{{
145
+ 'description': self.adaptor.theme_dir + 'rngs/call.rng',
146
+ 'permissible_children': function(node,mode) { //{{{
144
147
  if(node.children('finalize,update').length < 1)
145
148
  return [
146
149
  {'label': 'Scripts',
147
- 'function_call': adaptor.description.insert_last_into,
148
- 'menu_icon': elements.callmanipulate.illustrator.svg,
149
- 'params': [adaptor.description.elements.scripts, node]}
150
+ 'function_call': self.adaptor.description.insert_last_into,
151
+ 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
152
+ 'params': [self.adaptor.description.elements.scripts, node]}
150
153
  ];
151
154
  return [];
152
155
  }, //}}}
153
- 'adaptor' : {//{{{
154
- 'mousedown': function (node, e) { events.mousedown(node,e,true, true); },
155
- 'click': events.click,
156
- 'dragstart': events.dragstart,
156
+ 'adaptor': {//{{{
157
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
158
+ 'click': self.events.click,
159
+ 'dragstart': self.events.dragstart,
157
160
  }//}}}
158
161
  }; /*}}}*/
159
- this.elements.scripts = { /*{{{*/
160
- 'illustrator': {//{{{
161
- 'type' : 'primitive',
162
- 'endnodes' : 'this',
163
- 'svg': adaptor.theme_dir + 'symbols/scripts.svg'
164
- },//}}}
165
- 'description': ['<finalize xmlns="http://cpee.org/ns/description/1.0"/>','<update xmlns="http://cpee.org/ns/description/1.0"/>'],
166
- 'permissible_children': function(node) { //{{{
167
- return [];
168
- }, //}}}
169
- 'adaptor': { //{{{
170
- 'mousedown': function (node, e) { events.mousedown(node,e,false, true); },
171
- 'click': events.click,
172
- } //}}}
173
- }; /*}}}*/
174
162
  this.elements.manipulate = { /*{{{*/
163
+ 'type': 'primitive',
175
164
  'illustrator': {//{{{
176
- 'type' : 'primitive',
177
- 'endnodes' : 'this',
178
- 'svg': adaptor.theme_dir + 'symbols/manipulate.svg'
165
+ 'endnodes': 'this',
166
+ 'label': function(node){return $(node).attr('label').replace(/^['"]/,'').replace(/['"]$/,'')},
167
+ 'svg': self.adaptor.theme_dir + 'symbols/manipulate.svg'
179
168
  },//}}}
180
- 'description': '<manipulate id="###" xmlns="http://cpee.org/ns/description/1.0"/>',
181
- 'permissible_children': function(node) { //{{{
169
+ 'description': self.adaptor.theme_dir + 'rngs/manipulate.rng',
170
+ 'permissible_children': function(node,mode) { //{{{
182
171
  return [];
183
172
  }, //}}}
184
- 'adaptor' : {//{{{
185
- 'mousedown': function (node, e) { events.mousedown(node,e,false, true); },
186
- 'click': events.click,
173
+ 'adaptor': {//{{{
174
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,false,true); },
175
+ 'click': self.events.click,
187
176
  }//}}}
188
177
  }; /*}}}*/
189
178
  this.elements.escape = { /*{{{*/
179
+ 'type': 'primitive',
190
180
  'illustrator': {//{{{
191
- 'type' : 'primitive',
192
- 'endnodes' : 'this',
193
- 'svg': adaptor.theme_dir + 'symbols/escape.svg'
181
+ 'endnodes': 'this',
182
+ 'svg': self.adaptor.theme_dir + 'symbols/escape.svg'
194
183
  },//}}}
195
- 'description': '<escape xmlns="http://cpee.org/ns/description/1.0"/>',
196
- 'permissible_children': function(node) { //{{{
184
+ 'description': self.adaptor.theme_dir + 'rngs/escape.rng',
185
+ 'permissible_children': function(node,mode) { //{{{
197
186
  return [];
198
187
  }, //}}}
199
- 'adaptor' : {//{{{
200
- 'mousedown': function (node, e) { events.mousedown(node,e,false, true); },
201
- 'click': events.click,
188
+ 'adaptor': {//{{{
189
+ 'mousedown': function (node,e) { self.events.mousedown(node,e,false,true); },
190
+ 'click': self.events.click,
202
191
  }//}}}
203
192
  }; /*}}}*/
204
193
 
205
194
  // Complex Elements
206
195
  this.elements.choose = { /*{{{*/
196
+ 'type': 'complex',
207
197
  'illustrator': {//{{{
208
- 'type' : 'complex',
209
- 'endnodes' : 'aggregate',
198
+ 'label': function(node){return $(node).attr('mode') == 'exclusive' ? 'exclusive' : 'inclusive' },
199
+ 'endnodes': 'aggregate',
210
200
  'closeblock': false,
211
- 'expansion' : function(node) {
201
+ 'expansion': function(node) {
212
202
  return 'horizontal';
213
203
  },
214
- 'resolve_symbol' : function(node) {
204
+ 'resolve_symbol': function(node) {
215
205
  if($(node).attr('mode') == 'exclusive') {
216
206
  return 'choose_exclusive';
217
207
  } else {
218
208
  return 'choose_inclusive';
219
209
  }
220
210
  },
221
- 'col_shift' : function(node) {
211
+ 'col_shift': function(node) {
222
212
  return false;
223
213
  },
224
- 'svg': adaptor.theme_dir + 'symbols/choose.svg'
214
+ 'svg': self.adaptor.theme_dir + 'symbols/choose.svg'
225
215
  },//}}}
226
- 'description': '<choose mode="exclusive" xmlns="http://cpee.org/ns/description/1.0"><otherwise/></choose>',
227
- 'permissible_children': function(node) { //{{{
216
+ 'description': self.adaptor.theme_dir + 'rngs/choose.rng',
217
+ 'permissible_children': function(node,mode) { //{{{
228
218
  var func = null;
229
- if(node.get(0).tagName == 'choose') { func = adaptor.description.insert_first_into }
230
- else { func = adaptor.description.insert_after }
219
+ if (mode == 'into') { func = self.adaptor.description.insert_first_into }
220
+ else { func = self.adaptor.description.insert_after }
231
221
  if(node.children('parallel_branch').length > 0) {
232
222
  return [{'label': 'Parallel Branch',
233
223
  'function_call': func,
234
- 'menu_icon': elements.parallel_branch.illustrator.svg,
235
- 'params': [adaptor.description.elements.parallel_branch, node]}];
224
+ 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
225
+ 'params': [self.adaptor.description.elements.parallel_branch, node]}];
236
226
  }
237
227
  var childs = [{'label': 'Alternative',
238
228
  'function_call': func,
239
- 'menu_icon': elements.alternative.illustrator.svg,
240
- 'params': [adaptor.description.elements.alternative, node]}];
229
+ 'menu_icon': self.elements.alternative.illustrator.svg.clone(),
230
+ 'params': [self.adaptor.description.elements.alternative, node]}];
241
231
  if((node.children('otherwise').length == 0) && node.parents('parallel').length == node.parents('parallel_branch').length)
242
232
  childs.push({'label': 'Otherwise',
243
- 'function_call': func,
244
- 'menu_icon': elements.otherwise.illustrator.svg,
245
- 'params': [adaptor.description.elements.otherwise, node]});
233
+ 'function_call': self.adaptor.description.insert_last_into,
234
+ 'menu_icon': self.elements.otherwise.illustrator.svg.clone(),
235
+ 'params': [self.adaptor.description.elements.otherwise, node]});
246
236
  if(node.parents('parallel').length > node.parents('parallel_branch').length)
247
237
  childs.push({'label': 'Parallel Branch',
248
238
  'function_call': func,
249
- 'menu_icon': elements.parallel_branch.illustrator.svg,
250
- 'params': [adaptor.description.elements.parallel_branch, node]});
239
+ 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
240
+ 'params': [self.adaptor.description.elements.parallel_branch, node]});
251
241
  return childs;
252
242
  }, //}}}
253
- 'adaptor' : {//{{{
254
- 'mousedown': function (node, e) {
255
- events.mousedown(node,e,true, true);
243
+ 'adaptor': {//{{{
244
+ 'mousedown': function (node,e) {
245
+ self.events.mousedown(node,e,true,true);
256
246
  },
257
- 'click': events.click,
258
- 'dblclick': events.dblclick,
259
- 'mouseover': events.mouseover,
260
- 'mouseout': events.mouseout,
247
+ 'click': self.events.click,
248
+ 'dblclick': self.events.dblclick,
249
+ 'mouseover': self.events.mouseover,
250
+ 'mouseout': self.events.mouseout,
261
251
  }//}}}
262
252
  }; /*}}}*/
263
253
  this.elements.otherwise = { /*{{{*/
254
+ 'type': 'complex',
264
255
  'illustrator': {//{{{
265
- 'type' : 'complex',
266
- 'endnodes' : 'passthrough',
256
+ 'endnodes': 'passthrough',
267
257
  'closeblock': false,
268
- 'expansion' : function(node) {
258
+ 'expansion': function(node) {
269
259
  return 'vertical';
270
260
  },
271
- 'col_shift' : function(node) {
261
+ 'col_shift': function(node) {
272
262
  return false;
273
263
  },
274
- 'svg': adaptor.theme_dir + 'symbols/otherwise.svg'
264
+ 'svg': self.adaptor.theme_dir + 'symbols/otherwise.svg'
275
265
  },//}}}
276
- 'description': '<otherwise xmlns="http://cpee.org/ns/description/1.0"/>',
266
+ 'description': self.adaptor.theme_dir + 'rngs/otherwise.rng',
277
267
  'neverdelete': true,
278
- 'permissible_children': function(node) { //{{{
268
+ 'permissible_children': function(node,mode) { //{{{
279
269
  var func = null;
280
270
  var childs = null;
281
- if(node.get(0).tagName == 'otherwise') { func = adaptor.description.insert_first_into }
282
- else { func = adaptor.description.insert_after }
271
+ if (mode == 'into') { func = self.adaptor.description.insert_first_into }
272
+ else { func = self.adaptor.description.insert_after }
283
273
  return [
284
274
  {'label': 'Service Call with Scripts',
285
275
  'function_call': func,
286
- 'menu_icon': elements.callmanipulate.illustrator.svg,
287
- 'params': [adaptor.description.elements.callmanipulate, node]},
276
+ 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
277
+ 'params': [self.adaptor.description.elements.callmanipulate, node]},
288
278
  {'label': 'Service Call',
289
279
  'function_call': func,
290
- 'menu_icon': elements.call.illustrator.svg,
291
- 'params': [adaptor.description.elements.call, node]},
280
+ 'menu_icon': self.elements.call.illustrator.svg.clone(),
281
+ 'params': [self.adaptor.description.elements.call, node]},
292
282
  {'label': 'Script',
293
283
  'function_call': func,
294
- 'menu_icon': elements.manipulate.illustrator.svg,
295
- 'params': [adaptor.description.elements.manipulate, node]},
284
+ 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
285
+ 'params': [self.adaptor.description.elements.manipulate, node]},
296
286
  {'label': 'Parallel',
297
287
  'function_call': func,
298
- 'menu_icon': elements.parallel.illustrator.svg,
299
- 'params': [adaptor.description.elements.parallel, node]},
300
- {'label': 'Choose',
288
+ 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
289
+ 'params': [self.adaptor.description.elements.parallel, node]},
290
+ {'label': 'Decision',
301
291
  'function_call': func,
302
- 'menu_icon': elements.choose.illustrator.svg,
303
- 'params': [adaptor.description.elements.choose, node]},
292
+ 'menu_icon': self.elements.choose.illustrator.svg.clone(),
293
+ 'params': [self.adaptor.description.elements.choose, node]},
304
294
  {'label': 'Loop',
305
295
  'function_call': func,
306
- 'menu_icon': elements.loop.illustrator.svg,
307
- 'params': [adaptor.description.elements.loop, node]},
296
+ 'menu_icon': self.elements.loop.illustrator.svg.clone(),
297
+ 'params': [self.adaptor.description.elements.loop, node]},
308
298
  {'label': 'Critical',
309
299
  'function_call': func,
310
- 'menu_icon': elements.critical.illustrator.svg,
311
- 'params': [adaptor.description.elements.critical, node]}
300
+ 'menu_icon': self.elements.critical.illustrator.svg.clone(),
301
+ 'params': [self.adaptor.description.elements.critical, node]}
312
302
  ];
313
303
  }, //}}}
314
- 'adaptor' : {//{{{
315
- 'mousedown': function (node, e) {
316
- events.mousedown(node,e,true, false);
304
+ 'adaptor': {//{{{
305
+ 'mousedown': function (node,e) {
306
+ self.events.mousedown(node,e,true,false);
317
307
  },
318
- 'click': events.click,
319
- 'dblclick': events.dblclick,
320
- 'mouseover': events.mouseover,
321
- 'mouseout': events.mouseout,
308
+ 'click': self.events.click,
309
+ 'dblclick': self.events.dblclick,
310
+ 'mouseover': self.events.mouseover,
311
+ 'mouseout': self.events.mouseout,
322
312
  }//}}}
323
313
  }; /*}}}*/
324
314
  this.elements.alternative = { /*{{{*/
315
+ 'type': 'complex',
325
316
  'illustrator': {//{{{
326
- 'type' : 'complex',
327
- 'endnodes' : 'passthrough',
317
+ 'label': function(node){return $(node).attr('condition')},
318
+ 'endnodes': 'passthrough',
328
319
  'closeblock':false,
329
- 'expansion' : function(node) {
320
+ 'expansion': function(node) {
330
321
  return 'vertical';
331
322
  },
332
- 'col_shift' : function(node) {
323
+ 'col_shift': function(node) {
333
324
  return false;
334
325
  },
335
- 'svg': adaptor.theme_dir + 'symbols/alternative.svg'
326
+ 'svg': self.adaptor.theme_dir + 'symbols/alternative.svg'
336
327
  },//}}}
337
- 'description': '<alternative condition="" xmlns="http://cpee.org/ns/description/1.0"/>',
338
- 'permissible_children': function(node) { //{{{
339
- if(node.get(0).tagName == 'alternative') { func = adaptor.description.insert_first_into }
340
- else { func = adaptor.description.insert_after }
328
+ 'description': self.adaptor.theme_dir + 'rngs/alternative.rng',
329
+ 'permissible_children': function(node,mode) { //{{{
330
+ if (mode == 'into') { func = self.adaptor.description.insert_first_into }
331
+ else { func = self.adaptor.description.insert_after }
341
332
  if(node.parents('parallel').length > node.parents('parallel_branch').length && node.get(0).tagName == 'alternative') {
342
333
  return [{'label': 'Parallel Branch',
343
334
  'function_call': func,
344
- 'menu_icon': elements.parallel_branch.illustrator.svg,
345
- 'params': [adaptor.description.elements.parallel_branch, node]}];
335
+ 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
336
+ 'params': [self.adaptor.description.elements.parallel_branch, node]}];
346
337
  }
347
338
  return [
348
339
  {'label': 'Service Call with Scripts',
349
340
  'function_call': func,
350
- 'menu_icon': elements.callmanipulate.illustrator.svg,
351
- 'params': [adaptor.description.elements.callmanipulate, node]},
341
+ 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
342
+ 'params': [self.adaptor.description.elements.callmanipulate, node]},
352
343
  {'label': 'Service Call',
353
344
  'function_call': func,
354
- 'menu_icon': elements.call.illustrator.svg,
355
- 'params': [adaptor.description.elements.call, node]},
345
+ 'menu_icon': self.elements.call.illustrator.svg.clone(),
346
+ 'params': [self.adaptor.description.elements.call, node]},
356
347
  {'label': 'Script',
357
348
  'function_call': func,
358
- 'menu_icon': elements.manipulate.illustrator.svg,
359
- 'params': [adaptor.description.elements.manipulate, node]},
349
+ 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
350
+ 'params': [self.adaptor.description.elements.manipulate, node]},
360
351
  {'label': 'Parallel',
361
352
  'function_call': func,
362
- 'menu_icon': elements.parallel.illustrator.svg,
363
- 'params': [adaptor.description.elements.parallel, node]},
364
- {'label': 'Choose',
353
+ 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
354
+ 'params': [self.adaptor.description.elements.parallel, node]},
355
+ {'label': 'Decision',
365
356
  'function_call': func,
366
- 'menu_icon': elements.choose.illustrator.svg,
367
- 'params': [adaptor.description.elements.choose, node]},
357
+ 'menu_icon': self.elements.choose.illustrator.svg.clone(),
358
+ 'params': [self.adaptor.description.elements.choose, node]},
368
359
  {'label': 'Loop',
369
360
  'function_call': func,
370
- 'menu_icon': elements.loop.illustrator.svg,
371
- 'params': [adaptor.description.elements.loop, node]},
361
+ 'menu_icon': self.elements.loop.illustrator.svg.clone(),
362
+ 'params': [self.adaptor.description.elements.loop, node]},
372
363
  {'label': 'Critical',
373
364
  'function_call': func,
374
- 'menu_icon': elements.critical.illustrator.svg,
375
- 'params': [adaptor.description.elements.critical, node]}
365
+ 'menu_icon': self.elements.critical.illustrator.svg.clone(),
366
+ 'params': [self.adaptor.description.elements.critical, node]}
376
367
  ];
377
368
  }, //}}}
378
- 'adaptor' : {//{{{
379
- 'mousedown': function (node, e) {
380
- events.mousedown(node,e,true, false);
369
+ 'adaptor': {//{{{
370
+ 'mousedown': function (node,e) {
371
+ self.events.mousedown(node,e,true,false);
381
372
  },
382
- 'click': events.click,
383
- 'dblclick': events.dblclick,
384
- 'mouseover': events.mouseover,
385
- 'mouseout': events.mouseout,
373
+ 'click': self.events.click,
374
+ 'dblclick': self.events.dblclick,
375
+ 'mouseover': self.events.mouseover,
376
+ 'mouseout': self.events.mouseout,
386
377
  }//}}}
387
378
  }; /*}}}*/
388
379
  this.elements.loop = { /*{{{*/
380
+ 'type': 'complex',
389
381
  'illustrator': {//{{{
390
- 'type' : 'complex',
391
- 'endnodes' : 'this',
392
- 'closeblock' : true,
393
- 'expansion' : function(node) {
382
+ 'label': function(node){return $(node).attr('condition') + ($(node).attr('mode') == 'pre_test' ? ' (⭱)' : ' (⭳)') },
383
+ 'endnodes': 'this',
384
+ 'closeblock': true,
385
+ 'expansion': function(node) {
394
386
  return 'vertical';
395
387
  },
396
- 'col_shift' : function(node) {
388
+ 'col_shift': function(node) {
397
389
  return true;
398
390
  },
399
- 'svg': adaptor.theme_dir + 'symbols/loop.svg'
391
+ 'svg': self.adaptor.theme_dir + 'symbols/loop.svg'
400
392
  },// }}}
401
- 'description': '<loop pre_test="" xmlns="http://cpee.org/ns/description/1.0"/>',
402
- 'permissible_children': function(node) { //{{{
393
+ 'description': self.adaptor.theme_dir + 'rngs/loop.rng',
394
+ 'permissible_children': function(node,mode) { //{{{
403
395
  var func = null;
404
- if(node.get(0).tagName == 'loop') { func = adaptor.description.insert_first_into }
405
- else { func = adaptor.description.insert_after }
396
+ if (mode == 'into') { func = self.adaptor.description.insert_first_into }
397
+ else { func = self.adaptor.description.insert_after }
406
398
  var childs = [
407
399
  {'label': 'Service Call with Scripts',
408
400
  'function_call': func,
409
- 'menu_icon': elements.callmanipulate.illustrator.svg,
410
- 'params': [adaptor.description.elements.callmanipulate, node]},
401
+ 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
402
+ 'params': [self.adaptor.description.elements.callmanipulate, node]},
411
403
  {'label': 'Service Call',
412
404
  'function_call': func,
413
- 'menu_icon': elements.call.illustrator.svg,
414
- 'params': [adaptor.description.elements.call, node]},
405
+ 'menu_icon': self.elements.call.illustrator.svg.clone(),
406
+ 'params': [self.adaptor.description.elements.call, node]},
415
407
  {'label': 'Manipulate',
416
408
  'function_call': func,
417
- 'menu_icon': elements.manipulate.illustrator.svg,
418
- 'params': [adaptor.description.elements.manipulate, node]},
419
- {'label': 'Choose',
409
+ 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
410
+ 'params': [self.adaptor.description.elements.manipulate, node]},
411
+ {'label': 'Decision',
420
412
  'function_call': func,
421
- 'menu_icon': elements.choose.illustrator.svg,
422
- 'params': [adaptor.description.elements.choose, node]},
413
+ 'menu_icon': self.elements.choose.illustrator.svg.clone(),
414
+ 'params': [self.adaptor.description.elements.choose, node]},
423
415
  {'label': 'Loop',
424
416
  'function_call': func,
425
- 'menu_icon': elements.loop.illustrator.svg,
426
- 'params': [adaptor.description.elements.loop, node]},
417
+ 'menu_icon': self.elements.loop.illustrator.svg.clone(),
418
+ 'params': [self.adaptor.description.elements.loop, node]},
427
419
  {'label': 'Critical',
428
420
  'function_call': func,
429
- 'menu_icon': elements.critical.illustrator.svg,
430
- 'params': [adaptor.description.elements.critical, node]}
421
+ 'menu_icon': self.elements.critical.illustrator.svg.clone(),
422
+ 'params': [self.adaptor.description.elements.critical, node]}
431
423
  ];
432
424
  if(node.parent('parallel').length > node.parent('parallel_branch').length) {
433
425
  childs.push({'label': 'Parallel Branch',
434
426
  'function_call': func,
435
- 'menu_icon': elements.parallel_branch.illustrator.svg,
436
- 'params': [adaptor.description.elements.parallel_branch, node]}
427
+ 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
428
+ 'params': [self.adaptor.description.elements.parallel_branch, node]}
437
429
  );
438
430
  } else {
439
431
  childs.push({'label': 'Parallel',
440
432
  'function_call': func,
441
- 'menu_icon': elements.parallel.illustrator.svg,
442
- 'params': [adaptor.description.elements.parallel, node]}
433
+ 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
434
+ 'params': [self.adaptor.description.elements.parallel, node]}
443
435
  );
444
436
  }
445
437
  return childs;
446
438
  }, //}}}
447
- 'adaptor' : {//{{{
448
- 'mousedown': function (node, e) {
449
- events.mousedown(node,e,true, true);
439
+ 'adaptor': {//{{{
440
+ 'mousedown': function (node,e) {
441
+ self.events.mousedown(node,e,true,true);
450
442
  },
451
- 'click': events.click,
452
- 'dblclick': events.dblclick,
453
- 'mouseover': events.mouseover,
454
- 'mouseout': events.mouseout,
443
+ 'click': self.events.click,
444
+ 'dblclick': self.events.dblclick,
445
+ 'mouseover': self.events.mouseover,
446
+ 'mouseout': self.events.mouseout,
455
447
  }//}}}
456
448
  }; /*}}}*/
457
449
  this.elements.parallel = { /*{{{*/
450
+ 'type': 'complex',
458
451
  'illustrator': {//{{{
459
- 'type' : 'complex',
460
- 'endnodes' : 'this',
461
- 'closeblock' : false,
452
+ 'endnodes': 'this',
453
+ 'closeblock': false,
462
454
  'border': true,
463
- 'expansion' : function(node) {
455
+ 'expansion': function(node) {
464
456
  // check if any sibling other than 'parallel_branch' is present
465
457
  if($(node).children(':not(parallel_branch)').length > 0) return 'vertical';
466
458
  return 'horizontal';
467
459
  },
468
- 'col_shift' : function(node) {
460
+ 'col_shift': function(node) {
469
461
  return true;
470
462
  },
471
- 'svg': adaptor.theme_dir + 'symbols/parallel.svg'
463
+ 'svg': self.adaptor.theme_dir + 'symbols/parallel.svg'
472
464
  },//}}}
473
- 'description': '<parallel xmlns="http://cpee.org/ns/description/1.0"/>',
474
- 'permissible_children': function(node) { //{{{
465
+ 'description': self.adaptor.theme_dir + 'rngs/parallel.rng',
466
+ 'permissible_children': function(node,mode) { //{{{
475
467
  var childs = [
476
468
  {'label': 'Service Call with Scripts',
477
- 'function_call': adaptor.description.insert_last_into,
478
- 'menu_icon': elements.callmanipulate.illustrator.svg,
479
- 'params': [adaptor.description.elements.callmanipulate, node]},
469
+ 'function_call': self.adaptor.description.insert_last_into,
470
+ 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
471
+ 'params': [self.adaptor.description.elements.callmanipulate, node]},
480
472
  {'label': 'Service Call',
481
- 'function_call': adaptor.description.insert_last_into,
482
- 'menu_icon': elements.call.illustrator.svg,
483
- 'params': [adaptor.description.elements.call, node]},
473
+ 'function_call': self.adaptor.description.insert_last_into,
474
+ 'menu_icon': self.elements.call.illustrator.svg.clone(),
475
+ 'params': [self.adaptor.description.elements.call, node]},
484
476
  {'label': 'Manipulate',
485
- 'function_call': adaptor.description.insert_last_into,
486
- 'menu_icon': elements.manipulate.illustrator.svg,
487
- 'params': [adaptor.description.elements.manipulate, node]},
488
- {'label': 'Choose',
489
- 'function_call': adaptor.description.insert_last_into,
490
- 'menu_icon': elements.choose.illustrator.svg,
491
- 'params': [adaptor.description.elements.choose, node]},
477
+ 'function_call': self.adaptor.description.insert_last_into,
478
+ 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
479
+ 'params': [self.adaptor.description.elements.manipulate, node]},
480
+ {'label': 'Decision',
481
+ 'function_call': self.adaptor.description.insert_last_into,
482
+ 'menu_icon': self.elements.choose.illustrator.svg.clone(),
483
+ 'params': [self.adaptor.description.elements.choose, node]},
492
484
  {'label': 'Loop',
493
- 'function_call': adaptor.description.insert_last_into,
494
- 'menu_icon': elements.loop.illustrator.svg,
495
- 'params': [adaptor.description.elements.loop, node]},
485
+ 'function_call': self.adaptor.description.insert_last_into,
486
+ 'menu_icon': self.elements.loop.illustrator.svg.clone(),
487
+ 'params': [self.adaptor.description.elements.loop, node]},
496
488
  {'label': 'Critical',
497
- 'function_call': adaptor.description.insert_last_into,
498
- 'menu_icon': elements.critical.illustrator.svg,
499
- 'params': [adaptor.description.elements.critical, node]},
489
+ 'function_call': self.adaptor.description.insert_last_into,
490
+ 'menu_icon': self.elements.critical.illustrator.svg.clone(),
491
+ 'params': [self.adaptor.description.elements.critical, node]},
500
492
  {'label': 'Parallel Branch',
501
- 'function_call': adaptor.description.insert_last_into,
502
- 'menu_icon': elements.parallel_branch.illustrator.svg,
503
- 'params': [adaptor.description.elements.parallel_branch, node]}
493
+ 'function_call': self.adaptor.description.insert_last_into,
494
+ 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
495
+ 'params': [self.adaptor.description.elements.parallel_branch, node]}
504
496
  ];
505
497
  if(node.get(0).tagName != 'parallel')
506
498
  childs.push({'label': 'Parallel',
507
- 'function_call': adaptor.description.insert_last_into,
508
- 'menu_icon': elements.parallel.illustrator.svg,
509
- 'params': [adaptor.description.elements.parallel, node]});
499
+ 'function_call': self.adaptor.description.insert_last_into,
500
+ 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
501
+ 'params': [self.adaptor.description.elements.parallel, node]});
510
502
  return childs;
511
503
  }, //}}}
512
- 'adaptor' : {//{{{
513
- 'mousedown': function (node, e) {
514
- events.mousedown(node,e,true, true);
504
+ 'adaptor': {//{{{
505
+ 'mousedown': function (node,e) {
506
+ self.events.mousedown(node,e,true,true);
515
507
  },
516
- 'click': events.click,
517
- 'dblclick': events.dblclick,
518
- 'mouseover': events.mouseover,
519
- 'mouseout': events.mouseout,
508
+ 'click': self.events.click,
509
+ 'dblclick': self.events.dblclick,
510
+ 'mouseover': self.events.mouseover,
511
+ 'mouseout': self.events.mouseout,
520
512
  }//}}}
521
513
  }; /*}}}*/
522
514
  this.elements.parallel_branch = { /*{{{*/
515
+ 'type': 'complex',
523
516
  'illustrator': {//{{{
524
- 'type' : 'complex',
525
- 'endnodes' : 'this',
526
- 'closeblock' : false,
527
- 'expansion' : function(node) {
517
+ 'endnodes': 'this',
518
+ 'closeblock': false,
519
+ 'expansion': function(node) {
528
520
  return 'vertical';
529
521
  },
530
- 'col_shift' : function(node) {
522
+ 'col_shift': function(node) {
531
523
  if(node.parentNode.tagName == 'choose') return false;
532
524
  if($(node).parents('parallel').first().children(':not(parallel_branch)').length > 0) return true;
533
525
  return false;
534
526
  },
535
- 'svg': adaptor.theme_dir + 'symbols/parallel_branch.svg'
527
+ 'svg': self.adaptor.theme_dir + 'symbols/parallel_branch.svg'
536
528
  },//}}}
537
- 'description': '<parallel_branch xmlns="http://cpee.org/ns/description/1.0"/>',
538
- 'permissible_children': function(node) { //{{{
529
+ 'description': self.adaptor.theme_dir + 'rngs/parallel_branch.rng',
530
+ 'permissible_children': function(node,mode) { //{{{
539
531
  var func = null;
540
532
  var childs = null;
541
- if(node.get(0).tagName == 'parallel_branch') { func = adaptor.description.insert_first_into }
542
- else { func = adaptor.description.insert_after }
533
+ if (mode == 'into') { func = self.adaptor.description.insert_first_into }
534
+ else { func = self.adaptor.description.insert_after }
543
535
  childs = [
544
536
  {'label': 'Service Call with Scripts',
545
537
  'function_call': func,
546
- 'menu_icon': elements.callmanipulate.illustrator.svg,
547
- 'params': [adaptor.description.elements.callmanipulate, node]},
538
+ 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
539
+ 'params': [self.adaptor.description.elements.callmanipulate, node]},
548
540
  {'label': 'Service Call',
549
541
  'function_call': func,
550
- 'menu_icon': elements.call.illustrator.svg,
551
- 'params': [adaptor.description.elements.call, node]},
542
+ 'menu_icon': self.elements.call.illustrator.svg.clone(),
543
+ 'params': [self.adaptor.description.elements.call, node]},
552
544
  {'label': 'Script',
553
545
  'function_call': func,
554
- 'menu_icon': elements.manipulate.illustrator.svg,
555
- 'params': [adaptor.description.elements.manipulate, node]},
546
+ 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
547
+ 'params': [self.adaptor.description.elements.manipulate, node]},
556
548
  {'label': 'Parallel',
557
549
  'function_call': func,
558
- 'menu_icon': elements.parallel.illustrator.svg,
559
- 'params': [adaptor.description.elements.parallel, node]},
560
- {'label': 'Choose',
550
+ 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
551
+ 'params': [self.adaptor.description.elements.parallel, node]},
552
+ {'label': 'Decision',
561
553
  'function_call': func,
562
- 'menu_icon': elements.choose.illustrator.svg,
563
- 'params': [adaptor.description.elements.choose, node]},
554
+ 'menu_icon': self.elements.choose.illustrator.svg.clone(),
555
+ 'params': [self.adaptor.description.elements.choose, node]},
564
556
  {'label': 'Loop',
565
557
  'function_call': func,
566
- 'menu_icon': elements.loop.illustrator.svg,
567
- 'params': [adaptor.description.elements.loop, node]},
558
+ 'menu_icon': self.elements.loop.illustrator.svg.clone(),
559
+ 'params': [self.adaptor.description.elements.loop, node]},
568
560
  {'label': 'Critical',
569
561
  'function_call': func,
570
- 'menu_icon': elements.critical.illustrator.svg,
571
- 'params': [adaptor.description.elements.critical, node]},
562
+ 'menu_icon': self.elements.critical.illustrator.svg.clone(),
563
+ 'params': [self.adaptor.description.elements.critical, node]},
572
564
  ];
573
565
  if(node.parents('choose').length > node.parents('alternative, otherwise').length && node.get(0).tagName == 'parallel_branch') {
574
566
  return [{'label': 'Alternative',
575
567
  'function_call': func,
576
- 'menu_icon': elements.alternative.illustrator.svg,
577
- 'params': [adaptor.description.elements.alternative, node]}];
568
+ 'menu_icon': self.elements.alternative.illustrator.svg.clone(),
569
+ 'params': [self.adaptor.description.elements.alternative, node]}];
578
570
  }
579
571
  return childs;
580
572
  }, //}}}
581
- 'adaptor' : {//{{{
582
- 'mousedown': function (node, e) {
583
- events.mousedown(node,e,true, false);
573
+ 'adaptor': {//{{{
574
+ 'mousedown': function (node,e) {
575
+ self.events.mousedown(node,e,true,false);
584
576
  },
585
- 'click': events.click,
586
- 'dblclick': events.dblclick,
587
- 'mouseover': events.mouseover,
588
- 'mouseout': events.mouseout,
577
+ 'click': self.events.click,
578
+ 'dblclick': self.events.dblclick,
579
+ 'mouseover': self.events.mouseover,
580
+ 'mouseout': self.events.mouseout,
589
581
  }//}}}
590
582
  }; /*}}}*/
591
583
  this.elements.critical = { /*{{{*/
584
+ 'type': 'complex',
592
585
  'illustrator': {//{{{
593
- 'type' : 'complex',
594
- 'endnodes' : 'aggregate',
595
- 'closeblock' : false,
586
+ 'endnodes': 'aggregate',
587
+ 'closeblock': false,
596
588
  'border': true,
597
- 'expansion' : function(node) {
589
+ 'expansion': function(node) {
598
590
  return 'vertical';
599
591
  },
600
- 'col_shift' : function(node) {
592
+ 'col_shift': function(node) {
601
593
  return true;
602
594
  },
603
- 'svg': adaptor.theme_dir + 'symbols/critical.svg'
595
+ 'svg': self.adaptor.theme_dir + 'symbols/critical.svg'
604
596
  },//}}}
605
- 'description': '<critical sid="section" xmlns="http://cpee.org/ns/description/1.0"/>',
606
- 'permissible_children': function(node) { //{{{
597
+ 'description': self.adaptor.theme_dir + 'rngs/critical.rng',
598
+ 'permissible_children': function(node,mode) { //{{{
607
599
  var func = null;
608
- if(node.get(0).tagName == 'critical') { func = adaptor.description.insert_first_into }
609
- else { func = adaptor.description.insert_after }
600
+ if (mode == 'into') { func = self.adaptor.description.insert_first_into }
601
+ else { func = self.adaptor.description.insert_after }
610
602
  return [
611
603
  {'label': 'Service Call with Scripts',
612
604
  'function_call': func,
613
- 'menu_icon': elements.callmanipulate.illustrator.svg,
614
- 'params': [adaptor.description.elements.callmanipulate, node]},
605
+ 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
606
+ 'params': [self.adaptor.description.elements.callmanipulate, node]},
615
607
  {'label': 'Service Call',
616
608
  'function_call': func,
617
- 'menu_icon': elements.call.illustrator.svg,
618
- 'params': [adaptor.description.elements.call, node]},
609
+ 'menu_icon': self.elements.call.illustrator.svg.clone(),
610
+ 'params': [self.adaptor.description.elements.call, node]},
619
611
  {'label': 'Script',
620
612
  'function_call': func,
621
- 'menu_icon': elements.manipulate.illustrator.svg,
622
- 'params': [adaptor.description.elements.manipulate, node]},
613
+ 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
614
+ 'params': [self.adaptor.description.elements.manipulate, node]},
623
615
  {'label': 'Parallel',
624
616
  'function_call': func,
625
- 'menu_icon': elements.parallel.illustrator.svg,
626
- 'params': [adaptor.description.elements.parallel, node]},
627
- {'label': 'Choose',
617
+ 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
618
+ 'params': [self.adaptor.description.elements.parallel, node]},
619
+ {'label': 'Decision',
628
620
  'function_call': func,
629
- 'menu_icon': elements.choose.illustrator.svg,
630
- 'params': [adaptor.description.elements.choose, node]},
621
+ 'menu_icon': self.elements.choose.illustrator.svg.clone(),
622
+ 'params': [self.adaptor.description.elements.choose, node]},
631
623
  {'label': 'Loop',
632
624
  'function_call': func,
633
- 'menu_icon': elements.loop.illustrator.svg,
634
- 'params': [adaptor.description.elements.loop, node]},
625
+ 'menu_icon': self.elements.loop.illustrator.svg.clone(),
626
+ 'params': [self.adaptor.description.elements.loop, node]},
635
627
  {'label': 'Critical',
636
628
  'function_call': func,
637
- 'menu_icon': elements.critical.illustrator.svg,
638
- 'params': [adaptor.description.elements.critical, node]},
629
+ 'menu_icon': self.elements.critical.illustrator.svg.clone(),
630
+ 'params': [self.adaptor.description.elements.critical, node]},
639
631
  ];
640
632
  }, //}}}
641
- 'adaptor' : {//{{{
642
- 'mousedown': function (node, e) {
643
- events.mousedown(node,e,true, true);
633
+ 'adaptor': {//{{{
634
+ 'mousedown': function (node,e) {
635
+ self.events.mousedown(node,e,true,true);
644
636
  },
645
- 'click': events.click,
646
- 'dblclick': events.dblclick,
647
- 'mouseover': events.mouseover,
648
- 'mouseout': events.mouseout,
637
+ 'click': self.events.click,
638
+ 'dblclick': self.events.dblclick,
639
+ 'mouseover': self.events.mouseover,
640
+ 'mouseout': self.events.mouseout,
649
641
  }//}}}
650
642
  }; /*}}}*/
651
643
  this.elements.group = { /*{{{*/
644
+ 'type': 'complex',
652
645
  'illustrator': {//{{{
653
- 'type' : 'complex',
654
- 'endnodes' : 'aggregate',
655
- 'closeblock' : false,
646
+ 'endnodes': 'aggregate',
647
+ 'closeblock': false,
656
648
  'border': 'injectiongroup', // other value than true,false inidcates the used class for the svg-object
657
- 'expansion' : function(node) {
649
+ 'expansion': function(node) {
658
650
  return 'vertical';
659
651
  },
660
- 'col_shift' : function(node) {
652
+ 'col_shift': function(node) {
661
653
  return true;
662
654
  },
663
655
  'svg': null
664
656
  },//}}}
665
- 'description': '<group xmlns="http://cpee.org/ns/description/1.0"/>',
666
- 'permissible_children': function(node) { //{{{
657
+ 'description': self.adaptor.theme_dir + 'rngs/group.rng',
658
+ 'permissible_children': function(node,mode) { //{{{
667
659
  var func = null;
668
- if(node.get(0).tagName == 'group') { func = adaptor.description.insert_first_into }
669
- else { func = adaptor.description.insert_after }
660
+ if (mode == 'into') { func = self.adaptor.description.insert_first_into }
661
+ else { func = self.adaptor.description.insert_after }
670
662
  return [
671
663
  ];
672
664
  }, //}}}
673
- 'adaptor' : {//{{{
674
- 'mousedown': function (node, e) {
675
- events.mousedown(node,e,true, true);
665
+ 'adaptor': {//{{{
666
+ 'mousedown': function (node,e) {
667
+ self.events.mousedown(node,e,true,true);
676
668
  },
677
- 'click': events.click,
678
- 'dblclick': events.dblclick,
679
- 'mouseover': events.mouseover,
680
- 'mouseout': events.mouseout,
669
+ 'click': self.events.click,
670
+ 'dblclick': self.events.dblclick,
671
+ 'mouseover': self.events.mouseover,
672
+ 'mouseout': self.events.mouseout,
681
673
  }//}}}
682
674
  }; /*}}}*/
683
675
  this.elements.start = this.elements.description = { /*{{{*/
676
+ 'type': 'description',
684
677
  'illustrator': {//{{{
685
- 'type' : 'description',
686
- 'endnodes' : 'passthrough',
687
- 'closeblock' : false,
688
- 'expansion' : function(node) {
678
+ 'endnodes': 'passthrough',
679
+ 'closeblock': false,
680
+ 'expansion': function(node) {
689
681
  return 'vertical';
690
682
  },
691
- 'col_shift' : function(node) {
683
+ 'col_shift': function(node) {
692
684
  return true;
693
685
  },
694
- 'svg': adaptor.theme_dir + 'symbols/start.svg'
686
+ 'svg': self.adaptor.theme_dir + 'symbols/start.svg'
695
687
  },//}}}
696
688
  'description': null,
697
- 'permissible_children': function(node) { //{{{
689
+ 'permissible_children': function(node,mode) { //{{{
698
690
  var func = null;
699
- if(node.get(0).tagName == 'description') { func = adaptor.description.insert_first_into }
700
- else { func = adaptor.description.insert_after }
691
+ if (mode == 'into') { func = self.adaptor.description.insert_first_into }
692
+ else { func = self.adaptor.description.insert_after }
701
693
  return [
702
694
  {'label': 'Service Call with Scripts',
703
695
  'function_call': func,
704
- 'menu_icon': elements.callmanipulate.illustrator.svg,
705
- 'params': [adaptor.description.elements.callmanipulate, node]},
696
+ 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
697
+ 'params': [self.adaptor.description.elements.callmanipulate, node]},
706
698
  {'label': 'Service Call',
707
699
  'function_call': func,
708
- 'menu_icon': elements.call.illustrator.svg,
709
- 'params': [adaptor.description.elements.call, node]},
700
+ 'menu_icon': self.elements.call.illustrator.svg.clone(),
701
+ 'params': [self.adaptor.description.elements.call, node]},
710
702
  {'label': 'Script Task',
711
703
  'function_call': func,
712
- 'menu_icon': elements.manipulate.illustrator.svg,
713
- 'params': [adaptor.description.elements.manipulate, node]},
704
+ 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
705
+ 'params': [self.adaptor.description.elements.manipulate, node]},
714
706
  {'label': 'Parallel',
715
707
  'function_call': func,
716
- 'menu_icon': elements.parallel.illustrator.svg,
717
- 'params': [adaptor.description.elements.parallel, node]},
718
- {'label': 'Choose',
708
+ 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
709
+ 'params': [self.adaptor.description.elements.parallel, node]},
710
+ {'label': 'Decision',
719
711
  'function_call': func,
720
- 'menu_icon': elements.choose.illustrator.svg,
721
- 'params': [adaptor.description.elements.choose, node]},
712
+ 'menu_icon': self.elements.choose.illustrator.svg.clone(),
713
+ 'params': [self.adaptor.description.elements.choose, node]},
722
714
  {'label': 'Loop',
723
715
  'function_call': func,
724
- 'menu_icon': elements.loop.illustrator.svg,
725
- 'params': [adaptor.description.elements.loop, node]},
716
+ 'menu_icon': self.elements.loop.illustrator.svg.clone(),
717
+ 'params': [self.adaptor.description.elements.loop, node]},
726
718
  {'label': 'Critical',
727
719
  'function_call': func,
728
- 'menu_icon': elements.critical.illustrator.svg,
729
- 'params': [adaptor.description.elements.critical, node]}
720
+ 'menu_icon': self.elements.critical.illustrator.svg.clone(),
721
+ 'params': [self.adaptor.description.elements.critical, node]}
730
722
  ];
731
723
  }, //}}}
732
- 'adaptor' : {//{{{
733
- 'mousedown': function (node, e) {
734
- events.mousedown(node,e,true, false);
724
+ 'adaptor': {//{{{
725
+ 'mousedown': function (node,e) {
726
+ self.events.mousedown(node,e,true,false);
735
727
  },
736
- 'click': events.click,
737
- 'dblclick': events.dblclick,
738
- 'mouseover': events.mouseover,
739
- 'mouseout': events.mouseout,
728
+ 'click': self.events.click,
729
+ 'dblclick': self.events.dblclick,
730
+ 'mouseover': self.events.mouseover,
731
+ 'mouseout': self.events.mouseout,
740
732
  }//}}}
741
733
  }; /*}}}*/
734
+
735
+ // Abstract Elements
736
+ // * they may only have an illustrator (or other parts)
737
+ // * they HAVE TO have a parent
738
+ this.elements.callmanipulate = { /*{{{*/
739
+ 'type': 'abstract',
740
+ 'parent': 'call',
741
+ 'description': self.adaptor.theme_dir + 'rngs/callmanipulate.rng',
742
+ 'illustrator': {//{{{
743
+ 'label': function(node){return $('label',$(node).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,'')},
744
+ 'svg': self.adaptor.theme_dir + 'symbols/callmanipulate.svg'
745
+ },//}}}
746
+ }; /*}}}*/
747
+ this.elements.choose_inclusive = { /*{{{*/
748
+ 'type': 'abstract',
749
+ 'parent': 'choose',
750
+ 'illustrator': {//{{{
751
+ 'svg': self.adaptor.theme_dir + 'symbols/choose_inclusive.svg'
752
+ },//}}}
753
+ }; /*}}}*/
754
+ this.elements.choose_exclusive = { /*{{{*/
755
+ 'type': 'abstract',
756
+ 'parent': 'choose',
757
+ 'illustrator': {//{{{
758
+ 'svg': self.adaptor.theme_dir + 'symbols/choose_exclusive.svg'
759
+ },//}}}
760
+ }; /*}}}*/
761
+ this.elements.scripts = { /*{{{*/
762
+ 'type': 'abstract',
763
+ 'description': [self.adaptor.theme_dir + 'rngs/update.rng',self.adaptor.theme_dir + 'rngs/finalize.rng']
764
+ }; /*}}}*/
765
+ this.elements.callinstantiation = { /*{{{*/
766
+ 'type': 'abstract',
767
+ 'parent': 'call',
768
+ 'illustrator': {//{{{
769
+ 'svg': self.adaptor.theme_dir + 'symbols/callinstantiation.svg'
770
+ },//}}}
771
+ }; /*}}}*/
772
+ this.elements.callcorrelationsend = { /*{{{*/
773
+ 'type': 'abstract',
774
+ 'parent': 'call',
775
+ 'illustrator': {//{{{
776
+ 'svg': self.adaptor.theme_dir + 'symbols/callcorrelationsend.svg'
777
+ },//}}}
778
+ }; /*}}}*/
779
+ this.elements.callcorrelationreceive = { /*{{{*/
780
+ 'type': 'abstract',
781
+ 'parent': 'call',
782
+ 'illustrator': {//{{{
783
+ 'svg': self.adaptor.theme_dir + 'symbols/callcorrelationreceive.svg'
784
+ },//}}}
785
+ }; /*}}}*/
786
+ this.elements.callworklist = { /*{{{*/
787
+ 'type': 'abstract',
788
+ 'parent': 'call',
789
+ 'illustrator': {//{{{
790
+ 'svg': self.adaptor.theme_dir + 'symbols/callworklist.svg'
791
+ },//}}}
792
+ }; /*}}}*/
793
+ this.elements.callmanipulateworklist = { /*{{{*/
794
+ 'type': 'abstract',
795
+ 'parent': 'call',
796
+ 'description': self.adaptor.theme_dir + 'rngs/callmanipulate.rng',
797
+ 'illustrator': {//{{{
798
+ 'svg': self.adaptor.theme_dir + 'symbols/callmanipulateworklist.svg'
799
+ },//}}}
800
+ }; /*}}}*/
742
801
  }