jruby_activiti 1.2.5 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/.ruby-version +1 -1
- data/CHANGELOG +6 -0
- data/Jarfile +5 -0
- data/Jarfile.lock +52 -13
- data/README.md +21 -9
- data/java/build.md +3 -0
- data/java/mapping.md +20 -0
- data/java/pom.xml +30 -0
- data/java/src/main/java/jrubyactiviti/Modeler.java +95 -0
- data/java/src/main/java/jrubyactiviti/ProcessDiagram.java +491 -0
- data/java/src/main/java/jrubyactiviti/ProcessInstanceHighlights.java +237 -0
- data/java/src/main/java/jrubyactiviti/StencilsetResource.java +16 -0
- data/java/src/main/resources/stencilset.json +1339 -0
- data/jruby_activiti.gemspec +3 -2
- data/lib/generators/jruby_activiti/install_generator.rb +4 -0
- data/lib/jar/jrubyactiviti-2.0.jar +0 -0
- data/lib/jruby_activiti/version.rb +1 -1
- data/lib/jruby_activiti/web.rb +81 -0
- data/lib/jruby_activiti.rb +28 -20
- data/test/{base_test.rb → activiti_test.rb} +1 -3
- data/test/instance_hights_test.rb +18 -0
- data/test/modeler_test.rb +35 -0
- data/test/process_diagram_test.rb +33 -0
- data/test/resources/model_init_editor_source.json +1 -0
- data/test/resources/model_json_xml.json +278 -0
- data/test/resources/model_svg_xml.xml +66 -0
- data/test/stencilset_test.rb +7 -0
- data/test/test_helper.rb +2 -0
- data/web/public/diagram-viewer/images/bg.png +0 -0
- data/web/public/diagram-viewer/images/breadcrumbs.png +0 -0
- data/web/public/diagram-viewer/images/checker-bg.png +0 -0
- data/web/public/diagram-viewer/images/deployer/blue/message_catch.png +0 -0
- data/web/public/diagram-viewer/images/deployer/business_rule.png +0 -0
- data/web/public/diagram-viewer/images/deployer/error_catch.png +0 -0
- data/web/public/diagram-viewer/images/deployer/error_throw.png +0 -0
- data/web/public/diagram-viewer/images/deployer/manual.png +0 -0
- data/web/public/diagram-viewer/images/deployer/message_catch.png +0 -0
- data/web/public/diagram-viewer/images/deployer/message_throw.png +0 -0
- data/web/public/diagram-viewer/images/deployer/receive.png +0 -0
- data/web/public/diagram-viewer/images/deployer/script.png +0 -0
- data/web/public/diagram-viewer/images/deployer/send.png +0 -0
- data/web/public/diagram-viewer/images/deployer/service.png +0 -0
- data/web/public/diagram-viewer/images/deployer/signal_catch.png +0 -0
- data/web/public/diagram-viewer/images/deployer/signal_throw.png +0 -0
- data/web/public/diagram-viewer/images/deployer/timer.png +0 -0
- data/web/public/diagram-viewer/images/deployer/user.png +0 -0
- data/web/public/diagram-viewer/index.html +130 -0
- data/web/public/diagram-viewer/js/ActivitiRest.js +74 -0
- data/web/public/diagram-viewer/js/ActivityImpl.js +1 -0
- data/web/public/diagram-viewer/js/Color.js +603 -0
- data/web/public/diagram-viewer/js/LineBreakMeasurer.js +270 -0
- data/web/public/diagram-viewer/js/Polyline.js +387 -0
- data/web/public/diagram-viewer/js/ProcessDiagramCanvas.js +2172 -0
- data/web/public/diagram-viewer/js/ProcessDiagramGenerator.js +1087 -0
- data/web/public/diagram-viewer/js/jquery/jquery.asyncqueue.js +125 -0
- data/web/public/diagram-viewer/js/jquery/jquery.js +9266 -0
- data/web/public/diagram-viewer/js/jquery/jquery.progressbar.js +131 -0
- data/web/public/diagram-viewer/js/jstools.js +23 -0
- data/web/public/diagram-viewer/js/raphael.2.1.1.js +10 -0
- data/web/public/diagram-viewer/js/raphael.js +10 -0
- data/web/public/diagram-viewer/js/raphael_uncompressed.js +5815 -0
- data/web/public/diagram-viewer/js/textlayout.js +441 -0
- data/web/public/diagram-viewer/style.css +1 -0
- data/web/public/editor-app/app-cfg.js +25 -0
- data/web/public/editor-app/app.js +432 -0
- data/web/public/editor-app/configuration/properties/assignment-display-template.html +4 -0
- data/web/public/editor-app/configuration/properties/assignment-popup.html +44 -0
- data/web/public/editor-app/configuration/properties/assignment-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/boolean-property-template.html +4 -0
- data/web/public/editor-app/configuration/properties/condition-expression-display-template.html +2 -0
- data/web/public/editor-app/configuration/properties/condition-expression-popup.html +29 -0
- data/web/public/editor-app/configuration/properties/condition-expression-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/default-value-display-template.html +4 -0
- data/web/public/editor-app/configuration/properties/event-listeners-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/event-listeners-popup.html +115 -0
- data/web/public/editor-app/configuration/properties/event-listeners-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/execution-listeners-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/execution-listeners-popup.html +101 -0
- data/web/public/editor-app/configuration/properties/execution-listeners-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/feedback-popup.html +17 -0
- data/web/public/editor-app/configuration/properties/fields-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/fields-popup.html +61 -0
- data/web/public/editor-app/configuration/properties/fields-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/form-properties-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/form-properties-popup.html +93 -0
- data/web/public/editor-app/configuration/properties/form-properties-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/in-parameters-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/in-parameters-popup.html +53 -0
- data/web/public/editor-app/configuration/properties/in-parameters-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/message-definitions-display-template.html +2 -0
- data/web/public/editor-app/configuration/properties/message-definitions-popup.html +50 -0
- data/web/public/editor-app/configuration/properties/message-definitions-write-template.html +3 -0
- data/web/public/editor-app/configuration/properties/message-property-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/multiinstance-property-write-template.html +8 -0
- data/web/public/editor-app/configuration/properties/out-parameters-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/out-parameters-popup.html +53 -0
- data/web/public/editor-app/configuration/properties/out-parameters-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/sequenceflow-order-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/sequenceflow-order-popup.html +47 -0
- data/web/public/editor-app/configuration/properties/sequenceflow-order-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/signal-definitions-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/signal-definitions-popup.html +58 -0
- data/web/public/editor-app/configuration/properties/signal-definitions-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/signal-property-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/string-property-write-mode-template.html +8 -0
- data/web/public/editor-app/configuration/properties/subprocess-reference-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/subprocess-reference-popup.html +43 -0
- data/web/public/editor-app/configuration/properties/subprocess-reference-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/task-listeners-display-template.html +3 -0
- data/web/public/editor-app/configuration/properties/task-listeners-popup.html +102 -0
- data/web/public/editor-app/configuration/properties/task-listeners-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties/text-popup.html +17 -0
- data/web/public/editor-app/configuration/properties/text-property-write-template.html +4 -0
- data/web/public/editor-app/configuration/properties-assignment-controller.js +150 -0
- data/web/public/editor-app/configuration/properties-condition-expression-controller.js +58 -0
- data/web/public/editor-app/configuration/properties-custom-controllers.js +18 -0
- data/web/public/editor-app/configuration/properties-default-controllers.js +115 -0
- data/web/public/editor-app/configuration/properties-event-listeners-controller.js +266 -0
- data/web/public/editor-app/configuration/properties-execution-listeners-controller.js +326 -0
- data/web/public/editor-app/configuration/properties-fields-controller.js +192 -0
- data/web/public/editor-app/configuration/properties-form-properties-controller.js +192 -0
- data/web/public/editor-app/configuration/properties-in-parameters-controller.js +158 -0
- data/web/public/editor-app/configuration/properties-message-definitions-controller.js +137 -0
- data/web/public/editor-app/configuration/properties-message-scope-controller.js +48 -0
- data/web/public/editor-app/configuration/properties-multiinstance-controller.js +34 -0
- data/web/public/editor-app/configuration/properties-out-parameters-controller.js +158 -0
- data/web/public/editor-app/configuration/properties-sequenceflow-order-controller.js +130 -0
- data/web/public/editor-app/configuration/properties-signal-definitions-controller.js +136 -0
- data/web/public/editor-app/configuration/properties-signal-scope-controller.js +47 -0
- data/web/public/editor-app/configuration/properties-task-listeners-controller.js +325 -0
- data/web/public/editor-app/configuration/properties.js +99 -0
- data/web/public/editor-app/configuration/toolbar-custom-actions.js +18 -0
- data/web/public/editor-app/configuration/toolbar-default-actions.js +429 -0
- data/web/public/editor-app/configuration/toolbar.js +175 -0
- data/web/public/editor-app/configuration/url-config.js +34 -0
- data/web/public/editor-app/css/style-common.css +1518 -0
- data/web/public/editor-app/css/style-editor.css +639 -0
- data/web/public/editor-app/css/style.css +471 -0
- data/web/public/editor-app/editor/css/editor.css +202 -0
- data/web/public/editor-app/editor/i18n/translation_de.js +383 -0
- data/web/public/editor-app/editor/i18n/translation_en_us.js +423 -0
- data/web/public/editor-app/editor/i18n/translation_signavio_de.js +106 -0
- data/web/public/editor-app/editor/i18n/translation_signavio_en_us.js +108 -0
- data/web/public/editor-app/editor/oryx.debug.js +24510 -0
- data/web/public/editor-app/editor/oryx.js +30 -0
- data/web/public/editor-app/editor-config.js +32 -0
- data/web/public/editor-app/editor-controller.js +65 -0
- data/web/public/editor-app/editor-utils.js +135 -0
- data/web/public/editor-app/editor.html +136 -0
- data/web/public/editor-app/eventbus.js +133 -0
- data/web/public/editor-app/fonts/activiti-admin-webfont.eot +0 -0
- data/web/public/editor-app/fonts/activiti-admin-webfont.svg +43 -0
- data/web/public/editor-app/fonts/activiti-admin-webfont.ttf +0 -0
- data/web/public/editor-app/fonts/activiti-admin-webfont.woff +0 -0
- data/web/public/editor-app/fonts/glyphicons-halflings-regular.eot +0 -0
- data/web/public/editor-app/fonts/glyphicons-halflings-regular.svg +229 -0
- data/web/public/editor-app/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/web/public/editor-app/fonts/glyphicons-halflings-regular.woff +0 -0
- data/web/public/editor-app/header-controller.js +31 -0
- data/web/public/editor-app/i18n/en.json +286 -0
- data/web/public/editor-app/images/bpmn-error.png +0 -0
- data/web/public/editor-app/images/bpmn-warning.png +0 -0
- data/web/public/editor-app/images/datadefinition.png +0 -0
- data/web/public/editor-app/images/delete.png +0 -0
- data/web/public/editor-app/images/loading.gif +0 -0
- data/web/public/editor-app/images/logo-2x.png +0 -0
- data/web/public/editor-app/images/logo.png +0 -0
- data/web/public/editor-app/images/nw-handle-dark.gif +0 -0
- data/web/public/editor-app/images/se-handle-dark.gif +0 -0
- data/web/public/editor-app/images/shapemenu_highlight.png +0 -0
- data/web/public/editor-app/images/wrench.png +0 -0
- data/web/public/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js +8 -0
- data/web/public/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js.map +8 -0
- data/web/public/editor-app/libs/angular-dragdrop.min-1.0.3.js +9 -0
- data/web/public/editor-app/libs/angular-dragdrop_1.0.7/angular-dragdrop.min.js +29 -0
- data/web/public/editor-app/libs/angular-mocks_1.2.13/angular-mocks.js +2136 -0
- data/web/public/editor-app/libs/angular-resource_1.2.13/angular-resource.js +596 -0
- data/web/public/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js +13 -0
- data/web/public/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js.map +8 -0
- data/web/public/editor-app/libs/angular-route_1.2.13/angular-route.js +921 -0
- data/web/public/editor-app/libs/angular-route_1.2.13/angular-route.min.js +14 -0
- data/web/public/editor-app/libs/angular-route_1.2.13/angular-route.min.js.map +8 -0
- data/web/public/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.js +625 -0
- data/web/public/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js +14 -0
- data/web/public/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js.map +8 -0
- data/web/public/editor-app/libs/angular-scroll_0.5.7/angular-scroll.min.js +1 -0
- data/web/public/editor-app/libs/angular-strap_2.0.5/angular-strap.min.js +9 -0
- data/web/public/editor-app/libs/angular-strap_2.0.5/angular-strap.tpl.min.js +8 -0
- data/web/public/editor-app/libs/angular-translate-loader-static-files/.bower.json +19 -0
- data/web/public/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.js +31 -0
- data/web/public/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.min.js +6 -0
- data/web/public/editor-app/libs/angular-translate-storage-cookie/.bower.json +20 -0
- data/web/public/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.js +19 -0
- data/web/public/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.min.js +6 -0
- data/web/public/editor-app/libs/angular-translate_2.4.2/angular-translate.js +960 -0
- data/web/public/editor-app/libs/angular-translate_2.4.2/angular-translate.min.js +6 -0
- data/web/public/editor-app/libs/angular_1.2.13/angular-animate.min.js +27 -0
- data/web/public/editor-app/libs/angular_1.2.13/angular.min.js +204 -0
- data/web/public/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker-bs3.css +267 -0
- data/web/public/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker.js +1026 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css +347 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css.map +1 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.min.css +7 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css +5785 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css.map +1 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap.min.css +7 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.eot +0 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.svg +229 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.woff +0 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/js/bootstrap.js +1951 -0
- data/web/public/editor-app/libs/bootstrap_3.1.1/js/bootstrap.min.js +6 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/.bower.json +14 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/.gitignore +2 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/CHANGES +93 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/CONTRIBUTORS.md +25 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/LICENSE +19 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/README.md +161 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-sham.js +444 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-sham.map +1 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-sham.min.js +4 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-shim.js +1314 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-shim.map +1 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-shim.min.js +4 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/package.json +34 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js +64 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-matchers.js +34 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h.js +3 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/index.html +64 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/index.min.html +63 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine-html.js +190 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.css +166 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.js +2477 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine_favicon.png +0 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/json2.js +478 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-array.js +1223 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-date.js +152 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-function.js +147 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-number.js +14 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-object.js +181 -0
- data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-string.js +204 -0
- data/web/public/editor-app/libs/jquery-ui-1.10.3.custom.min.js +6 -0
- data/web/public/editor-app/libs/jquery.autogrow-textarea.js +61 -0
- data/web/public/editor-app/libs/jquery_1.11.0/jquery.js +9789 -0
- data/web/public/editor-app/libs/jquery_1.11.0/jquery.min.js +4 -0
- data/web/public/editor-app/libs/jquery_1.11.0/jquery.min.map +1 -0
- data/web/public/editor-app/libs/json3_3.2.6/LICENSE +20 -0
- data/web/public/editor-app/libs/json3_3.2.6/lib/json3.js +861 -0
- data/web/public/editor-app/libs/json3_3.2.6/lib/json3.min.js +18 -0
- data/web/public/editor-app/libs/momentjs_2.5.1/momentjs.min.js +6 -0
- data/web/public/editor-app/libs/mousetrap-1.4.5.min.js +9 -0
- data/web/public/editor-app/libs/ng-grid-2.0.7-min.js +2 -0
- data/web/public/editor-app/libs/ng-grid-2.0.7.min.css +1 -0
- data/web/public/editor-app/libs/path_parser.js +30 -0
- data/web/public/editor-app/libs/prototype-1.5.1.js +3272 -0
- data/web/public/editor-app/libs/ui-utils.min-0.0.4.js +7 -0
- data/web/public/editor-app/partials/root-stencil-item-template.html +11 -0
- data/web/public/editor-app/partials/stencil-item-template.html +27 -0
- data/web/public/editor-app/plugins.xml +58 -0
- data/web/public/editor-app/popups/icon-template.html +3 -0
- data/web/public/editor-app/popups/save-model.html +41 -0
- data/web/public/editor-app/popups/select-shape.html +20 -0
- data/web/public/editor-app/popups/unsaved-changes.html +22 -0
- data/web/public/editor-app/select-shape-controller.js +314 -0
- data/web/public/editor-app/stencil-controller.js +1421 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.collapsed.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/expanded.subprocess.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.business.rule.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.camel.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.manual.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.mule.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.receive.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.script.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.send.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.service.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.shell.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.user.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/subprocess.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/task.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/artifact/text.annotation.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/cancel.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/compensation.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/error.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/message.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/signal.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/timer.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/association.undirected.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/association.unidirectional.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/messageflow.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/sequenceflow.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/dataobject/data.store.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/diagram.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/cancel.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/error.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/none.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/terminate.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/eventbased.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/exclusive.databased.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/inclusive.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/parallel.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/error.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/message.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/none.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/signal.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/timer.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/swimlane/lane.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/swimlane/pool.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/throwing/none.png +0 -0
- data/web/public/editor-app/stencilsets/bpmn2.0/icons/throwing/signal.png +0 -0
- data/web/public/editor-app/toolbar-controller.js +162 -0
- data/web/public/modeler.html +140 -0
- data/web/views/models/index.erb +32 -0
- data/web/views/models/new.erb +15 -0
- metadata +334 -10
@@ -0,0 +1,1087 @@
|
|
1
|
+
/**
|
2
|
+
* Class to generate an image based the diagram interchange information in a
|
3
|
+
* BPMN 2.0 process.
|
4
|
+
*
|
5
|
+
* @author (Javascript) Dmitry Farafonov
|
6
|
+
*/
|
7
|
+
|
8
|
+
var ProcessDiagramGenerator = {
|
9
|
+
options: {},
|
10
|
+
|
11
|
+
processDiagramCanvas: [],
|
12
|
+
|
13
|
+
activityDrawInstructions:{},
|
14
|
+
|
15
|
+
processDiagrams: {},
|
16
|
+
|
17
|
+
diagramBreadCrumbs: null,
|
18
|
+
|
19
|
+
init: function(){
|
20
|
+
// start event
|
21
|
+
this.activityDrawInstructions["startEvent"] = function(){
|
22
|
+
var activityImpl = this.activity;
|
23
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
24
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
25
|
+
|
26
|
+
processDiagramCanvas.drawNoneStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
|
27
|
+
};
|
28
|
+
|
29
|
+
// start timer event
|
30
|
+
this.activityDrawInstructions["startTimerEvent"] = function(){
|
31
|
+
var activityImpl = this.activity;
|
32
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
33
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
34
|
+
|
35
|
+
var isInterrupting = activityImpl.getProperty("isInterrupting");
|
36
|
+
processDiagramCanvas.drawTimerStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, activityImpl.getProperty("name"));
|
37
|
+
};
|
38
|
+
|
39
|
+
// start event
|
40
|
+
this.activityDrawInstructions["messageStartEvent"] = function(){
|
41
|
+
var activityImpl = this.activity;
|
42
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
43
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
44
|
+
|
45
|
+
var isInterrupting = activityImpl.getProperty("isInterrupting");
|
46
|
+
processDiagramCanvas.drawMessageStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, activityImpl.getProperty("name"));
|
47
|
+
};
|
48
|
+
|
49
|
+
// start signal event
|
50
|
+
this.activityDrawInstructions["startSignalEvent"] = function(){
|
51
|
+
var activityImpl = this.activity;
|
52
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
53
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
54
|
+
|
55
|
+
var isInterrupting = activityImpl.getProperty("isInterrupting");
|
56
|
+
processDiagramCanvas.drawSignalStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, activityImpl.getProperty("name"));
|
57
|
+
};
|
58
|
+
|
59
|
+
// start multiple event
|
60
|
+
this.activityDrawInstructions["startMultipleEvent"] = function(){
|
61
|
+
var activityImpl = this.activity;
|
62
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
63
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
64
|
+
|
65
|
+
var isInterrupting = activityImpl.getProperty("isInterrupting");
|
66
|
+
processDiagramCanvas.drawMultipleStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, activityImpl.getProperty("name"));
|
67
|
+
};
|
68
|
+
|
69
|
+
// signal catch
|
70
|
+
this.activityDrawInstructions["intermediateSignalCatch"] = function(){
|
71
|
+
var activityImpl = this.activity;
|
72
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
73
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
74
|
+
|
75
|
+
var isInterrupting = activityImpl.getProperty("isInterrupting");
|
76
|
+
processDiagramCanvas.drawCatchingSignalEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
|
77
|
+
|
78
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
79
|
+
if (label)
|
80
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
81
|
+
};
|
82
|
+
|
83
|
+
// message catch
|
84
|
+
this.activityDrawInstructions["intermediateMessageCatch"] = function(){
|
85
|
+
var activityImpl = this.activity;
|
86
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
87
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
88
|
+
|
89
|
+
var isInterrupting = activityImpl.getProperty("isInterrupting");
|
90
|
+
processDiagramCanvas.drawCatchingMessageEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
|
91
|
+
|
92
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
93
|
+
if (label)
|
94
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
95
|
+
};
|
96
|
+
|
97
|
+
// multiple catch
|
98
|
+
this.activityDrawInstructions["intermediateMultipleCatch"] = function(){
|
99
|
+
var activityImpl = this.activity;
|
100
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
101
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
102
|
+
|
103
|
+
var isInterrupting = activityImpl.getProperty("isInterrupting");
|
104
|
+
processDiagramCanvas.drawCatchingMultipleEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
|
105
|
+
|
106
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
107
|
+
if (label)
|
108
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
109
|
+
};
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
// signal throw
|
114
|
+
this.activityDrawInstructions["intermediateSignalThrow"] = function(){
|
115
|
+
var activityImpl = this.activity;
|
116
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
117
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
118
|
+
|
119
|
+
processDiagramCanvas.drawThrowingSignalEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name"));
|
120
|
+
|
121
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
122
|
+
if (label)
|
123
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
124
|
+
};
|
125
|
+
|
126
|
+
// message throw
|
127
|
+
this.activityDrawInstructions["intermediateMessageThrow"] = function(){
|
128
|
+
var activityImpl = this.activity;
|
129
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
130
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
131
|
+
|
132
|
+
processDiagramCanvas.drawThrowingMessageEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name"));
|
133
|
+
|
134
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
135
|
+
if (label)
|
136
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
137
|
+
};
|
138
|
+
|
139
|
+
// multiple throw
|
140
|
+
this.activityDrawInstructions["intermediateMultipleThrow"] = function(){
|
141
|
+
var activityImpl = this.activity;
|
142
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
143
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
144
|
+
|
145
|
+
processDiagramCanvas.drawThrowingMultipleEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name"));
|
146
|
+
|
147
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
148
|
+
if (label)
|
149
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
150
|
+
};
|
151
|
+
|
152
|
+
// none throw
|
153
|
+
this.activityDrawInstructions["intermediateThrowEvent"] = function() {
|
154
|
+
var activityImpl = this.activity;
|
155
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
156
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
157
|
+
|
158
|
+
processDiagramCanvas.drawThrowingNoneEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name"));
|
159
|
+
|
160
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
161
|
+
if (label)
|
162
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
163
|
+
};
|
164
|
+
|
165
|
+
// end event
|
166
|
+
this.activityDrawInstructions["endEvent"] = function(){
|
167
|
+
var activityImpl = this.activity;
|
168
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
169
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
170
|
+
|
171
|
+
processDiagramCanvas.drawNoneEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
|
172
|
+
};
|
173
|
+
|
174
|
+
// error end event
|
175
|
+
this.activityDrawInstructions["errorEndEvent"] = function(){
|
176
|
+
var activityImpl = this.activity;
|
177
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
178
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
179
|
+
|
180
|
+
processDiagramCanvas.drawErrorEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), null);
|
181
|
+
|
182
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
183
|
+
if (label)
|
184
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
185
|
+
};
|
186
|
+
|
187
|
+
// message end event
|
188
|
+
this.activityDrawInstructions["messageEndEvent"] = function(){
|
189
|
+
var activityImpl = this.activity;
|
190
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
191
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
192
|
+
|
193
|
+
processDiagramCanvas.drawMessageEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), null);
|
194
|
+
|
195
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
196
|
+
if (label)
|
197
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
198
|
+
};
|
199
|
+
|
200
|
+
// signal end event
|
201
|
+
this.activityDrawInstructions["signalEndEvent"] = function(){
|
202
|
+
var activityImpl = this.activity;
|
203
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
204
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
205
|
+
|
206
|
+
processDiagramCanvas.drawSignalEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), null);
|
207
|
+
|
208
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
209
|
+
if (label)
|
210
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
211
|
+
};
|
212
|
+
|
213
|
+
// multiple end event
|
214
|
+
this.activityDrawInstructions["multipleEndEvent"] = function(){
|
215
|
+
var activityImpl = this.activity;
|
216
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
217
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
218
|
+
|
219
|
+
processDiagramCanvas.drawMultipleEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), null);
|
220
|
+
|
221
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
222
|
+
if (label)
|
223
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
224
|
+
};
|
225
|
+
|
226
|
+
// terminate end event
|
227
|
+
this.activityDrawInstructions["terminateEndEvent"] = function(){
|
228
|
+
var activityImpl = this.activity;
|
229
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
230
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
231
|
+
|
232
|
+
processDiagramCanvas.drawTerminateEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
|
233
|
+
|
234
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
235
|
+
if (label)
|
236
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
237
|
+
};
|
238
|
+
|
239
|
+
// error start event
|
240
|
+
this.activityDrawInstructions["errorStartEvent"] = function(){
|
241
|
+
var activityImpl = this.activity;
|
242
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
243
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
244
|
+
|
245
|
+
processDiagramCanvas.drawErrorStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name"));
|
246
|
+
|
247
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
248
|
+
if (label)
|
249
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
250
|
+
};
|
251
|
+
|
252
|
+
// task
|
253
|
+
this.activityDrawInstructions["task"] = function(){
|
254
|
+
var activityImpl = this.activity;
|
255
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
256
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
257
|
+
|
258
|
+
// TODO:
|
259
|
+
//console.error("task is not implemented yet");
|
260
|
+
/*
|
261
|
+
var activityImpl = this;
|
262
|
+
processDiagramCanvas.drawTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), thickBorder);
|
263
|
+
*/
|
264
|
+
};
|
265
|
+
|
266
|
+
|
267
|
+
// user task
|
268
|
+
this.activityDrawInstructions["userTask"] = function(){
|
269
|
+
var activityImpl = this.activity;
|
270
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
271
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
272
|
+
|
273
|
+
processDiagramCanvas.drawUserTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
|
274
|
+
};
|
275
|
+
|
276
|
+
// script task
|
277
|
+
this.activityDrawInstructions["scriptTask"] = function(){
|
278
|
+
var activityImpl = this.activity;
|
279
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
280
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
281
|
+
|
282
|
+
processDiagramCanvas.drawScriptTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
|
283
|
+
};
|
284
|
+
|
285
|
+
// service task
|
286
|
+
this.activityDrawInstructions["serviceTask"] = function(){
|
287
|
+
var activityImpl = this.activity;
|
288
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
289
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
290
|
+
|
291
|
+
processDiagramCanvas.drawServiceTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
|
292
|
+
};
|
293
|
+
|
294
|
+
// receive task
|
295
|
+
this.activityDrawInstructions["receiveTask"] = function(){
|
296
|
+
var activityImpl = this.activity;
|
297
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
298
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
299
|
+
|
300
|
+
processDiagramCanvas.drawReceiveTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
|
301
|
+
};
|
302
|
+
|
303
|
+
// send task
|
304
|
+
this.activityDrawInstructions["sendTask"] = function(){
|
305
|
+
var activityImpl = this.activity;
|
306
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
307
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
308
|
+
|
309
|
+
processDiagramCanvas.drawSendTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
|
310
|
+
};
|
311
|
+
|
312
|
+
// manual task
|
313
|
+
this.activityDrawInstructions["manualTask"] = function(){
|
314
|
+
var activityImpl = this.activity;
|
315
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
316
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
317
|
+
|
318
|
+
processDiagramCanvas.drawManualTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
|
319
|
+
};
|
320
|
+
|
321
|
+
// businessRuleTask task
|
322
|
+
this.activityDrawInstructions["businessRuleTask"] = function(){
|
323
|
+
var activityImpl = this.activity;
|
324
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
325
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
326
|
+
|
327
|
+
processDiagramCanvas.drawBusinessRuleTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
|
328
|
+
};
|
329
|
+
|
330
|
+
// exclusive gateway
|
331
|
+
this.activityDrawInstructions["exclusiveGateway"] = function(){
|
332
|
+
var activityImpl = this.activity;
|
333
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
334
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
335
|
+
|
336
|
+
processDiagramCanvas.drawExclusiveGateway(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
|
337
|
+
};
|
338
|
+
|
339
|
+
// inclusive gateway
|
340
|
+
this.activityDrawInstructions["inclusiveGateway"] = function(){
|
341
|
+
var activityImpl = this.activity;
|
342
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
343
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
344
|
+
|
345
|
+
processDiagramCanvas.drawInclusiveGateway(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
|
346
|
+
};
|
347
|
+
|
348
|
+
// parallel gateway
|
349
|
+
this.activityDrawInstructions["parallelGateway"] = function(){
|
350
|
+
var activityImpl = this.activity;
|
351
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
352
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
353
|
+
|
354
|
+
processDiagramCanvas.drawParallelGateway(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
|
355
|
+
};
|
356
|
+
|
357
|
+
// eventBasedGateway
|
358
|
+
this.activityDrawInstructions["eventBasedGateway"] = function(){
|
359
|
+
var activityImpl = this.activity;
|
360
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
361
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
362
|
+
|
363
|
+
processDiagramCanvas.drawEventBasedGateway(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
|
364
|
+
};
|
365
|
+
|
366
|
+
// Boundary timer
|
367
|
+
this.activityDrawInstructions["boundaryTimer"] = function(){
|
368
|
+
var activityImpl = this.activity;
|
369
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
370
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
371
|
+
|
372
|
+
var isInterrupting = activityImpl.getProperty("isInterrupting");
|
373
|
+
processDiagramCanvas.drawCatchingTimerEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
|
374
|
+
|
375
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
376
|
+
if (label)
|
377
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
378
|
+
};
|
379
|
+
|
380
|
+
// Boundary catch error
|
381
|
+
this.activityDrawInstructions["boundaryError"] = function(){
|
382
|
+
var activityImpl = this.activity;
|
383
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
384
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
385
|
+
|
386
|
+
var isInterrupting = activityImpl.getProperty("isInterrupting");
|
387
|
+
processDiagramCanvas.drawCatchingErrorEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
|
388
|
+
|
389
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
390
|
+
if (label)
|
391
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
392
|
+
};
|
393
|
+
|
394
|
+
// Boundary signal event
|
395
|
+
this.activityDrawInstructions["boundarySignal"] = function(){
|
396
|
+
var activityImpl = this.activity;
|
397
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
398
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
399
|
+
|
400
|
+
var isInterrupting = activityImpl.getProperty("isInterrupting");
|
401
|
+
processDiagramCanvas.drawCatchingSignalEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
|
402
|
+
|
403
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
404
|
+
if (label)
|
405
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
406
|
+
};
|
407
|
+
|
408
|
+
// Boundary message event
|
409
|
+
this.activityDrawInstructions["boundaryMessage"] = function(){
|
410
|
+
var activityImpl = this.activity;
|
411
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
412
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
413
|
+
|
414
|
+
var isInterrupting = activityImpl.getProperty("isInterrupting");
|
415
|
+
processDiagramCanvas.drawCatchingMessageEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null);
|
416
|
+
|
417
|
+
var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl);
|
418
|
+
if (label)
|
419
|
+
processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height);
|
420
|
+
};
|
421
|
+
|
422
|
+
// timer catch event
|
423
|
+
this.activityDrawInstructions["intermediateTimer"] = function(){
|
424
|
+
var activityImpl = this.activity;
|
425
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
426
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
427
|
+
|
428
|
+
var isInterrupting = null;
|
429
|
+
processDiagramCanvas.drawCatchingTimerEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, activityImpl.getProperty("name"));
|
430
|
+
};
|
431
|
+
|
432
|
+
// subprocess
|
433
|
+
this.activityDrawInstructions["subProcess"] = function(){
|
434
|
+
var activityImpl = this.activity;
|
435
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
436
|
+
// TODO:
|
437
|
+
|
438
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
439
|
+
|
440
|
+
var isExpanded = activityImpl.getProperty("isExpanded");
|
441
|
+
var isTriggeredByEvent = activityImpl.getProperty("triggeredByEvent");
|
442
|
+
if(isTriggeredByEvent == undefined) {
|
443
|
+
isTriggeredByEvent = true;
|
444
|
+
}
|
445
|
+
// TODO: check why isTriggeredByEvent = true when undefined
|
446
|
+
isTriggeredByEvent = false;
|
447
|
+
|
448
|
+
if (isExpanded != undefined && isExpanded == false) {
|
449
|
+
processDiagramCanvas.drawCollapsedSubProcess(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(),
|
450
|
+
activityImpl.getWidth(), activityImpl.getHeight(), isTriggeredByEvent);
|
451
|
+
} else {
|
452
|
+
processDiagramCanvas.drawExpandedSubProcess(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(),
|
453
|
+
activityImpl.getWidth(), activityImpl.getHeight(), isTriggeredByEvent);
|
454
|
+
}
|
455
|
+
|
456
|
+
//console.error("subProcess is not implemented yet");
|
457
|
+
};
|
458
|
+
|
459
|
+
// call activity
|
460
|
+
this.activityDrawInstructions["callActivity"] = function(){
|
461
|
+
var activityImpl = this.activity;
|
462
|
+
var processDiagramCanvas = this.processDiagramCanvas;
|
463
|
+
processDiagramCanvas.setConextObject(activityImpl);
|
464
|
+
processDiagramCanvas.drawCollapsedCallActivity(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight());
|
465
|
+
};
|
466
|
+
|
467
|
+
$(document).ready(function(){
|
468
|
+
// Protect right click on SVG elements (and on canvas too)
|
469
|
+
document.body.oncontextmenu = function(event) {
|
470
|
+
if (window.event.srcElement.tagName == "shape" || window.event.srcElement.tagName == "DIV" && window.event.srcElement.parentElement.className == "diagram") {
|
471
|
+
|
472
|
+
// IE DIAGRAM CANVAS OR SHAPE DETECTED!
|
473
|
+
return false;
|
474
|
+
}
|
475
|
+
return (!Object.isSVGElement(window.event.srcElement));
|
476
|
+
};
|
477
|
+
});
|
478
|
+
},
|
479
|
+
|
480
|
+
getActivitiLabel:function(activityImpl){
|
481
|
+
/*
|
482
|
+
TODO: Label object should be in activityImpl and looks like:
|
483
|
+
{
|
484
|
+
x: 250,
|
485
|
+
y: 250,
|
486
|
+
width: 80,
|
487
|
+
height: 30
|
488
|
+
}
|
489
|
+
And then:
|
490
|
+
if (!activityImpl.label)
|
491
|
+
return null;
|
492
|
+
var label = activityImpl.label;
|
493
|
+
label.text = activityImpl.name;
|
494
|
+
return label;
|
495
|
+
*/
|
496
|
+
|
497
|
+
// But now default label for all events is:
|
498
|
+
return {
|
499
|
+
text: activityImpl.getProperty("name"),
|
500
|
+
x: activityImpl.getX() + .5 + activityImpl.getWidth()/2,
|
501
|
+
y: activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING,
|
502
|
+
width: 100,
|
503
|
+
height: 0
|
504
|
+
};
|
505
|
+
},
|
506
|
+
|
507
|
+
generateDiagram: function(processDefinitionDiagramLayout){
|
508
|
+
// Init canvas
|
509
|
+
var processDefinitionId = processDefinitionDiagramLayout.processDefinition.id;
|
510
|
+
//console.log("Init canvas ", processDefinitionId);
|
511
|
+
|
512
|
+
if (this.getProcessDiagram(processDefinitionId) != undefined) {
|
513
|
+
// TODO: may be reset canvas if exists.. Or just show
|
514
|
+
//console.log("ProcessDiagram '" + processDefinitionId + "' is already generated. Just show it.");
|
515
|
+
return;
|
516
|
+
}
|
517
|
+
var processDiagram = this.initProcessDiagramCanvas(processDefinitionDiagramLayout);
|
518
|
+
var processDiagramCanvas = processDiagram.diagramCanvas;
|
519
|
+
|
520
|
+
// Draw pool shape, if process is participant in collaboration
|
521
|
+
|
522
|
+
if(processDefinitionDiagramLayout.participantProcess != undefined) {
|
523
|
+
//console.log("Draw pool shape");
|
524
|
+
var pProc = processDefinitionDiagramLayout.participantProcess;
|
525
|
+
processDiagramCanvas.drawPoolOrLane(pProc.x, pProc.y, pProc.width, pProc.height, pProc.name);
|
526
|
+
}
|
527
|
+
|
528
|
+
var laneSets = processDefinitionDiagramLayout.laneSets;
|
529
|
+
var activities = processDefinitionDiagramLayout.activities;
|
530
|
+
var sequenceFlows = processDefinitionDiagramLayout.sequenceFlows;
|
531
|
+
|
532
|
+
|
533
|
+
pb1.set('value', 0);
|
534
|
+
var cnt = 0;
|
535
|
+
if (laneSets)
|
536
|
+
for(var i in laneSets) {
|
537
|
+
cnt += laneSets[i].lanes.length;
|
538
|
+
}
|
539
|
+
if (activities)
|
540
|
+
cnt += activities.length;
|
541
|
+
if (sequenceFlows)
|
542
|
+
cnt += sequenceFlows.length;
|
543
|
+
var step = (cnt>0)? 100/cnt : 0;
|
544
|
+
var progress = 0;
|
545
|
+
//console.log("progress bar step: ", step);
|
546
|
+
|
547
|
+
var task1 = new $.AsyncQueue();
|
548
|
+
|
549
|
+
// Draw lanes
|
550
|
+
|
551
|
+
task1.add(function (task1) {
|
552
|
+
if (!laneSets) laneSets = [];
|
553
|
+
//console.log("> draw lane sets, count:", laneSets.length)
|
554
|
+
});
|
555
|
+
|
556
|
+
for(var i in laneSets) {
|
557
|
+
var laneSet = laneSets[i];
|
558
|
+
//laneSet.id, laneSet.name
|
559
|
+
|
560
|
+
task1.add(laneSet.lanes,function (task1, lane) {
|
561
|
+
progress += step;
|
562
|
+
pb1.set('value', parseInt(progress));
|
563
|
+
|
564
|
+
//console.log("--> laneId: " + lane.name + ", name: " + lane.name);
|
565
|
+
|
566
|
+
processDiagramCanvas.drawPoolOrLane(lane.x, lane.y, lane.width, lane.height, lane.name);
|
567
|
+
});
|
568
|
+
}
|
569
|
+
|
570
|
+
// Draw activities
|
571
|
+
|
572
|
+
task1.add(function (task1) {
|
573
|
+
if (!activities) activities = [];
|
574
|
+
//console.log("> draw activities, count:", activities.length)
|
575
|
+
});
|
576
|
+
|
577
|
+
var activitiesLength = activities.length;
|
578
|
+
task1.add(activities,function (task1, activityJson) {
|
579
|
+
var activity = new ActivityImpl(activityJson);
|
580
|
+
activitiesLength --;
|
581
|
+
progress += step;
|
582
|
+
pb1.set('value', parseInt(progress));
|
583
|
+
//console.log(activitiesLength, "--> activityId: " + activity.getId() + ", name: " + activity.getProperty("name"));
|
584
|
+
ProcessDiagramGenerator.drawActivity(processDiagramCanvas, activity);
|
585
|
+
});
|
586
|
+
|
587
|
+
// Draw sequence-flows
|
588
|
+
|
589
|
+
task1.add(function (task1) {
|
590
|
+
if (!sequenceFlows) sequenceFlows = [];
|
591
|
+
//console.log("> draw sequence flows, count:", sequenceFlows.length)
|
592
|
+
});
|
593
|
+
|
594
|
+
var flowsLength = sequenceFlows.length;
|
595
|
+
task1.add(sequenceFlows,function (task1, flow) {
|
596
|
+
var waypoints = [];
|
597
|
+
for(var j in flow.xPointArray) {
|
598
|
+
waypoints[j] = {x: flow.xPointArray[j], y: flow.yPointArray[j]};
|
599
|
+
}
|
600
|
+
var isDefault = flow.isDefault;
|
601
|
+
var isConditional = flow.isConditional;
|
602
|
+
var isHighLighted = flow.isHighLighted;
|
603
|
+
|
604
|
+
// TODO: add source and destination for sequence flows in REST
|
605
|
+
// parse for test
|
606
|
+
var f = flow.flow;
|
607
|
+
var matches = f.match(/\((.*)\)--.*-->\((.*)\)/);
|
608
|
+
var sourceActivityId, destinationActivityId;
|
609
|
+
if (matches != null) {
|
610
|
+
sourceActivityId = matches[1];
|
611
|
+
destinationActivityId = matches[2];
|
612
|
+
}
|
613
|
+
flow.sourceActivityId = sourceActivityId;
|
614
|
+
flow.destinationActivityId = destinationActivityId;
|
615
|
+
//
|
616
|
+
flowsLength--;
|
617
|
+
progress += step;
|
618
|
+
pb1.set('value', parseInt(progress));
|
619
|
+
|
620
|
+
//console.log(flowsLength, "--> flow: " + flow.flow);
|
621
|
+
|
622
|
+
processDiagramCanvas.setConextObject(flow);
|
623
|
+
processDiagramCanvas.drawSequenceflow(waypoints, isConditional, isDefault, isHighLighted);
|
624
|
+
});
|
625
|
+
|
626
|
+
task1.onComplete(function(){
|
627
|
+
if (progress<100)
|
628
|
+
pb1.set('value', 100);
|
629
|
+
//console.log("COMPLETE!!!");
|
630
|
+
|
631
|
+
//console.timeEnd('generateDiagram');
|
632
|
+
});
|
633
|
+
|
634
|
+
task1.run();
|
635
|
+
},
|
636
|
+
|
637
|
+
getProcessDiagram: function (processDefinitionId) {
|
638
|
+
return this.processDiagrams[processDefinitionId];
|
639
|
+
},
|
640
|
+
|
641
|
+
initProcessDiagramCanvas: function (processDefinitionDiagramLayout) {
|
642
|
+
var minX = 0;
|
643
|
+
var maxX = 0;
|
644
|
+
var minY = 0;
|
645
|
+
var maxY = 0;
|
646
|
+
|
647
|
+
if(processDefinitionDiagramLayout.participantProcess != undefined) {
|
648
|
+
var pProc = processDefinitionDiagramLayout.participantProcess;
|
649
|
+
|
650
|
+
minX = pProc.x;
|
651
|
+
maxX = pProc.x + pProc.width;
|
652
|
+
minY = pProc.y;
|
653
|
+
maxY = pProc.y + pProc.height;
|
654
|
+
}
|
655
|
+
|
656
|
+
var activities = processDefinitionDiagramLayout.activities;
|
657
|
+
for(var i in activities) {
|
658
|
+
var activityJson = activities[i];
|
659
|
+
var activity = new ActivityImpl(activityJson);
|
660
|
+
|
661
|
+
// width
|
662
|
+
if (activity.getX() + activity.getWidth() > maxX) {
|
663
|
+
maxX = activity.getX() + activity.getWidth();
|
664
|
+
}
|
665
|
+
if (activity.getX() < minX) {
|
666
|
+
minX = activity.getX();
|
667
|
+
}
|
668
|
+
// height
|
669
|
+
if (activity.getY() + activity.getHeight() > maxY) {
|
670
|
+
maxY = activity.getY() + activity.getHeight();
|
671
|
+
}
|
672
|
+
if (activity.getY() < minY) {
|
673
|
+
minY = activity.getY();
|
674
|
+
}
|
675
|
+
}
|
676
|
+
|
677
|
+
var sequenceFlows = processDefinitionDiagramLayout.sequenceFlows;
|
678
|
+
for(var i in sequenceFlows) {
|
679
|
+
var flow = sequenceFlows[i];
|
680
|
+
var waypoints = [];
|
681
|
+
for(var j in flow.xPointArray) {
|
682
|
+
waypoints[j] = {x: flow.xPointArray[j], y: flow.yPointArray[j]};
|
683
|
+
|
684
|
+
// width
|
685
|
+
if (waypoints[j].x > maxX) {
|
686
|
+
maxX = waypoints[j].x;
|
687
|
+
}
|
688
|
+
if (waypoints[j].x < minX) {
|
689
|
+
minX = waypoints[j].x;
|
690
|
+
}
|
691
|
+
// height
|
692
|
+
if (waypoints[j].y > maxY) {
|
693
|
+
maxY = waypoints[j].y;
|
694
|
+
}
|
695
|
+
if (waypoints[j].y < minY) {
|
696
|
+
minY = waypoints[j].y;
|
697
|
+
}
|
698
|
+
}
|
699
|
+
}
|
700
|
+
|
701
|
+
var laneSets = processDefinitionDiagramLayout.laneSets;
|
702
|
+
for(var i in laneSets) {
|
703
|
+
var laneSet = laneSets[i];
|
704
|
+
//laneSet.id, laneSet.name
|
705
|
+
|
706
|
+
for(var j in laneSet.lanes) {
|
707
|
+
var lane = laneSet.lanes[j];
|
708
|
+
// width
|
709
|
+
if (lane.x + lane.width > maxX) {
|
710
|
+
maxX = lane.x + lane.width;
|
711
|
+
}
|
712
|
+
if (lane.x < minX) {
|
713
|
+
minX = lane.x;
|
714
|
+
}
|
715
|
+
// height
|
716
|
+
if (lane.y + lane.height > maxY) {
|
717
|
+
maxY = lane.y + lane.height;
|
718
|
+
}
|
719
|
+
if (lane.y < minY) {
|
720
|
+
minY = lane.y;
|
721
|
+
}
|
722
|
+
}
|
723
|
+
}
|
724
|
+
|
725
|
+
var diagramCanvas = new ProcessDiagramCanvas();
|
726
|
+
if (diagramCanvas) {
|
727
|
+
|
728
|
+
// create div in diagramHolder
|
729
|
+
var diagramHolder = document.getElementById(this.options.diagramHolderId);
|
730
|
+
if (!diagramHolder)
|
731
|
+
throw {msg: "Diagram holder not found", error: "diagramHolderNotFound"};
|
732
|
+
var div = document.createElement("DIV");
|
733
|
+
div.id = processDefinitionDiagramLayout.processDefinition.id;
|
734
|
+
div.className = "diagram";
|
735
|
+
diagramHolder.appendChild(div);
|
736
|
+
|
737
|
+
diagramCanvas.init(maxX + 20, maxY + 20, processDefinitionDiagramLayout.processDefinition.id);
|
738
|
+
this.processDiagrams[processDefinitionDiagramLayout.processDefinition.id] = {
|
739
|
+
processDefinitionDiagramLayout: processDefinitionDiagramLayout,
|
740
|
+
diagramCanvas: diagramCanvas
|
741
|
+
};
|
742
|
+
}
|
743
|
+
return this.getProcessDiagram(processDefinitionDiagramLayout.processDefinition.id);
|
744
|
+
//return new DefaultProcessDiagramCanvas(maxX + 10, maxY + 10, minX, minY);
|
745
|
+
},
|
746
|
+
|
747
|
+
drawActivity: function(processDiagramCanvas, activity, highLightedActivities) {
|
748
|
+
var type = activity.getProperty("type");
|
749
|
+
var drawInstruction = this.activityDrawInstructions[type];
|
750
|
+
if (drawInstruction != null) {
|
751
|
+
drawInstruction.apply({processDiagramCanvas:processDiagramCanvas, activity:activity});
|
752
|
+
} else {
|
753
|
+
//console.error("no drawInstruction for " + type + ": ", activity);
|
754
|
+
}
|
755
|
+
|
756
|
+
// Actually draw the markers
|
757
|
+
if (activity.getProperty("multiInstance") != undefined || activity.getProperty("collapsed") != undefined) {
|
758
|
+
//console.log(activity.getProperty("name"), activity.properties);
|
759
|
+
var multiInstanceSequential = (activity.getProperty("multiInstance") == "sequential");
|
760
|
+
var multiInstanceParallel = (activity.getProperty("multiInstance") == "parrallel");
|
761
|
+
var collapsed = activity.getProperty("collapsed");
|
762
|
+
processDiagramCanvas.drawActivityMarkers(activity.getX(), activity.getY(), activity.getWidth(), activity.getHeight(),
|
763
|
+
multiInstanceSequential, multiInstanceParallel, collapsed);
|
764
|
+
}
|
765
|
+
/*
|
766
|
+
processDiagramCanvas.drawActivityMarkers(activity.getX(), activity.getY(), activity.getWidth(), activity.getHeight(), multiInstanceSequential,
|
767
|
+
multiInstanceParallel, collapsed);
|
768
|
+
*/
|
769
|
+
|
770
|
+
// TODO: Draw highlighted activities if they are present
|
771
|
+
|
772
|
+
},
|
773
|
+
|
774
|
+
setHighLights: function(highLights){
|
775
|
+
if (highLights.processDefinitionId == undefined) {
|
776
|
+
//console.error("Process instance " + highLights.processInstanceId + " doesn't exist");
|
777
|
+
return;
|
778
|
+
}
|
779
|
+
|
780
|
+
var processDiagram = this.getProcessDiagram(highLights.processDefinitionId);
|
781
|
+
if (processDiagram == undefined) {
|
782
|
+
//console.error("Process diagram " + highLights.processDefinitionId + " not found");
|
783
|
+
return;
|
784
|
+
}
|
785
|
+
|
786
|
+
var processDiagramCanvas = processDiagram.diagramCanvas;
|
787
|
+
|
788
|
+
// TODO: remove highLightes from all activities before set new highLight
|
789
|
+
for (var i in highLights.activities) {
|
790
|
+
var activityId = highLights.activities[i];
|
791
|
+
processDiagramCanvas.highLightActivity(activityId);
|
792
|
+
}
|
793
|
+
|
794
|
+
// TODO: remove highLightes from all flows before set new highLight
|
795
|
+
for (var i in highLights.flows) {
|
796
|
+
var flowId = highLights.flows[i];
|
797
|
+
var object = processDiagramCanvas.g.getById(flowId);
|
798
|
+
var flow = object.data("contextObject");
|
799
|
+
flow.isHighLighted = true;
|
800
|
+
processDiagramCanvas.highLightFlow(flowId);
|
801
|
+
}
|
802
|
+
},
|
803
|
+
|
804
|
+
drawHighLights: function(processInstanceId) {
|
805
|
+
// Load highLights for the processInstanceId
|
806
|
+
/*
|
807
|
+
var url = Lang.sub(this.options.processInstanceHighLightsUrl, {processInstanceId: processInstanceId});
|
808
|
+
$.ajax({
|
809
|
+
url: url,
|
810
|
+
type: 'GET',
|
811
|
+
dataType: 'json',
|
812
|
+
cache: false,
|
813
|
+
async: true,
|
814
|
+
}).done(function(data) {
|
815
|
+
var highLights = data;
|
816
|
+
if (!highLights) {
|
817
|
+
console.log("highLights not found");
|
818
|
+
return;
|
819
|
+
}
|
820
|
+
|
821
|
+
console.log("highLights[" + highLights.processDefinitionId + "][" + processInstanceId + "]: ", highLights);
|
822
|
+
|
823
|
+
ProcessDiagramGenerator.setHighLights(highLights);
|
824
|
+
}).fail(function(jqXHR, textStatus){
|
825
|
+
console.log('Get HighLights['+processDefinitionId+'] failure: ', textStatus, jqXHR);
|
826
|
+
});
|
827
|
+
*/
|
828
|
+
ActivitiRest.getHighLights(processInstanceId, this._drawHighLights);
|
829
|
+
},
|
830
|
+
_drawHighLights: function() {
|
831
|
+
var highLights = this.highLights;
|
832
|
+
ProcessDiagramGenerator.setHighLights(highLights);
|
833
|
+
},
|
834
|
+
|
835
|
+
// Load processDefinition
|
836
|
+
|
837
|
+
drawDiagram: function(processDefinitionId) {
|
838
|
+
// Hide all diagrams
|
839
|
+
var diagrams = $("#" + this.options.diagramHolderId + " div.diagram");
|
840
|
+
diagrams.addClass("hidden");
|
841
|
+
|
842
|
+
|
843
|
+
// If processDefinitionId doesn't contain ":" then it's a "processDefinitionKey", not an id.
|
844
|
+
// Get process definition by key
|
845
|
+
if (processDefinitionId.indexOf(":") < 0) {
|
846
|
+
ActivitiRest.getProcessDefinitionByKey(processDefinitionId, this._drawDiagram);
|
847
|
+
} else {
|
848
|
+
this._drawDiagram.apply({processDefinitionId: processDefinitionId});
|
849
|
+
}
|
850
|
+
},
|
851
|
+
_drawDiagram: function() {
|
852
|
+
var processDefinitionId = this.processDefinitionId;
|
853
|
+
|
854
|
+
ProcessDiagramGenerator.addBreadCrumbsItem(processDefinitionId);
|
855
|
+
|
856
|
+
|
857
|
+
// Check if processDefinition is already loaded and rendered
|
858
|
+
|
859
|
+
|
860
|
+
var processDiagram = ProcessDiagramGenerator.getProcessDiagram(processDefinitionId);
|
861
|
+
|
862
|
+
if (processDiagram != undefined && processDiagram != null) {
|
863
|
+
//console.log("Process diagram " + processDefinitionId + " is already loaded");
|
864
|
+
//return;
|
865
|
+
|
866
|
+
var diagram = document.getElementById(processDefinitionId);
|
867
|
+
$(diagram).removeClass("hidden");
|
868
|
+
|
869
|
+
// Regenerate image
|
870
|
+
var processDefinitionDiagramLayout = processDiagram.processDefinitionDiagramLayout;
|
871
|
+
ProcessDiagramGenerator.generateDiagram(processDefinitionDiagramLayout);
|
872
|
+
|
873
|
+
return;
|
874
|
+
}
|
875
|
+
|
876
|
+
//console.time('loadDiagram');
|
877
|
+
|
878
|
+
// Load processDefinition
|
879
|
+
|
880
|
+
ActivitiRest.getProcessDefinition(processDefinitionId, ProcessDiagramGenerator._generateDiagram);
|
881
|
+
},
|
882
|
+
_generateDiagram: function() {
|
883
|
+
var processDefinitionDiagramLayout = this.processDefinitionDiagramLayout;
|
884
|
+
|
885
|
+
//console.log("process-definition-diagram-layout["+processDefinitionDiagramLayout.processDefinition.id+"]: ", processDefinitionDiagramLayout);
|
886
|
+
|
887
|
+
//console.timeEnd('loadDiagram');
|
888
|
+
//console.time('generateDiagram');
|
889
|
+
|
890
|
+
pb1.set('value', 0);
|
891
|
+
ProcessDiagramGenerator.generateDiagram(processDefinitionDiagramLayout);
|
892
|
+
},
|
893
|
+
|
894
|
+
getProcessDefinitionByKey: function(processDefinitionKey) {
|
895
|
+
var url = Lang.sub(this.options.processDefinitionByKeyUrl, {processDefinitionKey: processDefinitionKey});
|
896
|
+
|
897
|
+
var processDefinition;
|
898
|
+
$.ajax({
|
899
|
+
url: url,
|
900
|
+
type: 'POST',
|
901
|
+
dataType: 'json',
|
902
|
+
cache: false,
|
903
|
+
async: false
|
904
|
+
}).done(function(data) {
|
905
|
+
//console.log("ajax returned data");
|
906
|
+
//console.log("ajax returned data:", data);
|
907
|
+
processDefinition = data;
|
908
|
+
if (!processDefinition) {
|
909
|
+
//console.error("Process definition '" + processDefinitionKey + "' not found");
|
910
|
+
}
|
911
|
+
}).fail(function(jqXHR, textStatus){
|
912
|
+
//console.error('Get diagram layout['+processDefinitionKey+'] failure: ', textStatus, jqXHR);
|
913
|
+
});
|
914
|
+
|
915
|
+
if (processDefinition) {
|
916
|
+
//console.log("Get process definition by key '" + processDefinitionKey + "': ", processDefinition.id);
|
917
|
+
return processDefinition;
|
918
|
+
} else {
|
919
|
+
return null;
|
920
|
+
}
|
921
|
+
},
|
922
|
+
|
923
|
+
addBreadCrumbsItem: function(processDefinitionId){
|
924
|
+
var TPL_UL_CONTAINER = '<ul></ul>',
|
925
|
+
TPL_LI_CONTAINER = '<li id="{id}", processDefinitionId="{processDefinitionId}"><span>{name}</span></li>';
|
926
|
+
|
927
|
+
if (!this.diagramBreadCrumbs)
|
928
|
+
this.diagramBreadCrumbs = $("#" + this.options.diagramBreadCrumbsId);
|
929
|
+
if (!this.diagramBreadCrumbs) return;
|
930
|
+
|
931
|
+
|
932
|
+
var ul = this.diagramBreadCrumbs.find("ul");
|
933
|
+
//console.log("ul: ", ul);
|
934
|
+
if (ul.size() == 0) {
|
935
|
+
ul = $(TPL_UL_CONTAINER);
|
936
|
+
this.diagramBreadCrumbs.append(ul);
|
937
|
+
|
938
|
+
}
|
939
|
+
var liListOld = ul.find("li");
|
940
|
+
//console.warn("liListOld", liListOld);
|
941
|
+
|
942
|
+
// TODO: if there is any items after current then remove that before adding new item (m.b. it is a duplicate)
|
943
|
+
var currentBreadCrumbsItemId = this.currentBreadCrumbsItemId;
|
944
|
+
found = false;
|
945
|
+
liListOld.each(
|
946
|
+
function(index, item) {
|
947
|
+
//console.warn("item:", $(this));
|
948
|
+
if (!found && currentBreadCrumbsItemId == $(this).attr("id")) {
|
949
|
+
found = true;
|
950
|
+
return;
|
951
|
+
}
|
952
|
+
if (found) {
|
953
|
+
//console.warn("remove ", $(this).attr("id"));
|
954
|
+
$(this).remove();
|
955
|
+
}
|
956
|
+
}
|
957
|
+
);
|
958
|
+
|
959
|
+
var liListNew = ul.find("li");
|
960
|
+
|
961
|
+
//console.log("liListNew size: ", liListNew.size());
|
962
|
+
var values = {
|
963
|
+
id: 'breadCrumbsItem_' + liListNew.size(),
|
964
|
+
processDefinitionId: processDefinitionId,
|
965
|
+
name: processDefinitionId
|
966
|
+
};
|
967
|
+
|
968
|
+
|
969
|
+
var tpl = Lang.sub(TPL_LI_CONTAINER, values);
|
970
|
+
//console.log("tpl: ", tpl);
|
971
|
+
ul.append(tpl);
|
972
|
+
|
973
|
+
var li = ul.find("#" + values.id);
|
974
|
+
//console.warn("li:", li);
|
975
|
+
$('#' + values.id).on('click', this._breadCrumbsItemClick);
|
976
|
+
|
977
|
+
ul.find("li").removeClass("selected");
|
978
|
+
li.attr("num", liListNew.size());
|
979
|
+
li.addClass("selected");
|
980
|
+
this.currentBreadCrumbsItemId = li.attr("id");
|
981
|
+
},
|
982
|
+
_breadCrumbsItemClick: function(){
|
983
|
+
var li = $(this),
|
984
|
+
id = li.attr("id"),
|
985
|
+
processDefinitionId = li.attr("processDefinitionId");
|
986
|
+
//console.warn("_breadCrumbsItemClick: ", id, ", processDefinitionId: ", processDefinitionId);
|
987
|
+
|
988
|
+
var ul = ProcessDiagramGenerator.diagramBreadCrumbs.one("ul");
|
989
|
+
ul.find("li").removeClass("selected");
|
990
|
+
li.addClass("selected");
|
991
|
+
ProcessDiagramGenerator.currentBreadCrumbsItemId = li.attr("id");
|
992
|
+
|
993
|
+
// Hide all diagrams
|
994
|
+
var diagrams = $("#"+ProcessDiagramGenerator.options.diagramHolderId+" div.diagram");
|
995
|
+
diagrams.addClass("hidden");
|
996
|
+
|
997
|
+
var processDiagram = ProcessDiagramGenerator.getProcessDiagram(processDefinitionId);
|
998
|
+
|
999
|
+
var diagram = document.getElementById(processDefinitionId);
|
1000
|
+
if (!diagram) return;
|
1001
|
+
$(diagram).removeClass("hidden");
|
1002
|
+
|
1003
|
+
// Regenerate image
|
1004
|
+
var processDefinitionDiagramLayout = processDiagram.processDefinitionDiagramLayout;
|
1005
|
+
ProcessDiagramGenerator.generateDiagram(processDefinitionDiagramLayout);
|
1006
|
+
},
|
1007
|
+
|
1008
|
+
showFlowInfo: function(flow){
|
1009
|
+
var diagramInfo = $("#" + this.options.diagramInfoId);
|
1010
|
+
if (!diagramInfo) return;
|
1011
|
+
|
1012
|
+
var values = {
|
1013
|
+
flow: flow.flow,
|
1014
|
+
isDefault: (flow.isDefault)? "true":"",
|
1015
|
+
isConditional: (flow.isConditional)? "true":"",
|
1016
|
+
isHighLighted: (flow.isHighLighted)? "true":"",
|
1017
|
+
sourceActivityId: flow.sourceActivityId,
|
1018
|
+
destinationActivityId: flow.destinationActivityId
|
1019
|
+
};
|
1020
|
+
var TPL_FLOW_INFO = '<div>{flow}</div>'
|
1021
|
+
+ '<div><b>sourceActivityId</b>: {sourceActivityId}</div>'
|
1022
|
+
+ '<div><b>destinationActivityId</b>: {destinationActivityId}</div>'
|
1023
|
+
+ '<div><b>isDefault</b>: {isDefault}</div>'
|
1024
|
+
+ '<div><b>isConditional</b>: {isConditional}</div>'
|
1025
|
+
+ '<div><b>isHighLighted</b>: {isHighLighted}</div>';
|
1026
|
+
var tpl = Lang.sub(TPL_FLOW_INFO, values);
|
1027
|
+
//console.log("info: ", tpl);
|
1028
|
+
diagramInfo.html(tpl);
|
1029
|
+
},
|
1030
|
+
|
1031
|
+
showActivityInfo: function(activity){
|
1032
|
+
var diagramInfo = $("#" + this.options.diagramInfoId);
|
1033
|
+
if (!diagramInfo) return;
|
1034
|
+
|
1035
|
+
var values = {
|
1036
|
+
activityId: activity.getId(),
|
1037
|
+
name: activity.getProperty("name"),
|
1038
|
+
type: activity.getProperty("type")
|
1039
|
+
};
|
1040
|
+
var TPL_ACTIVITY_INFO = ''
|
1041
|
+
+ '<div><b>activityId</b>: {activityId}</div>'
|
1042
|
+
+ '<div><b>name</b>: {name}</div>'
|
1043
|
+
+ '<div><b>type</b>: {type}</div>';
|
1044
|
+
var TPL_CALLACTIVITY_INFO = ''
|
1045
|
+
+ '<div><b>collapsed</b>: {collapsed}</div>'
|
1046
|
+
+ '<div><b>processDefinitonKey</b>: {processDefinitonKey}</div>';
|
1047
|
+
|
1048
|
+
var template = TPL_ACTIVITY_INFO;
|
1049
|
+
if (activity.getProperty("type") == "callActivity") {
|
1050
|
+
values.collapsed = activity.getProperty("collapsed");
|
1051
|
+
values.processDefinitonKey = activity.getProperty("processDefinitonKey");
|
1052
|
+
template += TPL_CALLACTIVITY_INFO;
|
1053
|
+
} else if (activity.getProperty("type") == "callActivity") {
|
1054
|
+
|
1055
|
+
}
|
1056
|
+
|
1057
|
+
var tpl = Lang.sub(template, values);
|
1058
|
+
//console.log("info: ", tpl);
|
1059
|
+
diagramInfo.html(tpl);
|
1060
|
+
},
|
1061
|
+
|
1062
|
+
hideInfo: function(){
|
1063
|
+
var diagramInfo = $("#" + this.options.diagramInfoId);
|
1064
|
+
if (!diagramInfo) return;
|
1065
|
+
diagramInfo.html("");
|
1066
|
+
},
|
1067
|
+
|
1068
|
+
vvoid: function(){}
|
1069
|
+
};
|
1070
|
+
|
1071
|
+
var Lang = {
|
1072
|
+
SUBREGEX: /\{\s*([^\|\}]+?)\s*(?:\|([^\}]*))?\s*\}/g,
|
1073
|
+
UNDEFINED: 'undefined',
|
1074
|
+
isUndefined: function(o) {
|
1075
|
+
return typeof o === Lang.UNDEFINED;
|
1076
|
+
},
|
1077
|
+
sub: function(s, o) {
|
1078
|
+
return ((s.replace) ? s.replace(Lang.SUBREGEX, function(match, key) {
|
1079
|
+
return (!Lang.isUndefined(o[key])) ? o[key] : match;
|
1080
|
+
}) : s);
|
1081
|
+
}
|
1082
|
+
};
|
1083
|
+
|
1084
|
+
if (Lang.isUndefined(console)) {
|
1085
|
+
console = { log: function() {}, warn: function() {}, error: function() {}};
|
1086
|
+
}
|
1087
|
+
ProcessDiagramGenerator.init();
|