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.
Files changed (317) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -1
  3. data/.ruby-version +1 -1
  4. data/CHANGELOG +6 -0
  5. data/Jarfile +5 -0
  6. data/Jarfile.lock +52 -13
  7. data/README.md +21 -9
  8. data/java/build.md +3 -0
  9. data/java/mapping.md +20 -0
  10. data/java/pom.xml +30 -0
  11. data/java/src/main/java/jrubyactiviti/Modeler.java +95 -0
  12. data/java/src/main/java/jrubyactiviti/ProcessDiagram.java +491 -0
  13. data/java/src/main/java/jrubyactiviti/ProcessInstanceHighlights.java +237 -0
  14. data/java/src/main/java/jrubyactiviti/StencilsetResource.java +16 -0
  15. data/java/src/main/resources/stencilset.json +1339 -0
  16. data/jruby_activiti.gemspec +3 -2
  17. data/lib/generators/jruby_activiti/install_generator.rb +4 -0
  18. data/lib/jar/jrubyactiviti-2.0.jar +0 -0
  19. data/lib/jruby_activiti/version.rb +1 -1
  20. data/lib/jruby_activiti/web.rb +81 -0
  21. data/lib/jruby_activiti.rb +28 -20
  22. data/test/{base_test.rb → activiti_test.rb} +1 -3
  23. data/test/instance_hights_test.rb +18 -0
  24. data/test/modeler_test.rb +35 -0
  25. data/test/process_diagram_test.rb +33 -0
  26. data/test/resources/model_init_editor_source.json +1 -0
  27. data/test/resources/model_json_xml.json +278 -0
  28. data/test/resources/model_svg_xml.xml +66 -0
  29. data/test/stencilset_test.rb +7 -0
  30. data/test/test_helper.rb +2 -0
  31. data/web/public/diagram-viewer/images/bg.png +0 -0
  32. data/web/public/diagram-viewer/images/breadcrumbs.png +0 -0
  33. data/web/public/diagram-viewer/images/checker-bg.png +0 -0
  34. data/web/public/diagram-viewer/images/deployer/blue/message_catch.png +0 -0
  35. data/web/public/diagram-viewer/images/deployer/business_rule.png +0 -0
  36. data/web/public/diagram-viewer/images/deployer/error_catch.png +0 -0
  37. data/web/public/diagram-viewer/images/deployer/error_throw.png +0 -0
  38. data/web/public/diagram-viewer/images/deployer/manual.png +0 -0
  39. data/web/public/diagram-viewer/images/deployer/message_catch.png +0 -0
  40. data/web/public/diagram-viewer/images/deployer/message_throw.png +0 -0
  41. data/web/public/diagram-viewer/images/deployer/receive.png +0 -0
  42. data/web/public/diagram-viewer/images/deployer/script.png +0 -0
  43. data/web/public/diagram-viewer/images/deployer/send.png +0 -0
  44. data/web/public/diagram-viewer/images/deployer/service.png +0 -0
  45. data/web/public/diagram-viewer/images/deployer/signal_catch.png +0 -0
  46. data/web/public/diagram-viewer/images/deployer/signal_throw.png +0 -0
  47. data/web/public/diagram-viewer/images/deployer/timer.png +0 -0
  48. data/web/public/diagram-viewer/images/deployer/user.png +0 -0
  49. data/web/public/diagram-viewer/index.html +130 -0
  50. data/web/public/diagram-viewer/js/ActivitiRest.js +74 -0
  51. data/web/public/diagram-viewer/js/ActivityImpl.js +1 -0
  52. data/web/public/diagram-viewer/js/Color.js +603 -0
  53. data/web/public/diagram-viewer/js/LineBreakMeasurer.js +270 -0
  54. data/web/public/diagram-viewer/js/Polyline.js +387 -0
  55. data/web/public/diagram-viewer/js/ProcessDiagramCanvas.js +2172 -0
  56. data/web/public/diagram-viewer/js/ProcessDiagramGenerator.js +1087 -0
  57. data/web/public/diagram-viewer/js/jquery/jquery.asyncqueue.js +125 -0
  58. data/web/public/diagram-viewer/js/jquery/jquery.js +9266 -0
  59. data/web/public/diagram-viewer/js/jquery/jquery.progressbar.js +131 -0
  60. data/web/public/diagram-viewer/js/jstools.js +23 -0
  61. data/web/public/diagram-viewer/js/raphael.2.1.1.js +10 -0
  62. data/web/public/diagram-viewer/js/raphael.js +10 -0
  63. data/web/public/diagram-viewer/js/raphael_uncompressed.js +5815 -0
  64. data/web/public/diagram-viewer/js/textlayout.js +441 -0
  65. data/web/public/diagram-viewer/style.css +1 -0
  66. data/web/public/editor-app/app-cfg.js +25 -0
  67. data/web/public/editor-app/app.js +432 -0
  68. data/web/public/editor-app/configuration/properties/assignment-display-template.html +4 -0
  69. data/web/public/editor-app/configuration/properties/assignment-popup.html +44 -0
  70. data/web/public/editor-app/configuration/properties/assignment-write-template.html +4 -0
  71. data/web/public/editor-app/configuration/properties/boolean-property-template.html +4 -0
  72. data/web/public/editor-app/configuration/properties/condition-expression-display-template.html +2 -0
  73. data/web/public/editor-app/configuration/properties/condition-expression-popup.html +29 -0
  74. data/web/public/editor-app/configuration/properties/condition-expression-write-template.html +4 -0
  75. data/web/public/editor-app/configuration/properties/default-value-display-template.html +4 -0
  76. data/web/public/editor-app/configuration/properties/event-listeners-display-template.html +3 -0
  77. data/web/public/editor-app/configuration/properties/event-listeners-popup.html +115 -0
  78. data/web/public/editor-app/configuration/properties/event-listeners-write-template.html +4 -0
  79. data/web/public/editor-app/configuration/properties/execution-listeners-display-template.html +3 -0
  80. data/web/public/editor-app/configuration/properties/execution-listeners-popup.html +101 -0
  81. data/web/public/editor-app/configuration/properties/execution-listeners-write-template.html +4 -0
  82. data/web/public/editor-app/configuration/properties/feedback-popup.html +17 -0
  83. data/web/public/editor-app/configuration/properties/fields-display-template.html +3 -0
  84. data/web/public/editor-app/configuration/properties/fields-popup.html +61 -0
  85. data/web/public/editor-app/configuration/properties/fields-write-template.html +4 -0
  86. data/web/public/editor-app/configuration/properties/form-properties-display-template.html +3 -0
  87. data/web/public/editor-app/configuration/properties/form-properties-popup.html +93 -0
  88. data/web/public/editor-app/configuration/properties/form-properties-write-template.html +4 -0
  89. data/web/public/editor-app/configuration/properties/in-parameters-display-template.html +3 -0
  90. data/web/public/editor-app/configuration/properties/in-parameters-popup.html +53 -0
  91. data/web/public/editor-app/configuration/properties/in-parameters-write-template.html +4 -0
  92. data/web/public/editor-app/configuration/properties/message-definitions-display-template.html +2 -0
  93. data/web/public/editor-app/configuration/properties/message-definitions-popup.html +50 -0
  94. data/web/public/editor-app/configuration/properties/message-definitions-write-template.html +3 -0
  95. data/web/public/editor-app/configuration/properties/message-property-write-template.html +4 -0
  96. data/web/public/editor-app/configuration/properties/multiinstance-property-write-template.html +8 -0
  97. data/web/public/editor-app/configuration/properties/out-parameters-display-template.html +3 -0
  98. data/web/public/editor-app/configuration/properties/out-parameters-popup.html +53 -0
  99. data/web/public/editor-app/configuration/properties/out-parameters-write-template.html +4 -0
  100. data/web/public/editor-app/configuration/properties/sequenceflow-order-display-template.html +3 -0
  101. data/web/public/editor-app/configuration/properties/sequenceflow-order-popup.html +47 -0
  102. data/web/public/editor-app/configuration/properties/sequenceflow-order-write-template.html +4 -0
  103. data/web/public/editor-app/configuration/properties/signal-definitions-display-template.html +3 -0
  104. data/web/public/editor-app/configuration/properties/signal-definitions-popup.html +58 -0
  105. data/web/public/editor-app/configuration/properties/signal-definitions-write-template.html +4 -0
  106. data/web/public/editor-app/configuration/properties/signal-property-write-template.html +4 -0
  107. data/web/public/editor-app/configuration/properties/string-property-write-mode-template.html +8 -0
  108. data/web/public/editor-app/configuration/properties/subprocess-reference-display-template.html +3 -0
  109. data/web/public/editor-app/configuration/properties/subprocess-reference-popup.html +43 -0
  110. data/web/public/editor-app/configuration/properties/subprocess-reference-write-template.html +4 -0
  111. data/web/public/editor-app/configuration/properties/task-listeners-display-template.html +3 -0
  112. data/web/public/editor-app/configuration/properties/task-listeners-popup.html +102 -0
  113. data/web/public/editor-app/configuration/properties/task-listeners-write-template.html +4 -0
  114. data/web/public/editor-app/configuration/properties/text-popup.html +17 -0
  115. data/web/public/editor-app/configuration/properties/text-property-write-template.html +4 -0
  116. data/web/public/editor-app/configuration/properties-assignment-controller.js +150 -0
  117. data/web/public/editor-app/configuration/properties-condition-expression-controller.js +58 -0
  118. data/web/public/editor-app/configuration/properties-custom-controllers.js +18 -0
  119. data/web/public/editor-app/configuration/properties-default-controllers.js +115 -0
  120. data/web/public/editor-app/configuration/properties-event-listeners-controller.js +266 -0
  121. data/web/public/editor-app/configuration/properties-execution-listeners-controller.js +326 -0
  122. data/web/public/editor-app/configuration/properties-fields-controller.js +192 -0
  123. data/web/public/editor-app/configuration/properties-form-properties-controller.js +192 -0
  124. data/web/public/editor-app/configuration/properties-in-parameters-controller.js +158 -0
  125. data/web/public/editor-app/configuration/properties-message-definitions-controller.js +137 -0
  126. data/web/public/editor-app/configuration/properties-message-scope-controller.js +48 -0
  127. data/web/public/editor-app/configuration/properties-multiinstance-controller.js +34 -0
  128. data/web/public/editor-app/configuration/properties-out-parameters-controller.js +158 -0
  129. data/web/public/editor-app/configuration/properties-sequenceflow-order-controller.js +130 -0
  130. data/web/public/editor-app/configuration/properties-signal-definitions-controller.js +136 -0
  131. data/web/public/editor-app/configuration/properties-signal-scope-controller.js +47 -0
  132. data/web/public/editor-app/configuration/properties-task-listeners-controller.js +325 -0
  133. data/web/public/editor-app/configuration/properties.js +99 -0
  134. data/web/public/editor-app/configuration/toolbar-custom-actions.js +18 -0
  135. data/web/public/editor-app/configuration/toolbar-default-actions.js +429 -0
  136. data/web/public/editor-app/configuration/toolbar.js +175 -0
  137. data/web/public/editor-app/configuration/url-config.js +34 -0
  138. data/web/public/editor-app/css/style-common.css +1518 -0
  139. data/web/public/editor-app/css/style-editor.css +639 -0
  140. data/web/public/editor-app/css/style.css +471 -0
  141. data/web/public/editor-app/editor/css/editor.css +202 -0
  142. data/web/public/editor-app/editor/i18n/translation_de.js +383 -0
  143. data/web/public/editor-app/editor/i18n/translation_en_us.js +423 -0
  144. data/web/public/editor-app/editor/i18n/translation_signavio_de.js +106 -0
  145. data/web/public/editor-app/editor/i18n/translation_signavio_en_us.js +108 -0
  146. data/web/public/editor-app/editor/oryx.debug.js +24510 -0
  147. data/web/public/editor-app/editor/oryx.js +30 -0
  148. data/web/public/editor-app/editor-config.js +32 -0
  149. data/web/public/editor-app/editor-controller.js +65 -0
  150. data/web/public/editor-app/editor-utils.js +135 -0
  151. data/web/public/editor-app/editor.html +136 -0
  152. data/web/public/editor-app/eventbus.js +133 -0
  153. data/web/public/editor-app/fonts/activiti-admin-webfont.eot +0 -0
  154. data/web/public/editor-app/fonts/activiti-admin-webfont.svg +43 -0
  155. data/web/public/editor-app/fonts/activiti-admin-webfont.ttf +0 -0
  156. data/web/public/editor-app/fonts/activiti-admin-webfont.woff +0 -0
  157. data/web/public/editor-app/fonts/glyphicons-halflings-regular.eot +0 -0
  158. data/web/public/editor-app/fonts/glyphicons-halflings-regular.svg +229 -0
  159. data/web/public/editor-app/fonts/glyphicons-halflings-regular.ttf +0 -0
  160. data/web/public/editor-app/fonts/glyphicons-halflings-regular.woff +0 -0
  161. data/web/public/editor-app/header-controller.js +31 -0
  162. data/web/public/editor-app/i18n/en.json +286 -0
  163. data/web/public/editor-app/images/bpmn-error.png +0 -0
  164. data/web/public/editor-app/images/bpmn-warning.png +0 -0
  165. data/web/public/editor-app/images/datadefinition.png +0 -0
  166. data/web/public/editor-app/images/delete.png +0 -0
  167. data/web/public/editor-app/images/loading.gif +0 -0
  168. data/web/public/editor-app/images/logo-2x.png +0 -0
  169. data/web/public/editor-app/images/logo.png +0 -0
  170. data/web/public/editor-app/images/nw-handle-dark.gif +0 -0
  171. data/web/public/editor-app/images/se-handle-dark.gif +0 -0
  172. data/web/public/editor-app/images/shapemenu_highlight.png +0 -0
  173. data/web/public/editor-app/images/wrench.png +0 -0
  174. data/web/public/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js +8 -0
  175. data/web/public/editor-app/libs/angular-cookies_1.2.13/angular-cookies.min.js.map +8 -0
  176. data/web/public/editor-app/libs/angular-dragdrop.min-1.0.3.js +9 -0
  177. data/web/public/editor-app/libs/angular-dragdrop_1.0.7/angular-dragdrop.min.js +29 -0
  178. data/web/public/editor-app/libs/angular-mocks_1.2.13/angular-mocks.js +2136 -0
  179. data/web/public/editor-app/libs/angular-resource_1.2.13/angular-resource.js +596 -0
  180. data/web/public/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js +13 -0
  181. data/web/public/editor-app/libs/angular-resource_1.2.13/angular-resource.min.js.map +8 -0
  182. data/web/public/editor-app/libs/angular-route_1.2.13/angular-route.js +921 -0
  183. data/web/public/editor-app/libs/angular-route_1.2.13/angular-route.min.js +14 -0
  184. data/web/public/editor-app/libs/angular-route_1.2.13/angular-route.min.js.map +8 -0
  185. data/web/public/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.js +625 -0
  186. data/web/public/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js +14 -0
  187. data/web/public/editor-app/libs/angular-sanitize_1.2.13/angular-sanitize.min.js.map +8 -0
  188. data/web/public/editor-app/libs/angular-scroll_0.5.7/angular-scroll.min.js +1 -0
  189. data/web/public/editor-app/libs/angular-strap_2.0.5/angular-strap.min.js +9 -0
  190. data/web/public/editor-app/libs/angular-strap_2.0.5/angular-strap.tpl.min.js +8 -0
  191. data/web/public/editor-app/libs/angular-translate-loader-static-files/.bower.json +19 -0
  192. data/web/public/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.js +31 -0
  193. data/web/public/editor-app/libs/angular-translate-loader-static-files/angular-translate-loader-static-files.min.js +6 -0
  194. data/web/public/editor-app/libs/angular-translate-storage-cookie/.bower.json +20 -0
  195. data/web/public/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.js +19 -0
  196. data/web/public/editor-app/libs/angular-translate-storage-cookie/angular-translate-storage-cookie.min.js +6 -0
  197. data/web/public/editor-app/libs/angular-translate_2.4.2/angular-translate.js +960 -0
  198. data/web/public/editor-app/libs/angular-translate_2.4.2/angular-translate.min.js +6 -0
  199. data/web/public/editor-app/libs/angular_1.2.13/angular-animate.min.js +27 -0
  200. data/web/public/editor-app/libs/angular_1.2.13/angular.min.js +204 -0
  201. data/web/public/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker-bs3.css +267 -0
  202. data/web/public/editor-app/libs/bootstrap-daterangepicker_1.3.7/daterangepicker.js +1026 -0
  203. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css +347 -0
  204. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.css.map +1 -0
  205. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap-theme.min.css +7 -0
  206. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css +5785 -0
  207. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap.css.map +1 -0
  208. data/web/public/editor-app/libs/bootstrap_3.1.1/css/bootstrap.min.css +7 -0
  209. data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.eot +0 -0
  210. data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.svg +229 -0
  211. data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.ttf +0 -0
  212. data/web/public/editor-app/libs/bootstrap_3.1.1/fonts/glyphicons-halflings-regular.woff +0 -0
  213. data/web/public/editor-app/libs/bootstrap_3.1.1/js/bootstrap.js +1951 -0
  214. data/web/public/editor-app/libs/bootstrap_3.1.1/js/bootstrap.min.js +6 -0
  215. data/web/public/editor-app/libs/es5-shim-15.3.4.5/.bower.json +14 -0
  216. data/web/public/editor-app/libs/es5-shim-15.3.4.5/.gitignore +2 -0
  217. data/web/public/editor-app/libs/es5-shim-15.3.4.5/CHANGES +93 -0
  218. data/web/public/editor-app/libs/es5-shim-15.3.4.5/CONTRIBUTORS.md +25 -0
  219. data/web/public/editor-app/libs/es5-shim-15.3.4.5/LICENSE +19 -0
  220. data/web/public/editor-app/libs/es5-shim-15.3.4.5/README.md +161 -0
  221. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-sham.js +444 -0
  222. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-sham.map +1 -0
  223. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-sham.min.js +4 -0
  224. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-shim.js +1314 -0
  225. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-shim.map +1 -0
  226. data/web/public/editor-app/libs/es5-shim-15.3.4.5/es5-shim.min.js +4 -0
  227. data/web/public/editor-app/libs/es5-shim-15.3.4.5/package.json +34 -0
  228. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-kill.js +64 -0
  229. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h-matchers.js +34 -0
  230. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/helpers/h.js +3 -0
  231. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/index.html +64 -0
  232. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/index.min.html +63 -0
  233. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine-html.js +190 -0
  234. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.css +166 -0
  235. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine.js +2477 -0
  236. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/jasmine_favicon.png +0 -0
  237. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/lib/json2.js +478 -0
  238. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-array.js +1223 -0
  239. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-date.js +152 -0
  240. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-function.js +147 -0
  241. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-number.js +14 -0
  242. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-object.js +181 -0
  243. data/web/public/editor-app/libs/es5-shim-15.3.4.5/tests/spec/s-string.js +204 -0
  244. data/web/public/editor-app/libs/jquery-ui-1.10.3.custom.min.js +6 -0
  245. data/web/public/editor-app/libs/jquery.autogrow-textarea.js +61 -0
  246. data/web/public/editor-app/libs/jquery_1.11.0/jquery.js +9789 -0
  247. data/web/public/editor-app/libs/jquery_1.11.0/jquery.min.js +4 -0
  248. data/web/public/editor-app/libs/jquery_1.11.0/jquery.min.map +1 -0
  249. data/web/public/editor-app/libs/json3_3.2.6/LICENSE +20 -0
  250. data/web/public/editor-app/libs/json3_3.2.6/lib/json3.js +861 -0
  251. data/web/public/editor-app/libs/json3_3.2.6/lib/json3.min.js +18 -0
  252. data/web/public/editor-app/libs/momentjs_2.5.1/momentjs.min.js +6 -0
  253. data/web/public/editor-app/libs/mousetrap-1.4.5.min.js +9 -0
  254. data/web/public/editor-app/libs/ng-grid-2.0.7-min.js +2 -0
  255. data/web/public/editor-app/libs/ng-grid-2.0.7.min.css +1 -0
  256. data/web/public/editor-app/libs/path_parser.js +30 -0
  257. data/web/public/editor-app/libs/prototype-1.5.1.js +3272 -0
  258. data/web/public/editor-app/libs/ui-utils.min-0.0.4.js +7 -0
  259. data/web/public/editor-app/partials/root-stencil-item-template.html +11 -0
  260. data/web/public/editor-app/partials/stencil-item-template.html +27 -0
  261. data/web/public/editor-app/plugins.xml +58 -0
  262. data/web/public/editor-app/popups/icon-template.html +3 -0
  263. data/web/public/editor-app/popups/save-model.html +41 -0
  264. data/web/public/editor-app/popups/select-shape.html +20 -0
  265. data/web/public/editor-app/popups/unsaved-changes.html +22 -0
  266. data/web/public/editor-app/select-shape-controller.js +314 -0
  267. data/web/public/editor-app/stencil-controller.js +1421 -0
  268. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.collapsed.png +0 -0
  269. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/event.subprocess.png +0 -0
  270. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/expanded.subprocess.png +0 -0
  271. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.business.rule.png +0 -0
  272. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.camel.png +0 -0
  273. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.manual.png +0 -0
  274. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.mule.png +0 -0
  275. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.receive.png +0 -0
  276. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.script.png +0 -0
  277. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.send.png +0 -0
  278. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.service.png +0 -0
  279. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.shell.png +0 -0
  280. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/list/type.user.png +0 -0
  281. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/subprocess.png +0 -0
  282. data/web/public/editor-app/stencilsets/bpmn2.0/icons/activity/task.png +0 -0
  283. data/web/public/editor-app/stencilsets/bpmn2.0/icons/artifact/text.annotation.png +0 -0
  284. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/cancel.png +0 -0
  285. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/compensation.png +0 -0
  286. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/error.png +0 -0
  287. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/message.png +0 -0
  288. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/signal.png +0 -0
  289. data/web/public/editor-app/stencilsets/bpmn2.0/icons/catching/timer.png +0 -0
  290. data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/association.undirected.png +0 -0
  291. data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/association.unidirectional.png +0 -0
  292. data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/messageflow.png +0 -0
  293. data/web/public/editor-app/stencilsets/bpmn2.0/icons/connector/sequenceflow.png +0 -0
  294. data/web/public/editor-app/stencilsets/bpmn2.0/icons/dataobject/data.store.png +0 -0
  295. data/web/public/editor-app/stencilsets/bpmn2.0/icons/diagram.png +0 -0
  296. data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/cancel.png +0 -0
  297. data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/error.png +0 -0
  298. data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/none.png +0 -0
  299. data/web/public/editor-app/stencilsets/bpmn2.0/icons/endevent/terminate.png +0 -0
  300. data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/eventbased.png +0 -0
  301. data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/exclusive.databased.png +0 -0
  302. data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/inclusive.png +0 -0
  303. data/web/public/editor-app/stencilsets/bpmn2.0/icons/gateway/parallel.png +0 -0
  304. data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/error.png +0 -0
  305. data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/message.png +0 -0
  306. data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/none.png +0 -0
  307. data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/signal.png +0 -0
  308. data/web/public/editor-app/stencilsets/bpmn2.0/icons/startevent/timer.png +0 -0
  309. data/web/public/editor-app/stencilsets/bpmn2.0/icons/swimlane/lane.png +0 -0
  310. data/web/public/editor-app/stencilsets/bpmn2.0/icons/swimlane/pool.png +0 -0
  311. data/web/public/editor-app/stencilsets/bpmn2.0/icons/throwing/none.png +0 -0
  312. data/web/public/editor-app/stencilsets/bpmn2.0/icons/throwing/signal.png +0 -0
  313. data/web/public/editor-app/toolbar-controller.js +162 -0
  314. data/web/public/modeler.html +140 -0
  315. data/web/views/models/index.erb +32 -0
  316. data/web/views/models/new.erb +15 -0
  317. metadata +334 -10
