cpee 2.1.56 → 2.1.57

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/cockpit/css/resources-label.css +33 -32
  3. data/cockpit/css/resources-svg.css +2 -2
  4. data/cockpit/css/ui.css +2 -42
  5. data/cockpit/css/wfadaptor.css +9 -0
  6. data/cockpit/edit.html +15 -2
  7. data/cockpit/graph.html +12 -1
  8. data/cockpit/index.html +14 -1
  9. data/cockpit/js/details.js +1 -0
  10. data/cockpit/js/instance.js +29 -13
  11. data/cockpit/js/resources.js +59 -11
  12. data/cockpit/js/wfadaptor.js +10 -6
  13. data/cockpit/model.html +3 -2
  14. data/cockpit/themes/base.js +1506 -0
  15. data/cockpit/themes/compact/rngs/start.rng +10 -0
  16. data/cockpit/themes/compact/symbols/start_event.svg +1 -1
  17. data/cockpit/themes/compact/theme.js +8 -1487
  18. data/cockpit/themes/control/rngs/start.rng +10 -0
  19. data/cockpit/themes/control/symbols/start_event.svg +1 -1
  20. data/cockpit/themes/control/theme.js +277 -1334
  21. data/cockpit/themes/dataflow/rngs/start.rng +10 -0
  22. data/cockpit/themes/dataflow/symbols/start_event.svg +1 -1
  23. data/cockpit/themes/dataflow/theme.js +144 -1563
  24. data/cockpit/themes/default/rngs/start.rng +10 -0
  25. data/cockpit/themes/default/symbols/start_event.svg +1 -1
  26. data/cockpit/themes/default/theme.js +1 -1493
  27. data/cockpit/themes/extended/rngs/start.rng +10 -0
  28. data/cockpit/themes/extended/symbols/start_event.svg +1 -1
  29. data/cockpit/themes/extended/theme.js +81 -1529
  30. data/cockpit/themes/felix/symbols/start_event.svg +1 -1
  31. data/cockpit/themes/felix/theme.js +68 -1528
  32. data/cockpit/themes/model/symbols/start_event.svg +1 -1
  33. data/cockpit/themes/model/theme.js +735 -1383
  34. data/cockpit/themes/packed/rngs/start.rng +10 -0
  35. data/cockpit/themes/packed/symbols/start_event.svg +1 -1
  36. data/cockpit/themes/packed/theme.js +9 -1487
  37. data/cockpit/themes/preset/rngs/start.rng +10 -0
  38. data/cockpit/themes/preset/symbols/start_event.svg +1 -1
  39. data/cockpit/themes/preset/theme.js +1 -1493
  40. data/cockpit/track.html +11 -0
  41. data/cpee.gemspec +1 -1
  42. data/lib/properties/executionhandler.rng +1 -1
  43. data/lib/properties.xml +1 -1
  44. data/server/executionhandlers/ruby/connection.rb +8 -11
  45. data/server/executionhandlers/rust/backend/README.md +17 -0
  46. data/server/executionhandlers/rust/backend/compile.sh +5 -0
  47. data/server/executionhandlers/rust/backend/opts.yaml +6 -0
  48. data/server/executionhandlers/rust/execution.rb +84 -0
  49. data/server/routing/end.pid +1 -1
  50. data/server/routing/forward-events-00.pid +1 -1
  51. data/server/routing/forward-votes.pid +1 -1
  52. data/server/routing/persist.pid +1 -1
  53. metadata +8 -3
