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,1493 +1 @@
1
- function WFAdaptorManifestation(adaptor) {
2
- var self = this;
3
-
4
- this.adaptor = adaptor;
5
- this.resources = {};
6
- this.elements = {};
7
- this.events = {};
8
- this.compact = false;
9
- this.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);
273
- } else {
274
- add_ui_pos(xml_node);
275
- }
276
- }
277
- }
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
- 'closing_symbol': 'choose_finish',
599
- 'expansion': function(node) {
600
- return 'horizontal';
601
- },
602
- 'resolve_symbol': function(node) {
603
- if($(node).attr('mode') == 'exclusive') {
604
- return 'choose_exclusive';
605
- } else {
606
- return 'choose_inclusive';
607
- }
608
- },
609
- 'col_shift': function(node) {
610
- return false;
611
- },
612
- 'svg': self.adaptor.theme_dir + 'symbols/choose.svg'
613
- },//}}}
614
- 'description': self.adaptor.theme_dir + 'rngs/choose.rng',
615
- 'permissible_children': function(node,mode) { //{{{
616
- var func = null;
617
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
618
- else { func = self.adaptor.description.insert_after }
619
- if(node.children('parallel_branch').length > 0) {
620
- return [{'label': 'Parallel Branch',
621
- 'function_call': func,
622
- 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
623
- 'type': 'parallel_branch',
624
- 'params': [self.adaptor.description.elements.parallel_branch, node]}];
625
- }
626
- var childs = [{'label': 'Alternative',
627
- 'function_call': func,
628
- 'menu_icon': self.elements.alternative.illustrator.svg.clone(),
629
- 'type': 'alternative',
630
- 'params': [self.adaptor.description.elements.alternative, node]}];
631
- if((node.children('otherwise').length == 0) && node.parents('parallel').length == node.parents('parallel_branch').length && node.parent('choose').length == 0)
632
- childs.push({'label': 'Otherwise',
633
- 'function_call': self.adaptor.description.insert_last_into,
634
- 'menu_icon': self.elements.otherwise.illustrator.svg.clone(),
635
- 'type': 'otherwise',
636
- 'params': [self.adaptor.description.elements.otherwise, node]});
637
- if(node.parents('parallel').length > node.parents('parallel_branch').length)
638
- childs.push({'label': 'Parallel Branch',
639
- 'function_call': func,
640
- 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
641
- 'type': 'parallel_branch',
642
- 'params': [self.adaptor.description.elements.parallel_branch, node]});
643
- return childs;
644
- }, //}}}
645
- 'adaptor': {//{{{
646
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
647
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
648
- 'touchend': self.events.touchend,
649
- 'click': self.events.click,
650
- 'dblclick': self.events.dblclick,
651
- 'mouseover': self.events.mouseover,
652
- 'mouseout': self.events.mouseout
653
- }//}}}
654
- }; /*}}}*/
655
- this.elements.otherwise = { /*{{{*/
656
- 'type': 'complex',
657
- 'illustrator': {//{{{
658
- 'endnodes': 'passthrough',
659
- 'closeblock': false,
660
- 'noarrow': true,
661
- 'expansion': function(node) {
662
- return 'vertical';
663
- },
664
- 'col_shift': function(node) {
665
- return false;
666
- },
667
- 'svg': self.adaptor.theme_dir + 'symbols/otherwise.svg'
668
- },//}}}
669
- 'description': self.adaptor.theme_dir + 'rngs/otherwise.rng',
670
- 'neverdelete': true,
671
- 'permissible_children': function(node,mode) { //{{{
672
- var func = null;
673
- var childs = null;
674
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
675
- else { func = self.adaptor.description.insert_after }
676
- var childs = [
677
- {'label': 'Service Call with Scripts',
678
- 'function_call': func,
679
- 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
680
- 'type': 'callmanipulate',
681
- 'params': [self.adaptor.description.elements.callmanipulate, node]},
682
- {'label': 'Service Call',
683
- 'function_call': func,
684
- 'menu_icon': self.elements.call.illustrator.svg.clone(),
685
- 'type': 'call',
686
- 'params': [self.adaptor.description.elements.call, node]},
687
- {'label': 'Script',
688
- 'function_call': func,
689
- 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
690
- 'type': 'manipulate',
691
- 'params': [self.adaptor.description.elements.manipulate, node]},
692
- {'label': 'Parallel',
693
- 'function_call': func,
694
- 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
695
- 'type': 'parallel',
696
- 'params': [self.adaptor.description.elements.parallel, node]},
697
- {'label': 'Decision',
698
- 'function_call': func,
699
- 'menu_icon': self.elements.choose.illustrator.svg.clone(),
700
- 'type': 'choose',
701
- 'params': [self.adaptor.description.elements.choose, node]},
702
- {'label': 'Loop',
703
- 'function_call': func,
704
- 'menu_icon': self.elements.loop.illustrator.svg.clone(),
705
- 'type': 'loop',
706
- 'params': [self.adaptor.description.elements.loop, node]},
707
- {'label': 'Terminate',
708
- 'function_call': func,
709
- 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
710
- 'type': 'terminate',
711
- 'params': [self.adaptor.description.elements.terminate, node]},
712
- {'label': 'Stop',
713
- 'function_call': func,
714
- 'menu_icon': self.elements.stop.illustrator.svg.clone(),
715
- 'type': 'stop',
716
- 'params': [self.adaptor.description.elements.stop, node]}
717
- ];
718
- if(node.parent('parallel_branch').length > 0) {
719
- childs.push({
720
- 'label': 'Critical',
721
- 'function_call': func,
722
- 'menu_icon': self.elements.critical.illustrator.svg.clone(),
723
- 'type': 'critical',
724
- 'params': [self.adaptor.description.elements.critical, node]
725
- });
726
- }
727
- return childs;
728
- }, //}}}
729
- 'adaptor': {//{{{
730
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,false); },
731
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,false); },
732
- 'touchend': self.events.touchend,
733
- 'click': self.events.click,
734
- 'dblclick': self.events.dblclick,
735
- 'mouseover': self.events.mouseover,
736
- 'mouseout': self.events.mouseout,
737
- }//}}}
738
- }; /*}}}*/
739
- this.elements.alternative = { /*{{{*/
740
- 'type': 'complex',
741
- 'illustrator': {//{{{
742
- 'label': function(node){
743
- var ret = [ { column: 'Label', value: $(node).attr('condition') } ];
744
- return ret;
745
- },
746
- 'endnodes': 'passthrough',
747
- 'noarrow': true,
748
- 'closeblock':false,
749
- 'expansion': function(node) {
750
- return 'vertical';
751
- },
752
- 'col_shift': function(node) {
753
- return false;
754
- },
755
- 'svg': self.adaptor.theme_dir + 'symbols/alternative.svg'
756
- },//}}}
757
- 'description': self.adaptor.theme_dir + 'rngs/alternative.rng',
758
- 'permissible_children': function(node,mode) { //{{{
759
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
760
- else { func = self.adaptor.description.insert_after }
761
- if(node.parents('parallel').length > node.parents('parallel_branch').length && node.get(0).tagName == 'alternative') {
762
- return [{'label': 'Parallel Branch',
763
- 'function_call': func,
764
- 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
765
- 'type': 'parallel_branch',
766
- 'params': [self.adaptor.description.elements.parallel_branch, node]}];
767
- }
768
- var childs = [
769
- {'label': 'Service Call with Scripts',
770
- 'function_call': func,
771
- 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
772
- 'type': 'callmanipulate',
773
- 'params': [self.adaptor.description.elements.callmanipulate, node]},
774
- {'label': 'Service Call',
775
- 'function_call': func,
776
- 'menu_icon': self.elements.call.illustrator.svg.clone(),
777
- 'type': 'call',
778
- 'params': [self.adaptor.description.elements.call, node]},
779
- {'label': 'Script',
780
- 'function_call': func,
781
- 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
782
- 'type': 'manipulate',
783
- 'params': [self.adaptor.description.elements.manipulate, node]},
784
- {'label': 'Parallel',
785
- 'function_call': func,
786
- 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
787
- 'type': 'parallel',
788
- 'params': [self.adaptor.description.elements.parallel, node]},
789
- {'label': 'Decision',
790
- 'function_call': func,
791
- 'menu_icon': self.elements.choose.illustrator.svg.clone(),
792
- 'type': 'choose',
793
- 'params': [self.adaptor.description.elements.choose, node]},
794
- {'label': 'Loop',
795
- 'function_call': func,
796
- 'menu_icon': self.elements.loop.illustrator.svg.clone(),
797
- 'type': 'loop',
798
- 'params': [self.adaptor.description.elements.loop, node]},
799
- {'label': 'Terminate',
800
- 'function_call': func,
801
- 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
802
- 'type': 'terminate',
803
- 'params': [self.adaptor.description.elements.terminate, node]},
804
- {'label': 'Stop',
805
- 'function_call': func,
806
- 'menu_icon': self.elements.stop.illustrator.svg.clone(),
807
- 'type': 'stop',
808
- 'params': [self.adaptor.description.elements.stop, node]}
809
- ];
810
- if(node.parent('parallel_branch').length > 0) {
811
- childs.push({
812
- 'label': 'Critical',
813
- 'function_call': func,
814
- 'menu_icon': self.elements.critical.illustrator.svg.clone(),
815
- 'type': 'critical',
816
- 'params': [self.adaptor.description.elements.critical, node]
817
- });
818
- }
819
- return childs;
820
- }, //}}}
821
- 'adaptor': {//{{{
822
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
823
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
824
- 'touchend': self.events.touchend,
825
- 'click': self.events.click,
826
- 'dblclick': self.events.dblclick,
827
- 'mouseover': self.events.mouseover,
828
- 'mouseout': self.events.mouseout,
829
- }//}}}
830
- }; /*}}}*/
831
- this.elements.loop = { /*{{{*/
832
- 'type': 'complex',
833
- 'illustrator': {//{{{
834
- 'resolve_symbol': function(node) {
835
- if($(node).attr('mode') == 'pre_test') {
836
- return 'loop_head';
837
- } else {
838
- return 'loop_tail';
839
- }
840
- },
841
- 'expansion': function(node) {
842
- return 'vertical';
843
- },
844
- 'col_shift': function(node) {
845
- return true;
846
- },
847
- 'svg': self.adaptor.theme_dir + 'symbols/loop.svg'
848
- },// }}}
849
- 'description': self.adaptor.theme_dir + 'rngs/loop.rng',
850
- 'permissible_children': function(node,mode) { //{{{
851
- var func = null;
852
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
853
- else { func = self.adaptor.description.insert_after }
854
- var childs = [
855
- {'label': 'Service Call with Scripts',
856
- 'function_call': func,
857
- 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
858
- 'type': 'callmanipulate',
859
- 'params': [self.adaptor.description.elements.callmanipulate, node]},
860
- {'label': 'Service Call',
861
- 'function_call': func,
862
- 'menu_icon': self.elements.call.illustrator.svg.clone(),
863
- 'type': 'call',
864
- 'params': [self.adaptor.description.elements.call, node]},
865
- {'label': 'Script',
866
- 'function_call': func,
867
- 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
868
- 'type': 'manipulate',
869
- 'params': [self.adaptor.description.elements.manipulate, node]},
870
- {'label': 'Decision',
871
- 'function_call': func,
872
- 'menu_icon': self.elements.choose.illustrator.svg.clone(),
873
- 'type': 'choose',
874
- 'params': [self.adaptor.description.elements.choose, node]},
875
- {'label': 'Loop',
876
- 'function_call': func,
877
- 'menu_icon': self.elements.loop.illustrator.svg.clone(),
878
- 'type': 'loop',
879
- 'params': [self.adaptor.description.elements.loop, node]},
880
- {'label': 'Terminate',
881
- 'function_call': func,
882
- 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
883
- 'type': 'terminate',
884
- 'params': [self.adaptor.description.elements.terminate, node]},
885
- {'label': 'Stop',
886
- 'function_call': func,
887
- 'menu_icon': self.elements.stop.illustrator.svg.clone(),
888
- 'type': 'stop',
889
- 'params': [self.adaptor.description.elements.stop, node]}
890
- ];
891
- if(node.parent('parallel_branch').length > 0) {
892
- childs.push({
893
- 'label': 'Critical',
894
- 'function_call': func,
895
- 'menu_icon': self.elements.critical.illustrator.svg.clone(),
896
- 'type': 'critical',
897
- 'params': [self.adaptor.description.elements.critical, node]
898
- });
899
- }
900
- if(node.parent('parallel').length > node.parent('parallel_branch').length) {
901
- childs.push({'label': 'Parallel Branch',
902
- 'function_call': func,
903
- 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
904
- 'type': 'parallel_branch',
905
- 'params': [self.adaptor.description.elements.parallel_branch, node]}
906
- );
907
- } else {
908
- childs.push({'label': 'Parallel',
909
- 'function_call': func,
910
- 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
911
- 'type': 'parallel',
912
- 'params': [self.adaptor.description.elements.parallel, node]}
913
- );
914
- }
915
- return childs;
916
- }, //}}}
917
- 'adaptor': {//{{{
918
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
919
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
920
- 'touchend': self.events.touchend,
921
- 'click': self.events.click,
922
- 'dblclick': self.events.dblclick,
923
- 'mouseover': self.events.mouseover,
924
- 'mouseout': self.events.mouseout,
925
- }//}}}
926
- }; /*}}}*/
927
- this.elements.parallel = { /*{{{*/
928
- 'type': 'complex',
929
- 'illustrator': {//{{{
930
- 'endnodes': 'aggregate',
931
- 'closeblock': false,
932
- 'closing_symbol': 'parallel_finish',
933
- 'expansion': function(node) {
934
- // check if any sibling other than 'parallel_branch' is present
935
- if($(node).children(':not(parallel_branch)').length > 0) return 'vertical';
936
- return 'horizontal';
937
- },
938
- 'col_shift': function(node) {
939
- return true;
940
- },
941
- 'svg': self.adaptor.theme_dir + 'symbols/parallel.svg',
942
- 'resolve_symbol': function(node) {
943
- if($(node).attr('cancel') == 'last') {
944
- return 'parallel_start';
945
- } else if($(node).attr('cancel') == 'first' && $(node).attr('wait') == 1) {
946
- return 'parallel_eventbased_exclusive';
947
- } else {
948
- return 'parallel_eventbased_parallel';
949
- }
950
- },
951
- },//}}}
952
- 'description': self.adaptor.theme_dir + 'rngs/parallel.rng',
953
- 'permissible_children': function(node,mode) { //{{{
954
- var func = null;
955
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
956
- else { func = self.adaptor.description.insert_after }
957
- var childs = [
958
- {'label': 'Parallel Branch',
959
- 'function_call': func,
960
- 'menu_icon': self.elements.parallel_branch.illustrator.svg.clone(),
961
- 'type': 'parallel_branch',
962
- 'params': [self.adaptor.description.elements.parallel_branch, node]},
963
- ];
964
- return childs;
965
- }, //}}}
966
- 'permissible_children_expert': function(node,mode) { //{{{
967
- var func = null;
968
- if (mode.match(/into/)) { func = self.adaptor.description.insert_first_into }
969
- else { func = self.adaptor.description.insert_after }
970
- var childs = [
971
- {'label': 'Service Call with Scripts',
972
- 'function_call': func,
973
- 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
974
- 'type': 'callmanipulate',
975
- 'params': [self.adaptor.description.elements.callmanipulate, node]},
976
- {'label': 'Service Call',
977
- 'function_call': func,
978
- 'menu_icon': self.elements.call.illustrator.svg.clone(),
979
- 'type': 'call',
980
- 'params': [self.adaptor.description.elements.call, node]},
981
- {'label': 'Script',
982
- 'function_call': func,
983
- 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
984
- 'type': 'manipulate',
985
- 'params': [self.adaptor.description.elements.manipulate, node]},
986
- {'label': 'Decision',
987
- 'function_call': func,
988
- 'menu_icon': self.elements.choose.illustrator.svg.clone(),
989
- 'type': 'choose',
990
- 'params': [self.adaptor.description.elements.choose, node]},
991
- {'label': 'Loop',
992
- 'function_call': func,
993
- 'menu_icon': self.elements.loop.illustrator.svg.clone(),
994
- 'type': 'loop',
995
- 'params': [self.adaptor.description.elements.loop, node]},
996
- {'label': 'Stop',
997
- 'function_call': func,
998
- 'menu_icon': self.elements.stop.illustrator.svg.clone(),
999
- 'type': 'stop',
1000
- 'params': [self.adaptor.description.elements.stop, node]}
1001
- ];
1002
- if(node.get(0).tagName != 'parallel')
1003
- childs.push({'label': 'Parallel',
1004
- 'function_call': self.adaptor.description.insert_last_into,
1005
- 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
1006
- 'type': 'parallel',
1007
- 'params': [self.adaptor.description.elements.parallel, node]});
1008
- return childs;
1009
- }, //}}}
1010
- 'adaptor': {//{{{
1011
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
1012
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
1013
- 'touchend': self.events.touchend,
1014
- 'click': self.events.click,
1015
- 'dblclick': self.events.dblclick,
1016
- 'mouseover': self.events.mouseover,
1017
- 'mouseout': self.events.mouseout,
1018
- }//}}}
1019
- }; /*}}}*/
1020
- this.elements.parallel_branch = { /*{{{*/
1021
- 'type': 'complex',
1022
- 'illustrator': {//{{{
1023
- 'endnodes': 'passthrough',
1024
- 'closeblock': false,
1025
- 'noarrow': true,
1026
- 'expansion': function(node) {
1027
- return 'vertical';
1028
- },
1029
- 'resolve_symbol': function(node,shift) {
1030
- if(shift == true) {
1031
- return 'parallel_branch_event';
1032
- } else {
1033
- return 'parallel_branch_normal';
1034
- }
1035
- },
1036
- 'col_shift': function(node) {
1037
- if(node.parentNode.tagName == 'choose') return false;
1038
- if($(node).parents('parallel').first().children(':not(parallel_branch)').length > 0) return true;
1039
- return false;
1040
- },
1041
- 'svg': self.adaptor.theme_dir + 'symbols/parallel_branch.svg'
1042
- },//}}}
1043
- 'description': self.adaptor.theme_dir + 'rngs/parallel_branch.rng',
1044
- 'permissible_children': function(node,mode) { //{{{
1045
- var func = null;
1046
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
1047
- else { func = self.adaptor.description.insert_after }
1048
- var childs = [
1049
- {'label': 'Service Call with Scripts',
1050
- 'function_call': func,
1051
- 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
1052
- 'type': 'callmanipulate',
1053
- 'params': [self.adaptor.description.elements.callmanipulate, node]},
1054
- {'label': 'Service Call',
1055
- 'function_call': func,
1056
- 'menu_icon': self.elements.call.illustrator.svg.clone(),
1057
- 'type': 'call',
1058
- 'params': [self.adaptor.description.elements.call, node]},
1059
- {'label': 'Script',
1060
- 'function_call': func,
1061
- 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
1062
- 'type': 'manipulate',
1063
- 'params': [self.adaptor.description.elements.manipulate, node]},
1064
- {'label': 'Parallel',
1065
- 'function_call': func,
1066
- 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
1067
- 'type': 'parallel',
1068
- 'params': [self.adaptor.description.elements.parallel, node]},
1069
- {'label': 'Decision',
1070
- 'function_call': func,
1071
- 'menu_icon': self.elements.choose.illustrator.svg.clone(),
1072
- 'type': 'choose',
1073
- 'params': [self.adaptor.description.elements.choose, node]},
1074
- {'label': 'Loop',
1075
- 'function_call': func,
1076
- 'menu_icon': self.elements.loop.illustrator.svg.clone(),
1077
- 'type': 'loop',
1078
- 'params': [self.adaptor.description.elements.loop, node]},
1079
- {'label': 'Terminate',
1080
- 'function_call': func,
1081
- 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
1082
- 'type': 'terminate',
1083
- 'params': [self.adaptor.description.elements.terminate, node]},
1084
- {'label': 'Stop',
1085
- 'function_call': func,
1086
- 'menu_icon': self.elements.stop.illustrator.svg.clone(),
1087
- 'type': 'stop',
1088
- 'params': [self.adaptor.description.elements.stop, node]},
1089
- {'label': 'Critical',
1090
- 'function_call': func,
1091
- 'menu_icon': self.elements.critical.illustrator.svg.clone(),
1092
- 'type': 'critical',
1093
- 'params': [self.adaptor.description.elements.critical, node]}
1094
- ];
1095
- if(node.parents('choose').length > node.parents('alternative, otherwise').length && node.get(0).tagName == 'parallel_branch') {
1096
- return [{'label': 'Alternative',
1097
- 'function_call': func,
1098
- 'menu_icon': self.elements.alternative.illustrator.svg.clone(),
1099
- 'type': 'alternative',
1100
- 'params': [self.adaptor.description.elements.alternative, node]}];
1101
- }
1102
- return childs;
1103
- }, //}}}
1104
- 'adaptor': {//{{{
1105
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
1106
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
1107
- 'touchend': self.events.touchend,
1108
- 'click': self.events.click,
1109
- 'dblclick': self.events.dblclick,
1110
- 'mouseover': self.events.mouseover,
1111
- 'mouseout': self.events.mouseout,
1112
- }//}}}
1113
- }; /*}}}*/
1114
- this.elements.critical = { /*{{{*/
1115
- 'type': 'complex',
1116
- 'illustrator': {//{{{
1117
- 'endnodes': 'aggregate',
1118
- 'closeblock': false,
1119
- 'border': true,
1120
- 'expansion': function(node) {
1121
- return 'vertical';
1122
- },
1123
- 'col_shift': function(node) {
1124
- return true;
1125
- },
1126
- 'svg': self.adaptor.theme_dir + 'symbols/critical.svg'
1127
- },//}}}
1128
- 'description': self.adaptor.theme_dir + 'rngs/critical.rng',
1129
- 'permissible_children': function(node,mode) { //{{{
1130
- var func = null;
1131
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
1132
- else { func = self.adaptor.description.insert_after }
1133
- var childs = [
1134
- {'label': 'Service Call with Scripts',
1135
- 'function_call': func,
1136
- 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
1137
- 'type': 'callmanipulate',
1138
- 'params': [self.adaptor.description.elements.callmanipulate, node]},
1139
- {'label': 'Service Call',
1140
- 'function_call': func,
1141
- 'menu_icon': self.elements.call.illustrator.svg.clone(),
1142
- 'type': 'call',
1143
- 'params': [self.adaptor.description.elements.call, node]},
1144
- {'label': 'Script',
1145
- 'function_call': func,
1146
- 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
1147
- 'type': 'manipulate',
1148
- 'params': [self.adaptor.description.elements.manipulate, node]},
1149
- {'label': 'Parallel',
1150
- 'function_call': func,
1151
- 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
1152
- 'type': 'parallel',
1153
- 'params': [self.adaptor.description.elements.parallel, node]},
1154
- {'label': 'Decision',
1155
- 'function_call': func,
1156
- 'menu_icon': self.elements.choose.illustrator.svg.clone(),
1157
- 'type': 'choose',
1158
- 'params': [self.adaptor.description.elements.choose, node]},
1159
- {'label': 'Loop',
1160
- 'function_call': func,
1161
- 'menu_icon': self.elements.loop.illustrator.svg.clone(),
1162
- 'type': 'loop',
1163
- 'params': [self.adaptor.description.elements.loop, node]},
1164
- {'label': 'Terminate',
1165
- 'function_call': func,
1166
- 'menu_icon': self.elements.terminate.illustrator.svg.clone(),
1167
- 'type': 'terminate',
1168
- 'params': [self.adaptor.description.elements.terminate, node]},
1169
- {'label': 'Stop',
1170
- 'function_call': func,
1171
- 'menu_icon': self.elements.stop.illustrator.svg.clone(),
1172
- 'type': 'stop',
1173
- 'params': [self.adaptor.description.elements.stop, node]}
1174
- ];
1175
- if(node.parent('parallel_branch').length > 0) {
1176
- childs.push({
1177
- 'label': 'Critical',
1178
- 'function_call': func,
1179
- 'menu_icon': self.elements.critical.illustrator.svg.clone(),
1180
- 'type': 'critical',
1181
- 'params': [self.adaptor.description.elements.critical, node]
1182
- });
1183
- }
1184
- return childs;
1185
- }, //}}}
1186
- 'adaptor': {//{{{
1187
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
1188
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
1189
- 'touchend': self.events.touchend,
1190
- 'click': self.events.click,
1191
- 'dblclick': self.events.dblclick,
1192
- 'mouseover': self.events.mouseover,
1193
- 'mouseout': self.events.mouseout,
1194
- }//}}}
1195
- }; /*}}}*/
1196
- this.elements.group = { /*{{{*/
1197
- 'type': 'complex',
1198
- 'illustrator': {//{{{
1199
- 'endnodes': 'aggregate',
1200
- 'closeblock': false,
1201
- 'border': 'injectiongroup', // other value than true,false inidcates the used class for the svg-object
1202
- 'expansion': function(node) {
1203
- return 'vertical';
1204
- },
1205
- 'col_shift': function(node) {
1206
- return true;
1207
- },
1208
- 'svg': null
1209
- },//}}}
1210
- 'description': self.adaptor.theme_dir + 'rngs/group.rng',
1211
- 'permissible_children': function(node,mode) { //{{{
1212
- var func = null;
1213
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
1214
- else { func = self.adaptor.description.insert_after }
1215
- return [
1216
- ];
1217
- }, //}}}
1218
- 'adaptor': {//{{{
1219
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,true); },
1220
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,true); },
1221
- 'touchend': self.events.touchend,
1222
- 'click': self.events.click,
1223
- 'dblclick': self.events.dblclick,
1224
- 'mouseover': self.events.mouseover,
1225
- 'mouseout': self.events.mouseout,
1226
- }//}}}
1227
- }; /*}}}*/
1228
- this.elements.start = this.elements.description = { /*{{{*/
1229
- 'type': 'description',
1230
- 'illustrator': {//{{{
1231
- 'endnodes': 'passthrough',
1232
- 'closeblock': false,
1233
- 'balance': true,
1234
- 'expansion': function(node) {
1235
- return 'vertical';
1236
- },
1237
- 'resolve_symbol': function(node) {
1238
- let alist = []
1239
- let plist = []
1240
-
1241
- 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
1242
- var reg_not_assi = /data\.([a-zA-Z_]+)\s*/g;
1243
- $ ('call > parameters > arguments > *, call > code > *, loop[condition], alternative[condition]',node).each(function(i,n) {
1244
- let item;
1245
- if (n.hasAttribute('condition')) {
1246
- item = n.getAttribute('condition');
1247
- } else {
1248
- item = n.textContent;
1249
- }
1250
- if (n.parentNode.nodeName == 'arguments' && item.charAt(0) != '!' ) { return }
1251
-
1252
- let indices = [];
1253
-
1254
- for (const match of item.matchAll(regassi)) {
1255
- indices.push(match.index);
1256
- alist.push(match[1]);
1257
- }
1258
- for (const match of item.matchAll(reg_not_assi)) {
1259
- const arg1 = match[1];
1260
- if (indices.includes(match.index)) { continue; }
1261
- if (!alist.includes(arg1)) { plist.push(arg1); }
1262
- }
1263
- })
1264
- if (plist.length > 0) { return 'start_event'; }
1265
- },
1266
- 'closing_symbol': 'end',
1267
- 'col_shift': function(node) {
1268
- return true;
1269
- },
1270
- 'svg': self.adaptor.theme_dir + 'symbols/start.svg'
1271
- },//}}}
1272
- 'description': self.adaptor.theme_dir + 'rngs/start.rng',
1273
- 'permissible_children': function(node,mode) { //{{{
1274
- var func = null;
1275
- if (mode == 'into') { func = self.adaptor.description.insert_first_into }
1276
- else { func = self.adaptor.description.insert_after }
1277
- var childs = [
1278
- {'label': 'Service Call with Scripts',
1279
- 'function_call': func,
1280
- 'menu_icon': self.elements.callmanipulate.illustrator.svg.clone(),
1281
- 'type': 'callmanipulate',
1282
- 'params': [self.adaptor.description.elements.callmanipulate, node]},
1283
- {'label': 'Service Call',
1284
- 'function_call': func,
1285
- 'menu_icon': self.elements.call.illustrator.svg.clone(),
1286
- 'type': 'call',
1287
- 'params': [self.adaptor.description.elements.call, node]},
1288
- {'label': 'Script',
1289
- 'function_call': func,
1290
- 'menu_icon': self.elements.manipulate.illustrator.svg.clone(),
1291
- 'type': 'manipulate',
1292
- 'params': [self.adaptor.description.elements.manipulate, node]},
1293
- {'label': 'Parallel',
1294
- 'function_call': func,
1295
- 'menu_icon': self.elements.parallel.illustrator.svg.clone(),
1296
- 'type': 'parallel',
1297
- 'params': [self.adaptor.description.elements.parallel, node]},
1298
- {'label': 'Decision',
1299
- 'function_call': func,
1300
- 'menu_icon': self.elements.choose.illustrator.svg.clone(),
1301
- 'type': 'choose',
1302
- 'params': [self.adaptor.description.elements.choose, node]},
1303
- {'label': 'Loop',
1304
- 'function_call': func,
1305
- 'menu_icon': self.elements.loop.illustrator.svg.clone(),
1306
- 'type': 'loop',
1307
- 'params': [self.adaptor.description.elements.loop, node]},
1308
- {'label': 'Stop',
1309
- 'function_call': func,
1310
- 'menu_icon': self.elements.stop.illustrator.svg.clone(),
1311
- 'type': 'stop',
1312
- 'params': [self.adaptor.description.elements.stop, node]}
1313
- ];
1314
- if(node.parent('parallel_branch').length > 0) {
1315
- childs.push({
1316
- 'label': 'Critical',
1317
- 'function_call': func,
1318
- 'menu_icon': self.elements.critical.illustrator.svg.clone(),
1319
- 'type': 'critical',
1320
- 'params': [self.adaptor.description.elements.critical, node]
1321
- });
1322
- }
1323
- return childs;
1324
- }, //}}}
1325
- 'adaptor': {//{{{
1326
- 'mousedown': function (node,e) { self.events.mousedown(node,e,true,false); },
1327
- 'touchstart': function (node,e) { self.events.touchstart(node,e,true,false); },
1328
- 'touchend': self.events.touchend,
1329
- 'click': self.events.click,
1330
- 'dblclick': self.events.dblclick,
1331
- 'mouseover': self.events.mouseover,
1332
- 'mouseout': self.events.mouseout,
1333
- }//}}}
1334
- }; /*}}}*/
1335
-
1336
- // Abstract Elements
1337
- // * they may only have an illustrator (or other parts)
1338
- // * they HAVE TO have a parent
1339
- this.elements.start_event = { /*{{{*/
1340
- 'parent': 'start',
1341
- 'illustrator': {//{{{
1342
- 'svg': self.adaptor.theme_dir + 'symbols/start_event.svg'
1343
- }//}}}
1344
- }; /*}}}*/
1345
- this.elements.call_sensor = { /*{{{*/
1346
- 'parent': 'call',
1347
- 'illustrator': {//{{{
1348
- 'svg': self.adaptor.theme_dir + 'symbols/call_sensor.svg'
1349
- }//}}}
1350
- }; /*}}}*/
1351
- this.elements.callmanipulate = { /*{{{*/
1352
- 'parent': 'call',
1353
- 'description': self.adaptor.theme_dir + 'rngs/callmanipulate.rng',
1354
- 'illustrator': {//{{{
1355
- 'svg': self.adaptor.theme_dir + 'symbols/callmanipulate.svg'
1356
- }//}}}
1357
- }; /*}}}*/
1358
- this.elements.callmanipulate_sensor = { /*{{{*/
1359
- 'parent': 'call',
1360
- 'description': self.adaptor.theme_dir + 'rngs/callmanipulate.rng',
1361
- 'illustrator': {//{{{
1362
- 'svg': self.adaptor.theme_dir + 'symbols/callmanipulate_sensor.svg'
1363
- }//}}}
1364
- }; /*}}}*/
1365
- this.elements.loop_head = { /*{{{*/
1366
- 'parent': 'loop',
1367
- 'illustrator': {//{{{
1368
- 'endnodes': 'this',
1369
- 'closeblock': true,
1370
- 'label': function(node){
1371
- var ret = [ { column: 'Label', value: $(node).attr('condition') } ];
1372
- return ret;
1373
- },
1374
- }//}}}
1375
- }; /*}}}*/
1376
- this.elements.loop_tail = { /*{{{*/
1377
- 'parent': 'loop',
1378
- 'illustrator': {//{{{
1379
- 'endnodes': 'aggregate',
1380
- 'closeblock': false,
1381
- 'closing_symbol': 'loop_finish'
1382
- },//}}}
1383
- }; /*}}}*/
1384
- this.elements.choose_inclusive = { /*{{{*/
1385
- 'parent': 'choose',
1386
- 'illustrator': {//{{{
1387
- 'svg': self.adaptor.theme_dir + 'symbols/choose_inclusive.svg'
1388
- }//}}}
1389
- }; /*}}}*/
1390
- this.elements.choose_exclusive = { /*{{{*/
1391
- 'parent': 'choose',
1392
- 'illustrator': {//{{{
1393
- 'svg': self.adaptor.theme_dir + 'symbols/choose_exclusive.svg'
1394
- },//}}}
1395
- }; /*}}}*/
1396
- this.elements.choose_inclusive_finish = { /*{{{*/
1397
- 'parent': 'choose_finish',
1398
- 'illustrator': {//{{{
1399
- 'svg': self.adaptor.theme_dir + 'symbols/choose_inclusive.svg'
1400
- }//}}}
1401
- }; /*}}}*/
1402
- this.elements.choose_exclusive_finish = { /*{{{*/
1403
- 'parent': 'choose_finish',
1404
- 'illustrator': {//{{{
1405
- 'svg': self.adaptor.theme_dir + 'symbols/choose_exclusive.svg'
1406
- },//}}}
1407
- }; /*}}}*/
1408
- this.elements.loop_head_finish = { /*{{{*/
1409
- 'parent': 'loop_finish',
1410
- 'illustrator': {//{{{
1411
- 'endnodes': 'this',
1412
- 'closeblock': true,
1413
- 'svg': self.adaptor.theme_dir + 'symbols/choose_exclusive.svg'
1414
- }//}}}
1415
- }; /*}}}*/
1416
- this.elements.loop_tail_finish = { /*{{{*/
1417
- 'parent': 'loop_finish',
1418
- 'illustrator': {//{{{
1419
- 'endnodes': 'this',
1420
- 'closeblock': false,
1421
- 'svg': self.adaptor.theme_dir + 'symbols/choose_exclusive.svg'
1422
- },//}}}
1423
- }; /*}}}*/
1424
- this.elements.parallel_start = { /*{{{*/
1425
- 'parent': 'parallel',
1426
- 'illustrator': {//{{{
1427
- 'svg': self.adaptor.theme_dir + 'symbols/parallel.svg'
1428
- }//}}}
1429
- }; /*}}}*/
1430
- this.elements.parallel_eventbased_exclusive = { /*{{{*/
1431
- 'parent': 'parallel',
1432
- 'illustrator': {//{{{
1433
- 'svg': self.adaptor.theme_dir + 'symbols/parallel_eventbased_exclusive.svg'
1434
- }//}}}
1435
- }; /*}}}*/
1436
- this.elements.parallel_eventbased_parallel = { /*{{{*/
1437
- 'parent': 'parallel',
1438
- 'illustrator': {//{{{
1439
- 'svg': self.adaptor.theme_dir + 'symbols/parallel_eventbased_parallel.svg'
1440
- }//}}}
1441
- }; /*}}}*/
1442
- this.elements.parallel_simple = { /*{{{*/
1443
- 'parent': 'parallel_finish',
1444
- 'illustrator': {//{{{
1445
- 'svg': self.adaptor.theme_dir + 'symbols/parallel.svg'
1446
- }//}}}
1447
- }; /*}}}*/
1448
- this.elements.parallel_complex = { /*{{{*/
1449
- 'parent': 'parallel_finish',
1450
- 'illustrator': {//{{{
1451
- 'svg': self.adaptor.theme_dir + 'symbols/complex.svg'
1452
- },//}}}
1453
- }; /*}}}*/
1454
- this.elements.parallel_event_all = { /*{{{*/
1455
- 'parent': 'parallel_finish',
1456
- 'illustrator': {//{{{
1457
- 'svg': self.adaptor.theme_dir + 'symbols/parallel_eventbased_parallel.svg'
1458
- }//}}}
1459
- }; /*}}}*/
1460
- this.elements.parallel_event_one = { /*{{{*/
1461
- 'parent': 'parallel_finish',
1462
- 'illustrator': {//{{{
1463
- 'svg': self.adaptor.theme_dir + 'symbols/choose_exclusive.svg'
1464
- }//}}}
1465
- }; /*}}}*/
1466
- this.elements.parallel_branch_normal = { /*{{{*/
1467
- 'parent': 'parallel_branch',
1468
- 'illustrator': {//{{{
1469
- 'svg': self.adaptor.theme_dir + 'symbols/parallel_branch_normal.svg'
1470
- }//}}}
1471
- }; /*}}}*/
1472
- this.elements.parallel_branch_event = { /*{{{*/
1473
- 'parent': 'parallel_branch',
1474
- 'illustrator': {//{{{
1475
- 'endnodes': 'this',
1476
- 'noarrow': false,
1477
- 'border': true,
1478
- 'wide': true,
1479
- 'closing_symbol': 'event_end',
1480
- 'svg': self.adaptor.theme_dir + 'symbols/parallel_branch_event.svg'
1481
- }//}}}
1482
- }; /*}}}*/
1483
- this.elements.parallel_branch_compact = { /*{{{*/
1484
- 'parent': 'parallel_branch',
1485
- 'illustrator': {//{{{
1486
- 'endnodes': 'this',
1487
- 'svg': self.adaptor.theme_dir + 'symbols/parallel_branch_compact.svg'
1488
- }//}}}
1489
- }; /*}}}*/
1490
- this.elements.scripts = { /*{{{*/
1491
- 'description': [self.adaptor.theme_dir + 'rngs/scripts.rng']
1492
- }; /*}}}*/
1493
- }
1
+ WFAdaptorManifestation = WFAdaptorManifestationBase;