cpee 1.3.181 → 1.3.183
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cockpit/css/ui.css +19 -60
- data/cockpit/css/wfadaptor.css +11 -0
- data/cockpit/index.html +45 -71
- data/cockpit/js/details.js +50 -139
- data/cockpit/js/instance.js +133 -185
- data/cockpit/js/parameters.js +57 -55
- data/cockpit/js/ui.js +4 -29
- data/cockpit/js/wfadaptor.js +190 -108
- data/cockpit/rngs/attributes.rng +8 -0
- data/cockpit/rngs/dataelements.rng +8 -0
- data/cockpit/rngs/endpoints.rng +8 -0
- data/cockpit/testsets/Concurrent.xml +6 -6
- data/cockpit/testsets/Coopis Testset.xml +12 -12
- data/cockpit/testsets/ICSOC Testset.xml +27 -27
- data/cockpit/testsets/Infinity.xml +4 -4
- data/cockpit/testsets/Linear.xml +10 -10
- data/cockpit/testsets/Mangler 1.xml +20 -20
- data/cockpit/testsets/Mangler 2.xml +18 -18
- data/cockpit/testsets/Promise.xml +258 -0
- data/cockpit/testsets/SOPROMO Test Sonification.xml +11 -11
- data/cockpit/testsets/Syncing P34 1.xml +12 -12
- data/cockpit/testsets/Syncing P34 2.xml +12 -12
- data/cockpit/testsets/Syncing P34 3.xml +12 -12
- data/cockpit/testsets/Syncing P34.xml +12 -12
- data/cockpit/testsets/TEST - Bad Loop.xml +39 -39
- data/cockpit/testsets/Update.xml +1 -1
- data/cockpit/testsets/Worklist Parallel.xml +8 -8
- data/cockpit/testsets/Worklist Test CPEE.xml +2 -2
- data/cockpit/testsets/Worklist Test.xml +2 -2
- data/cockpit/testsets/testsets.xml +2 -0
- data/cockpit/themes/adventure/rngs/alternative.rng +5 -0
- data/cockpit/themes/adventure/rngs/call.rng +29 -0
- data/cockpit/{rngtest2.rng → themes/adventure/rngs/callmanipulate.rng} +9 -9
- data/cockpit/themes/adventure/rngs/choose.rng +8 -0
- data/cockpit/themes/adventure/rngs/critical.rng +5 -0
- data/cockpit/themes/adventure/rngs/escape.rng +1 -0
- data/cockpit/themes/adventure/rngs/finalize.rng +6 -0
- data/cockpit/themes/adventure/rngs/group.rng +3 -0
- data/cockpit/themes/adventure/rngs/loop.rng +11 -0
- data/cockpit/themes/adventure/rngs/manipulate.rng +6 -0
- data/cockpit/themes/adventure/rngs/otherwise.rng +1 -0
- data/cockpit/themes/adventure/rngs/parallel.rng +5 -0
- data/cockpit/themes/adventure/rngs/parallel_branch.rng +8 -0
- data/cockpit/themes/adventure/rngs/update.rng +6 -0
- data/cockpit/themes/adventure/symbols/alternative.svg +4 -0
- data/cockpit/themes/adventure/symbols/call.svg +4 -0
- data/cockpit/themes/adventure/symbols/callmanipulate.svg +6 -0
- data/cockpit/themes/adventure/symbols/choose.svg +5 -0
- data/cockpit/themes/adventure/symbols/choose_exclusive.svg +5 -0
- data/cockpit/themes/adventure/symbols/choose_inclusive.svg +4 -0
- data/cockpit/themes/adventure/symbols/critical.svg +4 -0
- data/cockpit/themes/adventure/symbols/escape.svg +5 -0
- data/cockpit/themes/adventure/symbols/loop.svg +5 -0
- data/cockpit/themes/adventure/symbols/manipulate.svg +4 -0
- data/cockpit/themes/adventure/symbols/otherwise.svg +4 -0
- data/cockpit/themes/adventure/symbols/parallel.svg +5 -0
- data/cockpit/themes/adventure/symbols/parallel_branch.svg +4 -0
- data/cockpit/themes/adventure/symbols/scripts.svg +4 -0
- data/cockpit/themes/adventure/symbols/start.svg +3 -0
- data/cockpit/themes/adventure/theme.js +729 -0
- data/cockpit/themes/default/rngs/alternative.rng +5 -0
- data/cockpit/themes/default/rngs/call.rng +29 -0
- data/cockpit/themes/default/rngs/callmanipulate.rng +41 -0
- data/cockpit/themes/default/rngs/choose.rng +8 -0
- data/cockpit/themes/default/rngs/critical.rng +5 -0
- data/cockpit/themes/default/rngs/escape.rng +1 -0
- data/cockpit/themes/default/rngs/finalize.rng +6 -0
- data/cockpit/themes/default/rngs/group.rng +3 -0
- data/cockpit/themes/default/rngs/loop.rng +11 -0
- data/cockpit/themes/default/rngs/manipulate.rng +6 -0
- data/cockpit/themes/default/rngs/otherwise.rng +1 -0
- data/cockpit/themes/default/rngs/parallel.rng +5 -0
- data/cockpit/themes/default/rngs/parallel_branch.rng +8 -0
- data/cockpit/themes/default/rngs/update.rng +6 -0
- data/cockpit/themes/default/symbols/alternative.svg +4 -0
- data/cockpit/themes/default/symbols/call.svg +4 -0
- data/cockpit/themes/default/symbols/callmanipulate.svg +6 -0
- data/cockpit/themes/default/symbols/choose.svg +5 -0
- data/cockpit/themes/default/symbols/choose_exclusive.svg +5 -0
- data/cockpit/themes/default/symbols/choose_inclusive.svg +4 -0
- data/cockpit/themes/default/symbols/critical.svg +4 -0
- data/cockpit/themes/default/symbols/escape.svg +5 -0
- data/cockpit/themes/default/symbols/loop.svg +5 -0
- data/cockpit/themes/default/symbols/manipulate.svg +4 -0
- data/cockpit/themes/default/symbols/otherwise.svg +4 -0
- data/cockpit/themes/default/symbols/parallel.svg +5 -0
- data/cockpit/themes/default/symbols/parallel_branch.svg +4 -0
- data/cockpit/themes/default/symbols/scripts.svg +4 -0
- data/cockpit/themes/default/symbols/start.svg +3 -0
- data/cockpit/themes/default/theme.js +729 -0
- data/cockpit/themes/lego/rngs/alternative.rng +5 -0
- data/cockpit/themes/lego/rngs/call.rng +41 -0
- data/cockpit/themes/lego/rngs/choose.rng +8 -0
- data/cockpit/themes/lego/rngs/critical.rng +5 -0
- data/cockpit/themes/lego/rngs/loop.rng +11 -0
- data/cockpit/themes/lego/rngs/manipulate.rng +6 -0
- data/cockpit/themes/lego/rngs/parallel.rng +5 -0
- data/cockpit/themes/lego/rngs/parallel_branch.rng +8 -0
- data/cockpit/themes/lego/symbols/alternative.svg +4 -0
- data/cockpit/themes/lego/symbols/call.svg +4 -0
- data/cockpit/themes/lego/symbols/callmanipulate.svg +6 -0
- data/cockpit/themes/lego/symbols/callori.svg +4 -0
- data/cockpit/themes/lego/symbols/choose.svg +4 -0
- data/cockpit/themes/lego/symbols/choose_exclusive.svg +5 -0
- data/cockpit/themes/lego/symbols/choose_inclusive.svg +4 -0
- data/cockpit/themes/lego/symbols/critical.svg +4 -0
- data/cockpit/themes/lego/symbols/escape.svg +5 -0
- data/cockpit/themes/lego/symbols/lego.svg +72 -0
- data/cockpit/themes/lego/symbols/loop.svg +5 -0
- data/cockpit/themes/lego/symbols/manipulate.svg +4 -0
- data/cockpit/themes/lego/symbols/otherwise.svg +4 -0
- data/cockpit/themes/lego/symbols/parallel.svg +6 -0
- data/cockpit/themes/lego/symbols/parallel_branch.svg +4 -0
- data/cockpit/themes/lego/symbols/scripts.svg +4 -0
- data/cockpit/themes/lego/symbols/start.svg +3 -0
- data/cockpit/themes/lego/theme.js +742 -0
- data/cockpit/themes/promise/rngs/alternative.rng +5 -0
- data/cockpit/themes/promise/rngs/call.rng +41 -0
- data/cockpit/themes/promise/rngs/choose.rng +8 -0
- data/cockpit/themes/promise/rngs/critical.rng +5 -0
- data/cockpit/themes/promise/rngs/loop.rng +11 -0
- data/cockpit/themes/promise/rngs/manipulate.rng +6 -0
- data/cockpit/themes/promise/rngs/parallel.rng +5 -0
- data/cockpit/themes/promise/rngs/parallel_branch.rng +8 -0
- data/cockpit/themes/promise/symbols/alternative.svg +4 -0
- data/cockpit/themes/promise/symbols/call.svg +4 -0
- data/cockpit/themes/promise/symbols/callmanipulate.svg +6 -0
- data/cockpit/themes/promise/symbols/choose.svg +4 -0
- data/cockpit/themes/promise/symbols/choose_exclusive.svg +5 -0
- data/cockpit/themes/promise/symbols/choose_inclusive.svg +4 -0
- data/cockpit/themes/promise/symbols/critical.svg +4 -0
- data/cockpit/themes/promise/symbols/escape.svg +5 -0
- data/cockpit/themes/promise/symbols/loop.svg +5 -0
- data/cockpit/themes/promise/symbols/manipulate.svg +4 -0
- data/cockpit/themes/promise/symbols/otherwise.svg +4 -0
- data/cockpit/themes/promise/symbols/parallel.svg +6 -0
- data/cockpit/themes/promise/symbols/parallel_branch.svg +4 -0
- data/cockpit/themes/promise/symbols/preminder.svg +6 -0
- data/cockpit/themes/promise/symbols/scripts.svg +4 -0
- data/cockpit/themes/promise/symbols/start.svg +3 -0
- data/cockpit/themes/promise/theme.js +742 -0
- data/cpee.gemspec +2 -2
- data/lib/cpee/implementation.rb +15 -15
- data/server/handlerwrappers/default.rb +19 -19
- data/server/handlerwrappers/log.rb +264 -0
- data/server/instances/10/properties.xml +148 -0
- data/server/instances/11/properties.xml +149 -0
- data/server/instances/12/properties.xml +149 -0
- data/server/instances/13/properties.xml +149 -0
- data/server/instances/14/properties.xml +111 -0
- data/server/instances/15/properties.xml +113 -0
- data/server/instances/16/properties.xml +113 -0
- data/server/instances/17/properties.xml +149 -0
- data/server/instances/18/properties.xml +149 -0
- data/server/instances/19/properties.xml +114 -0
- data/server/instances/2/properties.xml +1 -1
- data/server/instances/20/properties.xml +113 -0
- data/server/instances/21/notifications/0851248d60c898cadd743d0dd5b6d273/consumer-secret +1 -0
- data/server/instances/21/notifications/0851248d60c898cadd743d0dd5b6d273/producer-secret +1 -0
- data/server/instances/21/notifications/0851248d60c898cadd743d0dd5b6d273/subscription.xml +6 -0
- data/server/instances/21/notifications/b7bac3f3010d433ce5d8f29338a06f9a/consumer-secret +1 -0
- data/server/instances/21/notifications/b7bac3f3010d433ce5d8f29338a06f9a/producer-secret +1 -0
- data/server/instances/21/notifications/b7bac3f3010d433ce5d8f29338a06f9a/subscription.xml +23 -0
- data/server/instances/21/properties.xml +149 -0
- data/server/instances/22/properties.xml +113 -0
- data/server/instances/23/properties.xml +88 -0
- data/server/instances/24/properties.xml +168 -0
- data/server/instances/25/properties.xml +149 -0
- data/server/instances/26/properties.xml +113 -0
- data/server/instances/27/properties.xml +141 -0
- data/server/instances/3/properties.xml +46 -0
- data/server/instances/4/properties.xml +148 -0
- data/server/instances/5/properties.xml +148 -0
- data/server/instances/6/properties.xml +148 -0
- data/server/instances/7/properties.xml +148 -0
- data/server/instances/8/properties.xml +148 -0
- data/server/instances/9/properties.xml +46 -0
- data/server/resources/properties.init +2 -1
- data/server/resources/transformation_dslx.xsl +12 -12
- data/server/server.pid +1 -0
- data/server/server.rb +2 -0
- metadata +152 -12
- data/cockpit/js/wfadaptor.cpee.js +0 -936
- data/cockpit/rngtest1.html +0 -53
- data/cockpit/rngtest1.rng +0 -38
- data/cockpit/rngtest1.xml +0 -16
- data/cockpit/rngtest2.html +0 -53
- data/cockpit/rngtest2.xml +0 -11
- data/cockpit/test.html +0 -46
data/cockpit/js/parameters.js
CHANGED
@@ -1,67 +1,69 @@
|
|
1
1
|
$(document).ready(function() {
|
2
|
-
//
|
3
|
-
|
4
|
-
|
2
|
+
// hook up dataelements with relaxngui //{{{
|
3
|
+
$.ajax({
|
4
|
+
type: "GET",
|
5
|
+
url: "rngs/dataelements.rng",
|
6
|
+
success: function(rng){
|
7
|
+
save['dataelements'] = new RelaxNGui(rng,$('#dat_dataelements'));
|
8
|
+
}
|
9
|
+
}); //}}}
|
10
|
+
// hook up endpoints with relaxngui //{{{
|
11
|
+
$.ajax({
|
12
|
+
type: "GET",
|
13
|
+
url: "rngs/endpoints.rng",
|
14
|
+
success: function(rng){
|
15
|
+
save['endpoints'] = new RelaxNGui(rng,$('#dat_endpoints'));
|
16
|
+
}
|
5
17
|
}); //}}}
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
18
|
+
// hook up attributes with relaxngui //{{{
|
19
|
+
$.ajax({
|
20
|
+
type: "GET",
|
21
|
+
url: "rngs/attributes.rng",
|
22
|
+
success: function(rng){
|
23
|
+
save['attributes'] = new RelaxNGui(rng,$('#dat_attributes'));
|
24
|
+
}
|
13
25
|
}); //}}}
|
14
26
|
|
15
|
-
//
|
16
|
-
$('#parameters ui-
|
17
|
-
|
27
|
+
// color of save button when changeing tabs //{{{
|
28
|
+
$('#parameters ui-tabbar ui-tab:not(.switch)').click(function(event){
|
29
|
+
highlight_save_button(event);
|
18
30
|
}); //}}}
|
19
31
|
|
20
|
-
//
|
32
|
+
// save entries //{{{
|
21
33
|
$('#parameters ui-behind button:nth-child(2)').click(function(event){
|
22
|
-
|
34
|
+
var visid = $('ui-tabbar ui-tab',$(event.target).parents('ui-tabbed')).not('.switch').not('.inactive').attr('data-tab');
|
35
|
+
if (save[visid].has_changed()) {
|
36
|
+
var url = $("#current-instance").text();
|
37
|
+
$('#parameters ui-tabbar ui-behind button:nth-child(2)').removeClass('highlight');
|
38
|
+
save[visid].set_checkpoint();
|
39
|
+
$.ajax({
|
40
|
+
type: "PUT",
|
41
|
+
url: url + "/properties/values/" + visid + "/",
|
42
|
+
data: ({'content': save[visid].save_text()}),
|
43
|
+
});
|
44
|
+
}
|
23
45
|
}); //}}}
|
24
46
|
|
25
|
-
|
26
|
-
$(
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
if (serialize_inputs(tab) != save[visid]) {
|
34
|
-
$('ui-tabbar ui-behind button:nth-child(2)',top).addClass('highlight');
|
35
|
-
} else {
|
36
|
-
$('ui-tabbar ui-behind button:nth-child(2)',top).removeClass('highlight');
|
37
|
-
}
|
38
|
-
} //}}}
|
39
|
-
function save_parameters(top) { //{{{
|
40
|
-
var visid = $('ui-tabbar ui-tab',top).not('.switch').not('.inactive').attr('id').replace(/tab/,'');
|
41
|
-
var table = $('#dat_' + visid);
|
42
|
-
var serxml = serialize_inputs(table);
|
47
|
+
// new entry //{{{
|
48
|
+
$('#parameters ui-behind button:nth-child(1)').click(function(event){
|
49
|
+
var but = $(document).find('#parameters ui-content ui-area:not(.inactive) button');
|
50
|
+
but.click();
|
51
|
+
var are = $(document).find('#parameters ui-content ui-area:not(.inactive)');
|
52
|
+
var tab = $(document).find('#parameters ui-content ui-area:not(.inactive) .relaxngui_table');
|
53
|
+
are.animate({ scrollTop: tab.height() }, "slow");
|
54
|
+
}); //}}}
|
43
55
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
type: "PUT",
|
50
|
-
url: url + "/properties/values/" + visid + "/",
|
51
|
-
data: ({'content': serxml}),
|
52
|
-
});
|
53
|
-
}
|
54
|
-
} //}}}
|
56
|
+
// when keyup in one of the inputs, highlight the save button //{{{
|
57
|
+
$(document).on('keyup','#dat_dataelements input, #dat_endpoints input, #dat_attributes input',function(event){
|
58
|
+
highlight_save_button(event);
|
59
|
+
}); //}}}
|
60
|
+
});
|
55
61
|
|
56
|
-
function
|
57
|
-
var
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
if (k.match(/^[a-zA-Z][a-zA-Z0-9_]*$/)) {
|
63
|
-
xml.append($X('<' + k + '>' + v + '</' + k + '>'));
|
64
|
-
}
|
62
|
+
function highlight_save_button(event) {
|
63
|
+
var visid = $('ui-tabbar ui-tab',$(event.target).parents('ui-tabbed')).not('.switch').not('.inactive').attr('data-tab');
|
64
|
+
if (save[visid].has_changed()) {
|
65
|
+
$('#parameters ui-tabbar ui-behind button:nth-child(2)').addClass('highlight');
|
66
|
+
} else {
|
67
|
+
$('#parameters ui-tabbar ui-behind button:nth-child(2)').removeClass('highlight');
|
65
68
|
}
|
66
|
-
|
67
|
-
} //}}}
|
69
|
+
}
|
data/cockpit/js/ui.js
CHANGED
@@ -4,17 +4,17 @@ $(document).ready(function() {
|
|
4
4
|
|
5
5
|
$('body').children().each(function(key,c){
|
6
6
|
if (skip) {
|
7
|
-
$(c).remove();
|
7
|
+
$(c).remove();
|
8
8
|
} else {
|
9
9
|
$(c).removeClass('hidden');
|
10
|
-
}
|
10
|
+
}
|
11
11
|
skip = true;
|
12
12
|
});
|
13
13
|
|
14
14
|
$("#iagree").click(function(){
|
15
15
|
if($(this).is(':checked')){
|
16
16
|
$("#icontinue").prop("disabled", false);
|
17
|
-
} else {
|
17
|
+
} else {
|
18
18
|
$("#icontinue").prop("disabled", true);
|
19
19
|
}
|
20
20
|
});
|
@@ -22,30 +22,5 @@ $(document).ready(function() {
|
|
22
22
|
$.cookie('cpee_iagree','yes');
|
23
23
|
location.reload();
|
24
24
|
});
|
25
|
-
}
|
25
|
+
}
|
26
26
|
});
|
27
|
-
|
28
|
-
// flexible parameter input
|
29
|
-
|
30
|
-
function remove_entry(target,foc) { //{{{
|
31
|
-
var tr = $($(target).parents('tr').get(0));
|
32
|
-
if (foc) {
|
33
|
-
var par = tr.parent();
|
34
|
-
$('input.' + $(target).attr('class'),par).each(function(){
|
35
|
-
if (this == target) {
|
36
|
-
if (prev) prev.focus();
|
37
|
-
return false;
|
38
|
-
}
|
39
|
-
prev = this;
|
40
|
-
});
|
41
|
-
}
|
42
|
-
tr.remove();
|
43
|
-
} //}}}
|
44
|
-
|
45
|
-
function new_entry(top) { //{{{
|
46
|
-
var visid = $('ui-tabbar ui-tab',top).not('.switch').not('.inactive').attr('id').replace(/tab/,'');
|
47
|
-
var node = $('#dat_template_pair tr').clone();
|
48
|
-
var vnode = $('#dat_' + visid).append(node);
|
49
|
-
$('.pair_name',vnode).focus();
|
50
|
-
return node;
|
51
|
-
} //}}}
|
data/cockpit/js/wfadaptor.js
CHANGED
@@ -19,22 +19,25 @@
|
|
19
19
|
// 2) creation of svg-container (Bug: arrows on lines)
|
20
20
|
// 3) after-function to insert using namespace of description
|
21
21
|
|
22
|
-
// WfAdaptor:
|
23
|
-
// Handles interaction between Illustartor and Description
|
22
|
+
// WfAdaptor:
|
23
|
+
// Handles interaction between Illustartor and Description
|
24
24
|
// e.g. Event fires to Adaptor to insert Element and Illustrator and Description do it
|
25
|
-
function WfAdaptor(
|
26
|
-
|
25
|
+
function WfAdaptor(theme_base,doit) { // Controller {{{
|
26
|
+
|
27
27
|
// public variables {{{
|
28
28
|
this.illustrator;
|
29
29
|
this.description;
|
30
30
|
this.elements = {};
|
31
|
+
this.theme_base = theme_base;
|
32
|
+
this.theme_dir = theme_base.replace(/theme.js/,'');
|
31
33
|
// }}}
|
32
34
|
|
33
|
-
//
|
35
|
+
// private variables {{{
|
34
36
|
var illustrator;
|
35
37
|
var description;
|
38
|
+
var self = this;
|
36
39
|
// }}}
|
37
|
-
|
40
|
+
|
38
41
|
// helper funtions
|
39
42
|
this.set_description = function(desc) { // public {{{
|
40
43
|
this.description.set_description(desc);
|
@@ -48,74 +51,133 @@ function WfAdaptor(manifesto) { // Controller {{{
|
|
48
51
|
illustrator.set_container(container); // TODO: shadowing the container element
|
49
52
|
} // }}}
|
50
53
|
|
54
|
+
|
51
55
|
// initialze
|
52
56
|
this.illustrator = illustrator = new WfIllustrator(this);
|
53
57
|
this.description = description = new WfDescription(this, this.illustrator);
|
54
58
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
$.getScript(theme_base, function() {
|
60
|
+
manifestation = new WFAdaptorManifestation(self);
|
61
|
+
illustrator.noarrow = manifestation.noarrow;
|
62
|
+
description.source = manifestation.source;
|
63
|
+
var deferreds = [];
|
64
|
+
// copy parent stuff
|
65
|
+
for(element in manifestation.elements) {
|
66
|
+
if (!manifestation.elements[element].description) {
|
67
|
+
if (manifestation.elements[element].parent) { // take from parent if empty
|
68
|
+
manifestation.elements[element].description = manifestation.elements[manifestation.elements[element].parent].description;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
if (!manifestation.elements[element].adaptor) {
|
72
|
+
if (manifestation.elements[element].parent) { // take from parent if empty
|
73
|
+
manifestation.elements[element].adaptor = manifestation.elements[manifestation.elements[element].parent].adaptor;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
// doit
|
78
|
+
for(element in manifestation.elements) {
|
79
|
+
if (manifestation.elements[element].illustrator) {
|
80
|
+
if (manifestation.elements[element].illustrator.svg) {
|
81
|
+
deferreds.push(
|
82
|
+
$.ajax({
|
83
|
+
type: "GET",
|
84
|
+
url: manifestation.elements[element].illustrator.svg,
|
85
|
+
context: element,
|
86
|
+
success: function(res){
|
87
|
+
manifestation.elements[this].illustrator.svg = $(res.documentElement);
|
88
|
+
}
|
89
|
+
})
|
90
|
+
);
|
91
|
+
}
|
92
|
+
illustrator.elements[element] = manifestation.elements[element].illustrator;
|
93
|
+
illustrator.elements[element].type = manifestation.elements[element].type || 'abstract';
|
94
|
+
}
|
95
|
+
if (manifestation.elements[element].description) {
|
96
|
+
if ( typeof manifestation.elements[element].description === 'string' ) {
|
97
|
+
manifestation.elements[element].description = [ manifestation.elements[element].description ];
|
98
|
+
}
|
99
|
+
if ($.isArray(manifestation.elements[element].description)) {
|
100
|
+
_.each(manifestation.elements[element].description,function(val,ind){
|
101
|
+
deferreds.push(
|
102
|
+
$.ajax({
|
103
|
+
type: "GET",
|
104
|
+
url: val,
|
105
|
+
context: element,
|
106
|
+
success: function(res){
|
107
|
+
manifestation.elements[this].description = $(res.documentElement);
|
108
|
+
description.elements[this] = manifestation.elements[this].description;
|
109
|
+
}
|
110
|
+
})
|
111
|
+
);
|
112
|
+
});
|
113
|
+
}
|
114
|
+
}
|
115
|
+
if (manifestation.elements[element].adaptor) {
|
116
|
+
self.elements[element] = manifestation.elements[element].adaptor;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
$.when.apply($, deferreds).then(function(x) {
|
120
|
+
doit(self);
|
121
|
+
});
|
122
|
+
});
|
123
|
+
} // }}}
|
63
124
|
|
64
|
-
// WfIllustrator:
|
125
|
+
// WfIllustrator:
|
65
126
|
// Is in charge of displaying the Graph. It is further able insert and remove elements with given ID's from the illsutration.
|
66
127
|
function WfIllustrator(wf_adaptor) { // View {{{
|
67
128
|
// Variable {{{
|
68
129
|
// public
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
130
|
+
this.height = 40;
|
131
|
+
this.width = 40;
|
132
|
+
this.noarrow = [];
|
133
|
+
this.elements = {}; // the svgs
|
134
|
+
this.svg = {};
|
74
135
|
this.draw = {};
|
75
136
|
// private
|
137
|
+
var self = this;
|
76
138
|
var adaptor = null;
|
77
|
-
// }}}
|
139
|
+
// }}}
|
78
140
|
// Generic Functions {{{
|
79
141
|
this.set_container = function(con) { // {{{
|
80
|
-
svg.container = con;
|
81
|
-
svg.container.append($X('<defs xmlns="http://www.w3.org/2000/svg">' +
|
142
|
+
self.svg.container = con;
|
143
|
+
self.svg.container.append($X('<defs xmlns="http://www.w3.org/2000/svg">' +
|
82
144
|
'<marker id="arrow" viewBox="0 0 10 10" refX="33" refY="5" orient="auto" markerUnits="strokeWidth" markerWidth="4.5" makerHeight="4.5">' +
|
83
145
|
'<path d="m 2 2 l 6 3 l -6 3 z"/>' +
|
84
146
|
'</marker>' +
|
85
147
|
'</defs>'));
|
86
|
-
svg.defs = {};
|
87
|
-
svg.defs['unknown'] = $X('<g xmlns="http://www.w3.org/2000/svg" class="unknown">' +
|
148
|
+
self.svg.defs = {};
|
149
|
+
self.svg.defs['unknown'] = $X('<g xmlns="http://www.w3.org/2000/svg" class="unknown">' +
|
88
150
|
'<circle cx="15" cy="15" r="14" class="unkown"/>' +
|
89
151
|
'<text transform="translate(15,20)" class="normal">?</text>' +
|
90
152
|
'</g>');
|
91
|
-
for(element in elements)
|
92
|
-
if(elements[element].svg
|
93
|
-
var sym = $X('<g xmlns="http://www.w3.org/2000/svg"/>').append(elements[element].svg().children()); // append all children to symbol
|
94
|
-
$.each(elements[element].svg
|
95
|
-
svg.defs[element] = sym;
|
153
|
+
for(element in self.elements)
|
154
|
+
if(self.elements[element].svg) {
|
155
|
+
var sym = $X('<g xmlns="http://www.w3.org/2000/svg"/>').append(self.elements[element].svg.clone().children()); // append all children to symbol
|
156
|
+
$.each(self.elements[element].svg.attr('class').split(/\s+/), function(index, item) { sym.addClass(item); }); // copy all classes from the root node
|
157
|
+
self.svg.defs[element] = sym;
|
96
158
|
}
|
97
159
|
} // }}}
|
98
160
|
var clear = this.clear = function() { // {{{
|
99
|
-
$('> :not(defs)', svg.container).each(function() {$(this).remove()});
|
161
|
+
$('> :not(defs)', self.svg.container).each(function() {$(this).remove()});
|
100
162
|
} // }}}
|
101
163
|
this.set_svg = function(graph) { // {{{
|
102
164
|
if(graph.max.row < 1) graph.max.row = 1;
|
103
165
|
if(graph.max.col < 1) graph.max.col = 1;
|
104
|
-
svg.container.attr({'height': (graph.max.row+0.3)*height, 'width':(graph.max.col+0.65)*width});
|
105
|
-
svg.container.append(graph.svg);
|
166
|
+
self.svg.container.attr({'height': (graph.max.row+0.3)*self.height, 'width':(graph.max.col+0.65)*self.width});
|
167
|
+
self.svg.container.append(graph.svg);
|
106
168
|
} // }}}
|
107
169
|
// }}}
|
108
170
|
// Helper Functions {{{
|
109
171
|
var draw_symbol = this.draw.draw_symbol = function (tname, sym_name, id, title, row, col, group) { // {{{
|
110
|
-
if(elements[sym_name] == undefined || elements[sym_name].svg == undefined) sym_name = 'unknown';
|
111
|
-
var g = $X('<g class="element" element-id="' + id + '" transform="translate(' + String((col*width)-((width*0.39))) + ',' + String(row*height-((height*0.74))) + ')" xmlns="http://www.w3.org/2000/svg">' +
|
172
|
+
if(self.elements[sym_name] == undefined || self.elements[sym_name].svg == undefined) sym_name = 'unknown';
|
173
|
+
var g = $X('<g class="element" element-type="' + sym_name + '" element-id="' + id + '" transform="translate(' + String((col*self.width)-((self.width*0.39))) + ',' + String(row*self.height-((self.height*0.74))) + ')" xmlns="http://www.w3.org/2000/svg">' +
|
112
174
|
'<text class="super" transform="translate(30,8.4)">' +
|
113
175
|
'<tspan class="active">0</tspan>' +
|
114
176
|
'<tspan class="colon">,</tspan>' +
|
115
177
|
'<tspan class="vote">0</tspan>' +
|
116
178
|
'</text>' +
|
117
|
-
'</g>');
|
118
|
-
var sym = svg.defs[sym_name].clone();
|
179
|
+
'</g>');
|
180
|
+
var sym = self.svg.defs[sym_name].clone();
|
119
181
|
sym.prepend($X('<title xmlns="http://www.w3.org/2000/svg">' + title + '</title>'));
|
120
182
|
sym.attr('class','activities');
|
121
183
|
g.append(sym);
|
@@ -126,21 +188,21 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
126
188
|
if(event_name == 'mousedown') sym.bind('contextmenu', false);
|
127
189
|
}
|
128
190
|
if(group) {group.append(g);}
|
129
|
-
else {svg.container.children('g:first').append(g);}
|
191
|
+
else {self.svg.container.children('g:first').append(g);}
|
130
192
|
return g;
|
131
|
-
} // }}}
|
193
|
+
} // }}}
|
132
194
|
var draw_border = this.draw.draw_border = function(id, p1, p2, group) { // {{{
|
133
|
-
group.prepend($X('<rect element-id="' + id + '" x="' + (p1.col-0.50)*width + '" ' +
|
134
|
-
'y="' + (p1.row-0.80)*height + '" ' +
|
135
|
-
'width="' + ((p2.col+1.00)-p1.col)*width + '" ' +
|
136
|
-
'height="' + ((p2.row+1.00)-p1.row)*height +'" ' +
|
195
|
+
group.prepend($X('<rect element-id="' + id + '" x="' + (p1.col-0.50)*self.width + '" ' +
|
196
|
+
'y="' + (p1.row-0.80)*self.height + '" ' +
|
197
|
+
'width="' + ((p2.col+1.00)-p1.col)*self.width + '" ' +
|
198
|
+
'height="' + ((p2.row+1.00)-p1.row)*self.height +'" ' +
|
137
199
|
'class="block" rx="15" ry="15" xmlns="http://www.w3.org/2000/svg"/>'));
|
138
|
-
} // }}}
|
200
|
+
} // }}}
|
139
201
|
var draw_tile = this.draw.draw_tile = function(id, p1, p2, group) { // {{{
|
140
|
-
group.prepend($X('<rect element-id="' + id + '" x="' + (p1.col-0.50)*width + '" ' +
|
141
|
-
'y="' + (p1.row-0.80)*height + '" ' +
|
142
|
-
'width="' + ((p2.col+1.00)-p1.col)*width + '" ' +
|
143
|
-
'height="' + ((p2.row+1.00)-p1.row)*height +'" ' +
|
202
|
+
group.prepend($X('<rect element-id="' + id + '" x="' + (p1.col-0.50)*self.width + '" ' +
|
203
|
+
'y="' + (p1.row-0.80)*self.height + '" ' +
|
204
|
+
'width="' + ((p2.col+1.00)-p1.col)*self.width + '" ' +
|
205
|
+
'height="' + ((p2.row+1.00)-p1.row)*self.height +'" ' +
|
144
206
|
'class="tile" rx="15" ry="15" xmlns="http://www.w3.org/2000/svg"/>'));
|
145
207
|
} // }}}
|
146
208
|
var draw_connection = this.draw.draw_connection = function(group, start, end, max_line, num_lines, arrow) { // {{{
|
@@ -148,46 +210,46 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
148
210
|
var line;
|
149
211
|
if (arrow)
|
150
212
|
line = $X('<path xmlns="http://www.w3.org/2000/svg" class="ourline" marker-end="url(#arrow)"/>');
|
151
|
-
else
|
213
|
+
else
|
152
214
|
line = $X('<path xmlns="http://www.w3.org/2000/svg" class="ourline"/>');
|
153
215
|
if (end['row']-start['row'] == 0 || end['col']-start['col'] == 0) { // straight line
|
154
|
-
line.attr("d", "M " + String(start['col']*width) + "," + String(start['row']*height-15) +" "+
|
155
|
-
String(end['col']*width) + "," + String(end['row']*height-15)
|
216
|
+
line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
|
217
|
+
String(end['col']*self.width) + "," + String(end['row']*self.height-15)
|
156
218
|
);
|
157
219
|
} else if (end['row']-start['row'] > 0) { // downwards
|
158
220
|
if (end['col']-start['col'] > 0) {// left - right
|
159
|
-
line.attr("d", "M " + String(start['col']*width) + "," + String(start['row']*height-15) +" "+
|
160
|
-
String(start['col']*width+14) + "," + String((end['row']-1)*height) +" "+ // first turn of hotizontal-line going away from node
|
161
|
-
String(end['col']*width) + "," + String((end['row']-1)*height) +" "+
|
162
|
-
String(end['col']*width) + "," + String(end['row']*height-15)
|
221
|
+
line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
|
222
|
+
String(start['col']*self.width+14) + "," + String((end['row']-1)*self.height) +" "+ // first turn of hotizontal-line going away from node
|
223
|
+
String(end['col']*self.width) + "," + String((end['row']-1)*self.height) +" "+
|
224
|
+
String(end['col']*self.width) + "," + String(end['row']*self.height-15)
|
163
225
|
);
|
164
226
|
} else { // right - left
|
165
|
-
line.attr("d", "M " + String(start['col']*width) + "," + String(start['row']*height-15) +" "+
|
166
|
-
String(start['col']*width) + "," + String(end['row']*height-35) +" "+
|
167
|
-
String(end['col']*width+14) + "," + String(end['row']*height-35) +" "+ // last turn of horizontal-line going into the node
|
168
|
-
String(end['col']*width) + "," + String(end['row']*height-15)
|
227
|
+
line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
|
228
|
+
String(start['col']*self.width) + "," + String(end['row']*self.height-35) +" "+
|
229
|
+
String(end['col']*self.width+14) + "," + String(end['row']*self.height-35) +" "+ // last turn of horizontal-line going into the node
|
230
|
+
String(end['col']*self.width) + "," + String(end['row']*self.height-15)
|
169
231
|
);
|
170
232
|
}
|
171
233
|
} else if(end['row']-start['row'] < 0) { // upwards
|
172
234
|
if(num_lines > 1) {// ??? no idea
|
173
|
-
line.attr("d", "M " + String(start['col']*width) + "," + String(start['row']*height-15) +" "+
|
174
|
-
String(start['col']*width) + "," + String((max_line-1)*height+5) +" "+
|
175
|
-
String(end['col']*width+20) + "," + String((max_line-1)*height+5) +" "+
|
176
|
-
String(end['col']*width+20) + "," + String(end['row']*height+25)+" "+
|
177
|
-
String(end['col']*width) + "," + String(end['row']*height-15)
|
235
|
+
line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
|
236
|
+
String(start['col']*self.width) + "," + String((max_line-1)*self.height+5) +" "+
|
237
|
+
String(end['col']*self.width+20) + "," + String((max_line-1)*self.height+5) +" "+
|
238
|
+
String(end['col']*self.width+20) + "," + String(end['row']*self.height+25)+" "+
|
239
|
+
String(end['col']*self.width) + "," + String(end['row']*self.height-15)
|
178
240
|
);
|
179
241
|
} else {
|
180
|
-
line.attr("d", "M " + String(start['col']*width) + "," + String(start['row']*height-15) +" "+
|
181
|
-
String(end['col']*width+20) + "," + String(start['row']*height-15) +" "+
|
182
|
-
String(end['col']*width+20) + "," + String(end['row']*height+25)+" "+
|
183
|
-
String(end['col']*width) + "," + String(end['row']*height-15)
|
242
|
+
line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
|
243
|
+
String(end['col']*self.width+20) + "," + String(start['row']*self.height-15) +" "+
|
244
|
+
String(end['col']*self.width+20) + "," + String(end['row']*self.height+25)+" "+
|
245
|
+
String(end['col']*self.width) + "," + String(end['row']*self.height-15)
|
184
246
|
);
|
185
247
|
}
|
186
248
|
}
|
187
249
|
// Seems to solve injection groups-line problem, but I guess it will caus problem when collapsing elements
|
188
250
|
//if(group) {group.prepend(line);}
|
189
|
-
//else
|
190
|
-
{svg.container.append(line);}
|
251
|
+
//else
|
252
|
+
{self.svg.container.append(line);}
|
191
253
|
} // }}}
|
192
254
|
// }}}
|
193
255
|
// Initialize {{{
|
@@ -195,17 +257,19 @@ function WfIllustrator(wf_adaptor) { // View {{{
|
|
195
257
|
// }}}
|
196
258
|
} // }}}
|
197
259
|
|
198
|
-
// WfDescription:
|
260
|
+
// WfDescription:
|
199
261
|
// Manages the description. Is is further able to add/remove elements from the controlflow description.
|
200
262
|
function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
201
263
|
// public variables
|
202
|
-
|
264
|
+
this.elements = {}; // the rngs
|
265
|
+
this.source = null;
|
203
266
|
// private variables
|
267
|
+
var self = this;
|
204
268
|
var adaptor;
|
205
269
|
var illustrator;
|
206
270
|
var description;
|
207
271
|
var id_counter = {};
|
208
|
-
var update_illustrator = true;
|
272
|
+
var update_illustrator = true;
|
209
273
|
|
210
274
|
// Generic Functions {{{
|
211
275
|
this.set_description = function(desc, auto_update) { // public {{{
|
@@ -226,23 +290,34 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
226
290
|
var gd = this.get_description = function() { // public {{{
|
227
291
|
var serxml = $(description.get(0).documentElement).clone(true);
|
228
292
|
serxml.removeAttr('svg-id');
|
293
|
+
serxml.removeAttr('svg-type');
|
294
|
+
serxml.removeAttr('svg-label');
|
229
295
|
$('*[svg-id]',serxml).each(function(){
|
230
296
|
$(this).removeAttr('svg-id');
|
231
297
|
});
|
298
|
+
$('*[svg-type]',serxml).each(function(){
|
299
|
+
$(this).removeAttr('svg-type');
|
300
|
+
});
|
301
|
+
$('*[svg-label]',serxml).each(function(){
|
302
|
+
$(this).removeAttr('svg-label');
|
303
|
+
});
|
232
304
|
return serxml.serializeXML();
|
233
305
|
} // }}}
|
234
306
|
this.get_node_by_svg_id = function(svg_id) { // {{{
|
235
307
|
return $('[svg-id = \'' + svg_id + '\']', description);
|
236
308
|
} // }}}
|
309
|
+
var context_eval = this.context_eval = function(what) { // {{{
|
310
|
+
return eval(what);
|
311
|
+
} // }}}
|
237
312
|
var get_free_id = this.get_free_id = function() { // {{{
|
238
313
|
var existing = new Array();
|
239
314
|
$('*[id]', description).each(function(){existing.push($(this).attr('id'))});
|
240
315
|
var id = 1;
|
241
316
|
while ($.inArray('a' + id,existing) != -1) {
|
242
|
-
id += 1;
|
317
|
+
id += 1;
|
243
318
|
}
|
244
319
|
return 'a' + id;
|
245
|
-
} // }}}
|
320
|
+
} // }}}
|
246
321
|
var update = this.update = function(svgid) { // {{{
|
247
322
|
id_counter = {};
|
248
323
|
if(update_illustrator){
|
@@ -250,27 +325,30 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
250
325
|
var graph = parse(description.children('description').get(0), {'row':0,'col':0});
|
251
326
|
illustrator.set_svg(graph);
|
252
327
|
}
|
328
|
+
|
253
329
|
var newn = $('*[new=true]',description);
|
254
330
|
newn.removeAttr('new');
|
255
331
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
332
|
+
if (newn.attr('svg-id') != undefined)
|
333
|
+
adaptor.notify(newn.attr('svg-id'));
|
334
|
+
else if (svgid != undefined)
|
335
|
+
adaptor.notify(svgid);
|
336
|
+
else if (newn.parent('[svg-id]').length > 0)
|
337
|
+
adaptor.notify(newn.parent('[svg-id]').attr('svg-id'));
|
338
|
+
else
|
339
|
+
console.info('Something went horribly wrong');
|
262
340
|
} // }}}
|
263
341
|
// }}}
|
264
342
|
// Adaption functions {{{
|
265
343
|
this.insert_after = function(new_node, target) { // {{{
|
266
344
|
if ($.isArray(new_node)) {
|
267
345
|
$.each(new_node,function(k,v){
|
268
|
-
var nn =
|
346
|
+
var nn = self.source(v);
|
269
347
|
target.after(nn);
|
270
348
|
nn.attr('new','true');
|
271
349
|
});
|
272
350
|
} else {
|
273
|
-
var nn =
|
351
|
+
var nn = self.source(new_node);
|
274
352
|
target.after(nn);
|
275
353
|
nn.attr('new','true');
|
276
354
|
}
|
@@ -279,12 +357,12 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
279
357
|
this.insert_first_into = function(new_node, target, selector) { // {{{
|
280
358
|
if ($.isArray(new_node)) {
|
281
359
|
$.each(new_node,function(k,v){
|
282
|
-
var nn =
|
360
|
+
var nn = self.source(v);
|
283
361
|
target.prepend(nn);
|
284
362
|
nn.attr('new','true');
|
285
363
|
});
|
286
364
|
} else {
|
287
|
-
var nn =
|
365
|
+
var nn = self.source(new_node);
|
288
366
|
target.prepend(nn);
|
289
367
|
nn.attr('new','true');
|
290
368
|
}
|
@@ -293,12 +371,12 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
293
371
|
this.insert_last_into = function(new_node, target, selector) { // {{{
|
294
372
|
if ($.isArray(new_node)) {
|
295
373
|
$.each(new_node,function(k,v){
|
296
|
-
var nn =
|
374
|
+
var nn = self.source(v);
|
297
375
|
target.append(nn);
|
298
376
|
nn.attr('new','true');
|
299
377
|
});
|
300
378
|
} else {
|
301
|
-
var nn =
|
379
|
+
var nn = self.source(new_node);
|
302
380
|
target.append(nn);
|
303
381
|
nn.attr('new','true');
|
304
382
|
}
|
@@ -309,8 +387,11 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
309
387
|
if(selector == undefined) {
|
310
388
|
svgid = target.attr('svg-id');
|
311
389
|
target.remove()
|
312
|
-
} else {
|
390
|
+
} else {
|
313
391
|
svgid = $(selector, target).attr('svg-id');
|
392
|
+
if (!svgid) {
|
393
|
+
svgid = target.attr('svg-id');
|
394
|
+
}
|
314
395
|
$(selector, target).remove();
|
315
396
|
}
|
316
397
|
update(svgid);
|
@@ -322,15 +403,15 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
322
403
|
var pos = jQuery.extend(true, {}, parent_pos);
|
323
404
|
var max = {'row': 0,'col': 0};
|
324
405
|
var prev = [parent_pos]; // connects parent with child(s), depending on the expansion
|
325
|
-
var endnodes = [];
|
406
|
+
var endnodes = [];
|
326
407
|
var root_expansion = illustrator.elements[root.tagName].expansion(root);
|
327
408
|
var block = {'max':{}}; // e.g. {'max':{'row':0,'col':0}, 'endpoints':[]};
|
328
409
|
var collapsed = false;
|
329
410
|
|
330
411
|
var group = $X('<g class="group" xmlns="http://www.w3.org/2000/svg"/>');
|
331
412
|
|
332
|
-
if(root_expansion == 'horizontal') pos.row++;
|
333
|
-
if(illustrator.elements[root.tagName].col_shift(root) == true && root_expansion != 'horizontal') pos.col++;
|
413
|
+
if(root_expansion == 'horizontal') pos.row++;
|
414
|
+
if(illustrator.elements[root.tagName].col_shift(root) == true && root_expansion != 'horizontal') pos.col++;
|
334
415
|
|
335
416
|
if(root.tagName == 'description') { // First parsing {{{
|
336
417
|
pos.row++;
|
@@ -340,7 +421,7 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
340
421
|
illustrator.draw.draw_symbol('start', 'start', 'description', 'START', pos.row, pos.col, group);
|
341
422
|
} // }}}
|
342
423
|
|
343
|
-
$(root).children().each(function() {
|
424
|
+
$(root).children().each(function() {
|
344
425
|
var tname = this.tagName;
|
345
426
|
|
346
427
|
// Set SVG-ID {{{
|
@@ -348,13 +429,13 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
348
429
|
if(id_counter[tname] == undefined) id_counter[tname] = -1;
|
349
430
|
$(this).attr('svg-id', tname + '_' + (++id_counter[tname]));
|
350
431
|
$(this).attr('svg-label', '');
|
351
|
-
} else {
|
432
|
+
} else {
|
352
433
|
$(this).attr('svg-id', $(this).attr('id'));
|
353
434
|
if ($(this).children('parameters').length > 0) {
|
354
435
|
$(this).attr('svg-label', $('label',$(this).children('parameters')).text().replace(/^['"]/,'').replace(/['"]$/,''));
|
355
|
-
} else {
|
436
|
+
} else {
|
356
437
|
$(this).attr('svg-label', '');
|
357
|
-
}
|
438
|
+
}
|
358
439
|
} // }}}
|
359
440
|
// Calculate next position {{{
|
360
441
|
if($(this).attr('collapsed') == undefined || $(this).attr('collapsed') == 'false') { collapsed = false; }
|
@@ -362,14 +443,14 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
362
443
|
if(root_expansion == 'vertical') pos.row++;
|
363
444
|
if(root_expansion == 'horizontal') pos.col++;
|
364
445
|
if(illustrator.elements[tname] != undefined && illustrator.elements[tname].type == 'complex' && !collapsed) {
|
365
|
-
if(illustrator.elements[tname] != undefined && !illustrator.elements[tname].svg
|
366
|
-
// TODO: Remaining problem is the order inside the svg. Thats why the connection is above the icon
|
446
|
+
if(illustrator.elements[tname] != undefined && !illustrator.elements[tname].svg) pos.row--;
|
447
|
+
// TODO: Remaining problem is the order inside the svg. Thats why the connection is above the icon
|
367
448
|
block = parse(this, jQuery.extend(true, {}, pos));
|
368
449
|
group.append(block.svg);
|
369
|
-
block.svg.attr('id', 'group-' + $(this).attr('svg-id'));
|
370
|
-
if(illustrator.elements[tname].endnodes == 'aggregate') endnodes = []; // resets endpoints e.g. potential preceding primitive
|
450
|
+
block.svg.attr('id', 'group-' + $(this).attr('svg-id'));
|
451
|
+
if(illustrator.elements[tname].endnodes == 'aggregate') endnodes = []; // resets endpoints e.g. potential preceding primitive
|
371
452
|
} else {
|
372
|
-
if(illustrator.elements[tname] != undefined && illustrator.elements[tname].type == 'primitive' && illustrator.elements[tname].svg
|
453
|
+
if(illustrator.elements[tname] != undefined && illustrator.elements[tname].type == 'primitive' && illustrator.elements[tname].svg) { // This enables "invisble" elements, by returning undefined in the SVG function (e.g. constraints)
|
373
454
|
block.max.row = pos.row;
|
374
455
|
block.max.col = pos.col;
|
375
456
|
block.endnodes = (!collapsed ? [pos] : [jQuery.extend(true, {}, pos)]);
|
@@ -383,27 +464,28 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
383
464
|
else if(typeof illustrator.elements[tname].resolve_symbol == 'function') {sym_name = illustrator.elements[tname].resolve_symbol(this);}
|
384
465
|
else if(typeof illustrator.elements[tname].resolve_symbol == 'string') {sym_name = illustrator.elements[tname].resolve_symbol;}
|
385
466
|
else {sym_name = tname;}
|
386
|
-
|
467
|
+
$(this).attr('svg-type',sym_name);
|
468
|
+
if((illustrator.elements[tname] && illustrator.elements[tname].svg) || sym_name == 'unknown') {
|
387
469
|
illustrator.draw.draw_symbol(tname, sym_name, $(this).attr('svg-id'), $(this).attr('svg-label'), pos.row, pos.col, block.svg).addClass(illustrator.elements[tname] ? illustrator.elements[tname].type : 'primitive unknown');
|
388
470
|
} else { console.log("no icon "+ tname);}
|
389
471
|
if(illustrator.elements[tname] && illustrator.elements[tname].border) illustrator.draw.draw_border($(this).attr('svg-id'), pos, block.max, block.svg);
|
390
472
|
if(illustrator.elements[tname] && illustrator.elements[tname].type == 'complex') illustrator.draw.draw_tile($(this).attr('svg-id'), pos, block.max, block.svg);
|
391
473
|
// }}}
|
392
474
|
// Calculate Connection {{{
|
393
|
-
if(illustrator.elements[tname] != undefined && illustrator.elements[tname].closeblock) { // Close Block if element e.g. loop
|
475
|
+
if(illustrator.elements[tname] != undefined && illustrator.elements[tname].closeblock) { // Close Block if element e.g. loop
|
394
476
|
for(node in block.endnodes) illustrator.draw.draw_connection(group, block.endnodes[node], pos, block.max.row+1, block.endnodes.length, true);
|
395
477
|
}
|
396
|
-
if(illustrator.elements[tname] != undefined && illustrator.elements[tname].endnodes != 'this') {
|
397
|
-
for(i in block.endnodes) endnodes.push(block.endnodes[i]); // collects all endpoints from different childs e.g. alternatives from choose
|
478
|
+
if(illustrator.elements[tname] != undefined && illustrator.elements[tname].endnodes != 'this') {
|
479
|
+
for(i in block.endnodes) endnodes.push(block.endnodes[i]); // collects all endpoints from different childs e.g. alternatives from choose
|
398
480
|
} else { endnodes = [jQuery.extend(true, {}, pos)]; } // sets this element as only endpoint (aggreagte)
|
399
481
|
if(prev[0].row == 0 || prev[0].col == 0) { // this enforces the connection from description to the first element
|
400
482
|
illustrator.draw.draw_connection(group, { row: 1, col: 1 }, pos, null, null, true);
|
401
483
|
} else {
|
402
|
-
if ($.inArray(tname,noarrow) == -1)
|
484
|
+
if ($.inArray(tname,illustrator.noarrow) == -1)
|
403
485
|
for(node in prev) illustrator.draw.draw_connection(group, prev[node], pos, null, null, true);
|
404
|
-
else
|
486
|
+
else
|
405
487
|
for(node in prev) illustrator.draw.draw_connection(group, prev[node], pos, null, null, false);
|
406
|
-
}
|
488
|
+
}
|
407
489
|
// }}}
|
408
490
|
// Prepare next iteration {{{
|
409
491
|
if(root_expansion == 'vertical') { prev = jQuery.extend(true, {}, endnodes); pos.row = block.max.row;} // covers e.g. input's for alternative, parallel_branch, ... everything with horizontal expansion
|
@@ -427,4 +509,4 @@ function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
|
427
509
|
adaptor = wf_adaptor;
|
428
510
|
illustrator = wf_illustrator;
|
429
511
|
// }}}
|
430
|
-
} // }}}
|
512
|
+
} // }}}
|