@@ -1,1492 +1,14 @@
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 = true;
9
- this.striped = false;
10
- this.endpoints = {};
11
- this.presstimer;
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
- return(nnew);
20
- } else {
21
- if (opts && opts == 'clone') {
22
- base = base.clone();
23
- if (base.attr('id')) {
24
- base.attr('id',self.adaptor.description.get_free_id());
25
- }
26
- base.find('*[id]').each(function(k,v){
27
- $(v).attr('id',self.adaptor.description.get_free_id(base));
28
- });
29
- }
30
- return base;
31
- }
32
- }; //}}}
33
- //{{{ Return the svgid for the selected task
34
- this.selected = function(){
35
- var svgid = 'unknown';
36
- _.each(self.adaptor.illustrator.get_elements(),function(value,key) {
37
- if ($(value).hasClass('selected')) {
38
- svgid = $(value).attr('element-id');
39
- }
40
- });
41
- return svgid;
42
- }; //}}}
43
- //{{{ Return the svgids for all marked tasks
44
- this.marked = function(){
45
- var svgid = [];
46
- _.each(self.adaptor.illustrator.get_elements(),function(value,key) {
47
- if ($(value).hasClass('marked')) {
48
- svgid.push($(value).attr('element-id'));
49
- }
50
- });
51
- return svgid;
52
- }; //}}}
53
- //{{{ Return the json for all marked tasks
54
- this.marked_text = function(){
55
- var nodes = [];
56
- var markymark = _.uniq(self.marked());
57
- $(markymark).each(function(key,svgid){
58
- var node = self.adaptor.description.get_node_by_svg_id(svgid);
59
- nodes.push($(node).serializePrettyXML());
60
- });
61
- return JSON.stringify(nodes);
62
- }; //}}}
63
- //{{{ Render the details from rng (right hand side of graph tab)
64
- this.update_details = function(svgid){
65
- var tab = $('#dat_details');
66
- var node = self.adaptor.description.get_node_by_svg_id(svgid).get(0);
67
- if (self.adaptor.description.elements[$(node).attr('svg-subtype')]) {
68
- save['details_target'] = { 'svgid': svgid, 'model': self.adaptor.description };
69
- var rng = self.adaptor.description.elements[$(node).attr('svg-subtype')].clone();
70
- if (save['endpoints_cache'][$(node).attr('endpoint')] && save['endpoints_cache'][$(node).attr('endpoint')].schema) {
71
- var schema = save['endpoints_cache'][$(node).attr('endpoint')].schema.documentElement;
72
- $(rng).find(' > element[name="parameters"] > element[name="arguments"]').replaceWith($(schema).clone());
73
- }
74
- if (save['endpoints_list'][$(node).attr('endpoint')] && (!save['endpoints_list'][$(node).attr('endpoint')].startsWith('http') || save['endpoints_list'][$(node).attr('endpoint')].match(/^https?-/))) {
75
- $(rng).find(' > element[name="parameters"] > element[name="method"]').remove();
76
- }
77
- var nn = $X($(node).serializeXML());
78
- nn.removeAttr('svg-id');
79
- nn.removeAttr('svg-type');
80
- nn.removeAttr('svg-subtype');
81
- nn.removeAttr('svg-label');
82
-
83
- tab.empty();
84
- save['details'] = new RelaxNGui(rng,tab,self.adaptor.description.context_eval,true);
85
- save['details'].content(nn);
86
-
87
- format_visual_forms();
88
- }
89
- }; //}}}
90
-
91
- function copyOrMove(menu,group,xml_node,mode) { //{{{
92
- var nodes = localStorage.getItem('marked');
93
-
94
- if (typeof(nodes) != "string") { return; }
95
-
96
- nodes = JSON.parse(nodes);
97
- $(nodes).each(function(key,str) {
98
- nodes[key] = $X(str);
99
- });
100
-
101
- var check1 = [];
102
- var check2 = [];
103
- $(nodes).each(function(key,node){
104
- check1.push($(node).attr('svg-type'));
105
- });
106
- $(group).each(function(key,value){
107
- check2.push(value.type);
108
- });
109
-
110
- if (nodes.length > 0 && _.uniq(check1).length == _.intersection(check1,check2).length) {
111
- if (myid == localStorage.getItem('marked_from')) {
112
- $(nodes).each(function(key,node){
113
- nodes[key] = self.adaptor.description.get_node_by_svg_id($(node).attr('svg-id'));
114
- });
115
- }
116
- nodes.reverse();
117
- var iconm = self.resources['arrow'].clone();
118
- var iconc = self.resources['arrow'].clone();
119
- iconm.children('.rfill').addClass('menu');
120
- if (myid == localStorage.getItem('marked_from')) {
121
- menu.push(
122
- {
123
- 'label': '<em>Move Marked Elements</em>',
124
- 'function_call': mode,
125
- 'menu_icon': iconm,
126
- 'type': undefined,
127
- 'params': [nodes, xml_node]
128
- }
129
- );
130
- }
131
- menu.push(
132
- {
133
- 'label': '<em>Copy Marked Elements</em>',
134
- 'function_call': mode,
135
- 'menu_icon': iconc,
136
- 'type': undefined,
137
- 'params': [nodes, xml_node, 'clone']
138
- }
139
- );
140
- }
141
- } //}}}
142
-
143
- function contextMenuHandling(svgid,e,child,sibling) { //{{{
144
- if (save['state'] != "ready" && save['state'] != "stopped") { return false; }
145
-
146
- var xml_node = self.adaptor.description.get_node_by_svg_id(svgid);
147
- var group = null;
148
- var menu = {};
149
-
150
- if (child) {
151
- group = self.elements[xml_node.get(0).tagName].permissible_children(xml_node,'into');
152
- if(group.length > 0) {
153
- menu['Insert into'] = group;
154
- copyOrMove(menu['Insert into'],group,xml_node,self.adaptor.description.insert_first_into);
155
- }
156
- if (self.elements[xml_node.get(0).tagName].permissible_children_expert) {
157
- group = self.elements[xml_node.get(0).tagName].permissible_children_expert(xml_node,'into');
158
- if(group.length > 0) {
159
- menu['Insert into (Experts Only!)'] = group;
160
- copyOrMove(menu['Insert into (Experts Only!)'],group,xml_node,self.adaptor.description.insert_first_into);
161
- }
162
- }
163
- }
164
- if (sibling) {
165
- group = self.elements[xml_node.parent().get(0).tagName].permissible_children(xml_node,'after');
166
- if(group.length > 0) {
167
- menu['Insert after'] = group;
168
- copyOrMove(menu['Insert after'],group,xml_node,self.adaptor.description.insert_after);
169
- }
170
- if (self.elements[xml_node.parent().get(0).tagName].permissible_children_expert) {
171
- group = self.elements[xml_node.parent().get(0).tagName].permissible_children_expert(xml_node,'after');
172
- if(group.length > 0) {
173
- menu['Insert after (Experts Only!)'] = group;
174
- copyOrMove(menu['Insert after (Experts Only!)'],group,xml_node,self.adaptor.description.insert_after);
175
- }
176
- }
177
- }
178
-
179
- if(xml_node.get(0).tagName != 'description' && !self.elements[xml_node.get(0).tagName].neverdelete) {
180
- var icon = self.elements[xml_node.get(0).tagName].illustrator.svg.clone();
181
- icon.find('.rfill').addClass('menu');
182
- icon.find('.hfill').addClass('menu');
183
- menu['Delete'] = [{
184
- 'label': 'Remove Element',
185
- 'function_call': function(selector,target,selected){
186
- del_ui_pos(target)
187
- self.adaptor.description.remove(selector,target);
188
- localStorage.removeItem('marked');
189
- localStorage.removeItem('marked_from');
190
- },
191
- 'menu_icon': icon,
192
- 'type': undefined,
193
- 'params': [null, xml_node, self.selected()]
194
- }];
195
- var nodes = localStorage.getItem('marked');
196
- nodes = JSON.parse(nodes);
197
- if (nodes && nodes.length > 0) {
198
- var icond = self.resources['delete'].clone();
199
- icond.children('.standfat').addClass('menu');
200
- menu['Delete'].push({
201
- 'label': 'Remove Marked Elements',
202
- 'function_call': function(){
203
- $(nodes).each(function(key,str) {
204
- nodes[key] = $X(str);
205
- });
206
- let svgids = [];
207
- $(nodes).each(function(key,node){
208
- svgids.push($(node).attr('svg-id'));
209
- });
210
- svgids.sort((a,b) => {
211
- if (a > b) { return -1; }
212
- else if (a < b) { return 1; }
213
- else { return 0; }
214
- });
215
- svgids.forEach(svgid => {
216
- var target = self.adaptor.description.get_node_by_svg_id(svgid);
217
- del_ui_pos(target)
218
- self.adaptor.description.remove(null,target);
219
- localStorage.removeItem('marked');
220
- localStorage.removeItem('marked_from');
221
- });
222
- },
223
- 'menu_icon': icond,
224
- 'type': undefined,
225
- 'params': []
226
- })
227
- }
228
- }
229
- if($('> code', xml_node).length > 0 && xml_node.get(0).tagName == 'call') {
230
- var icon = self.elements.callmanipulate.illustrator.svg.clone();
231
- icon.children('.rfill:last').addClass('menu');
232
- menu['Delete'].push({
233
- 'label': 'Remove Scripts',
234
- 'function_call': self.adaptor.description.remove,
235
- 'menu_icon': icon,
236
- 'type': undefined,
237
- 'params': ['> code', xml_node]
238
- });
239
- }
240
- if (xml_node.get(0).tagName == "call" || xml_node.get(0).tagName == "manipulate" || xml_node.get(0).tagName == "stop") {
241
- var icon = self.elements.call.illustrator.svg.clone();
242
- icon.children('g.replace').addClass('passive');
243
- var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
244
- if (vtarget.length > 0) {
245
- if (vtarget.parents('g.activities.passive, g.activities.active').length > 0) {
246
- menu['Position'] = [{
247
- 'label': 'No Execution from here',
248
- 'function_call': del_ui_pos,
249
- 'menu_icon': icon,
250
- 'type': undefined,
251
- 'params': xml_node
252
- }];
253
- } else {
254
- menu['Position'] = [{
255
- 'label': 'Execute from here',
256
- 'function_call': add_ui_pos,
257
- 'menu_icon': icon,
258
- 'type': undefined,
259
- 'params': xml_node
260
- }];
261
- }
262
- }
263
- }
264
- new CustomMenu(e).contextmenu(menu);
265
- } //}}}
266
-
267
- function positionHandling(svgid) {
268
- var xml_node = self.adaptor.description.get_node_by_svg_id(svgid);
269
- var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
270
- if (vtarget.length > 0) {
271
- if (vtarget.parents('g.activities.passive, g.activities.active').length > 0) {
272
- del_ui_pos(xml_node);
1
+ WFAdaptorManifestation = class extends WFAdaptorManifestationBase {
2
+ constructor(adaptor) {
3
+ super(adaptor);
4
+ this.compact = true;
5
+ delete(this.elements.choose.illustrator.closing_symbol);
6
+ this.elements.parallel_branch.illustrator.resolve_symbol = function(node,shift) {
7
+ if(shift == true) {
8
+ return 'parallel_branch_compact';
273
9
  } else {
274
- add_ui_pos(xml_node);
10
+ return 'parallel_branch_normal';
275
11
  }
276
12
  }
277
13
  }
278
-
279
- // Events
280
- this.events.touchend = function(svgid, e) { // {{{
281
- clearTimeout(self.presstimer);
282
- } // }}}
283
- this.events.touchstart = function(svgid, e, child, sibling) { // {{{
284
- self.presstimer = window.setTimeout(function() { contextMenuHandling(svgid,e,child,sibling); },1000);
285
- return false;
286
- } // }}}
287
- this.events.mousedown = function(svgid, e, child, sibling) { // {{{
288
- if(e.button == 0) { // left-click
289
- } else if(e.button == 1) { // middle-click
290
- positionHandling(svgid);
291
- } else if(e.button == 2) { // right-click
292
- contextMenuHandling(svgid,e,child,sibling);
293
- }
294
- return false;
295
- } // }}}
296
- this.events.suppress = function(svgid, e, child, sibling) { // {{{
297
- return false;
298
- } // }}}
299
- this.events.click = function(svgid, e) { // {{{
300
- if (self.adaptor.description.get_node_by_svg_id(svgid).length == 0) {
301
- return;
302
- }
303
-
304
- self.adaptor.illustrator.get_elements().removeClass('selected');
305
- self.adaptor.illustrator.get_labels().removeClass('selected');
306
-
307
- if (e && (e.ctrlKey || e.metaKey)) {
308
- if (save['state'] != "ready" && save['state'] != "stopped") { return false; }
309
- var tab = $('#dat_details');
310
- tab.empty();
311
- var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
312
- if (vtarget.length > 0) {
313
- var vt = vtarget.parents('g.element[element-id]');
314
- vt.toggleClass('marked');
315
- if (vt.hasClass('marked')) {
316
- localStorage.setItem('marked',self.marked_text());
317
- localStorage.setItem('marked_from',myid);
318
- } else {
319
- localStorage.removeItem('marked');
320
- localStorage.removeItem('marked_from');
321
- }
322
- }
323
- } else if (e && (e.shiftKey)) {
324
- positionHandling(svgid);
325
- } else {
326
- self.adaptor.illustrator.get_elements().removeClass('marked');
327
- localStorage.removeItem('marked');
328
- localStorage.removeItem('marked_from');
329
-
330
- var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
331
- if (vtarget.length > 0) {
332
- vtarget.parents('g.element[element-id]').addClass('selected');
333
- }
334
- self.adaptor.illustrator.get_label_by_svg_id(svgid).addClass('selected');
335
-
336
- self.update_details(svgid);
337
- }
338
- } // }}}
339
- this.events.dblclick = function(svgid, e) { // {{{
340
- } // }}}
341
- this.events.mouseover = function(svgid, e) { // {{{
342
- self.adaptor.illustrator.svg.container.find('.tile[element-id = "' + svgid + '"]').css('display','block');
343
- self.adaptor.illustrator.svg.container.find('[element-id = "' + svgid + '"]').addClass('hover');
344
- self.adaptor.illustrator.svg.label_container.find('[element-id = "' + svgid + '"]').addClass('hover');
345
- return false;
346
- } // }}}
347
- this.events.mouseout = function(svgid, e) { // {{{
348
- self.adaptor.illustrator.svg.container.find('.tile[element-id = "' + svgid + '"]').css('display','none');
349
- self.adaptor.illustrator.svg.container.find('[element-id = "' + svgid + '"]').removeClass('hover');
350
- self.adaptor.illustrator.svg.label_container.find('[element-id = "' + svgid + '"]').removeClass('hover');
351
- return false;
352
- } // }}}
353
- this.events.dragstart = function (svgid, e) { //{{{
354
- } //}}}
355
-
356
- // other resources
357
- this.resources.arrow = self.adaptor.theme_dir + 'symbols/arrow.svg';
358
- this.resources.delete = self.adaptor.theme_dir + 'symbols/delete.svg';
359
-
360
- // Primitive Elements
361
- this.elements.call = { /*{{{*/
362
- 'type': 'primitive',
363
- 'illustrator': {//{{{
364
- 'endnodes': 'this',
365
- 'label': function(node){
366
- var ret = [ { column: 'Label', value: $('> label',$(node).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,'') } ];
367
- return ret;
368
- },
369
- 'info': function(node){ return { 'element-endpoint': $(node).attr('endpoint') }; },
370
- 'resolve_symbol': function(node) {
371
- if ($('> annotations > _context_data_analysis > probes > probe', node).length > 0) {
372
- if ($('> code', node).length > 0) {
373
- return 'callmanipulate_sensor';
374
- } else {
375
- return 'call_sensor';
376
- }
377
- } else {
378
- if ($('> code', node).length > 0) {
379
- return 'callmanipulate';
380
- } else {
381
- return 'call';
382
- }
383
- }
384
- },
385
- 'svg': self.adaptor.theme_dir + 'symbols/call.svg'
386
- },//}}}
387
- 'description': self.adaptor.theme_dir + 'rngs/call.rng',
388
- 'permissible_children': function(node,mode) { //{{{
389
- if(node.children('code').length < 1)
390
- return [
391
- {'label': 'Scripts',
392
- 'function_call': self.adaptor.description.insert_last_into,
393
- 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
394
- 'type': undefined,
395
- 'params': [self.adaptor.description.elements.scripts, node]}
396
- ];
397
- return [];
398
- }, //}}}
399
- 'adaptor': {//{{{
400
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
401
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
402
- 'touchend': self.events.touchend,
403
- 'click': self.events.click,
404
- 'dragstart': self.events.dragstart,
405
- 'mouseover': self.events.mouseover,
406
- 'mouseout': self.events.mouseout
407
- }//}}}
408
- }; /*}}}*/
409
- this.elements.manipulate = { /*{{{*/
410
- 'type': 'primitive',
411
- 'illustrator': {//{{{
412
- 'endnodes': 'this',
413
- 'label': function(node){
414
- var lab = $(node).attr('label');
415
- if (lab) {
416
- return [ { column: 'Label', value: lab.replace(/^['"]/,'').replace(/['"]$/,'') } ];
417
- } else {
418
- return [];
419
- }
420
- },
421
- 'svg': self.adaptor.theme_dir + 'symbols/manipulate.svg'
422
- },//}}}
423
- 'description': self.adaptor.theme_dir + 'rngs/manipulate.rng',
424
- 'permissible_children': function(node,mode) { //{{{
425
- return [];
426
- }, //}}}
427
- 'adaptor': {//{{{
428
- 'mousedown': function (node,e) { self.events.mousedown(node,e,false,true); },
429
- 'touchstart': function (node,e) { self.events.touchstart(node,e,false,true); },
430
- 'touchend': self.events.touchend,
431
- 'click': self.events.click,
432
- 'mouseover': self.events.mouseover,
433
- 'mouseout': self.events.mouseout
434
- }//}}}
435
- }; /*}}}*/
436
- this.elements.escape = { /*{{{*/
437
- 'type': 'primitive',
438
- 'illustrator': {//{{{
439
- 'endnodes': 'this',
440
- 'svg': self.adaptor.theme_dir + 'symbols/escape.svg'
441
- },//}}}
442
- 'description': self.adaptor.theme_dir + 'rngs/escape.rng',
443
- 'permissible_children': function(node,mode) { //{{{
444
- return [];
445
- }, //}}}
446
- 'adaptor': {//{{{
447
- 'mousedown': function (node,e) { self.events.mousedown(node,e,false,true); },
448
- 'touchstart': function (node,e) { self.events.touchstart(node,e,false,true); },
449
- 'touchend': self.events.touchend,
450
- 'click': self.events.click,
451
- 'mouseover': self.events.mouseover,
452
- 'mouseout': self.events.mouseout
453
- }//}}}
454
- }; /*}}}*/
455
- this.elements.stop = { /*{{{*/
456
- 'type': 'primitive',
457
- 'illustrator': {//{{{
458
- 'endnodes': 'this',
459
- 'svg': self.adaptor.theme_dir + 'symbols/stop.svg'
460
- },//}}}
461
- 'description': self.adaptor.theme_dir + 'rngs/stop.rng',
462
- 'permissible_children': function(node,mode) { //{{{
463
- return [];
464
- }, //}}}
465
- 'adaptor': {//{{{
466
- 'mousedown': function (node,e) { self.events.mousedown(node,e,false,true); },
467
- 'touchstart': function (node,e) { self.events.touchstart(node,e,false,true); },
468
- 'touchend': self.events.touchend,
469
- 'click': self.events.click,
470
- 'mouseover': self.events.mouseover,
471
- 'mouseout': self.events.mouseout
472
- }//}}}
473
- }; /*}}}*/
474
- this.elements.terminate = { /*{{{*/
475
- 'type': 'primitive',
476
- 'illustrator': {//{{{
477
- 'endnodes': 'this',
478
- 'final': true,
479
- 'svg': self.adaptor.theme_dir + 'symbols/terminate.svg'
480
- },//}}}
481
- 'description': self.adaptor.theme_dir + 'rngs/terminate.rng',
482
- 'permissible_children': function(node,mode) { //{{{
483
- return [];
484
- }, //}}}
485
- 'adaptor': {//{{{
486
- 'mousedown': function (node,e) { self.events.mousedown(node,e,false,false); },
487
- 'touchstart': function (node,e) { self.events.touchstart(node,e,false,false); },
488
- 'touchend': self.events.touchend,
489
- 'mouseover': self.events.mouseover,
490
- 'mouseout': self.events.mouseout
491
- }//}}}
492
- }; /*}}}*/
493
- this.elements.end = { /*{{{*/
494
- 'type': 'primitive',
495
- 'illustrator': {//{{{
496
- 'endnodes': 'this',
497
- 'svg': self.adaptor.theme_dir + 'symbols/end.svg'
498
- }, //}}}
499
- 'adaptor': {//{{{
500
- 'mousedown': function (node,e) { self.events.suppress(); }
501
- }//}}}
502
- }; /*}}}*/
503
- this.elements.event_end = { /*{{{*/
504
- 'type': 'primitive',
505
- 'illustrator': {//{{{
506
- 'endnodes': 'this',
507
- 'svg': self.adaptor.theme_dir + 'symbols/event_end.svg'
508
- }, //}}}
509
- 'adaptor': {//{{{
510
- 'mousedown': function (node,e) { self.events.suppress(); },
511
- 'click': self.events.click,
512
- 'dblclick': self.events.dblclick,
513
- 'mouseover': self.events.mouseover,
514
- 'mouseout': self.events.mouseout
515
- }//}}}
516
- }; /*}}}*/
517
- this.elements.choose_finish = { /*{{{*/
518
- 'type': 'primitive',
519
- 'illustrator': {//{{{
520
- 'endnodes': 'this',
521
- 'svg': self.adaptor.theme_dir + 'symbols/choose_inclusive.svg',
522
- 'resolve_symbol': function(node) {
523
- if($(node).attr('mode') == 'exclusive') {
524
- return 'choose_exclusive_finish';
525
- } else {
526
- return 'choose_inclusive_finish';
527
- }
528
- },
529
- }, //}}}
530
- 'adaptor': {//{{{
531
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
532
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
533
- 'touchend': self.events.touchend,
534
- 'click': self.events.click,
535
- 'dblclick': self.events.dblclick,
536
- 'mouseover': self.events.mouseover,
537
- 'mouseout': self.events.mouseout
538
- }//}}}
539
- }; /*}}}*/
540
- this.elements.loop_finish = { /*{{{*/
541
- 'type': 'primitive',
542
- 'illustrator': {//{{{
543
- 'endnodes': 'this',
544
- 'closeblock': true,
545
- 'label': function(node){
546
- var ret = [ { column: 'Label', value: $(node).attr('condition') } ];
547
- return ret;
548
- },
549
- 'svg': self.adaptor.theme_dir + 'symbols/choose_exclusive.svg',
550
- }, //}}}
551
- 'adaptor': {//{{{
552
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
553
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
554
- 'touchend': self.events.touchend,
555
- 'click': self.events.click,
556
- 'dblclick': self.events.dblclick,
557
- 'mouseover': self.events.mouseover,
558
- 'mouseout': self.events.mouseout
559
- }//}}}
560
- }; /*}}}*/
561
- this.elements.parallel_finish = { /*{{{*/
562
- 'type': 'primitive',
563
- 'illustrator': {//{{{
564
- 'endnodes': 'this',
565
- 'svg': self.adaptor.theme_dir + 'symbols/parallel.svg',
566
- 'resolve_symbol': function(node) {
567
- if($(node).children(':not(parallel_branch)').length > 0) {
568
- return 'parallel_complex';
569
- } else if($(node).attr('cancel') == 'last' && $(node).attr('wait') == '-1') {
570
- return 'parallel_simple';
571
- } else if($(node).attr('cancel') == 'first' && $(node).attr('wait') == '-1') {
572
- return 'parallel_event_all';
573
- } else if($(node).attr('cancel') == 'first' && $(node).attr('wait') == '1') {
574
- return 'parallel_event_one';
575
- } else {
576
- return 'parallel_complex';
577
- }
578
- },
579
- }, //}}}
580
- 'adaptor': {//{{{
581
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
582
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
583
- 'touchend': self.events.touchend,
584
- 'click': self.events.click,
585
- 'dblclick': self.events.dblclick,
586
- 'mouseover': self.events.mouseover,
587
- 'mouseout': self.events.mouseout
588
- }//}}}
589
- }; /*}}}*/
590
-
591
- // Complex Elements
592
- this.elements.choose = { /*{{{*/
593
- 'type': 'complex',
594
- 'illustrator': {//{{{
595
- 'label': function(node){ return [ { column: 'Label', value: $(node).attr('mode') == 'exclusive' ? 'exclusive' : 'inclusive' } ]; },
596
- 'endnodes': 'aggregate',
597
- 'closeblock': false,
598
- 'expansion': function(node) {
599
- return 'horizontal';
600
- },
601
- 'resolve_symbol': function(node) {
602
- if($(node).attr('mode') == 'exclusive') {
603
- return 'choose_exclusive';
604
- } else {
605
- return 'choose_inclusive';
606
- }
607
- },
608
- 'col_shift': function(node) {
609
- return false;
610
- },
611
- 'svg': self.adaptor.theme_dir + 'symbols/choose.svg'
612
- },//}}}
613
- 'description': self.adaptor.theme_dir + 'rngs/choose.rng',
614
- 'permissible_children': function(node,mode) { //{{{
615
- var func = null;
616
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
617
- else { func = self.adaptor.description.insert_after }
618
- if(node.children('parallel_branch').length > 0) {
619
- return [{'label': 'Parallel Branch',
620
- 'function_call': func,
621
- 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
622
- 'type': 'parallel_branch',
623
- 'params': [self.adaptor.description.elements.parallel_branch, node]}];
624
- }
625
- var childs = [{'label': 'Alternative',
626
- 'function_call': func,
627
- 'menu_icon': self.elements.alternative.illustrator.svg.clone(),
628
- 'type': 'alternative',
629
- 'params': [self.adaptor.description.elements.alternative, node]}];
630
- if((node.children('otherwise').length == 0) && node.parents('parallel').length == node.parents('parallel_branch').length && node.parent('choose').length == 0)
631
- childs.push({'label': 'Otherwise',
632
- 'function_call': self.adaptor.description.insert_last_into,
633
- 'menu_icon': self.elements.otherwise.illustrator.svg.clone(),
634
- 'type': 'otherwise',
635
- 'params': [self.adaptor.description.elements.otherwise, node]});
636
- if(node.parents('parallel').length > node.parents('parallel_branch').length)
637
- childs.push({'label': 'Parallel Branch',
638
- 'function_call': func,
639
- 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
640
- 'type': 'parallel_branch',
641
- 'params': [self.adaptor.description.elements.parallel_branch, node]});
642
- return childs;
643
- }, //}}}
644
- 'adaptor': {//{{{
645
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
646
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
647
- 'touchend': self.events.touchend,
648
- 'click': self.events.click,
649
- 'dblclick': self.events.dblclick,
650
- 'mouseover': self.events.mouseover,
651
- 'mouseout': self.events.mouseout
652
- }//}}}
653
- }; /*}}}*/
654
- this.elements.otherwise = { /*{{{*/
655
- 'type': 'complex',
656
- 'illustrator': {//{{{
657
- 'endnodes': 'passthrough',
658
- 'closeblock': false,
659
- 'noarrow': true,
660
- 'expansion': function(node) {
661
- return 'vertical';
662
- },
663
- 'col_shift': function(node) {
664
- return false;
665
- },
666
- 'svg': self.adaptor.theme_dir + 'symbols/otherwise.svg'
667
- },//}}}
668
- 'description': self.adaptor.theme_dir + 'rngs/otherwise.rng',
669
- 'neverdelete': true,
670
- 'permissible_children': function(node,mode) { //{{{
671
- var func = null;
672
- var childs = null;
673
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
674
- else { func = self.adaptor.description.insert_after }
675
- var childs = [
676
- {'label': 'Service Call with Scripts',
677
- 'function_call': func,
678
- 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
679
- 'type': 'callmanipulate',
680
- 'params': [self.adaptor.description.elements.callmanipulate, node]},
681
- {'label': 'Service Call',
682
- 'function_call': func,
683
- 'menu_icon': self.elements.call.illustrator.svg.clone(),
684
- 'type': 'call',
685
- 'params': [self.adaptor.description.elements.call, node]},
686
- {'label': 'Script',
687
- 'function_call': func,
688
- 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
689
- 'type': 'manipulate',
690
- 'params': [self.adaptor.description.elements.manipulate, node]},
691
- {'label': 'Parallel',
692
- 'function_call': func,
693
- 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
694
- 'type': 'parallel',
695
- 'params': [self.adaptor.description.elements.parallel, node]},
696
- {'label': 'Decision',
697
- 'function_call': func,
698
- 'menu_icon': self.elements.choose.illustrator.svg.clone(),
699
- 'type': 'choose',
700
- 'params': [self.adaptor.description.elements.choose, node]},
701
- {'label': 'Loop',
702
- 'function_call': func,
703
- 'menu_icon': self.elements.loop.illustrator.svg.clone(),
704
- 'type': 'loop',
705
- 'params': [self.adaptor.description.elements.loop, node]},
706
- {'label': 'Terminate',
707
- 'function_call': func,
708
- 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
709
- 'type': 'terminate',
710
- 'params': [self.adaptor.description.elements.terminate, node]},
711
- {'label': 'Stop',
712
- 'function_call': func,
713
- 'menu_icon': self.elements.stop.illustrator.svg.clone(),
714
- 'type': 'stop',
715
- 'params': [self.adaptor.description.elements.stop, node]}
716
- ];
717
- if(node.parent('parallel_branch').length > 0) {
718
- childs.push({
719
- 'label': 'Critical',
720
- 'function_call': func,
721
- 'menu_icon': self.elements.critical.illustrator.svg.clone(),
722
- 'type': 'critical',
723
- 'params': [self.adaptor.description.elements.critical, node]
724
- });
725
- }
726
- return childs;
727
- }, //}}}
728
- 'adaptor': {//{{{
729
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,false); },
730
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,false); },
731
- 'touchend': self.events.touchend,
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.alternative = { /*{{{*/
739
- 'type': 'complex',
740
- 'illustrator': {//{{{
741
- 'label': function(node){
742
- var ret = [ { column: 'Label', value: $(node).attr('condition') } ];
743
- return ret;
744
- },
745
- 'endnodes': 'passthrough',
746
- 'noarrow': true,
747
- 'closeblock':false,
748
- 'expansion': function(node) {
749
- return 'vertical';
750
- },
751
- 'col_shift': function(node) {
752
- return false;
753
- },
754
- 'svg': self.adaptor.theme_dir + 'symbols/alternative.svg'
755
- },//}}}
756
- 'description': self.adaptor.theme_dir + 'rngs/alternative.rng',
757
- 'permissible_children': function(node,mode) { //{{{
758
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
759
- else { func = self.adaptor.description.insert_after }
760
- if(node.parents('parallel').length > node.parents('parallel_branch').length && node.get(0).tagName == 'alternative') {
761
- return [{'label': 'Parallel Branch',
762
- 'function_call': func,
763
- 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
764
- 'type': 'parallel_branch',
765
- 'params': [self.adaptor.description.elements.parallel_branch, node]}];
766
- }
767
- var childs = [
768
- {'label': 'Service Call with Scripts',
769
- 'function_call': func,
770
- 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
771
- 'type': 'callmanipulate',
772
- 'params': [self.adaptor.description.elements.callmanipulate, node]},
773
- {'label': 'Service Call',
774
- 'function_call': func,
775
- 'menu_icon': self.elements.call.illustrator.svg.clone(),
776
- 'type': 'call',
777
- 'params': [self.adaptor.description.elements.call, node]},
778
- {'label': 'Script',
779
- 'function_call': func,
780
- 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
781
- 'type': 'manipulate',
782
- 'params': [self.adaptor.description.elements.manipulate, node]},
783
- {'label': 'Parallel',
784
- 'function_call': func,
785
- 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
786
- 'type': 'parallel',
787
- 'params': [self.adaptor.description.elements.parallel, node]},
788
- {'label': 'Decision',
789
- 'function_call': func,
790
- 'menu_icon': self.elements.choose.illustrator.svg.clone(),
791
- 'type': 'choose',
792
- 'params': [self.adaptor.description.elements.choose, node]},
793
- {'label': 'Loop',
794
- 'function_call': func,
795
- 'menu_icon': self.elements.loop.illustrator.svg.clone(),
796
- 'type': 'loop',
797
- 'params': [self.adaptor.description.elements.loop, node]},
798
- {'label': 'Terminate',
799
- 'function_call': func,
800
- 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
801
- 'type': 'terminate',
802
- 'params': [self.adaptor.description.elements.terminate, node]},
803
- {'label': 'Stop',
804
- 'function_call': func,
805
- 'menu_icon': self.elements.stop.illustrator.svg.clone(),
806
- 'type': 'stop',
807
- 'params': [self.adaptor.description.elements.stop, node]}
808
- ];
809
- if(node.parent('parallel_branch').length > 0) {
810
- childs.push({
811
- 'label': 'Critical',
812
- 'function_call': func,
813
- 'menu_icon': self.elements.critical.illustrator.svg.clone(),
814
- 'type': 'critical',
815
- 'params': [self.adaptor.description.elements.critical, node]
816
- });
817
- }
818
- return childs;
819
- }, //}}}
820
- 'adaptor': {//{{{
821
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
822
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
823
- 'touchend': self.events.touchend,
824
- 'click': self.events.click,
825
- 'dblclick': self.events.dblclick,
826
- 'mouseover': self.events.mouseover,
827
- 'mouseout': self.events.mouseout,
828
- }//}}}
829
- }; /*}}}*/
830
- this.elements.loop = { /*{{{*/
831
- 'type': 'complex',
832
- 'illustrator': {//{{{
833
- 'resolve_symbol': function(node) {
834
- if($(node).attr('mode') == 'pre_test') {
835
- return 'loop_head';
836
- } else {
837
- return 'loop_tail';
838
- }
839
- },
840
- 'expansion': function(node) {
841
- return 'vertical';
842
- },
843
- 'col_shift': function(node) {
844
- return true;
845
- },
846
- 'svg': self.adaptor.theme_dir + 'symbols/loop.svg'
847
- },// }}}
848
- 'description': self.adaptor.theme_dir + 'rngs/loop.rng',
849
- 'permissible_children': function(node,mode) { //{{{
850
- var func = null;
851
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
852
- else { func = self.adaptor.description.insert_after }
853
- var childs = [
854
- {'label': 'Service Call with Scripts',
855
- 'function_call': func,
856
- 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
857
- 'type': 'callmanipulate',
858
- 'params': [self.adaptor.description.elements.callmanipulate, node]},
859
- {'label': 'Service Call',
860
- 'function_call': func,
861
- 'menu_icon': self.elements.call.illustrator.svg.clone(),
862
- 'type': 'call',
863
- 'params': [self.adaptor.description.elements.call, node]},
864
- {'label': 'Script',
865
- 'function_call': func,
866
- 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
867
- 'type': 'manipulate',
868
- 'params': [self.adaptor.description.elements.manipulate, node]},
869
- {'label': 'Decision',
870
- 'function_call': func,
871
- 'menu_icon': self.elements.choose.illustrator.svg.clone(),
872
- 'type': 'choose',
873
- 'params': [self.adaptor.description.elements.choose, node]},
874
- {'label': 'Loop',
875
- 'function_call': func,
876
- 'menu_icon': self.elements.loop.illustrator.svg.clone(),
877
- 'type': 'loop',
878
- 'params': [self.adaptor.description.elements.loop, node]},
879
- {'label': 'Terminate',
880
- 'function_call': func,
881
- 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
882
- 'type': 'terminate',
883
- 'params': [self.adaptor.description.elements.terminate, node]},
884
- {'label': 'Stop',
885
- 'function_call': func,
886
- 'menu_icon': self.elements.stop.illustrator.svg.clone(),
887
- 'type': 'stop',
888
- 'params': [self.adaptor.description.elements.stop, node]}
889
- ];
890
- if(node.parent('parallel_branch').length > 0) {
891
- childs.push({
892
- 'label': 'Critical',
893
- 'function_call': func,
894
- 'menu_icon': self.elements.critical.illustrator.svg.clone(),
895
- 'type': 'critical',
896
- 'params': [self.adaptor.description.elements.critical, node]
897
- });
898
- }
899
- if(node.parent('parallel').length > node.parent('parallel_branch').length) {
900
- childs.push({'label': 'Parallel Branch',
901
- 'function_call': func,
902
- 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
903
- 'type': 'parallel_branch',
904
- 'params': [self.adaptor.description.elements.parallel_branch, node]}
905
- );
906
- } else {
907
- childs.push({'label': 'Parallel',
908
- 'function_call': func,
909
- 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
910
- 'type': 'parallel',
911
- 'params': [self.adaptor.description.elements.parallel, node]}
912
- );
913
- }
914
- return childs;
915
- }, //}}}
916
- 'adaptor': {//{{{
917
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
918
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
919
- 'touchend': self.events.touchend,
920
- 'click': self.events.click,
921
- 'dblclick': self.events.dblclick,
922
- 'mouseover': self.events.mouseover,
923
- 'mouseout': self.events.mouseout,
924
- }//}}}
925
- }; /*}}}*/
926
- this.elements.parallel = { /*{{{*/
927
- 'type': 'complex',
928
- 'illustrator': {//{{{
929
- 'endnodes': 'aggregate',
930
- 'closeblock': false,
931
- 'closing_symbol': 'parallel_finish',
932
- 'expansion': function(node) {
933
- // check if any sibling other than 'parallel_branch' is present
934
- if($(node).children(':not(parallel_branch)').length > 0) return 'vertical';
935
- return 'horizontal';
936
- },
937
- 'col_shift': function(node) {
938
- return true;
939
- },
940
- 'svg': self.adaptor.theme_dir + 'symbols/parallel.svg',
941
- 'resolve_symbol': function(node) {
942
- if($(node).attr('cancel') == 'last') {
943
- return 'parallel_start';
944
- } else if($(node).attr('cancel') == 'first' && $(node).attr('wait') == 1) {
945
- return 'parallel_eventbased_exclusive';
946
- } else {
947
- return 'parallel_eventbased_parallel';
948
- }
949
- },
950
- },//}}}
951
- 'description': self.adaptor.theme_dir + 'rngs/parallel.rng',
952
- 'permissible_children': function(node,mode) { //{{{
953
- var func = null;
954
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
955
- else { func = self.adaptor.description.insert_after }
956
- var childs = [
957
- {'label': 'Parallel Branch',
958
- 'function_call': func,
959
- 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
960
- 'type': 'parallel_branch',
961
- 'params': [self.adaptor.description.elements.parallel_branch, node]},
962
- ];
963
- return childs;
964
- }, //}}}
965
- 'permissible_children_expert': function(node,mode) { //{{{
966
- var func = null;
967
- if (mode.match(/into/)) { func = self.adaptor.description.insert_first_into }
968
- else { func = self.adaptor.description.insert_after }
969
- var childs = [
970
- {'label': 'Service Call with Scripts',
971
- 'function_call': func,
972
- 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
973
- 'type': 'callmanipulate',
974
- 'params': [self.adaptor.description.elements.callmanipulate, node]},
975
- {'label': 'Service Call',
976
- 'function_call': func,
977
- 'menu_icon': self.elements.call.illustrator.svg.clone(),
978
- 'type': 'call',
979
- 'params': [self.adaptor.description.elements.call, node]},
980
- {'label': 'Script',
981
- 'function_call': func,
982
- 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
983
- 'type': 'manipulate',
984
- 'params': [self.adaptor.description.elements.manipulate, node]},
985
- {'label': 'Decision',
986
- 'function_call': func,
987
- 'menu_icon': self.elements.choose.illustrator.svg.clone(),
988
- 'type': 'choose',
989
- 'params': [self.adaptor.description.elements.choose, node]},
990
- {'label': 'Loop',
991
- 'function_call': func,
992
- 'menu_icon': self.elements.loop.illustrator.svg.clone(),
993
- 'type': 'loop',
994
- 'params': [self.adaptor.description.elements.loop, node]},
995
- {'label': 'Stop',
996
- 'function_call': func,
997
- 'menu_icon': self.elements.stop.illustrator.svg.clone(),
998
- 'type': 'stop',
999
- 'params': [self.adaptor.description.elements.stop, node]}
1000
- ];
1001
- if(node.get(0).tagName != 'parallel')
1002
- childs.push({'label': 'Parallel',
1003
- 'function_call': self.adaptor.description.insert_last_into,
1004
- 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
1005
- 'type': 'parallel',
1006
- 'params': [self.adaptor.description.elements.parallel, node]});
1007
- return childs;
1008
- }, //}}}
1009
- 'adaptor': {//{{{
1010
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
1011
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
1012
- 'touchend': self.events.touchend,
1013
- 'click': self.events.click,
1014
- 'dblclick': self.events.dblclick,
1015
- 'mouseover': self.events.mouseover,
1016
- 'mouseout': self.events.mouseout,
1017
- }//}}}
1018
- }; /*}}}*/
1019
- this.elements.parallel_branch = { /*{{{*/
1020
- 'type': 'complex',
1021
- 'illustrator': {//{{{
1022
- 'endnodes': 'passthrough',
1023
- 'closeblock': false,
1024
- 'noarrow': true,
1025
- 'expansion': function(node) {
1026
- return 'vertical';
1027
- },
1028
- 'resolve_symbol': function(node,shift) {
1029
- if(shift == true) {
1030
- return 'parallel_branch_compact';
1031
- } else {
1032
- return 'parallel_branch_normal';
1033
- }
1034
- },
1035
- 'col_shift': function(node) {
1036
- if(node.parentNode.tagName == 'choose') return false;
1037
- if($(node).parents('parallel').first().children(':not(parallel_branch)').length > 0) return true;
1038
- return false;
1039
- },
1040
- 'svg': self.adaptor.theme_dir + 'symbols/parallel_branch.svg'
1041
- },//}}}
1042
- 'description': self.adaptor.theme_dir + 'rngs/parallel_branch.rng',
1043
- 'permissible_children': function(node,mode) { //{{{
1044
- var func = null;
1045
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
1046
- else { func = self.adaptor.description.insert_after }
1047
- var childs = [
1048
- {'label': 'Service Call with Scripts',
1049
- 'function_call': func,
1050
- 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
1051
- 'type': 'callmanipulate',
1052
- 'params': [self.adaptor.description.elements.callmanipulate, node]},
1053
- {'label': 'Service Call',
1054
- 'function_call': func,
1055
- 'menu_icon': self.elements.call.illustrator.svg.clone(),
1056
- 'type': 'call',
1057
- 'params': [self.adaptor.description.elements.call, node]},
1058
- {'label': 'Script',
1059
- 'function_call': func,
1060
- 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
1061
- 'type': 'manipulate',
1062
- 'params': [self.adaptor.description.elements.manipulate, node]},
1063
- {'label': 'Parallel',
1064
- 'function_call': func,
1065
- 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
1066
- 'type': 'parallel',
1067
- 'params': [self.adaptor.description.elements.parallel, node]},
1068
- {'label': 'Decision',
1069
- 'function_call': func,
1070
- 'menu_icon': self.elements.choose.illustrator.svg.clone(),
1071
- 'type': 'choose',
1072
- 'params': [self.adaptor.description.elements.choose, node]},
1073
- {'label': 'Loop',
1074
- 'function_call': func,
1075
- 'menu_icon': self.elements.loop.illustrator.svg.clone(),
1076
- 'type': 'loop',
1077
- 'params': [self.adaptor.description.elements.loop, node]},
1078
- {'label': 'Terminate',
1079
- 'function_call': func,
1080
- 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
1081
- 'type': 'terminate',
1082
- 'params': [self.adaptor.description.elements.terminate, node]},
1083
- {'label': 'Stop',
1084
- 'function_call': func,
1085
- 'menu_icon': self.elements.stop.illustrator.svg.clone(),
1086
- 'type': 'stop',
1087
- 'params': [self.adaptor.description.elements.stop, node]},
1088
- {'label': 'Critical',
1089
- 'function_call': func,
1090
- 'menu_icon': self.elements.critical.illustrator.svg.clone(),
1091
- 'type': 'critical',
1092
- 'params': [self.adaptor.description.elements.critical, node]}
1093
- ];
1094
- if(node.parents('choose').length > node.parents('alternative, otherwise').length && node.get(0).tagName == 'parallel_branch') {
1095
- return [{'label': 'Alternative',
1096
- 'function_call': func,
1097
- 'menu_icon': self.elements.alternative.illustrator.svg.clone(),
1098
- 'type': 'alternative',
1099
- 'params': [self.adaptor.description.elements.alternative, node]}];
1100
- }
1101
- return childs;
1102
- }, //}}}
1103
- 'adaptor': {//{{{
1104
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
1105
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
1106
- 'touchend': self.events.touchend,
1107
- 'click': self.events.click,
1108
- 'dblclick': self.events.dblclick,
1109
- 'mouseover': self.events.mouseover,
1110
- 'mouseout': self.events.mouseout,
1111
- }//}}}
1112
- }; /*}}}*/
1113
- this.elements.critical = { /*{{{*/
1114
- 'type': 'complex',
1115
- 'illustrator': {//{{{
1116
- 'endnodes': 'aggregate',
1117
- 'closeblock': false,
1118
- 'border': true,
1119
- 'expansion': function(node) {
1120
- return 'vertical';
1121
- },
1122
- 'col_shift': function(node) {
1123
- return true;
1124
- },
1125
- 'svg': self.adaptor.theme_dir + 'symbols/critical.svg'
1126
- },//}}}
1127
- 'description': self.adaptor.theme_dir + 'rngs/critical.rng',
1128
- 'permissible_children': function(node,mode) { //{{{
1129
- var func = null;
1130
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
1131
- else { func = self.adaptor.description.insert_after }
1132
- var childs = [
1133
- {'label': 'Service Call with Scripts',
1134
- 'function_call': func,
1135
- 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
1136
- 'type': 'callmanipulate',
1137
- 'params': [self.adaptor.description.elements.callmanipulate, node]},
1138
- {'label': 'Service Call',
1139
- 'function_call': func,
1140
- 'menu_icon': self.elements.call.illustrator.svg.clone(),
1141
- 'type': 'call',
1142
- 'params': [self.adaptor.description.elements.call, node]},
1143
- {'label': 'Script',
1144
- 'function_call': func,
1145
- 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
1146
- 'type': 'manipulate',
1147
- 'params': [self.adaptor.description.elements.manipulate, node]},
1148
- {'label': 'Parallel',
1149
- 'function_call': func,
1150
- 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
1151
- 'type': 'parallel',
1152
- 'params': [self.adaptor.description.elements.parallel, node]},
1153
- {'label': 'Decision',
1154
- 'function_call': func,
1155
- 'menu_icon': self.elements.choose.illustrator.svg.clone(),
1156
- 'type': 'choose',
1157
- 'params': [self.adaptor.description.elements.choose, node]},
1158
- {'label': 'Loop',
1159
- 'function_call': func,
1160
- 'menu_icon': self.elements.loop.illustrator.svg.clone(),
1161
- 'type': 'loop',
1162
- 'params': [self.adaptor.description.elements.loop, node]},
1163
- {'label': 'Terminate',
1164
- 'function_call': func,
1165
- 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
1166
- 'type': 'terminate',
1167
- 'params': [self.adaptor.description.elements.terminate, node]},
1168
- {'label': 'Stop',
1169
- 'function_call': func,
1170
- 'menu_icon': self.elements.stop.illustrator.svg.clone(),
1171
- 'type': 'stop',
1172
- 'params': [self.adaptor.description.elements.stop, node]}
1173
- ];
1174
- if(node.parent('parallel_branch').length > 0) {
1175
- childs.push({
1176
- 'label': 'Critical',
1177
- 'function_call': func,
1178
- 'menu_icon': self.elements.critical.illustrator.svg.clone(),
1179
- 'type': 'critical',
1180
- 'params': [self.adaptor.description.elements.critical, node]
1181
- });
1182
- }
1183
- return childs;
1184
- }, //}}}
1185
- 'adaptor': {//{{{
1186
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
1187
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
1188
- 'touchend': self.events.touchend,
1189
- 'click': self.events.click,
1190
- 'dblclick': self.events.dblclick,
1191
- 'mouseover': self.events.mouseover,
1192
- 'mouseout': self.events.mouseout,
1193
- }//}}}
1194
- }; /*}}}*/
1195
- this.elements.group = { /*{{{*/
1196
- 'type': 'complex',
1197
- 'illustrator': {//{{{
1198
- 'endnodes': 'aggregate',
1199
- 'closeblock': false,
1200
- 'border': 'injectiongroup', // other value than true,false inidcates the used class for the svg-object
1201
- 'expansion': function(node) {
1202
- return 'vertical';
1203
- },
1204
- 'col_shift': function(node) {
1205
- return true;
1206
- },
1207
- 'svg': null
1208
- },//}}}
1209
- 'description': self.adaptor.theme_dir + 'rngs/group.rng',
1210
- 'permissible_children': function(node,mode) { //{{{
1211
- var func = null;
1212
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
1213
- else { func = self.adaptor.description.insert_after }
1214
- return [
1215
- ];
1216
- }, //}}}
1217
- 'adaptor': {//{{{
1218
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
1219
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
1220
- 'touchend': self.events.touchend,
1221
- 'click': self.events.click,
1222
- 'dblclick': self.events.dblclick,
1223
- 'mouseover': self.events.mouseover,
1224
- 'mouseout': self.events.mouseout,
1225
- }//}}}
1226
- }; /*}}}*/
1227
- this.elements.start = this.elements.description = { /*{{{*/
1228
- 'type': 'description',
1229
- 'illustrator': {//{{{
1230
- 'endnodes': 'passthrough',
1231
- 'closeblock': false,
1232
- 'balance': true,
1233
- 'expansion': function(node) {
1234
- return 'vertical';
1235
- },
1236
- 'resolve_symbol': function(node) {
1237
- let alist = []
1238
- let plist = []
1239
-
1240
- var regassi = /data\.([a-zA-Z_]+)\s*(=[^=]|\+\=|\-\=|\*\=|\/\=|<<|>>)/g; // we do not have to check for &gt;/&lt; version of stuff as only conditions are in attributes, and conditions can not contain assignments
1241
- var reg_not_assi = /data\.([a-zA-Z_]+)\s*/g;
1242
- $ ('call > parameters > arguments > *, call > code > *, loop[condition], alternative[condition]',node).each(function(i,n) {
1243
- let item;
1244
- if (n.hasAttribute('condition')) {
1245
- item = n.getAttribute('condition');
1246
- } else {
1247
- item = n.textContent;
1248
- }
1249
- if (n.parentNode.nodeName == 'arguments' && item.charAt(0) != '!' ) { return }
1250
-
1251
- let indices = [];
1252
-
1253
- for (const match of item.matchAll(regassi)) {
1254
- indices.push(match.index);
1255
- alist.push(match[1]);
1256
- }
1257
- for (const match of item.matchAll(reg_not_assi)) {
1258
- const arg1 = match[1];
1259
- if (indices.includes(match.index)) { continue; }
1260
- if (!alist.includes(arg1)) { plist.push(arg1); }
1261
- }
1262
- })
1263
- if (plist.length > 0) { return 'start_event'; }
1264
- },
1265
- 'closing_symbol': 'end',
1266
- 'col_shift': function(node) {
1267
- return true;
1268
- },
1269
- 'svg': self.adaptor.theme_dir + 'symbols/start.svg'
1270
- },//}}}
1271
- 'description': self.adaptor.theme_dir + 'rngs/start.rng',
1272
- 'permissible_children': function(node,mode) { //{{{
1273
- var func = null;
1274
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
1275
- else { func = self.adaptor.description.insert_after }
1276
- var childs = [
1277
- {'label': 'Service Call with Scripts',
1278
- 'function_call': func,
1279
- 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
1280
- 'type': 'callmanipulate',
1281
- 'params': [self.adaptor.description.elements.callmanipulate, node]},
1282
- {'label': 'Service Call',
1283
- 'function_call': func,
1284
- 'menu_icon': self.elements.call.illustrator.svg.clone(),
1285
- 'type': 'call',
1286
- 'params': [self.adaptor.description.elements.call, node]},
1287
- {'label': 'Script',
1288
- 'function_call': func,
1289
- 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
1290
- 'type': 'manipulate',
1291
- 'params': [self.adaptor.description.elements.manipulate, node]},
1292
- {'label': 'Parallel',
1293
- 'function_call': func,
1294
- 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
1295
- 'type': 'parallel',
1296
- 'params': [self.adaptor.description.elements.parallel, node]},
1297
- {'label': 'Decision',
1298
- 'function_call': func,
1299
- 'menu_icon': self.elements.choose.illustrator.svg.clone(),
1300
- 'type': 'choose',
1301
- 'params': [self.adaptor.description.elements.choose, node]},
1302
- {'label': 'Loop',
1303
- 'function_call': func,
1304
- 'menu_icon': self.elements.loop.illustrator.svg.clone(),
1305
- 'type': 'loop',
1306
- 'params': [self.adaptor.description.elements.loop, node]},
1307
- {'label': 'Stop',
1308
- 'function_call': func,
1309
- 'menu_icon': self.elements.stop.illustrator.svg.clone(),
1310
- 'type': 'stop',
1311
- 'params': [self.adaptor.description.elements.stop, node]}
1312
- ];
1313
- if(node.parent('parallel_branch').length > 0) {
1314
- childs.push({
1315
- 'label': 'Critical',
1316
- 'function_call': func,
1317
- 'menu_icon': self.elements.critical.illustrator.svg.clone(),
1318
- 'type': 'critical',
1319
- 'params': [self.adaptor.description.elements.critical, node]
1320
- });
1321
- }
1322
- return childs;
1323
- }, //}}}
1324
- 'adaptor': {//{{{
1325
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,false); },
1326
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,false); },
1327
- 'touchend': self.events.touchend,
1328
- 'click': self.events.click,
1329
- 'dblclick': self.events.dblclick,
1330
- 'mouseover': self.events.mouseover,
1331
- 'mouseout': self.events.mouseout,
1332
- }//}}}
1333
- }; /*}}}*/
1334
-
1335
- // Abstract Elements
1336
- // * they may only have an illustrator (or other parts)
1337
- // * they HAVE TO have a parent
1338
- this.elements.start_event = { /*{{{*/
1339
- 'parent': 'start',
1340
- 'illustrator': {//{{{
1341
- 'svg': self.adaptor.theme_dir + 'symbols/start_event.svg'
1342
- }//}}}
1343
- }; /*}}}*/
1344
- this.elements.call_sensor = { /*{{{*/
1345
- 'parent': 'call',
1346
- 'illustrator': {//{{{
1347
- 'svg': self.adaptor.theme_dir + 'symbols/call_sensor.svg'
1348
- }//}}}
1349
- }; /*}}}*/
1350
- this.elements.callmanipulate = { /*{{{*/
1351
- 'parent': 'call',
1352
- 'description': self.adaptor.theme_dir + 'rngs/callmanipulate.rng',
1353
- 'illustrator': {//{{{
1354
- 'svg': self.adaptor.theme_dir + 'symbols/callmanipulate.svg'
1355
- }//}}}
1356
- }; /*}}}*/
1357
- this.elements.callmanipulate_sensor = { /*{{{*/
1358
- 'parent': 'call',
1359
- 'description': self.adaptor.theme_dir + 'rngs/callmanipulate.rng',
1360
- 'illustrator': {//{{{
1361
- 'svg': self.adaptor.theme_dir + 'symbols/callmanipulate_sensor.svg'
1362
- }//}}}
1363
- }; /*}}}*/
1364
- this.elements.loop_head = { /*{{{*/
1365
- 'parent': 'loop',
1366
- 'illustrator': {//{{{
1367
- 'endnodes': 'this',
1368
- 'closeblock': true,
1369
- 'label': function(node){
1370
- var ret = [ { column: 'Label', value: $(node).attr('condition') } ];
1371
- return ret;
1372
- },
1373
- }//}}}
1374
- }; /*}}}*/
1375
- this.elements.loop_tail = { /*{{{*/
1376
- 'parent': 'loop',
1377
- 'illustrator': {//{{{
1378
- 'endnodes': 'aggregate',
1379
- 'closeblock': false,
1380
- 'closing_symbol': 'loop_finish'
1381
- },//}}}
1382
- }; /*}}}*/
1383
- this.elements.choose_inclusive = { /*{{{*/
1384
- 'parent': 'choose',
1385
- 'illustrator': {//{{{
1386
- 'svg': self.adaptor.theme_dir + 'symbols/choose_inclusive.svg'
1387
- }//}}}
1388
- }; /*}}}*/
1389
- this.elements.choose_exclusive = { /*{{{*/
1390
- 'parent': 'choose',
1391
- 'illustrator': {//{{{
1392
- 'svg': self.adaptor.theme_dir + 'symbols/choose_exclusive.svg'
1393
- },//}}}
1394
- }; /*}}}*/
1395
- this.elements.choose_inclusive_finish = { /*{{{*/
1396
- 'parent': 'choose_finish',
1397
- 'illustrator': {//{{{
1398
- 'svg': self.adaptor.theme_dir + 'symbols/choose_inclusive.svg'
1399
- }//}}}
1400
- }; /*}}}*/
1401
- this.elements.choose_exclusive_finish = { /*{{{*/
1402
- 'parent': 'choose_finish',
1403
- 'illustrator': {//{{{
1404
- 'svg': self.adaptor.theme_dir + 'symbols/choose_exclusive.svg'
1405
- },//}}}
1406
- }; /*}}}*/
1407
- this.elements.loop_head_finish = { /*{{{*/
1408
- 'parent': 'loop_finish',
1409
- 'illustrator': {//{{{
1410
- 'endnodes': 'this',
1411
- 'closeblock': true,
1412
- 'svg': self.adaptor.theme_dir + 'symbols/choose_exclusive.svg'
1413
- }//}}}
1414
- }; /*}}}*/
1415
- this.elements.loop_tail_finish = { /*{{{*/
1416
- 'parent': 'loop_finish',
1417
- 'illustrator': {//{{{
1418
- 'endnodes': 'this',
1419
- 'closeblock': false,
1420
- 'svg': self.adaptor.theme_dir + 'symbols/choose_exclusive.svg'
1421
- },//}}}
1422
- }; /*}}}*/
1423
- this.elements.parallel_start = { /*{{{*/
1424
- 'parent': 'parallel',
1425
- 'illustrator': {//{{{
1426
- 'svg': self.adaptor.theme_dir + 'symbols/parallel.svg'
1427
- }//}}}
1428
- }; /*}}}*/
1429
- this.elements.parallel_eventbased_exclusive = { /*{{{*/
1430
- 'parent': 'parallel',
1431
- 'illustrator': {//{{{
1432
- 'svg': self.adaptor.theme_dir + 'symbols/parallel_eventbased_exclusive.svg'
1433
- }//}}}
1434
- }; /*}}}*/
1435
- this.elements.parallel_eventbased_parallel = { /*{{{*/
1436
- 'parent': 'parallel',
1437
- 'illustrator': {//{{{
1438
- 'svg': self.adaptor.theme_dir + 'symbols/parallel_eventbased_parallel.svg'
1439
- }//}}}
1440
- }; /*}}}*/
1441
- this.elements.parallel_simple = { /*{{{*/
1442
- 'parent': 'parallel_finish',
1443
- 'illustrator': {//{{{
1444
- 'svg': self.adaptor.theme_dir + 'symbols/parallel.svg'
1445
- }//}}}
1446
- }; /*}}}*/
1447
- this.elements.parallel_complex = { /*{{{*/
1448
- 'parent': 'parallel_finish',
1449
- 'illustrator': {//{{{
1450
- 'svg': self.adaptor.theme_dir + 'symbols/complex.svg'
1451
- },//}}}
1452
- }; /*}}}*/
1453
- this.elements.parallel_event_all = { /*{{{*/
1454
- 'parent': 'parallel_finish',
1455
- 'illustrator': {//{{{
1456
- 'svg': self.adaptor.theme_dir + 'symbols/parallel_eventbased_parallel.svg'
1457
- }//}}}
1458
- }; /*}}}*/
1459
- this.elements.parallel_event_one = { /*{{{*/
1460
- 'parent': 'parallel_finish',
1461
- 'illustrator': {//{{{
1462
- 'svg': self.adaptor.theme_dir + 'symbols/choose_exclusive.svg'
1463
- }//}}}
1464
- }; /*}}}*/
1465
- this.elements.parallel_branch_normal = { /*{{{*/
1466
- 'parent': 'parallel_branch',
1467
- 'illustrator': {//{{{
1468
- 'svg': self.adaptor.theme_dir + 'symbols/parallel_branch_normal.svg'
1469
- }//}}}
1470
- }; /*}}}*/
1471
- this.elements.parallel_branch_event = { /*{{{*/
1472
- 'parent': 'parallel_branch',
1473
- 'illustrator': {//{{{
1474
- 'endnodes': 'this',
1475
- 'noarrow': false,
1476
- 'border': true,
1477
- 'wide': true,
1478
- 'closing_symbol': 'event_end',
1479
- 'svg': self.adaptor.theme_dir + 'symbols/parallel_branch_event.svg'
1480
- }//}}}
1481
- }; /*}}}*/
1482
- this.elements.parallel_branch_compact = { /*{{{*/
1483
- 'parent': 'parallel_branch',
1484
- 'illustrator': {//{{{
1485
- 'endnodes': 'this',
1486
- 'svg': self.adaptor.theme_dir + 'symbols/parallel_branch_compact.svg'
1487
- }//}}}
1488
- }; /*}}}*/
1489
- this.elements.scripts = { /*{{{*/
1490
- 'description': [self.adaptor.theme_dir + 'rngs/scripts.rng']
1491
- }; /*}}}*/
1492
14
  }