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