cpee 2.0.19 → 2.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cockpit/css/model.css +2 -0
- data/cockpit/css/replay.css +55 -0
- data/cockpit/css/wfadaptor.css +17 -0
- data/cockpit/edit.html +1 -1
- data/cockpit/index.html +2 -0
- data/cockpit/js/instance.js +8 -20
- data/cockpit/js/replay.js +40 -0
- data/cockpit/js_libs.zip +0 -0
- data/cockpit/model.html +3 -1
- data/cockpit/replay.html +52 -0
- data/cockpit/templates/.CPEE.xml +8 -0
- data/cockpit/templates/.Signavio.xml +8 -0
- data/cockpit/templates/.templates.xml +13 -0
- data/cockpit/templates/.transformations.xml +4 -0
- data/cockpit/templates/instantiate.local/Take_Sub.xml +1 -1
- data/cockpit/themes/compact/rngs/call.rng +67 -40
- data/cockpit/themes/compact/rngs/callmanipulate.rng +81 -38
- data/cockpit/themes/control/rngs/alternative.rng +25 -0
- data/cockpit/themes/control/rngs/call.rng +149 -0
- data/cockpit/themes/control/rngs/callmanipulate.rng +188 -0
- data/cockpit/themes/control/rngs/choose.rng +14 -0
- data/cockpit/themes/control/rngs/closed_loop.rng +62 -0
- data/cockpit/themes/control/rngs/closed_loop_cancel.rng +5 -0
- data/cockpit/themes/control/rngs/closed_loop_control.rng +31 -0
- data/cockpit/themes/control/rngs/closed_loop_measuring.rng +12 -0
- data/cockpit/themes/control/rngs/critical.rng +5 -0
- data/cockpit/themes/control/rngs/escape.rng +1 -0
- data/cockpit/themes/control/rngs/group.rng +3 -0
- data/cockpit/themes/control/rngs/loop.rng +22 -0
- data/cockpit/themes/control/rngs/manipulate.rng +9 -0
- data/cockpit/themes/control/rngs/otherwise.rng +22 -0
- data/cockpit/themes/control/rngs/parallel.rng +21 -0
- data/cockpit/themes/control/rngs/parallel_branch.rng +8 -0
- data/cockpit/themes/control/rngs/scripts.rng +23 -0
- data/cockpit/themes/control/rngs/stop.rng +5 -0
- data/cockpit/themes/control/rngs/terminate.rng +1 -0
- data/cockpit/themes/control/symbols/alternative.svg +5 -0
- data/cockpit/themes/control/symbols/arrow.svg +3 -0
- data/cockpit/themes/control/symbols/call.svg +6 -0
- data/cockpit/themes/control/symbols/callmanipulate.svg +8 -0
- data/cockpit/themes/control/symbols/choose.svg +5 -0
- data/cockpit/themes/control/symbols/choose_exclusive.svg +5 -0
- data/cockpit/themes/control/symbols/choose_inclusive.svg +4 -0
- data/cockpit/themes/control/symbols/closed_loop.svg +5 -0
- data/cockpit/themes/control/symbols/closed_loop_cancel.svg +5 -0
- data/cockpit/themes/control/symbols/closed_loop_control.svg +5 -0
- data/cockpit/themes/control/symbols/closed_loop_measuring.svg +6 -0
- data/cockpit/themes/control/symbols/complex.svg +8 -0
- data/cockpit/themes/control/symbols/critical.svg +4 -0
- data/cockpit/themes/control/symbols/end.svg +3 -0
- data/cockpit/themes/control/symbols/escape.svg +5 -0
- data/cockpit/themes/control/symbols/event_end.svg +3 -0
- data/cockpit/themes/control/symbols/loop.svg +5 -0
- data/cockpit/themes/control/symbols/manipulate.svg +4 -0
- data/cockpit/themes/control/symbols/otherwise.svg +5 -0
- data/cockpit/themes/control/symbols/parallel.svg +5 -0
- data/cockpit/themes/control/symbols/parallel_branch.svg +5 -0
- data/cockpit/themes/control/symbols/parallel_branch_compact.svg +4 -0
- data/cockpit/themes/control/symbols/parallel_branch_event.svg +14 -0
- data/cockpit/themes/control/symbols/parallel_branch_normal.svg +5 -0
- data/cockpit/themes/control/symbols/scripts.svg +4 -0
- data/cockpit/themes/control/symbols/start.svg +3 -0
- data/cockpit/themes/control/symbols/stop.svg +5 -0
- data/cockpit/themes/control/symbols/terminate.svg +4 -0
- data/cockpit/themes/control/theme.js +1665 -0
- data/cockpit/themes/default/rngs/call.rng +67 -40
- data/cockpit/themes/default/rngs/callmanipulate.rng +81 -38
- data/cockpit/themes/default/theme.js +1287 -0
- data/cockpit/themes/diana/rngs/call.rng +67 -40
- data/cockpit/themes/diana/rngs/callmanipulate.rng +81 -38
- data/cockpit/themes/extended/rngs/call.rng +67 -40
- data/cockpit/themes/extended/rngs/callmanipulate.rng +81 -38
- data/cockpit/themes/model/rngs/call.rng +2 -1
- data/cockpit/themes/model/rngs/callmanipulate.rng +2 -1
- data/cockpit/themes/model/theme.js +1 -1
- data/cockpit/themes/packed/rngs/call.rng +67 -40
- data/cockpit/themes/packed/rngs/callmanipulate.rng +81 -38
- data/cockpit/themes/preset/rngs/call.rng +67 -40
- data/cockpit/themes/preset/rngs/callmanipulate.rng +81 -38
- data/cockpit/track.html +0 -7
- data/cpee.gemspec +2 -2
- data/lib/cpee/controller.rb +6 -3
- data/lib/cpee/implementation.rb +23 -8
- data/lib/cpee/implementation_notifications.rb +1 -1
- data/lib/cpee/persistence.rb +2 -1
- data/lib/cpee/redis.rb +57 -0
- data/server/handlerwrappers/default.rb +2 -2
- data/server/resources/notifications/logging/subscription.xml +6 -0
- data/server/routing/end.pid +1 -0
- data/server/routing/end.rb +16 -4
- data/server/routing/forward-events.pid +1 -0
- data/server/routing/forward-events.rb +19 -7
- data/server/routing/forward-votes.pid +1 -0
- data/server/routing/forward-votes.rb +19 -7
- data/server/routing/persist.pid +1 -0
- data/server/routing/persist.rb +26 -14
- data/server/server.pid +1 -0
- data/tools/cpee +5 -5
- data/tools/test/README +4 -0
- data/tools/test/config.json +3 -0
- data/tools/test/contrib/graph_example.svg +1166 -0
- data/tools/test/contrib/legend.svg +817 -0
- data/tools/test/contrib/symbols.svg +224 -0
- data/tools/test/contrib/transformation1.xsl +264 -0
- data/tools/test/contrib/transformation2.xsl +10 -0
- data/tools/test/contrib/tree_example.svg +788 -0
- data/tools/test/css/model.css +24 -0
- data/tools/test/css/track.css +60 -0
- data/tools/test/css/ui.css +214 -0
- data/tools/test/css/wfadaptor.css +422 -0
- data/tools/test/edit.html +258 -0
- data/tools/test/graph.html +69 -0
- data/tools/test/index.html +258 -0
- data/tools/test/js/details.js +109 -0
- data/tools/test/js/instance.js +1344 -0
- data/tools/test/js/model.js +41 -0
- data/tools/test/js/parameters.js +82 -0
- data/tools/test/js/track.js +18 -0
- data/tools/test/js/ui.js +104 -0
- data/tools/test/js/wfadaptor.js +763 -0
- data/tools/test/js_libs.zip +0 -0
- data/tools/test/js_libs/Makefile +2 -0
- data/tools/test/js_libs/ansi_up.js +333 -0
- data/tools/test/js_libs/console.js +80 -0
- data/tools/test/js_libs/custommenu.css +84 -0
- data/tools/test/js_libs/custommenu.js +104 -0
- data/tools/test/js_libs/experiments1/relaxngui.css +185 -0
- data/tools/test/js_libs/experiments1/relaxngui.js +488 -0
- data/tools/test/js_libs/experiments1/rngtest9.html +60 -0
- data/tools/test/js_libs/experiments1/rngtest9.rng +35 -0
- data/tools/test/js_libs/experiments1/rngtest9.xml +8 -0
- data/tools/test/js_libs/jquery-2.2.4.min.js +4 -0
- data/tools/test/js_libs/jquery-3.2.1.min.js +4 -0
- data/tools/test/js_libs/jquery-3.3.1.min.js +2 -0
- data/tools/test/js_libs/jquery.browser.js +40 -0
- data/tools/test/js_libs/jquery.caret.min.js +10 -0
- data/tools/test/js_libs/jquery.cookie.js +117 -0
- data/tools/test/js_libs/jquery.min.js +1 -0
- data/tools/test/js_libs/jquery.svg.min.js +6 -0
- data/tools/test/js_libs/jquery.svgdom.min.js +6 -0
- data/tools/test/js_libs/markdown.min.js +1 -0
- data/tools/test/js_libs/parsequery.js +21 -0
- data/tools/test/js_libs/printf.js +368 -0
- data/tools/test/js_libs/relaxngui.css +213 -0
- data/tools/test/js_libs/relaxngui.js +543 -0
- data/tools/test/js_libs/strftime.min.js +1 -0
- data/tools/test/js_libs/tests/dataelements.html +59 -0
- data/tools/test/js_libs/tests/dataelements.rng +8 -0
- data/tools/test/js_libs/tests/dataelements.xml +3 -0
- data/tools/test/js_libs/tests/relaxngui.css +203 -0
- data/tools/test/js_libs/tests/relaxngui.js +502 -0
- data/tools/test/js_libs/tests/rngtest1.html +66 -0
- data/tools/test/js_libs/tests/rngtest1.rng +147 -0
- data/tools/test/js_libs/tests/rngtest1.xml +13 -0
- data/tools/test/js_libs/tests/rngtest2.html +60 -0
- data/tools/test/js_libs/tests/rngtest2.rng +6 -0
- data/tools/test/js_libs/tests/rngtest2.xml +3 -0
- data/tools/test/js_libs/tests/rngtest3.html +60 -0
- data/tools/test/js_libs/tests/rngtest3.rng +23 -0
- data/tools/test/js_libs/tests/rngtest3.xml +9 -0
- data/tools/test/js_libs/tests/rngtest4.html +60 -0
- data/tools/test/js_libs/tests/rngtest4.rng +19 -0
- data/tools/test/js_libs/tests/rngtest4.xml +12 -0
- data/tools/test/js_libs/tests/rngtest5.html +60 -0
- data/tools/test/js_libs/tests/rngtest5.rng +75 -0
- data/tools/test/js_libs/tests/rngtest5.xml +40 -0
- data/tools/test/js_libs/tests/rngtest6.html +60 -0
- data/tools/test/js_libs/tests/rngtest6.rng +24 -0
- data/tools/test/js_libs/tests/rngtest6.xml +6 -0
- data/tools/test/js_libs/tests/rngtest8.html +60 -0
- data/tools/test/js_libs/tests/rngtest8.rng +13 -0
- data/tools/test/js_libs/tests/rngtest8.xml +2 -0
- data/tools/test/js_libs/tests/rngtest9.html +60 -0
- data/tools/test/js_libs/tests/rngtest9.rng +31 -0
- data/tools/test/js_libs/tests/rngtest9.xml +8 -0
- data/tools/test/js_libs/ui.css +333 -0
- data/tools/test/js_libs/ui.html +168 -0
- data/tools/test/js_libs/ui.js +177 -0
- data/tools/test/js_libs/underscore.min.js +27 -0
- data/tools/test/js_libs/util.js +81 -0
- data/tools/test/js_libs/vkbeautify.0.99.00.beta.js +358 -0
- data/tools/test/js_libs/vkbeautify.js +1 -0
- data/tools/test/js_libs/webcomponents.min.js +196 -0
- data/tools/test/model.html +192 -0
- data/tools/test/rngs/attributes.rng +8 -0
- data/tools/test/rngs/dataelements.rng +8 -0
- data/tools/test/rngs/endpoints.rng +8 -0
- data/tools/test/templates.legacy/Async.xml +46 -0
- data/tools/test/templates.legacy/BCO.xml +70 -0
- data/tools/test/templates.legacy/BCS.xml +70 -0
- data/tools/test/templates.legacy/Centurio.xml +75 -0
- data/tools/test/templates.legacy/Concurrent.xml +40 -0
- data/tools/test/templates.legacy/Coopis Testset.xml +76 -0
- data/tools/test/templates.legacy/Endpoints and Data Manipulation.xml +30 -0
- data/tools/test/templates.legacy/ICSOC Testset.xml +95 -0
- data/tools/test/templates.legacy/Infinity.xml +28 -0
- data/tools/test/templates.legacy/Lego Boxer.xml +31 -0
- data/tools/test/templates.legacy/Lego Conveyor.xml +31 -0
- data/tools/test/templates.legacy/Lego Crane.xml +87 -0
- data/tools/test/templates.legacy/Lego Ejector.xml +55 -0
- data/tools/test/templates.legacy/Lego Full.xml +142 -0
- data/tools/test/templates.legacy/Lego Liddy.xml +40 -0
- data/tools/test/templates.legacy/Lego Plate.xml +31 -0
- data/tools/test/templates.legacy/Lego Transporter.xml +43 -0
- data/tools/test/templates.legacy/Lego_Part_1.xml +85 -0
- data/tools/test/templates.legacy/LgLinear.xml +65 -0
- data/tools/test/templates.legacy/Linear.xml +77 -0
- data/tools/test/templates.legacy/Log.xml +117 -0
- data/tools/test/templates.legacy/Mangler 1.xml +87 -0
- data/tools/test/templates.legacy/Mangler 2.xml +103 -0
- data/tools/test/templates.legacy/Manuel Labels.xml +55 -0
- data/tools/test/templates.legacy/Promise.xml +275 -0
- data/tools/test/templates.legacy/SOPROMO Test Sonification.xml +83 -0
- data/tools/test/templates.legacy/Subprocess.xml +56 -0
- data/tools/test/templates.legacy/Syncing P34 1.xml +77 -0
- data/tools/test/templates.legacy/Syncing P34 2.xml +77 -0
- data/tools/test/templates.legacy/Syncing P34 3.xml +77 -0
- data/tools/test/templates.legacy/Syncing P34.xml +77 -0
- data/tools/test/templates.legacy/TEST - Bad Loop.xml +173 -0
- data/tools/test/templates.legacy/TEST - Wrong Positions.xml +174 -0
- data/tools/test/templates.legacy/Take_5.xml +48 -0
- data/tools/test/templates.legacy/Update.xml +32 -0
- data/tools/test/templates.legacy/Worklist Parallel.xml +104 -0
- data/tools/test/templates.legacy/Worklist Test CPEE.xml +40 -0
- data/tools/test/templates.legacy/Worklist Test.xml +42 -0
- data/tools/test/templates.legacy/Worklist Test2.xml +43 -0
- data/tools/test/templates.legacy/convert_cpee2.rb +15 -0
- data/tools/test/templates.legacy/convert_preset.rb +32 -0
- data/tools/test/templates.legacy/testsets.xml +37 -0
- data/tools/test/templates.legacy/transformations.xml +4 -0
- data/tools/test/templates/Coopis 2010.xml +76 -0
- data/tools/test/templates/IUPC arXiv:1104.3609 P34 1.xml +77 -0
- data/tools/test/templates/IUPC arXiv:1104.3609 P34 2.xml +77 -0
- data/tools/test/templates/IUPC arXiv:1104.3609 P34 3.xml +77 -0
- data/tools/test/templates/Track Test Local.xml +82 -0
- data/tools/test/templates/Track Test.xml +82 -0
- data/tools/test/templates/UR-VUE 2020 Manual Adjust.xml +182 -0
- data/tools/test/templates/UR-VUE 2020 Solution Baseline.xml +203 -0
- data/tools/test/templates/UR-VUE 2020 Solution NN.xml +197 -0
- data/tools/test/templates/UR-VUE 2020 Solution View.xml +151 -0
- data/tools/test/templates/UR-VUE 2020.xml +26 -0
- data/tools/test/templates/Worklist.xml +42 -0
- data/tools/test/templates/instantiate.local/Take_Sub.xml +59 -0
- data/tools/test/templates/instantiate/Take_Perf.xml +46 -0
- data/tools/test/templates/instantiate/Take_Sub.xml +58 -0
- data/tools/test/templates/instantiate/Take_X.xml +48 -0
- data/tools/test/themes/compact/theme.js +1285 -0
- data/tools/test/themes/diana/theme.js +1650 -0
- data/tools/test/themes/extended/theme.js +1325 -0
- data/tools/test/themes/model/rngs/alternative.rng +1 -0
- data/tools/test/themes/model/rngs/call.rng +67 -0
- data/tools/test/themes/model/rngs/callmanipulate.rng +72 -0
- data/tools/test/themes/model/rngs/choose.rng +1 -0
- data/tools/test/themes/model/rngs/critical.rng +1 -0
- data/tools/test/themes/model/rngs/escape.rng +1 -0
- data/tools/test/themes/model/rngs/group.rng +1 -0
- data/tools/test/themes/model/rngs/loop.rng +1 -0
- data/tools/test/themes/model/rngs/manipulate.rng +1 -0
- data/tools/test/themes/model/rngs/otherwise.rng +1 -0
- data/tools/test/themes/model/rngs/parallel.rng +1 -0
- data/tools/test/themes/model/rngs/parallel_branch.rng +1 -0
- data/tools/test/themes/model/rngs/scripts.rng +7 -0
- data/tools/test/themes/model/rngs/stop.rng +1 -0
- data/tools/test/themes/model/rngs/terminate.rng +1 -0
- data/tools/test/themes/model/theme.js +1268 -0
- data/tools/test/themes/packed/theme.js +1286 -0
- data/tools/test/themes/preset/rngs/alternative.rng +25 -0
- data/tools/test/themes/preset/rngs/call.rng +122 -0
- data/tools/test/themes/preset/rngs/callmanipulate.rng +145 -0
- data/tools/test/themes/preset/rngs/choose.rng +14 -0
- data/tools/test/themes/preset/rngs/closed_loop.rng +62 -0
- data/tools/test/themes/preset/rngs/closed_loop_cancel.rng +5 -0
- data/tools/test/themes/preset/rngs/closed_loop_control.rng +31 -0
- data/tools/test/themes/preset/rngs/closed_loop_measuring.rng +12 -0
- data/tools/test/themes/preset/rngs/critical.rng +5 -0
- data/tools/test/themes/preset/rngs/escape.rng +1 -0
- data/tools/test/themes/preset/rngs/group.rng +3 -0
- data/tools/test/themes/preset/rngs/loop.rng +22 -0
- data/tools/test/themes/preset/rngs/manipulate.rng +9 -0
- data/tools/test/themes/preset/rngs/otherwise.rng +22 -0
- data/tools/test/themes/preset/rngs/parallel.rng +21 -0
- data/tools/test/themes/preset/rngs/parallel_branch.rng +8 -0
- data/tools/test/themes/preset/rngs/scripts.rng +23 -0
- data/tools/test/themes/preset/rngs/stop.rng +5 -0
- data/tools/test/themes/preset/rngs/terminate.rng +1 -0
- data/tools/test/themes/preset/symbols/alternative.svg +5 -0
- data/tools/test/themes/preset/symbols/arrow.svg +3 -0
- data/tools/test/themes/preset/symbols/call.svg +6 -0
- data/tools/test/themes/preset/symbols/callmanipulate.svg +8 -0
- data/tools/test/themes/preset/symbols/choose.svg +5 -0
- data/tools/test/themes/preset/symbols/choose_exclusive.svg +5 -0
- data/tools/test/themes/preset/symbols/choose_inclusive.svg +4 -0
- data/tools/test/themes/preset/symbols/closed_loop.svg +5 -0
- data/tools/test/themes/preset/symbols/closed_loop_cancel.svg +5 -0
- data/tools/test/themes/preset/symbols/closed_loop_control.svg +5 -0
- data/tools/test/themes/preset/symbols/closed_loop_measuring.svg +6 -0
- data/tools/test/themes/preset/symbols/complex.svg +8 -0
- data/tools/test/themes/preset/symbols/critical.svg +4 -0
- data/tools/test/themes/preset/symbols/end.svg +3 -0
- data/tools/test/themes/preset/symbols/escape.svg +5 -0
- data/tools/test/themes/preset/symbols/event_end.svg +3 -0
- data/tools/test/themes/preset/symbols/loop.svg +5 -0
- data/tools/test/themes/preset/symbols/manipulate.svg +4 -0
- data/tools/test/themes/preset/symbols/otherwise.svg +5 -0
- data/tools/test/themes/preset/symbols/parallel.svg +5 -0
- data/tools/test/themes/preset/symbols/parallel_branch.svg +5 -0
- data/tools/test/themes/preset/symbols/parallel_branch_compact.svg +4 -0
- data/tools/test/themes/preset/symbols/parallel_branch_event.svg +14 -0
- data/tools/test/themes/preset/symbols/parallel_branch_normal.svg +5 -0
- data/tools/test/themes/preset/symbols/scripts.svg +4 -0
- data/tools/test/themes/preset/symbols/start.svg +3 -0
- data/tools/test/themes/preset/symbols/stop.svg +5 -0
- data/tools/test/themes/preset/symbols/terminate.svg +4 -0
- data/tools/test/themes/preset/theme.js +1287 -0
- data/tools/test/track.html +142 -0
- metadata +282 -2
@@ -0,0 +1,41 @@
|
|
1
|
+
document.addEventListener('graph:changed', function (e) {
|
2
|
+
$("button[name=save]").prop("disabled",false);
|
3
|
+
}, false);
|
4
|
+
|
5
|
+
$(document).ready(function() {
|
6
|
+
$('#tabmodel').click(function(event){
|
7
|
+
$('#model ui-behind button:nth-child(1)').addClass('hidden');
|
8
|
+
});
|
9
|
+
$('#tabdataelements').click(function(event){
|
10
|
+
$('#model ui-behind button:nth-child(1)').removeClass('hidden');
|
11
|
+
});
|
12
|
+
|
13
|
+
$('#model ui-behind button:nth-child(1)').click(function(event){
|
14
|
+
var but = $(document).find('#model ui-content ui-area:not(.inactive) button');
|
15
|
+
but.click();
|
16
|
+
var are = $(document).find('#model ui-content ui-area:not(.inactive)');
|
17
|
+
var tab = $(document).find('#model ui-content ui-area:not(.inactive) .relaxngui_table');
|
18
|
+
are.animate({ scrollTop: tab.height() }, "slow");
|
19
|
+
});
|
20
|
+
|
21
|
+
$("button[name=save]").click(function(){
|
22
|
+
var def = new $.Deferred();
|
23
|
+
def.done(function(name,testset) {
|
24
|
+
$.ajax({
|
25
|
+
url: $('body').attr('current-save') + ($('body').attr('current-save-dir') ? ($('body').attr('current-save-dir') + '/').replace(/\/+/,'/') : '') + name + '.xml',
|
26
|
+
type: 'PUT',
|
27
|
+
contentType: 'application/xml',
|
28
|
+
data: testset.serializePrettyXML(),
|
29
|
+
headers: { 'Content-ID': 'content' },
|
30
|
+
success: function() {
|
31
|
+
$("button[name=save]").prop("disabled",true);
|
32
|
+
$("#lastsavedline").removeClass('hidden');
|
33
|
+
var dt = new Date();
|
34
|
+
var time = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
|
35
|
+
$("#lastsaved").text(time);
|
36
|
+
}
|
37
|
+
});
|
38
|
+
});
|
39
|
+
get_testset(def);
|
40
|
+
});
|
41
|
+
});
|
@@ -0,0 +1,82 @@
|
|
1
|
+
$(document).ready(function() {
|
2
|
+
// hook up dataelements with relaxngui //{{{
|
3
|
+
$.ajax({
|
4
|
+
type: "GET",
|
5
|
+
url: "rngs/dataelements.rng",
|
6
|
+
dataType: "xml",
|
7
|
+
success: function(rng){
|
8
|
+
save['dataelements'] = new RelaxNGui(rng,$('#dat_dataelements'));
|
9
|
+
}
|
10
|
+
}); //}}}
|
11
|
+
// hook up endpoints with relaxngui //{{{
|
12
|
+
$.ajax({
|
13
|
+
type: "GET",
|
14
|
+
dataType: "xml",
|
15
|
+
url: "rngs/endpoints.rng",
|
16
|
+
success: function(rng){
|
17
|
+
save['endpoints'] = new RelaxNGui(rng,$('#dat_endpoints'));
|
18
|
+
}
|
19
|
+
}); //}}}
|
20
|
+
// hook up attributes with relaxngui //{{{
|
21
|
+
$.ajax({
|
22
|
+
type: "GET",
|
23
|
+
dataType: "xml",
|
24
|
+
url: "rngs/attributes.rng",
|
25
|
+
success: function(rng){
|
26
|
+
save['attributes'] = new RelaxNGui(rng,$('#dat_attributes'));
|
27
|
+
}
|
28
|
+
}); //}}}
|
29
|
+
|
30
|
+
// new entry //{{{
|
31
|
+
$('#parameters ui-behind button:nth-child(1)').click(function(event){
|
32
|
+
var but = $(document).find('#parameters ui-content ui-area:not(.inactive) button');
|
33
|
+
but.click();
|
34
|
+
var are = $(document).find('#parameters ui-content ui-area:not(.inactive)');
|
35
|
+
var tab = $(document).find('#parameters ui-content ui-area:not(.inactive) .relaxngui_table');
|
36
|
+
are.animate({ scrollTop: tab.height() }, "slow");
|
37
|
+
}); //}}}
|
38
|
+
|
39
|
+
var timer;
|
40
|
+
// when input in one of the inputs, save
|
41
|
+
$(document).on('input','#dat_dataelements input, #dat_endpoints input, #dat_attributes input',function(event){
|
42
|
+
clearTimeout(timer);
|
43
|
+
timer = setTimeout(function(){ do_parameters_save(event); }, 5000);
|
44
|
+
});
|
45
|
+
$(document).on('blur','#dat_dataelements input, #dat_endpoints input, #dat_attributes input',function(event){
|
46
|
+
clearTimeout(timer);
|
47
|
+
do_parameters_save(event);
|
48
|
+
}); //}}}
|
49
|
+
$(document).on('keypress','#dat_dataelements input, #dat_endpoints input, #dat_attributes input',function(event){
|
50
|
+
if (event.keyCode == 13) {
|
51
|
+
clearTimeout(timer);
|
52
|
+
do_parameters_save(event);
|
53
|
+
}
|
54
|
+
}); //}}}
|
55
|
+
$(document).on('relaxngui_remove', '#dat_dataelements, #dat_endpoints, #dat_attributes', function(event){
|
56
|
+
clearTimeout(timer);
|
57
|
+
do_parameters_save(event);
|
58
|
+
});
|
59
|
+
$(document).on('relaxngui_move', '#dat_dataelements, #dat_endpoints, #dat_attributes', function(event){
|
60
|
+
clearTimeout(timer);
|
61
|
+
do_parameters_save(event);
|
62
|
+
});
|
63
|
+
});
|
64
|
+
|
65
|
+
function do_parameters_save(event) { //{{{
|
66
|
+
var visid = $('ui-tabbar ui-tab',$(event.target).parents('ui-tabbed')).not('.switch').not('.inactive').attr('data-tab');
|
67
|
+
if (save[visid].has_changed()) {
|
68
|
+
var url = $('body').attr('current-instance');
|
69
|
+
save[visid].set_checkpoint();
|
70
|
+
var send = save[visid].save_text();
|
71
|
+
$.ajax({
|
72
|
+
type: "PUT",
|
73
|
+
url: url + "/properties/" + visid + "/",
|
74
|
+
contentType: 'text/xml',
|
75
|
+
headers: {
|
76
|
+
'Content-ID': visid,
|
77
|
+
'CPEE-Event-Source': myid
|
78
|
+
},
|
79
|
+
data: send
|
80
|
+
});
|
81
|
+
}
|
82
|
+
} //}}}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
function closeIFrame(srch) {
|
2
|
+
var count = 0;
|
3
|
+
$('iframe').each(function(i,val){
|
4
|
+
if ($(val).attr('src') == 'track.html' + srch) {
|
5
|
+
$(val).remove();
|
6
|
+
}
|
7
|
+
count += 1;
|
8
|
+
});
|
9
|
+
if (count == 1) {
|
10
|
+
$('#graphcolumn').removeClass('resize');
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
$(document).ready(function() {
|
15
|
+
$("a[name=glob_unshow]").click(e => {
|
16
|
+
parent.closeIFrame(window.location.search);
|
17
|
+
});
|
18
|
+
});
|
data/tools/test/js/ui.js
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
function config_defaults(){
|
2
|
+
var default_values = {};
|
3
|
+
// logs is missing, so that the button is not shown, when there is no info
|
4
|
+
if (location.protocol.match(/^file/)) {
|
5
|
+
default_values['res-url'] = 'http://localhost:' + $('body').data('res-port');
|
6
|
+
default_values['base-url'] = 'http://localhost:' + $('body').data('base-port');
|
7
|
+
default_values['save-url'] = 'http://localhost:' + $('body').data('base-port') + '/design';
|
8
|
+
} else {
|
9
|
+
default_values['res-url'] = location.protocol + "//" + location.hostname + ":" + $('body').data('res-port');
|
10
|
+
default_values['base-url'] = location.protocol + "//" + location.hostname + ":" + $('body').data('base-port');
|
11
|
+
default_values['save-url'] = location.protocol + "//" + location.hostname + ":" + $('body').data('base-port') + '/design';
|
12
|
+
}
|
13
|
+
default_values['templates-url'] = 'templates/';
|
14
|
+
return default_values;
|
15
|
+
}
|
16
|
+
|
17
|
+
$(document).ready(function() {
|
18
|
+
if (!($.cookie('cpee_iagree')) && $("body > div[id='disclaimer']").length > 0) {
|
19
|
+
$("body > :not([id='disclaimer'])").remove();
|
20
|
+
$("body > [id='disclaimer']").removeClass('hidden');
|
21
|
+
|
22
|
+
$("#iagree").click(function(){
|
23
|
+
if($(this).is(':checked')){
|
24
|
+
$("#icontinue").prop("disabled", false);
|
25
|
+
} else {
|
26
|
+
$("#icontinue").prop("disabled", true);
|
27
|
+
}
|
28
|
+
});
|
29
|
+
$("#icontinue").click(function(){
|
30
|
+
$.cookie('cpee_iagree','yes');
|
31
|
+
location.reload();
|
32
|
+
});
|
33
|
+
} else {
|
34
|
+
$.ajax({
|
35
|
+
url: "config.json",
|
36
|
+
success: function(res){
|
37
|
+
var res_def = config_defaults();
|
38
|
+
if (res['log-url']) { // just leave it out when it is not configured
|
39
|
+
$("body").attr('current-logs',res['log-url']);
|
40
|
+
}
|
41
|
+
if (res['res-url']) {
|
42
|
+
$("body").attr('current-resources',res['res-url']);
|
43
|
+
} else {
|
44
|
+
$("body").attr('current-resources',res_def['res-url']);
|
45
|
+
}
|
46
|
+
if (res['base-url']) {
|
47
|
+
$("body").attr('current-base',res['base-url']);
|
48
|
+
} else {
|
49
|
+
$("body").attr('current-base',res_def['base-url']);
|
50
|
+
}
|
51
|
+
if (res['save-url']) {
|
52
|
+
$("body").attr('current-save',res['save-url']);
|
53
|
+
} else {
|
54
|
+
$("body").attr('current-save',res_def['save-url']);
|
55
|
+
}
|
56
|
+
if (res['templates-url']) {
|
57
|
+
$("body").attr('current-templates',res['templates-url']);
|
58
|
+
} else {
|
59
|
+
$("body").attr('current-templates',res_def['templates-url']);
|
60
|
+
}
|
61
|
+
$("input[name=res-url]").val($("body").attr('current-resources'));
|
62
|
+
$("input[name=base-url]").val($("body").attr('current-base'));
|
63
|
+
cockpit();
|
64
|
+
},
|
65
|
+
error: function(){
|
66
|
+
var res = config_defaults();
|
67
|
+
$("body").attr('current-resources',res['res-url']);
|
68
|
+
$("body").attr('current-base',res['base-url']);
|
69
|
+
$("body").attr('current-save',res['save-url']);
|
70
|
+
$("body").attr('current-templates',res['templates-url']);
|
71
|
+
$("input[name=res-url]").val($("body").attr('current-resources'));
|
72
|
+
$("input[name=base-url]").val($("body").attr('current-base'));
|
73
|
+
cockpit();
|
74
|
+
}
|
75
|
+
});
|
76
|
+
}
|
77
|
+
});
|
78
|
+
|
79
|
+
$(document).on('copy', '[contenteditable]', function (e) {
|
80
|
+
e = e.originalEvent;
|
81
|
+
var selectedText = window.getSelection();
|
82
|
+
var range = selectedText.getRangeAt(0);
|
83
|
+
var selectedTextReplacement = range.toString()
|
84
|
+
e.clipboardData.setData('text/plain', selectedTextReplacement);
|
85
|
+
e.preventDefault(); // default behaviour is to copy any selected text
|
86
|
+
});
|
87
|
+
|
88
|
+
// Paste fix for contenteditable
|
89
|
+
$(document).on('paste', '[contenteditable]', function (e) {
|
90
|
+
e.preventDefault();
|
91
|
+
|
92
|
+
if (window.clipboardData) {
|
93
|
+
content = window.clipboardData.getData('Text');
|
94
|
+
if (window.getSelection) {
|
95
|
+
var selObj = window.getSelection();
|
96
|
+
var selRange = selObj.getRangeAt(0);
|
97
|
+
selRange.deleteContents();
|
98
|
+
selRange.insertNode(document.createTextNode(content));
|
99
|
+
}
|
100
|
+
} else if (e.originalEvent.clipboardData) {
|
101
|
+
content = (e.originalEvent || e).clipboardData.getData('text/plain');
|
102
|
+
document.execCommand('insertText', false, content);
|
103
|
+
}
|
104
|
+
});
|
@@ -0,0 +1,763 @@
|
|
1
|
+
/*
|
2
|
+
This file is part of CPEE.
|
3
|
+
|
4
|
+
CPEE is free software: you can redistribute it and/or modify it under the terms
|
5
|
+
of the GNU General Public License as published by the Free Software Foundation,
|
6
|
+
either version 3 of the License, or (at your option) any later version.
|
7
|
+
|
8
|
+
CPEE is distributed in the hope that it will be useful, but WITHOUT ANY
|
9
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
10
|
+
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
11
|
+
|
12
|
+
You should have received a copy of the GNU General Public License along with
|
13
|
+
CPEE (file COPYING in the main directory). If not, see
|
14
|
+
<http://www.gnu.org/licenses/>.
|
15
|
+
*/
|
16
|
+
|
17
|
+
// TODO: changes in svg-script:
|
18
|
+
// 1) drawing functions
|
19
|
+
// 2) creation of svg-container (Bug: arrows on lines)
|
20
|
+
// 3) after-function to insert using namespace of description
|
21
|
+
|
22
|
+
// WfAdaptor:
|
23
|
+
// Handles interaction between Illustartor and Description
|
24
|
+
// e.g. Event fires to Adaptor to insert Element and Illustrator and Description do it
|
25
|
+
function WfAdaptor(theme_base,doit) { // Controller {{{
|
26
|
+
|
27
|
+
// public variables {{{
|
28
|
+
this.illustrator;
|
29
|
+
this.description;
|
30
|
+
this.elements = {};
|
31
|
+
this.theme_base = theme_base;
|
32
|
+
this.theme_dir = theme_base.replace(/theme.js/,'');
|
33
|
+
// }}}
|
34
|
+
|
35
|
+
// private variables {{{
|
36
|
+
var illustrator;
|
37
|
+
var description;
|
38
|
+
var self = this;
|
39
|
+
// }}}
|
40
|
+
|
41
|
+
// helper funtions
|
42
|
+
this.set_description = function(desc,auto_update) { // public {{{
|
43
|
+
this.description.set_description(desc,auto_update);
|
44
|
+
} // }}}
|
45
|
+
|
46
|
+
this.get_description = function() { // public {{{
|
47
|
+
return description.get_description();
|
48
|
+
} // }}}
|
49
|
+
this.notify = function() { // public {{{
|
50
|
+
} // }}}
|
51
|
+
this.draw_labels = function(max,labels,height_shift,striped){ // public {{{
|
52
|
+
} // }}}
|
53
|
+
this.set_svg_container = function (container) { // {{{
|
54
|
+
illustrator.set_svg_container(container); // TODO: shadowing the container element
|
55
|
+
} // }}}
|
56
|
+
this.set_label_container = function(container) { // {{{
|
57
|
+
illustrator.set_label_container(container);
|
58
|
+
} // }}}
|
59
|
+
|
60
|
+
// initialize
|
61
|
+
this.illustrator = illustrator = new WfIllustrator(this);
|
62
|
+
this.description = description = new WfDescription(this, this.illustrator);
|
63
|
+
|
64
|
+
this.update = function(doit){ doit(self); };
|
65
|
+
|
66
|
+
$.getScript(theme_base, function() {
|
67
|
+
manifestation = new WFAdaptorManifestation(self);
|
68
|
+
illustrator.compact = manifestation.compact == true ? true : false;
|
69
|
+
illustrator.striped = manifestation.striped == true ? true : false;
|
70
|
+
description.source = manifestation.source;
|
71
|
+
var deferreds = [];
|
72
|
+
// copy parent stuff
|
73
|
+
for(element in manifestation.elements) {
|
74
|
+
if (manifestation.elements[element].parent) {
|
75
|
+
if (!manifestation.elements[element].description) {
|
76
|
+
manifestation.elements[element].description = manifestation.elements[manifestation.elements[element].parent].description;
|
77
|
+
}
|
78
|
+
if (!manifestation.elements[element].adaptor) {
|
79
|
+
manifestation.elements[element].adaptor = manifestation.elements[manifestation.elements[element].parent].adaptor;
|
80
|
+
}
|
81
|
+
var ill = manifestation.elements[manifestation.elements[element].parent].illustrator;
|
82
|
+
for (var key in ill) {
|
83
|
+
if (manifestation.elements[element].illustrator[key] == undefined) {
|
84
|
+
manifestation.elements[element].illustrator[key] = ill[key];
|
85
|
+
}
|
86
|
+
}
|
87
|
+
if (manifestation.elements[element].type == undefined) {
|
88
|
+
manifestation.elements[element].type = manifestation.elements[manifestation.elements[element].parent].type;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
// doit
|
93
|
+
for(element in manifestation.resources) {
|
94
|
+
deferreds.push(
|
95
|
+
$.ajax({
|
96
|
+
type: "GET",
|
97
|
+
dataType: "xml",
|
98
|
+
url: manifestation.resources[element],
|
99
|
+
context: element,
|
100
|
+
success: function(res){
|
101
|
+
manifestation.resources[this] = $(res.documentElement);
|
102
|
+
}
|
103
|
+
})
|
104
|
+
);
|
105
|
+
}
|
106
|
+
for(element in manifestation.elements) {
|
107
|
+
if (manifestation.elements[element].illustrator) {
|
108
|
+
if (manifestation.elements[element].illustrator.svg) {
|
109
|
+
deferreds.push(
|
110
|
+
$.ajax({
|
111
|
+
type: "GET",
|
112
|
+
dataType: "xml",
|
113
|
+
url: manifestation.elements[element].illustrator.svg,
|
114
|
+
context: element,
|
115
|
+
success: function(res){
|
116
|
+
manifestation.elements[this].illustrator.svg = $(res.documentElement);
|
117
|
+
}
|
118
|
+
})
|
119
|
+
);
|
120
|
+
}
|
121
|
+
illustrator.elements[element] = manifestation.elements[element].illustrator;
|
122
|
+
illustrator.elements[element].type = manifestation.elements[element].type || 'abstract';
|
123
|
+
}
|
124
|
+
if (manifestation.elements[element].description) {
|
125
|
+
if ( typeof manifestation.elements[element].description === 'string' ) {
|
126
|
+
manifestation.elements[element].description = [ manifestation.elements[element].description ];
|
127
|
+
}
|
128
|
+
if ($.isArray(manifestation.elements[element].description)) {
|
129
|
+
_.each(manifestation.elements[element].description,function(val,ind){
|
130
|
+
deferreds.push(
|
131
|
+
$.ajax({
|
132
|
+
type: "GET",
|
133
|
+
dataType: "xml",
|
134
|
+
url: val,
|
135
|
+
context: element,
|
136
|
+
success: function(res){
|
137
|
+
manifestation.elements[this].description = $(res.documentElement);
|
138
|
+
description.elements[this] = manifestation.elements[this].description;
|
139
|
+
}
|
140
|
+
})
|
141
|
+
);
|
142
|
+
});
|
143
|
+
}
|
144
|
+
}
|
145
|
+
if (manifestation.elements[element].adaptor) {
|
146
|
+
self.elements[element] = manifestation.elements[element].adaptor;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
$.when.apply($, deferreds).then(function(x) {
|
150
|
+
doit(self);
|
151
|
+
});
|
152
|
+
});
|
153
|
+
} // }}}
|
154
|
+
|
155
|
+
// WfIllustrator:
|
156
|
+
// Is in charge of displaying the Graph. It is further able insert and remove elements with given ID's from the illsutration.
|
157
|
+
function WfIllustrator(wf_adaptor) { // View {{{
|
158
|
+
// Variable {{{
|
159
|
+
// public
|
160
|
+
this.height = 40;
|
161
|
+
this.width = 40;
|
162
|
+
this.height_shift = this.height * 0.26;
|
163
|
+
this.width_shift = this.width * 0.39;
|
164
|
+
this.elements = {}; // the svgs
|
165
|
+
this.svg = {};
|
166
|
+
this.draw = {};
|
167
|
+
this.compact = true;
|
168
|
+
this.striped = true;
|
169
|
+
// private
|
170
|
+
var self = this;
|
171
|
+
var adaptor = null;
|
172
|
+
// }}}
|
173
|
+
// Generic Functions {{{
|
174
|
+
this.set_label_container = function(con) { // {{{
|
175
|
+
self.svg.label_container = con;
|
176
|
+
} // }}}
|
177
|
+
this.set_svg_container = function(con) { // {{{
|
178
|
+
self.svg.container = con;
|
179
|
+
self.svg.container.append($X('<defs xmlns="http://www.w3.org/2000/svg">' +
|
180
|
+
' <marker id="arrow" viewBox="0 0 10 10" refX="33" refY="5" orient="auto" markerUnits="strokeWidth" markerWidth="4.5" makerHeight="4.5">' +
|
181
|
+
' <path d="m 2 2 l 6 3 l -6 3 z"/>' +
|
182
|
+
' </marker>' +
|
183
|
+
'</defs>'));
|
184
|
+
self.svg.defs = {};
|
185
|
+
self.svg.defs['unknown'] = $X('<g xmlns="http://www.w3.org/2000/svg" class="unknown">' +
|
186
|
+
'<circle cx="15" cy="15" r="14" class="unkown"/>' +
|
187
|
+
'<text transform="translate(15,20)" class="normal">?</text>' +
|
188
|
+
'</g>');
|
189
|
+
for(element in self.elements)
|
190
|
+
if(self.elements[element].svg) {
|
191
|
+
var sym = $X('<g xmlns="http://www.w3.org/2000/svg"/>').append(self.elements[element].svg.clone().children()); // append all children to symbol
|
192
|
+
$.each(self.elements[element].svg.attr('class').split(/\s+/), function(index, item) { sym.addClass(item); }); // copy all classes from the root node
|
193
|
+
self.svg.defs[element] = sym;
|
194
|
+
}
|
195
|
+
} // }}}
|
196
|
+
var clear = this.clear = function() { // {{{
|
197
|
+
$('> :not(defs)', self.svg.container).each(function() {$(this).remove()});
|
198
|
+
} // }}}
|
199
|
+
this.set_svg = function(graph) { // {{{
|
200
|
+
if(graph.max.row < 1) graph.max.row = 1;
|
201
|
+
if(graph.max.col < 1) graph.max.col = 1;
|
202
|
+
self.svg.container.attr('height', (graph.max.row) * self.height + self.height_shift);
|
203
|
+
self.svg.container.attr('width', (graph.max.col+0.55) * self.width );
|
204
|
+
self.svg.container.append(graph.svg);
|
205
|
+
} // }}}
|
206
|
+
this.get_node_by_svg_id = function(svg_id) { // {{{
|
207
|
+
return $('[element-id = \'' + svg_id + '\'] g.activities', self.svg.container);
|
208
|
+
} // }}}
|
209
|
+
this.get_label_by_svg_id = function(svg_id) { // {{{
|
210
|
+
return $('[element-id = \'' + svg_id + '\']', self.svg.label_container);
|
211
|
+
} // }}}
|
212
|
+
this.get_elements = function() { // {{{
|
213
|
+
return $('g.element', self.svg.container);
|
214
|
+
} // }}}
|
215
|
+
this.get_labels = function() { // {{{
|
216
|
+
return $('[element-id]', self.svg.label_container);
|
217
|
+
} // }}}
|
218
|
+
// }}}
|
219
|
+
// Helper Functions {{{
|
220
|
+
var draw_stripe = this.draw.draw_stripe = function (row, maxcol) { // {{{
|
221
|
+
if (maxcol < 1) maxcol = 1;
|
222
|
+
var g = $X('<rect class="stripe ' + (row % 2 == 0 ? 'even' : 'odd') + '" x="0" y="' + String(row*self.height+self.height_shift/2) + '" width="' + (self.width * maxcol + self.width - self.width_shift) + '" height="' + (self.height) + '" xmlns="http://www.w3.org/2000/svg"></rect>');
|
223
|
+
self.svg.container.prepend(g);
|
224
|
+
return g;
|
225
|
+
} // }}}
|
226
|
+
|
227
|
+
var draw_label = this.draw.draw_label = function (tname, id, label, row, col, group) { // {{{
|
228
|
+
var g = $X('<text class="label" transform="translate(' + String(col*self.width-self.width_shift) + ',' + String(row*self.height+20-(self.height-self.height_shift)) + ')" xmlns="http://www.w3.org/2000/svg"></text>');
|
229
|
+
var spli = $(label.split(/\n/));
|
230
|
+
spli.each(function(k,v) {
|
231
|
+
var tspan = $X('<tspan x="0" dy="' + (spli.length > 1 ? '-7' : '0') + '" xmlns="http://www.w3.org/2000/svg"></tspan>');
|
232
|
+
if (k == 0) {
|
233
|
+
tspan.text(v);
|
234
|
+
} else {
|
235
|
+
tspan.text(v);
|
236
|
+
tspan.attr('dy','15');
|
237
|
+
tspan.attr('dx','15');
|
238
|
+
}
|
239
|
+
g.append(tspan);
|
240
|
+
});
|
241
|
+
if(group) { group.find('g.element[element-id=' + id + ']').append(g); }
|
242
|
+
else {self.svg.container.append(g);}
|
243
|
+
return g;
|
244
|
+
} // }}}
|
245
|
+
var draw_symbol = this.draw.draw_symbol = function (sname, id, title, row, col, group, addition) { // {{{
|
246
|
+
if(self.elements[sname] == undefined || self.elements[sname].svg == undefined) sname = 'unknown';
|
247
|
+
if (addition) {
|
248
|
+
var g = $X('<g class="element" element-type="' + sname + '" element-id="' + id + '" xmlns="http://www.w3.org/2000/svg">' +
|
249
|
+
'<g transform="translate(' + String(col*self.width-self.width_shift) + ',' + String(row*self.height-(self.height-self.height_shift)) + ')"></g>' +
|
250
|
+
'</g>');
|
251
|
+
} else {
|
252
|
+
var g = $X('<g class="element" element-type="' + sname + '" element-id="' + id + '" xmlns="http://www.w3.org/2000/svg">' +
|
253
|
+
'<g transform="translate(' + String(col*self.width-self.width_shift) + ',' + String(row*self.height-(self.height-self.height_shift)) + ')">' +
|
254
|
+
'<text class="super" transform="translate(30,8.4)">' +
|
255
|
+
'<tspan class="active">0</tspan>' +
|
256
|
+
'<tspan class="colon">,</tspan>' +
|
257
|
+
'<tspan class="vote">0</tspan>' +
|
258
|
+
'</text>' +
|
259
|
+
'</g>' +
|
260
|
+
'</g>');
|
261
|
+
}
|
262
|
+
var sym = self.svg.defs[sname].clone();
|
263
|
+
var tit = $X('<title xmlns="http://www.w3.org/2000/svg"></title>');
|
264
|
+
tit.text(title);
|
265
|
+
sym.prepend(tit);
|
266
|
+
sym.attr('class','activities');
|
267
|
+
$(g[0].childNodes[0]).append(sym);
|
268
|
+
|
269
|
+
// Binding events for symbol
|
270
|
+
bind_event(g,sname,true);
|
271
|
+
|
272
|
+
if(group) {group.append(g);}
|
273
|
+
else {self.svg.container.children('g:first').append(g);}
|
274
|
+
return g;
|
275
|
+
} // }}}
|
276
|
+
var bind_event = this.draw.bind_event = function(sym,tname,context) { //{{{
|
277
|
+
for(event_name in adaptor.elements[tname]) {
|
278
|
+
sym.bind(event_name, {'function_call':adaptor.elements[tname][event_name]}, function(e) { e.data.function_call($(this).attr('element-id'),e)});
|
279
|
+
if(event_name == 'mousedown') sym.bind('contextmenu', false);
|
280
|
+
}
|
281
|
+
} //}}}
|
282
|
+
var draw_border = this.draw.draw_border = function(id, p1, p2, group) { // {{{
|
283
|
+
group.prepend($X('<rect element-id="' + id + '" x="' + (p1.col-0.50)*self.width + '" ' +
|
284
|
+
'y="' + (p1.row-0.80)*self.height + '" ' +
|
285
|
+
'width="' + ((p2.col+1.00)-p1.col)*self.width + '" ' +
|
286
|
+
'height="' + ((p2.row+1.00)-p1.row)*self.height +'" ' +
|
287
|
+
'class="block" rx="15" ry="15" xmlns="http://www.w3.org/2000/svg"/>'));
|
288
|
+
} // }}}
|
289
|
+
var draw_tile = this.draw.draw_tile = function(id, p1, p2, group) { // {{{
|
290
|
+
group.prepend($X('<rect element-id="' + id + '" x="' + ((p1.col-1)*self.width + 1.3 * self.width_shift) + '" ' +
|
291
|
+
'y="' + ((p1.row-1)*self.height+self.height_shift/2) + '" ' +
|
292
|
+
'width="' + ((p2.col+1)-p1.col)*self.width + '" ' +
|
293
|
+
'height="' + ((p2.row+1)-p1.row)*self.height +'" ' +
|
294
|
+
'class="tile" rx="15" ry="15" xmlns="http://www.w3.org/2000/svg"/>'));
|
295
|
+
} // }}}
|
296
|
+
var draw_connection = this.draw.draw_connection = function(group, start, end, max_line, num_lines, arrow) { // {{{
|
297
|
+
if(((end['row']-start['row']) == 0) && ((end['col']-start['col']) == 0)) return;
|
298
|
+
var line;
|
299
|
+
if (arrow)
|
300
|
+
line = $X('<path xmlns="http://www.w3.org/2000/svg" class="ourline" marker-end="url(#arrow)"/>');
|
301
|
+
else
|
302
|
+
line = $X('<path xmlns="http://www.w3.org/2000/svg" class="ourline"/>');
|
303
|
+
if (end['row']-start['row'] == 0 || end['col']-start['col'] == 0) { // straight line
|
304
|
+
line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
|
305
|
+
String(end['col']*self.width) + "," + String(end['row']*self.height-15)
|
306
|
+
);
|
307
|
+
} else if (end['row']-start['row'] > 0) { // downwards
|
308
|
+
if (end['col']-start['col'] > 0) {// left - right
|
309
|
+
if (self.compact) {
|
310
|
+
line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
|
311
|
+
String(start['col']*self.width+14) + "," + String((end['row']-1)*self.height) +" "+ // first turn of hotizontal-line going away from node
|
312
|
+
String(end['col']*self.width) + "," + String((end['row']-1)*self.height) +" "+
|
313
|
+
String(end['col']*self.width) + "," + String(end['row']*self.height-15)
|
314
|
+
);
|
315
|
+
} else {
|
316
|
+
line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
|
317
|
+
String(end['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
|
318
|
+
String(end['col']*self.width) + "," + String(end['row']*self.height-15)
|
319
|
+
);
|
320
|
+
}
|
321
|
+
} else { // right - left
|
322
|
+
line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
|
323
|
+
String(start['col']*self.width) + "," + String(end['row']*self.height-35) +" "+
|
324
|
+
String(end['col']*self.width+14) + "," + String(end['row']*self.height-35) +" "+ // last turn of horizontal-line going into the node
|
325
|
+
String(end['col']*self.width) + "," + String(end['row']*self.height-15)
|
326
|
+
);
|
327
|
+
}
|
328
|
+
} else if(end['row']-start['row'] < 0) { // upwards
|
329
|
+
if(num_lines > 1) {// ??? no idea
|
330
|
+
line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
|
331
|
+
String(start['col']*self.width) + "," + String((max_line-1)*self.height+5) +" "+
|
332
|
+
String(end['col']*self.width+20) + "," + String((max_line-1)*self.height+5) +" "+
|
333
|
+
String(end['col']*self.width+20) + "," + String(end['row']*self.height+25)+" "+
|
334
|
+
String(end['col']*self.width) + "," + String(end['row']*self.height-15)
|
335
|
+
);
|
336
|
+
} else {
|
337
|
+
line.attr("d", "M " + String(start['col']*self.width) + "," + String(start['row']*self.height-15) +" "+
|
338
|
+
String(end['col']*self.width+15) + "," + String(start['row']*self.height-15) +" "+
|
339
|
+
String(end['col']*self.width+15) + "," + String(end['row']*self.height+15)+" "+
|
340
|
+
String(end['col']*self.width) + "," + String(end['row']*self.height-15)
|
341
|
+
);
|
342
|
+
}
|
343
|
+
}
|
344
|
+
self.svg.container.append(line);
|
345
|
+
} // }}}
|
346
|
+
// }}}
|
347
|
+
// Initialize {{{
|
348
|
+
adaptor = wf_adaptor;
|
349
|
+
// }}}
|
350
|
+
} // }}}
|
351
|
+
|
352
|
+
// WfDescription:
|
353
|
+
// Manages the description. Is is further able to add/remove elements from the controlflow description.
|
354
|
+
function WfDescription(wf_adaptor, wf_illustrator) { // Model {{{
|
355
|
+
// public variables
|
356
|
+
this.elements = {}; // the rngs
|
357
|
+
this.source = null;
|
358
|
+
// private variables
|
359
|
+
var self = this;
|
360
|
+
var adaptor;
|
361
|
+
var illustrator;
|
362
|
+
var description;
|
363
|
+
var id_counter = {};
|
364
|
+
var update_illustrator = true;
|
365
|
+
var labels = [];
|
366
|
+
|
367
|
+
// Set Labels //{{{
|
368
|
+
this.set_labels = function(graph) {
|
369
|
+
if (illustrator.compact == false) {
|
370
|
+
adaptor.draw_labels(graph.max,labels,illustrator.height_shift,illustrator.striped == true ? true : false);
|
371
|
+
} else {
|
372
|
+
adaptor.draw_labels(graph.max,[],illustrator.height_shift,false);
|
373
|
+
}
|
374
|
+
if (illustrator.striped == true && illustrator.compact == false) {
|
375
|
+
for (var i=0; i < graph.max.row; i++) {
|
376
|
+
illustrator.draw.draw_stripe(i,graph.max.col);
|
377
|
+
}
|
378
|
+
}
|
379
|
+
if (illustrator.compact == false) {
|
380
|
+
if (labels.length > 0) {
|
381
|
+
_.each(labels,function(a,key) {
|
382
|
+
if (a.label && a.label[0] && a.label[0].column == 'Label' && a.label[0].value) {
|
383
|
+
illustrator.draw.draw_label(a.tname, a.element_id, a.label[0].value, a.row, graph.max.col + 1, graph.svg);
|
384
|
+
}
|
385
|
+
});
|
386
|
+
}
|
387
|
+
}
|
388
|
+
} //}}}
|
389
|
+
|
390
|
+
// Generic Functions {{{
|
391
|
+
this.set_description = function(desc, auto_update) { // public {{{
|
392
|
+
if(auto_update != undefined) update_illustrator = auto_update;
|
393
|
+
if(typeof desc == "string") {
|
394
|
+
description = $($.parseXML(desc));
|
395
|
+
} else if(desc instanceof jQuery) {
|
396
|
+
description = desc;
|
397
|
+
} else {
|
398
|
+
alert("WfDescription: unknown description type:\nConstructor-Name: " + desc.constructor + " / TypeOf: " + (typeof desc));
|
399
|
+
description = null;
|
400
|
+
}
|
401
|
+
id_counter = {};
|
402
|
+
labels = [];
|
403
|
+
illustrator.clear();
|
404
|
+
var graph = parse(description.children('description').get(0), {'row':0,'col':0,final:false,wide:false});
|
405
|
+
self.set_labels(graph);
|
406
|
+
// set labels
|
407
|
+
illustrator.set_svg(graph);
|
408
|
+
} // }}}
|
409
|
+
var gd = this.get_description = function() { // public {{{
|
410
|
+
var serxml = $(description.get(0).documentElement).clone(true);
|
411
|
+
serxml.removeAttr('svg-id');
|
412
|
+
serxml.removeAttr('svg-type');
|
413
|
+
serxml.removeAttr('svg-subtype');
|
414
|
+
serxml.removeAttr('svg-label');
|
415
|
+
$('*[svg-id]',serxml).each(function(){
|
416
|
+
$(this).removeAttr('svg-id');
|
417
|
+
});
|
418
|
+
$('*[svg-type]',serxml).each(function(){
|
419
|
+
$(this).removeAttr('svg-type');
|
420
|
+
});
|
421
|
+
$('*[svg-subtype]',serxml).each(function(){
|
422
|
+
$(this).removeAttr('svg-subtype');
|
423
|
+
});
|
424
|
+
$('*[svg-label]',serxml).each(function(){
|
425
|
+
$(this).removeAttr('svg-label');
|
426
|
+
});
|
427
|
+
return serxml.serializeXML();
|
428
|
+
} // }}}
|
429
|
+
this.get_node_by_svg_id = function(svg_id) { // {{{
|
430
|
+
return $('[svg-id = \'' + svg_id + '\']', description);
|
431
|
+
} // }}}
|
432
|
+
var context_eval = this.context_eval = function(what) { // {{{
|
433
|
+
return eval(what);
|
434
|
+
} // }}}
|
435
|
+
var get_free_id = this.get_free_id = function(other) { // {{{
|
436
|
+
var existing = new Array();
|
437
|
+
if (other) {
|
438
|
+
if ($(other).attr('id')) {
|
439
|
+
existing.push($(other).attr('id'));
|
440
|
+
}
|
441
|
+
$(other).find("[id]").each(function(k,v){
|
442
|
+
existing.push($(v).attr('id'));
|
443
|
+
});
|
444
|
+
}
|
445
|
+
$('*[id]', description).each(function(){existing.push($(this).attr('id'))});
|
446
|
+
var id = 1;
|
447
|
+
while ($.inArray('a' + id,existing) != -1) {
|
448
|
+
id += 1;
|
449
|
+
}
|
450
|
+
return 'a' + id;
|
451
|
+
} // }}}
|
452
|
+
var refresh = this.refresh = function(doit) {
|
453
|
+
id_counter = {};
|
454
|
+
labels = [];
|
455
|
+
illustrator.clear();
|
456
|
+
var graph = parse(description.children('description').get(0), {'row':0,'col':0});
|
457
|
+
self.set_labels(graph);
|
458
|
+
// set labels
|
459
|
+
illustrator.set_svg(graph);
|
460
|
+
doit(self);
|
461
|
+
}
|
462
|
+
var update = this.update = function(svgid) { // {{{
|
463
|
+
id_counter = {};
|
464
|
+
if(update_illustrator){
|
465
|
+
labels = [];
|
466
|
+
illustrator.clear();
|
467
|
+
var graph = parse(description.children('description').get(0), {'row':0,'col':0});
|
468
|
+
self.set_labels(graph);
|
469
|
+
illustrator.set_svg(graph);
|
470
|
+
}
|
471
|
+
|
472
|
+
var newn = $('*[new=true]',description);
|
473
|
+
newn.removeAttr('new');
|
474
|
+
|
475
|
+
if (newn.attr('svg-id') != undefined)
|
476
|
+
adaptor.notify(newn.attr('svg-id'));
|
477
|
+
else if (svgid != undefined)
|
478
|
+
adaptor.notify(svgid);
|
479
|
+
else if (newn.parent('[svg-id]').length > 0)
|
480
|
+
adaptor.notify(newn.parent('[svg-id]').attr('svg-id'));
|
481
|
+
else
|
482
|
+
console.info('Something went horribly wrong');
|
483
|
+
} // }}}
|
484
|
+
// }}}
|
485
|
+
// Adaption functions {{{
|
486
|
+
this.insert_after = function(new_node, target, source_opts) { // {{{
|
487
|
+
if ($.isArray(new_node)) {
|
488
|
+
$.each(new_node,function(k,v){
|
489
|
+
var nn = self.source(v,source_opts);
|
490
|
+
target.after(nn);
|
491
|
+
nn.attr('new','true');
|
492
|
+
});
|
493
|
+
} else {
|
494
|
+
var nn = self.source(new_node,source_opts);
|
495
|
+
target.after(nn);
|
496
|
+
nn.attr('new','true');
|
497
|
+
}
|
498
|
+
update();
|
499
|
+
} // }}}
|
500
|
+
this.insert_first_into = function(new_node, target, source_opts) { // {{{
|
501
|
+
if ($.isArray(new_node)) {
|
502
|
+
$.each(new_node,function(k,v){
|
503
|
+
var nn = self.source(v,source_opts);
|
504
|
+
target.prepend(nn);
|
505
|
+
nn.attr('new','true');
|
506
|
+
});
|
507
|
+
} else {
|
508
|
+
var nn = self.source(new_node,source_opts);
|
509
|
+
target.prepend(nn);
|
510
|
+
nn.attr('new','true');
|
511
|
+
}
|
512
|
+
update();
|
513
|
+
} // }}}
|
514
|
+
this.insert_last_into = function(new_node, target) { // {{{
|
515
|
+
if ($.isArray(new_node)) {
|
516
|
+
$.each(new_node,function(k,v){
|
517
|
+
var nn = self.source(v);
|
518
|
+
target.append(nn);
|
519
|
+
nn.attr('new','true');
|
520
|
+
});
|
521
|
+
} else {
|
522
|
+
var nn = self.source(new_node);
|
523
|
+
target.append(nn);
|
524
|
+
nn.attr('new','true');
|
525
|
+
}
|
526
|
+
update();
|
527
|
+
} // }}}
|
528
|
+
this.remove = function(selector, target) {//{{{
|
529
|
+
var svgid;
|
530
|
+
if(selector == undefined) {
|
531
|
+
svgid = target.attr('svg-id');
|
532
|
+
target.remove()
|
533
|
+
} else {
|
534
|
+
svgid = $(selector, target).attr('svg-id');
|
535
|
+
if (!svgid) {
|
536
|
+
svgid = target.attr('svg-id');
|
537
|
+
}
|
538
|
+
$(selector, target).remove();
|
539
|
+
}
|
540
|
+
update(svgid);
|
541
|
+
}
|
542
|
+
// }}}
|
543
|
+
// }}}
|
544
|
+
// Helper Functions {{{
|
545
|
+
var parse = function(root, parent_pos) { // private {{{
|
546
|
+
var pos = jQuery.extend(true, {}, parent_pos);
|
547
|
+
var max = {'row': 0,'col': 0};
|
548
|
+
var prev = [parent_pos]; // connects parent with child(s), depending on the expansion
|
549
|
+
var endnodes = [];
|
550
|
+
var sname = sym_name(root.tagName,root);
|
551
|
+
var root_expansion = illustrator.elements[root.tagName].expansion(root);
|
552
|
+
var block = {'max':{}}; // e.g. {'max':{'row':0,'col':0}, 'endpoints':[]};
|
553
|
+
|
554
|
+
var group = $X('<g class="group" xmlns="http://www.w3.org/2000/svg"/>');
|
555
|
+
|
556
|
+
if(root_expansion == 'horizontal') pos.row++;
|
557
|
+
if(illustrator.elements[root.tagName].col_shift(root) == true && root_expansion != 'horizontal') pos.col++;
|
558
|
+
|
559
|
+
if(root.tagName == 'description') { // First parsing {{{
|
560
|
+
pos.row++;
|
561
|
+
$(root).attr('svg-id','description');
|
562
|
+
group.attr('element-id','group-description');
|
563
|
+
if (illustrator.elements[sname].label) {
|
564
|
+
labels.push({row: pos.row, element_id: 'start', tname: 'start', label: illustrator.elements[sname].label(root)});
|
565
|
+
}
|
566
|
+
illustrator.draw.draw_symbol('start', 'description', 'START', pos.row, pos.col, group);
|
567
|
+
} // }}}
|
568
|
+
|
569
|
+
$(root).children().filter(function(){ return this.localName[0] != '_'; }).each(function() {
|
570
|
+
var context = this;
|
571
|
+
var tname = context.tagName;
|
572
|
+
var sname = sym_name(tname,context);
|
573
|
+
pos.final = illustrator.elements[sname].final ? true : false;
|
574
|
+
pos.wide = illustrator.elements[sname].wide ? true : false;
|
575
|
+
|
576
|
+
// Calculate next position {{{
|
577
|
+
if(root_expansion == 'vertical') pos.row++;
|
578
|
+
if(root_expansion == 'horizontal') {
|
579
|
+
pos.col++;
|
580
|
+
if (!illustrator.compact) {
|
581
|
+
if (block.max.row) {
|
582
|
+
pos.row = block.max.row + 1;
|
583
|
+
}
|
584
|
+
}
|
585
|
+
}
|
586
|
+
|
587
|
+
if(illustrator.elements[tname] != undefined && illustrator.elements[tname].type == 'complex') {
|
588
|
+
if(illustrator.elements[tname] != undefined && !illustrator.elements[tname].svg) pos.row--;
|
589
|
+
// TODO: Remaining problem is the order inside the svg. Thats why the connection is above the icon
|
590
|
+
block = parse(context, jQuery.extend(true, {}, pos));
|
591
|
+
group.append(block.svg);
|
592
|
+
block.svg.attr('id', 'group-' + $(context).attr('svg-id'));
|
593
|
+
if(illustrator.elements[sname].endnodes == 'aggregate') endnodes = []; // resets endpoints e.g. potential preceding primitive
|
594
|
+
} else {
|
595
|
+
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)
|
596
|
+
block.max.row = pos.row;
|
597
|
+
block.max.col = pos.col;
|
598
|
+
block.endnodes = [pos];
|
599
|
+
block.svg = group;
|
600
|
+
}
|
601
|
+
}
|
602
|
+
// }}}
|
603
|
+
|
604
|
+
var g;
|
605
|
+
set_details(tname,sname,pos,context);
|
606
|
+
|
607
|
+
var origpos = jQuery.extend(true, {}, pos);
|
608
|
+
[g, endnodes] = draw_position(tname,origpos,prev,block,group,endnodes,context);
|
609
|
+
|
610
|
+
// Prepare next iteration {{{
|
611
|
+
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
|
612
|
+
if(root_expansion == 'horizontal') pos.col = block.max.col;
|
613
|
+
if(max.row < block.max.row) max.row = block.max.row;
|
614
|
+
if(max.col < block.max.col) max.col = block.max.col;
|
615
|
+
// }}}
|
616
|
+
|
617
|
+
if (illustrator.elements[sname].closing_symbol) {
|
618
|
+
var ctname = illustrator.elements[sname].closing_symbol;
|
619
|
+
var csname = sym_name(ctname,context);
|
620
|
+
pos.row++;
|
621
|
+
max.row++;
|
622
|
+
block.max.row = pos.row;
|
623
|
+
if (illustrator.elements[sname].endnodes == 'this') {
|
624
|
+
pos.col++;
|
625
|
+
if (pos.col > max.col) {
|
626
|
+
max.col++;
|
627
|
+
block.max.col = pos.col;
|
628
|
+
}
|
629
|
+
draw_position(ctname,pos,block.endnodes,block,group,[],context,{svg: g, pos: origpos});
|
630
|
+
pos.col--;
|
631
|
+
} else {
|
632
|
+
[undefined, endnodes] = draw_position(ctname,pos,prev,block,group,[],context,{svg: g, pos: origpos});
|
633
|
+
}
|
634
|
+
set_details(ctname,csname,pos,context,true);
|
635
|
+
prev = jQuery.extend(true, {}, endnodes);
|
636
|
+
}
|
637
|
+
});
|
638
|
+
|
639
|
+
if($(root).children().filter(function(){ return this.attributes['svg-id'] != undefined; }).length == 0) { // empty complex found
|
640
|
+
endnodes = [parent_pos];
|
641
|
+
max.row = parent_pos.row;
|
642
|
+
max.col = parent_pos.col;
|
643
|
+
}
|
644
|
+
|
645
|
+
if(root.tagName == 'description' && illustrator.elements[root.tagName].closing_symbol) {
|
646
|
+
pos.row++;
|
647
|
+
max.row = pos.row;
|
648
|
+
draw_position(illustrator.elements['start'].closing_symbol,pos,prev,block,group,[],this,{svg: group, pos: pos});
|
649
|
+
}
|
650
|
+
|
651
|
+
return {'endnodes': endnodes, 'max':max, 'svg':group};
|
652
|
+
} // }}}
|
653
|
+
var sym_name = function(tname,context) { //{{{
|
654
|
+
var sname;
|
655
|
+
if(!illustrator.elements[tname]) {sname = 'unknown';}
|
656
|
+
else if(typeof illustrator.elements[tname].resolve_symbol == 'function') {sname = illustrator.elements[tname].resolve_symbol(context,illustrator.elements[tname].col_shift ? illustrator.elements[tname].col_shift(context) : undefined);}
|
657
|
+
else if(typeof illustrator.elements[tname].resolve_symbol == 'string') {sname = illustrator.elements[tname].resolve_symbol;}
|
658
|
+
else {sname = tname;}
|
659
|
+
return sname;
|
660
|
+
} //}}}
|
661
|
+
var set_details = function(tname,sname,pos,context,simple) { //{{{
|
662
|
+
if (simple == undefined || simple == false) {
|
663
|
+
if($(context).attr('id') == undefined) {
|
664
|
+
if(id_counter[tname] == undefined) id_counter[tname] = -1;
|
665
|
+
$(context).attr('svg-id', tname + '_' + (++id_counter[tname]));
|
666
|
+
} else {
|
667
|
+
$(context).attr('svg-id', $(context).attr('id'));
|
668
|
+
}
|
669
|
+
}
|
670
|
+
if (illustrator.elements[sname].label) {
|
671
|
+
var lab = illustrator.elements[sname].label(context);
|
672
|
+
if (lab && lab[0] && lab[0].value && lab[0].column == 'Label' && lab[0].value != '') {
|
673
|
+
$(context).attr('svg-label', lab[0].value);
|
674
|
+
}
|
675
|
+
labels.push({row: pos.row, element_id: $(context).attr('svg-id'), tname: tname, label: lab});
|
676
|
+
}
|
677
|
+
} //}}}
|
678
|
+
var draw_position = function(tname,pos,prev,block,group,endnodes,context,second) { // private {{{
|
679
|
+
var sname = sym_name(tname,context);
|
680
|
+
// Draw Symbol {{{
|
681
|
+
if (second) {
|
682
|
+
illustrator.draw.draw_symbol(sname, $(context).attr('svg-id'), $(context).attr('svg-label'), pos.row, pos.col, second.svg, true).addClass(illustrator.elements[sname] ? illustrator.elements[sname].type : 'primitive unknown');
|
683
|
+
} else {
|
684
|
+
$(context).attr('svg-type',tname);
|
685
|
+
$(context).attr('svg-subtype',sname);
|
686
|
+
if((illustrator.elements[sname] && illustrator.elements[sname].svg) || sname == 'unknown') {
|
687
|
+
var g = illustrator.draw.draw_symbol(sname, $(context).attr('svg-id'), $(context).attr('svg-label'), pos.row, pos.col, block.svg).addClass(illustrator.elements[sname] ? illustrator.elements[sname].type : 'primitive unknown');
|
688
|
+
if (illustrator.elements[sname].info) {
|
689
|
+
var info = illustrator.elements[sname].info(context);
|
690
|
+
_.each(info,function(val,key) {
|
691
|
+
g.attr(key, val);
|
692
|
+
});
|
693
|
+
}
|
694
|
+
} else { console.log("no icon "+ sname);}
|
695
|
+
if(illustrator.elements[sname] && illustrator.elements[sname].border) {
|
696
|
+
var wide = (illustrator.elements[sname].wide == true && block.max.col == pos.col) ? pos.col + 1 : block.max.col;
|
697
|
+
if (illustrator.elements[sname].closing_symbol) {
|
698
|
+
illustrator.draw.draw_border($(context).attr('svg-id'), pos, { col: wide, row: block.max.row + 1 }, block.svg);
|
699
|
+
} else {
|
700
|
+
illustrator.draw.draw_border($(context).attr('svg-id'), pos, { col: wide, row: block.max.row }, block.svg);
|
701
|
+
}
|
702
|
+
}
|
703
|
+
if(illustrator.elements[sname] && illustrator.elements[sname].type == 'complex') {
|
704
|
+
var wide = (illustrator.elements[sname].wide == true && block.max.col == pos.col) ? pos.col + 1 : block.max.col;
|
705
|
+
if (illustrator.elements[sname].closing_symbol) {
|
706
|
+
illustrator.draw.draw_tile($(context).attr('svg-id'), pos, { col: wide, row: block.max.row + 1 }, block.svg);
|
707
|
+
} else {
|
708
|
+
illustrator.draw.draw_tile($(context).attr('svg-id'), pos, { col: wide, row: block.max.row }, block.svg);
|
709
|
+
}
|
710
|
+
}
|
711
|
+
}
|
712
|
+
// }}}
|
713
|
+
// Calculate Connection {{{
|
714
|
+
if(illustrator.elements[sname] != undefined && illustrator.elements[sname].closeblock == true) { // Close Block if element e.g. loop
|
715
|
+
if (second) {
|
716
|
+
if (second.pos.row+1 < pos.row) { // when no content, dont paint the up arrow
|
717
|
+
illustrator.draw.draw_connection(group, pos, second.pos, block.max.row+1, 1, true);
|
718
|
+
}
|
719
|
+
} else {
|
720
|
+
for(node in block.endnodes) {
|
721
|
+
if (!block.endnodes[node].final) {
|
722
|
+
illustrator.draw.draw_connection(group, block.endnodes[node], pos, block.max.row+1, block.endnodes.length, true);
|
723
|
+
}
|
724
|
+
}
|
725
|
+
}
|
726
|
+
}
|
727
|
+
if(illustrator.elements[sname] != undefined && illustrator.elements[sname].endnodes != 'this') {
|
728
|
+
for(i in block.endnodes) { endnodes.push(block.endnodes[i]); } // collects all endpoints from different childs e.g. alternatives from choose
|
729
|
+
} else { endnodes = [jQuery.extend(true, {}, pos)]; } // sets this element as only endpoint (aggregate)
|
730
|
+
if(prev[0].row == 0 || prev[0].col == 0) { // this enforces the connection from description to the first element
|
731
|
+
illustrator.draw.draw_connection(group, { row: 1, col: 1 }, pos, null, null, true);
|
732
|
+
} else {
|
733
|
+
if (illustrator.elements[sname].noarrow == undefined || illustrator.elements[sname].noarrow == false) {
|
734
|
+
for (node in prev) {
|
735
|
+
if (!prev[node].final) {
|
736
|
+
if (prev[node].wide) {
|
737
|
+
var pn = jQuery.extend(true, {}, prev[node]);
|
738
|
+
if (pos.col > prev[node].col) {
|
739
|
+
pn.col = pos.col;
|
740
|
+
}
|
741
|
+
illustrator.draw.draw_connection(group, pn, pos, null, null, true);
|
742
|
+
} else {
|
743
|
+
illustrator.draw.draw_connection(group, prev[node], pos, null, null, true);
|
744
|
+
}
|
745
|
+
}
|
746
|
+
}
|
747
|
+
} else {
|
748
|
+
for(node in prev) {
|
749
|
+
if (!prev[node].final)
|
750
|
+
illustrator.draw.draw_connection(group, prev[node], pos, null, null, false);
|
751
|
+
}
|
752
|
+
}
|
753
|
+
}
|
754
|
+
// }}}
|
755
|
+
return [g, endnodes];
|
756
|
+
} // }}}
|
757
|
+
// }}}
|
758
|
+
|
759
|
+
// Initialze {{{
|
760
|
+
adaptor = wf_adaptor;
|
761
|
+
illustrator = wf_illustrator;
|
762
|
+
// }}}
|
763
|
+
} // }}}
|