@@ -0,0 +1,270 @@
1
+ /**
2
+ * Word wrapping
3
+ *
4
+ * @author (Javascript) Dmitry Farafonov
5
+ */
6
+
7
+ var AttributedStringIterator = function(text){
8
+ //this.text = this.rtrim(this.ltrim(text));
9
+ text = text.replace(/(\s)+/, " ");
10
+ this.text = this.rtrim(text);
11
+ /*
12
+ if (beginIndex < 0 || beginIndex > endIndex || endIndex > length()) {
13
+ throw new IllegalArgumentException("Invalid substring range");
14
+ }
15
+ */
16
+ this.beginIndex = 0;
17
+ this.endIndex = this.text.length;
18
+ this.currentIndex = this.beginIndex;
19
+
20
+ //console.group("[AttributedStringIterator]");
21
+ var i = 0;
22
+ var string = this.text;
23
+ var fullPos = 0;
24
+
25
+ //console.log("string: \"" + string + "\", length: " + string.length);
26
+ this.startWordOffsets = [];
27
+ this.startWordOffsets.push(fullPos);
28
+
29
+ // TODO: remove i 1000
30
+ while (i<1000) {
31
+ var pos = string.search(/[ \t\n\f-\.\,]/);
32
+ if (pos == -1)
33
+ break;
34
+
35
+ // whitespace start
36
+ fullPos += pos;
37
+ string = string.substr(pos);
38
+ ////console.log("fullPos: " + fullPos + ", pos: " + pos + ", string: ", string);
39
+
40
+ // remove whitespaces
41
+ var pos = string.search(/[^ \t\n\f-\.\,]/);
42
+ if (pos == -1)
43
+ break;
44
+
45
+ // whitespace end
46
+ fullPos += pos;
47
+ string = string.substr(pos);
48
+
49
+ ////console.log("fullPos: " + fullPos);
50
+ this.startWordOffsets.push(fullPos);
51
+
52
+ i++;
53
+ }
54
+ //console.log("startWordOffsets: ", this.startWordOffsets);
55
+ //console.groupEnd();
56
+ };
57
+ AttributedStringIterator.prototype = {
58
+ getEndIndex: function(pos){
59
+ if (typeof(pos) == "undefined")
60
+ return this.endIndex;
61
+
62
+ var string = this.text.substr(pos, this.endIndex - pos);
63
+
64
+ var posEndOfLine = string.search(/[\n]/);
65
+ if (posEndOfLine == -1)
66
+ return this.endIndex;
67
+ else
68
+ return pos + posEndOfLine;
69
+ },
70
+ getBeginIndex: function(){
71
+ return this.beginIndex;
72
+ },
73
+ isWhitespace: function(pos){
74
+ var str = this.text[pos];
75
+ var whitespaceChars = " \t\n\f";
76
+
77
+ return (whitespaceChars.indexOf(str) != -1);
78
+ },
79
+ isNewLine: function(pos){
80
+ var str = this.text[pos];
81
+ var whitespaceChars = "\n";
82
+
83
+ return (whitespaceChars.indexOf(str) != -1);
84
+ },
85
+ preceding: function(pos){
86
+ //console.group("[AttributedStringIterator.preceding]");
87
+ for(var i in this.startWordOffsets) {
88
+ var startWordOffset = this.startWordOffsets[i];
89
+ if (pos < startWordOffset && i>0) {
90
+ //console.log("startWordOffset: " + this.startWordOffsets[i-1]);
91
+ //console.groupEnd();
92
+ return this.startWordOffsets[i-1];
93
+ }
94
+ }
95
+ //console.log("pos: " + pos);
96
+ //console.groupEnd();
97
+ return this.startWordOffsets[i];
98
+ },
99
+ following: function(pos){
100
+ //console.group("[AttributedStringIterator.following]");
101
+ for(var i in this.startWordOffsets) {
102
+ var startWordOffset = this.startWordOffsets[i];
103
+ if (pos < startWordOffset && i>0) {
104
+ //console.log("startWordOffset: " + this.startWordOffsets[i]);
105
+ //console.groupEnd();
106
+ return this.startWordOffsets[i];
107
+ }
108
+ }
109
+ //console.log("pos: " + pos);
110
+ //console.groupEnd();
111
+ return this.startWordOffsets[i];
112
+ },
113
+ ltrim: function(str){
114
+ var patt2=/^\s+/g;
115
+ return str.replace(patt2, "");
116
+ },
117
+ rtrim: function(str){
118
+ var patt2=/\s+$/g;
119
+ return str.replace(patt2, "");
120
+ },
121
+ getLayout: function(start, limit){
122
+ return this.text.substr(start, limit - start);
123
+ },
124
+ getCharAtPos: function(pos) {
125
+ return this.text[pos];
126
+ }
127
+ };
128
+
129
+ var LineBreakMeasurer = function(paper, x, y, text, fontAttrs){
130
+ this.paper = paper;
131
+ this.text = new AttributedStringIterator(text);
132
+ this.fontAttrs = fontAttrs;
133
+
134
+ if (this.text.getEndIndex() - this.text.getBeginIndex() < 1) {
135
+ throw {message: "Text must contain at least one character.", code: "IllegalArgumentException"};
136
+ }
137
+
138
+ //this.measurer = new TextMeasurer(paper, this.text, this.fontAttrs);
139
+ this.limit = this.text.getEndIndex();
140
+ this.pos = this.start = this.text.getBeginIndex();
141
+
142
+ this.rafaelTextObject = this.paper.text(x, y, this.text.text).attr(fontAttrs).attr("text-anchor", "start");
143
+ this.svgTextObject = this.rafaelTextObject[0];
144
+ };
145
+ LineBreakMeasurer.prototype = {
146
+ nextOffset: function(wrappingWidth, offsetLimit, requireNextWord) {
147
+ //console.group("[nextOffset]");
148
+ var nextOffset = this.pos;
149
+ if (this.pos < this.limit) {
150
+ if (offsetLimit <= this.pos) {
151
+ throw {message: "offsetLimit must be after current position", code: "IllegalArgumentException"};
152
+ }
153
+
154
+ var charAtMaxAdvance = this.getLineBreakIndex(this.pos, wrappingWidth);
155
+ //charAtMaxAdvance --;
156
+ //console.log("charAtMaxAdvance:", charAtMaxAdvance, ", [" + this.text.getCharAtPos(charAtMaxAdvance) + "]");
157
+
158
+ if (charAtMaxAdvance == this.limit) {
159
+ nextOffset = this.limit;
160
+ //console.log("charAtMaxAdvance == this.limit");
161
+ } else if (this.text.isNewLine(charAtMaxAdvance)) {
162
+ //console.log("isNewLine");
163
+ nextOffset = charAtMaxAdvance+1;
164
+ } else if (this.text.isWhitespace(charAtMaxAdvance)) {
165
+ // TODO: find next noSpaceChar
166
+ //return nextOffset;
167
+ nextOffset = this.text.following(charAtMaxAdvance);
168
+ } else {
169
+ // Break is in a word; back up to previous break.
170
+ /*
171
+ var testPos = charAtMaxAdvance + 1;
172
+ if (testPos == this.limit) {
173
+ console.error("hbz...");
174
+ } else {
175
+ nextOffset = this.text.preceding(charAtMaxAdvance);
176
+ }
177
+ */
178
+ nextOffset = this.text.preceding(charAtMaxAdvance);
179
+
180
+ if (nextOffset <= this.pos) {
181
+ nextOffset = Math.max(this.pos+1, charAtMaxAdvance);
182
+ }
183
+ }
184
+ }
185
+ if (nextOffset > offsetLimit) {
186
+ nextOffset = offsetLimit;
187
+ }
188
+ //console.log("nextOffset: " + nextOffset);
189
+ //console.groupEnd();
190
+ return nextOffset;
191
+ },
192
+ nextLayout: function(wrappingWidth) {
193
+ //console.groupCollapsed("[nextLayout]");
194
+ if (this.pos < this.limit) {
195
+ var requireNextWord = false;
196
+ var layoutLimit = this.nextOffset(wrappingWidth, this.limit, requireNextWord);
197
+ //console.log("layoutLimit:", layoutLimit);
198
+ if (layoutLimit == this.pos) {
199
+ //console.groupEnd();
200
+ return null;
201
+ }
202
+ var result = this.text.getLayout(this.pos, layoutLimit);
203
+ //console.log("layout: \"" + result + "\"");
204
+
205
+ // remove end of line
206
+
207
+ //var posEndOfLine = this.text.getEndIndex(this.pos);
208
+ //if (posEndOfLine < result.length)
209
+ // result = result.substr(0, posEndOfLine);
210
+
211
+ this.pos = layoutLimit;
212
+
213
+ //console.groupEnd();
214
+ return result;
215
+ } else {
216
+ //console.groupEnd();
217
+ return null;
218
+ }
219
+ },
220
+ getLineBreakIndex: function(pos, wrappingWidth) {
221
+ //console.group("[getLineBreakIndex]");
222
+ //console.log("pos:"+pos + ", text: \""+ this.text.text.replace(/\n/g, "_").substr(pos, 1) + "\"");
223
+
224
+ var bb = this.rafaelTextObject.getBBox();
225
+
226
+ var charNum = -1;
227
+ try {
228
+ var svgPoint = this.svgTextObject.getStartPositionOfChar(pos);
229
+ //var dot = this.paper.ellipse(svgPoint.x, svgPoint.y, 1, 1).attr({"stroke-width": 0, fill: Color.blue});
230
+ svgPoint.x = svgPoint.x + wrappingWidth;
231
+ //svgPoint.y = bb.y;
232
+ //console.log("svgPoint:", svgPoint);
233
+
234
+ //var dot = this.paper.ellipse(svgPoint.x, svgPoint.y, 1, 1).attr({"stroke-width": 0, fill: Color.red});
235
+
236
+ charNum = this.svgTextObject.getCharNumAtPosition(svgPoint);
237
+ } catch (e){
238
+ console.warn("getStartPositionOfChar error, pos:" + pos);
239
+ /*
240
+ var testPos = pos + 1;
241
+ if (testPos < this.limit) {
242
+ return testPos
243
+ }
244
+ */
245
+ }
246
+ //console.log("charNum:", charNum);
247
+ if (charNum == -1) {
248
+ //console.groupEnd();
249
+ return this.text.getEndIndex(pos);
250
+ } else {
251
+ // When case there is new line between pos and charnum then use this new line
252
+ var newLineIndex = this.text.getEndIndex(pos);
253
+ if (newLineIndex < charNum ) {
254
+ console.log("newLineIndex <= charNum, newLineIndex:"+newLineIndex+", charNum:"+charNum, "\"" + this.text.text.substr(newLineIndex+1).replace(/\n/g, "?") + "\"");
255
+ //console.groupEnd();
256
+
257
+ return newLineIndex;
258
+ }
259
+
260
+ //var charAtMaxAdvance = this.text.text.substring(charNum, charNum + 1);
261
+ var charAtMaxAdvance = this.text.getCharAtPos(charNum);
262
+ //console.log("!!charAtMaxAdvance: " + charAtMaxAdvance);
263
+ //console.groupEnd();
264
+ return charNum;
265
+ }
266
+ },
267
+ getPosition: function() {
268
+ return this.pos;
269
+ }
270
+ };
@@ -0,0 +1,387 @@
1
+ /**
2
+ * Class to generate polyline
3
+ *
4
+ * @author Dmitry Farafonov
5
+ */
6
+
7
+ var ANCHOR_TYPE= {
8
+ main: "main",
9
+ middle: "middle",
10
+ first: "first",
11
+ last: "last"
12
+ };
13
+
14
+ function Anchor(uuid, type, x, y) {
15
+ this.uuid = uuid;
16
+ this.x = x
17
+ this.y = y
18
+ this.type = (type == ANCHOR_TYPE.middle) ? ANCHOR_TYPE.middle : ANCHOR_TYPE.main;
19
+ };
20
+ Anchor.prototype = {
21
+ uuid: null,
22
+ x: 0,
23
+ y: 0,
24
+ type: ANCHOR_TYPE.main,
25
+ isFirst: false,
26
+ isLast: false,
27
+ ndex: 0,
28
+ typeIndex: 0
29
+ };
30
+
31
+ function Polyline(uuid, points, strokeWidth) {
32
+ /* Array on coordinates:
33
+ * points: [{x: 410, y: 110}, 1
34
+ * {x: 570, y: 110}, 1 2
35
+ * {x: 620, y: 240}, 2 3
36
+ * {x: 750, y: 270}, 3 4
37
+ * {x: 650, y: 370}]; 4
38
+ */
39
+ this.points = points;
40
+
41
+ /*
42
+ * path for graph
43
+ * [["M", x1, y1], ["L", x2, y2], ["C", ax, ay, bx, by, x3, y3], ["L", x3, y3]]
44
+ */
45
+ this.path = [];
46
+
47
+ this.anchors = [];
48
+
49
+ if (strokeWidth) this.strokeWidth = strokeWidth;
50
+
51
+ this.closePath = false;
52
+
53
+ this.init();
54
+ };
55
+
56
+ Polyline.prototype = {
57
+ id: null,
58
+ points: [],
59
+ path: [],
60
+ anchors: [],
61
+ strokeWidth: 1,
62
+ radius: 15,
63
+ showDetails: false,
64
+ element: null,
65
+ isDefaultConditionAvailable: false,
66
+ closePath: false,
67
+
68
+ init: function(points){
69
+ var linesCount = this.getLinesCount();
70
+ if (linesCount < 1)
71
+ return;
72
+
73
+ this.normalizeCoordinates();
74
+
75
+ // create anchors
76
+
77
+ this.pushAnchor(ANCHOR_TYPE.first, this.getLine(0).x1, this.getLine(0).y1);
78
+
79
+ for(var i = 1; i < linesCount; i++){
80
+ var line1 = this.getLine(i-1),
81
+ line2 = this.getLine(i);
82
+
83
+ //this.pushAnchor(ANCHOR_TYPE.middle, line1.x1 + line1.x2-line1.x1, line1.y1 + line1.y2-line1.y1);
84
+ this.pushAnchor(ANCHOR_TYPE.main, line1.x2, line1.y2);
85
+ //this.pushAnchor(ANCHOR_TYPE.middle, line2.x1 + line2.x2-line2.x1, line2.y1 + line2.y2-line2.y1);
86
+ }
87
+
88
+ this.pushAnchor(ANCHOR_TYPE.last, this.getLine(linesCount-1).x2, this.getLine(linesCount-1).y2);
89
+
90
+ this.rebuildPath();
91
+ },
92
+
93
+ normalizeCoordinates: function(){
94
+ for(var i=0; i < this.points.length; i++){
95
+ this.points[i].x = parseFloat(this.points[i].x);
96
+ this.points[i].y = parseFloat(this.points[i].y);
97
+ }
98
+ },
99
+
100
+ getLinesCount: function(){
101
+ return this.points.length-1;
102
+ },
103
+ _getLine: function(i){
104
+ return {x1: this.points[i].x, y1: this.points[i].y, x2: this.points[i+1].x, y2: this.points[i+1].y};
105
+ },
106
+ getLine: function(i){
107
+ var line = this._getLine(i);
108
+ line.angle = this.getLineAngle(i) ;
109
+ return line;
110
+ },
111
+ getLineAngle: function(i){
112
+ var line = this._getLine(i);
113
+ return Math.atan2(line.y2 - line.y1, line.x2 - line.x1);
114
+ },
115
+ getLineLengthX: function(i){
116
+ var line = this.getLine(i);
117
+ return (line.x2 - line.x1);
118
+ },
119
+ getLineLengthY: function(i){
120
+ var line = this.getLine(i);
121
+ return (line.y2 - line.y1);
122
+ },
123
+ getLineLength: function(i){
124
+ var line = this.getLine(i);
125
+ return Math.sqrt(Math.pow(this.getLineLengthX(i), 2) + Math.pow(this.getLineLengthY(i), 2));
126
+ },
127
+
128
+ getAnchors: function(){
129
+ // ������� ��������������� ������
130
+ // ????
131
+ return this.anchors;
132
+ },
133
+ getAnchorsCount: function(type){
134
+ if (!type)
135
+ return this.anchors.length;
136
+ else {
137
+ var count = 0;
138
+ for(var i=0; i < this.getAnchorsCount(); i++){
139
+ var anchor = this.anchors[i];
140
+ if (anchor.getType() == type) {
141
+ count++;
142
+ }
143
+ }
144
+ return count;
145
+ }
146
+ },
147
+
148
+ pushAnchor: function(type, x, y, index){
149
+ if (type == ANCHOR_TYPE.first) {
150
+ index = 0;
151
+ typeIndex = 0;
152
+ } else if (type == ANCHOR_TYPE.last) {
153
+ index = this.getAnchorsCount();
154
+ typeIndex = 0;
155
+ } else if (!index) {
156
+ index = this.anchors.length;
157
+ } else {
158
+ // ��������� anchors, �������� ������� ��� �������, ������� � index
159
+ //var anchor = this.getAnchor()
160
+ for(var i=0; i < this.getAnchorsCount(); i++){
161
+ var anchor = this.anchors[i];
162
+ if (anchor.index > index) {
163
+ anchor.index++;
164
+ anchor.typeIndex++;
165
+ }
166
+ }
167
+ }
168
+
169
+ var anchor = new Anchor(this.id, ANCHOR_TYPE.main, x, y, index, typeIndex);
170
+
171
+ this.anchors.push(anchor);
172
+ },
173
+
174
+ getAnchor: function(position){
175
+ return this.anchors[position];
176
+ },
177
+
178
+ getAnchorByType: function(type, position){
179
+ if (type == ANCHOR_TYPE.first)
180
+ return this.anchors[0];
181
+ if (type == ANCHOR_TYPE.last)
182
+ return this.anchors[this.getAnchorsCount()-1];
183
+
184
+ for(var i=0; i < this.getAnchorsCount(); i++){
185
+ var anchor = this.anchors[i];
186
+ if (anchor.type == type) {
187
+ if( position == anchor.position)
188
+ return anchor;
189
+ }
190
+ }
191
+ return null;
192
+ },
193
+
194
+ addNewPoint: function(position, x, y){
195
+ //
196
+ for(var i = 0; i < this.getLinesCount(); i++){
197
+ var line = this.getLine(i);
198
+ if (x > line.x1 && x < line.x2 && y > line.y1 && y < line.y2) {
199
+ this.points.splice(i+1,0,{x: x, y: y});
200
+ break;
201
+ }
202
+ }
203
+
204
+ this.rebuildPath();
205
+ },
206
+
207
+ rebuildPath: function(){
208
+ var path = [];
209
+
210
+ for(var i = 0; i < this.getAnchorsCount(); i++){
211
+ var anchor = this.getAnchor(i);
212
+
213
+ var pathType = ""
214
+ if (i==0)
215
+ pathType = "M";
216
+ else
217
+ pathType = "L";
218
+
219
+ // TODO: save previous points and calculate new path just if points are updated, and then save currents values as previous
220
+
221
+ var targetX = anchor.x, targetY = anchor.y;
222
+ if (i>0 && i < this.getAnchorsCount()-1) {
223
+ // get new x,y
224
+ var cx = anchor.x, cy = anchor.y;
225
+
226
+ // pivot point of prev line
227
+ var AO = this.getLineLength(i-1);
228
+ if (AO < this.radius) {
229
+ AO = this.radius;
230
+ }
231
+
232
+ this.isDefaultConditionAvailable = (this.isDefaultConditionAvailable || (i == 1 && AO > 10));
233
+ //console.log("isDefaultConditionAvailable", this.isDefaultConditionAvailable);
234
+
235
+ var ED = this.getLineLengthY(i-1) * this.radius / AO;
236
+ var OD = this.getLineLengthX(i-1) * this.radius / AO;
237
+ targetX = anchor.x - OD;
238
+ targetY = anchor.y - ED;
239
+
240
+ if (AO < 2*this.radius && i>1) {
241
+ targetX = anchor.x - this.getLineLengthX(i-1)/2;
242
+ targetY = anchor.y - this.getLineLengthY(i-1)/2;;
243
+ }
244
+
245
+ // pivot point of next line
246
+ var AO = this.getLineLength(i);
247
+ if (AO < this.radius) {
248
+ AO = this.radius;
249
+ }
250
+ var ED = this.getLineLengthY(i) * this.radius / AO;
251
+ var OD = this.getLineLengthX(i) * this.radius / AO;
252
+ var nextSrcX = anchor.x + OD;
253
+ var nextSrcY = anchor.y + ED;
254
+
255
+ if (AO < 2*this.radius && i<this.getAnchorsCount()-2) {
256
+ nextSrcX = anchor.x + this.getLineLengthX(i)/2;
257
+ nextSrcY = anchor.y + this.getLineLengthY(i)/2;;
258
+ }
259
+
260
+
261
+ var dx0 = (cx - targetX) / 3,
262
+ dy0 = (cy - targetY) / 3,
263
+ ax = cx - dx0,
264
+ ay = cy - dy0,
265
+
266
+ dx1 = (cx - nextSrcX) / 3,
267
+ dy1 = (cy - nextSrcY) / 3,
268
+ bx = cx - dx1,
269
+ by = cy - dy1,
270
+
271
+ zx=nextSrcX, zy=nextSrcY;
272
+
273
+ if (this.showDetails) {
274
+ var c = ProcessDiagramCanvas.g.path("M"+targetX+","+targetY+"L"+ax+","+ay).attr({stroke: Color.get(255, 153, 51), "stroke-dasharray": "- "});
275
+ var c = ProcessDiagramCanvas.g.path("M"+nextSrcX+","+nextSrcY+"L"+bx+","+by).attr({stroke: Color.get(255, 153, 51), "stroke-dasharray": "- "});
276
+ var c = ProcessDiagramCanvas.g.ellipse(ax, ay, 2, 2).attr({stroke: Color.SlateGrey});
277
+ var c = ProcessDiagramCanvas.g.ellipse(bx, by, 2, 2).attr({stroke: Color.SlateGrey});
278
+ var c = ProcessDiagramCanvas.g.ellipse(cx, cy, this.radius, this.radius).attr({stroke: Color.Gainsboro});
279
+ var c = ProcessDiagramCanvas.g.ellipse(targetX, targetY, 2, 2).attr({fill: Color.red});
280
+ var c = ProcessDiagramCanvas.g.ellipse(nextSrcX, nextSrcY, 2, 2).attr({fill: Color.red});
281
+ }
282
+ } else if (i==1 && this.getAnchorsCount() == 2){
283
+ var AO = this.getLineLength(i-1);
284
+ if (AO < this.radius) {
285
+ AO = this.radius;
286
+ }
287
+ this.isDefaultConditionAvailable = (this.isDefaultConditionAvailable || (i == 1 && AO > 10));
288
+ //console.log("-- isDefaultConditionAvailable", this.isDefaultConditionAvailable);
289
+ }
290
+
291
+ // anti smoothing
292
+ if (this.strokeWidth%2 == 1) {
293
+ targetX += 0.5;
294
+ targetY += 0.5;
295
+ }
296
+
297
+ path.push([pathType, targetX, targetY]);
298
+
299
+ if (i>0 && i < this.getAnchorsCount()-1) {
300
+ path.push(["C", ax, ay, bx, by, zx, zy]);
301
+ }
302
+ }
303
+
304
+ if (this.closePath) {
305
+ console.log("closePath:", this.closePath);
306
+ path.push(["Z"]);
307
+ }
308
+
309
+ this.path = path;
310
+ },
311
+
312
+ transform: function(transformation){
313
+ this.element.transform(transformation);
314
+ },
315
+ attr: function(attrs){
316
+ //console.log("attrs: " +attrs, "", this.element);
317
+ // TODO: foreach and set each
318
+ this.element.attr(attrs);
319
+ }
320
+ };
321
+
322
+ function Polygone(points, strokeWidth) {
323
+ /* Array on coordinates:
324
+ * points: [{x: 410, y: 110}, 1
325
+ * {x: 570, y: 110}, 1 2
326
+ * {x: 620, y: 240}, 2 3
327
+ * {x: 750, y: 270}, 3 4
328
+ * {x: 650, y: 370}]; 4
329
+ */
330
+ this.points = points;
331
+
332
+ /*
333
+ * path for graph
334
+ * [["M", x1, y1], ["L", x2, y2], ["C", ax, ay, bx, by, x3, y3], ["L", x3, y3]]
335
+ */
336
+ this.path = [];
337
+
338
+ this.anchors = [];
339
+
340
+ if (strokeWidth) this.strokeWidth = strokeWidth;
341
+
342
+ this.closePath = true;
343
+ this.init();
344
+ };
345
+
346
+
347
+ /*
348
+ * Poligone is inherited from Poliline: draws closedPath of polyline
349
+ */
350
+
351
+ var Foo = function () { };
352
+ Foo.prototype = Polyline.prototype;
353
+
354
+ Polygone.prototype = new Foo();
355
+
356
+ Polygone.prototype.rebuildPath = function(){
357
+ var path = [];
358
+ //console.log("Polygone rebuildPath");
359
+ for(var i = 0; i < this.getAnchorsCount(); i++){
360
+ var anchor = this.getAnchor(i);
361
+
362
+ var pathType = ""
363
+ if (i==0)
364
+ pathType = "M";
365
+ else
366
+ pathType = "L";
367
+
368
+ var targetX = anchor.x, targetY = anchor.y;
369
+
370
+ // anti smoothing
371
+ if (this.strokeWidth%2 == 1) {
372
+ targetX += 0.5;
373
+ targetY += 0.5;
374
+ }
375
+
376
+ path.push([pathType, targetX, targetY]);
377
+ }
378
+ if (this.closePath)
379
+ path.push(["Z"]);
380
+
381
+ this.path = path;
382
+ };
383
+ /*
384
+ Polygone.prototype.transform = function(transformation){
385
+ this.element.transform(transformation);
386
+ };
387
+ */