cpee 2.1.51 → 2.1.53

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