Permalink
Browse files

Converted tabs to spaces.

  • Loading branch information...
1 parent 84bbe40 commit f89615839c8daccfd6073b7905beb51f594ef6a0 @jbeard4 committed Mar 16, 2012
Showing with 9,092 additions and 9,092 deletions.
  1. +77 −77 src/demo/drag-and-drop/drag-and-drop.xhtml
  2. +107 −107 src/demo/drag-and-drop/drag-and-drop2.xhtml
  3. +63 −63 src/demo/drag-and-drop/drag-and-drop2.xml
  4. +597 −597 src/demo/drawing-tool/behaviour/canvas.xml
  5. +162 −162 src/demo/drawing-tool/drawing-tool.html
  6. +3 −3 src/demo/drawing-tool/lib/jquery.svg.css
  7. +1,254 −1,254 src/demo/drawing-tool/lib/jquery.svg.js
  8. +251 −251 src/demo/drawing-tool/lib/jquery.svgdom.js
  9. +115 −115 src/demo/drawing-tool/transform.js
  10. +1 −1 src/demo/node-repl/README.md
  11. +10 −10 src/demo/node-repl/repl.js
  12. +1 −1 src/demo/node-web-repl/README.md
  13. +56 −56 src/demo/node-web-repl/repl.js
  14. +7 −7 src/main/bash/build/convert-scxml-tests-to-json.sh
  15. +8 −8 src/main/bash/build/generate-requirejs-array-test-loader-module.sh
  16. +4 −4 src/main/bash/build/generate-requirejs-json-test-tuples.sh
  17. +9 −9 src/main/bash/build/generate-requirejs-test-loader-module.sh
  18. +1 −1 src/main/bash/util/scxml-to-json.sh
  19. +6 −6 src/main/coffeescript/node/index.coffee
  20. +108 −108 src/main/coffeescript/optimization/class.coffee
  21. +42 −42 src/main/coffeescript/optimization/initializer.coffee
  22. +91 −91 src/main/coffeescript/optimization/state-table.coffee
  23. +74 −74 src/main/coffeescript/optimization/switch.coffee
  24. +10 −10 src/main/coffeescript/optimization/transition-optimizer.coffee
  25. +21 −21 src/main/coffeescript/runner.coffee
  26. +7 −7 src/main/coffeescript/scxml/async-for.coffee
  27. +6 −6 src/main/coffeescript/scxml/doc2json.coffee
  28. +220 −220 src/main/coffeescript/scxml/doc2model.coffee
  29. +3 −3 src/main/coffeescript/scxml/event.coffee
  30. +13 −13 src/main/coffeescript/scxml/extra-model.coffee
  31. +11 −11 src/main/coffeescript/scxml/json2extra-model.coffee
  32. +41 −41 src/main/coffeescript/scxml/model.coffee
  33. +9 −9 src/main/coffeescript/scxml/scxml-dynamic-name-match-transition-selector.coffee
  34. +7 −7 src/main/coffeescript/scxml/setup-default-opts.coffee
  35. +6 −6 src/main/coffeescript/scxml/state-kinds-enum.coffee
  36. +23 −23 src/main/coffeescript/test-harness/basic-test-harness.coffee
  37. +46 −46 src/main/coffeescript/test-harness/browser-harness.coffee
  38. +91 −91 src/main/coffeescript/test-harness/harness.coffee
  39. +226 −226 src/main/coffeescript/test-harness/multi-process/client.coffee
  40. +45 −45 src/main/coffeescript/test-harness/multi-process/initialize-json-test-descriptor.coffee
  41. +41 −41 src/main/coffeescript/test-harness/multi-process/json-tests.coffee
  42. +32 −32 src/main/coffeescript/test-harness/multi-process/scxml.coffee
  43. +209 −209 src/main/coffeescript/test-harness/multi-process/server.coffee
  44. +5 −5 src/main/coffeescript/test-harness/node-optimization-harness.coffee
  45. +96 −96 src/main/coffeescript/test-harness/optimization-harness.coffee
  46. +7 −7 src/main/coffeescript/test-harness/report2string.coffee
  47. +10 −10 src/main/coffeescript/test-harness/rhino-optimization-harness.coffee
  48. +10 −10 src/main/coffeescript/test-harness/simple-browser-test.coffee
  49. +15 −15 src/main/coffeescript/test-harness/simple-browser-test.html
  50. +22 −22 src/main/coffeescript/test-harness/simple-env.coffee
  51. +10 −10 src/main/coffeescript/test-harness/simple-node-test.coffee
  52. +6 −6 src/main/coffeescript/test-harness/spartan-optimization-harness.coffee
  53. +14 −14 src/main/coffeescript/util/BufferedStream.coffee
  54. +418 −418 src/main/coffeescript/util/annotate-scxml-json.coffee
  55. +66 −66 src/main/coffeescript/util/browser/parseOnLoad.coffee
  56. +9 −9 src/main/coffeescript/util/memory.coffee
  57. +9 −9 src/main/coffeescript/util/readline.coffee
  58. +28 −28 src/main/coffeescript/util/reduce.coffee
  59. +38 −38 src/main/coffeescript/util/set/ArraySet.coffee
  60. +75 −75 src/main/coffeescript/util/set/BitVector.coffee
  61. +39 −39 src/main/coffeescript/util/set/BooleanArray.coffee
  62. +44 −44 src/main/coffeescript/util/set/ObjectSet.coffee
  63. +7 −7 src/main/coffeescript/util/utils.coffee
  64. +374 −374 src/main/python/scxml/SCXML.py
  65. +153 −153 src/main/python/scxml/doc2model.py
  66. +9 −9 src/main/python/scxml/evaluators/es.py
  67. +4 −4 src/main/python/scxml/evaluators/interface.py
  68. +9 −9 src/main/python/scxml/evaluators/py.py
  69. +7 −7 src/main/python/scxml/event.py
  70. +69 −69 src/main/python/scxml/json2model.py
  71. +123 −123 src/main/python/scxml/model.py
  72. +27 −27 src/main/python/scxml/multithreaded.py
  73. +7 −7 src/main/python/scxml/simpleEnv.py
  74. +74 −74 src/main/python/scxml/test/harness.py
  75. +50 −50 src/main/xslt/add-entry-exit-logging.xsl
  76. +53 −53 src/main/xslt/flattenTransitions.xsl
  77. +23 −23 src/main/xslt/normalizeInitialStates.xsl
  78. +2 −2 src/test-scripts/run-basic-test.sh
  79. +2 −2 src/test-scripts/run-optimization-tests-node.sh
  80. +4 −4 src/test-scripts/run-optimization-tests-rhino.sh
  81. +2 −2 src/test-scripts/run-optimization-tests-spartan-shell.sh
  82. +17 −17 src/test-scripts/test-runner.html
  83. +7 −7 src/test/actionSend/send1.json
  84. +12 −12 src/test/actionSend/send1.scxml
  85. +7 −7 src/test/actionSend/send2.json
  86. +14 −14 src/test/actionSend/send2.scxml
  87. +7 −7 src/test/actionSend/send3.json
  88. +14 −14 src/test/actionSend/send3.scxml
  89. +7 −7 src/test/actionSend/send4.json
  90. +23 −23 src/test/actionSend/send4.scxml
  91. +7 −7 src/test/actionSend/send5.json
  92. +24 −24 src/test/actionSend/send5.scxml
  93. +7 −7 src/test/actionSend/send6.json
  94. +25 −25 src/test/actionSend/send6.scxml
  95. +7 −7 src/test/actionSend/send7.json
  96. +22 −22 src/test/actionSend/send7.scxml
  97. +7 −7 src/test/actionSend/send8.json
  98. +22 −22 src/test/actionSend/send8.scxml
  99. +7 −7 src/test/assign-current-small-step/test0.json
  100. +35 −35 src/test/assign-current-small-step/test0.scxml
  101. +7 −7 src/test/assign-current-small-step/test1.json
  102. +21 −21 src/test/assign-current-small-step/test1.scxml
  103. +7 −7 src/test/assign-current-small-step/test2.json
  104. +31 −31 src/test/assign-current-small-step/test2.scxml
  105. +15 −15 src/test/assign-current-small-step/test3.json
  106. +34 −34 src/test/assign-current-small-step/test3.scxml
  107. +7 −7 src/test/assign-current-small-step/test4.json
  108. +7 −7 src/test/assign-next-small-step/test0.json
  109. +18 −18 src/test/assign-next-small-step/test0.scxml
  110. +7 −7 src/test/assign-next-small-step/test1.json
  111. +25 −25 src/test/assign-next-small-step/test1.scxml
  112. +7 −7 src/test/assign-next-small-step/test2.json
  113. +39 −39 src/test/assign-next-small-step/test2.scxml
  114. +15 −15 src/test/assign-next-small-step/test3.json
  115. +51 −51 src/test/assign-next-small-step/test3.scxml
  116. +11 −11 src/test/atom3-basic-tests/m0.json
  117. +11 −11 src/test/atom3-basic-tests/m1.json
  118. +11 −11 src/test/atom3-basic-tests/m2.json
  119. +19 −19 src/test/atom3-basic-tests/m3.json
  120. +2 −2 src/test/basic/basic0.json
  121. +4 −4 src/test/basic/basic0.scxml
  122. +7 −7 src/test/basic/basic1.json
  123. +6 −6 src/test/basic/basic1.scxml
  124. +11 −11 src/test/basic/basic2.json
  125. +9 −9 src/test/basic/basic2.scxml
  126. +27 −27 src/test/cond-js/TestConditionalTransition.json
  127. +59 −59 src/test/cond-js/TestConditionalTransition.scxml
  128. +7 −7 src/test/cond-js/test0.json
  129. +6 −6 src/test/cond-js/test0.scxml
  130. +7 −7 src/test/cond-js/test1.json
  131. +8 −8 src/test/cond-js/test1.scxml
  132. +7 −7 src/test/cond-js/test2.json
  133. +6 −6 src/test/cond-js/test2.scxml
  134. +7 −7 src/test/default-initial-state/initial1.json
  135. +8 −8 src/test/default-initial-state/initial1.scxml
  136. +7 −7 src/test/default-initial-state/initial2.json
  137. +8 −8 src/test/default-initial-state/initial2.scxml
  138. +7 −7 src/test/default-initial-state/initial3.json
  139. +10 −10 src/test/default-initial-state/initial3.scxml
  140. +12 −12 src/test/delayedSend/send1.json
  141. +14 −14 src/test/delayedSend/send1.scxml
  142. +12 −12 src/test/delayedSend/send2.json
  143. +16 −16 src/test/delayedSend/send2.scxml
  144. +12 −12 src/test/delayedSend/send3.json
  145. +16 −16 src/test/delayedSend/send3.scxml
  146. +7 −7 src/test/documentOrder/documentOrder0.json
  147. +9 −9 src/test/documentOrder/documentOrder0.scxml
  148. +7 −7 src/test/hierarchy+documentOrder/test0.json
  149. +14 −14 src/test/hierarchy+documentOrder/test0.scxml
  150. +7 −7 src/test/hierarchy+documentOrder/test1.json
  151. +14 −14 src/test/hierarchy+documentOrder/test1.scxml
  152. +7 −7 src/test/hierarchy/hier0.json
  153. +9 −9 src/test/hierarchy/hier0.scxml
  154. +7 −7 src/test/hierarchy/hier1.json
  155. +11 −11 src/test/hierarchy/hier1.scxml
  156. +7 −7 src/test/hierarchy/hier2.json
  157. +11 −11 src/test/hierarchy/hier2.scxml
  158. +19 −19 src/test/history/history0.json
  159. +20 −20 src/test/history/history0.scxml
  160. +19 −19 src/test/history/history1.json
  161. +22 −22 src/test/history/history1.scxml
  162. +19 −19 src/test/history/history2.json
  163. +22 −22 src/test/history/history2.scxml
  164. +19 −19 src/test/history/history3.json
  165. +33 −33 src/test/history/history3.scxml
  166. +39 −39 src/test/history/history4.json
  167. +71 −71 src/test/history/history4.scxml
  168. +15 −15 src/test/history/history5.json
  169. +49 −49 src/test/history/history5.scxml
  170. +43 −43 src/test/in/TestInPredicate.json
  171. +88 −88 src/test/in/TestInPredicate.scxml
  172. +15 −15 src/test/multiple-events-per-transition/test1.json
  173. +13 −13 src/test/multiple-events-per-transition/test1.scxml
  174. +7 −7 src/test/parallel+interrupt/test0.json
  175. +15 −15 src/test/parallel+interrupt/test0.scxml
  176. +7 −7 src/test/parallel+interrupt/test1.json
  177. +24 −24 src/test/parallel+interrupt/test1.scxml
  178. +8 −8 src/test/parallel+interrupt/test10.json
  179. +20 −20 src/test/parallel+interrupt/test10.scxml
  180. +8 −8 src/test/parallel+interrupt/test11.json
  181. +22 −22 src/test/parallel+interrupt/test11.scxml
  182. +8 −8 src/test/parallel+interrupt/test12.json
  183. +22 −22 src/test/parallel+interrupt/test12.scxml
  184. +8 −8 src/test/parallel+interrupt/test13.json
  185. +22 −22 src/test/parallel+interrupt/test13.scxml
  186. +8 −8 src/test/parallel+interrupt/test14.json
  187. +44 −44 src/test/parallel+interrupt/test14.scxml
  188. +8 −8 src/test/parallel+interrupt/test15.json
  189. +34 −34 src/test/parallel+interrupt/test15.scxml
  190. +8 −8 src/test/parallel+interrupt/test16.json
  191. +17 −17 src/test/parallel+interrupt/test16.scxml
  192. +8 −8 src/test/parallel+interrupt/test17.json
  193. +17 −17 src/test/parallel+interrupt/test17.scxml
  194. +8 −8 src/test/parallel+interrupt/test18.json
  195. +14 −14 src/test/parallel+interrupt/test18.scxml
  196. +8 −8 src/test/parallel+interrupt/test19.json
  197. +21 −21 src/test/parallel+interrupt/test19.scxml
  198. +7 −7 src/test/parallel+interrupt/test2.json
  199. +20 −20 src/test/parallel+interrupt/test2.scxml
  200. +8 −8 src/test/parallel+interrupt/test20.json
  201. +19 −19 src/test/parallel+interrupt/test20.scxml
  202. +8 −8 src/test/parallel+interrupt/test21.json
  203. +19 −19 src/test/parallel+interrupt/test21.scxml
  204. +8 −8 src/test/parallel+interrupt/test22.json
  205. +21 −21 src/test/parallel+interrupt/test22.scxml
  206. +8 −8 src/test/parallel+interrupt/test23.json
  207. +14 −14 src/test/parallel+interrupt/test23.scxml
  208. +8 −8 src/test/parallel+interrupt/test24.json
  209. +21 −21 src/test/parallel+interrupt/test24.scxml
  210. +8 −8 src/test/parallel+interrupt/test25.json
  211. +19 −19 src/test/parallel+interrupt/test25.scxml
  212. +8 −8 src/test/parallel+interrupt/test26.json
  213. +19 −19 src/test/parallel+interrupt/test26.scxml
  214. +8 −8 src/test/parallel+interrupt/test27.json
  215. +21 −21 src/test/parallel+interrupt/test27.scxml
  216. +8 −8 src/test/parallel+interrupt/test28.json
  217. +16 −16 src/test/parallel+interrupt/test28.scxml
  218. +8 −8 src/test/parallel+interrupt/test29.json
  219. +16 −16 src/test/parallel+interrupt/test29.scxml
  220. +8 −8 src/test/parallel+interrupt/test3.json
  221. +23 −23 src/test/parallel+interrupt/test3.scxml
  222. +8 −8 src/test/parallel+interrupt/test30.json
  223. +21 −21 src/test/parallel+interrupt/test30.scxml
  224. +8 −8 src/test/parallel+interrupt/test31.json
  225. +23 −23 src/test/parallel+interrupt/test31.scxml
  226. +8 −8 src/test/parallel+interrupt/test4.json
  227. +26 −26 src/test/parallel+interrupt/test4.scxml
  228. +8 −8 src/test/parallel+interrupt/test5.json
  229. +26 −26 src/test/parallel+interrupt/test5.scxml
  230. +7 −7 src/test/parallel+interrupt/test6.json
  231. +30 −30 src/test/parallel+interrupt/test6.scxml
  232. +8 −8 src/test/parallel+interrupt/test7.json
  233. +25 −25 src/test/parallel+interrupt/test7.scxml
  234. +8 −8 src/test/parallel+interrupt/test8.json
  235. +25 −25 src/test/parallel+interrupt/test8.scxml
  236. +8 −8 src/test/parallel+interrupt/test9.json
  237. +24 −24 src/test/parallel+interrupt/test9.scxml
  238. +2 −2 src/test/parallel/test0.json
  239. +6 −6 src/test/parallel/test0.scxml
  240. +8 −8 src/test/parallel/test1.json
  241. +34 −34 src/test/parallel/test1.scxml
  242. +8 −8 src/test/parallel/test2.json
  243. +31 −31 src/test/parallel/test2.scxml
  244. +8 −8 src/test/parallel/test3.json
  245. +40 −40 src/test/parallel/test3.scxml
  246. +7 −7 src/test/script/test0.json
  247. +15 −15 src/test/script/test0.scxml
  248. +7 −7 src/test/script/test1.json
  249. +26 −26 src/test/script/test1.scxml
  250. +7 −7 src/test/script/test2.json
  251. +36 −36 src/test/script/test2.scxml
  252. +7 −7 src/test/scxml-prefix-event-name-matching/star0.json
  253. +12 −12 src/test/scxml-prefix-event-name-matching/star0.scxml
  254. +35 −35 src/test/scxml-prefix-event-name-matching/test0.json
  255. +22 −22 src/test/scxml-prefix-event-name-matching/test0.scxml
  256. +35 −35 src/test/scxml-prefix-event-name-matching/test1.json
  257. +26 −26 src/test/scxml-prefix-event-name-matching/test1.scxml
  258. +12 −12 src/test/send-data/send1.json
  259. +37 −37 src/test/send-data/send1.scxml
  260. +7 −7 src/test/targetless-transition/test0.json
  261. +20 −20 src/test/targetless-transition/test0.scxml
  262. +11 −11 src/test/targetless-transition/test1.json
  263. +23 −23 src/test/targetless-transition/test1.scxml
  264. +11 −11 src/test/targetless-transition/test2.json
  265. +26 −26 src/test/targetless-transition/test2.scxml
  266. +11 −11 src/test/targetless-transition/test3.json
  267. +51 −51 src/test/targetless-transition/test3.scxml
@@ -24,98 +24,98 @@ allow authoring of SVG content with inline, declarative behavioural descriptions
using SCXML:
* the document is searched for scxml elements
* it compiles them locally to JavaScript, and then hooks up event listeners on the parent DOM node,
- so that DOM events are sent to the state machine for processing
+ so that DOM events are sent to the state machine for processing
* the state machine is able to manipulate the DOM directly through executable content nodes
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
- <head>
- <style type="text/css">
- html, body {
- height:100%;
- margin: 0;
- padding: 0;
- }
- </style>
- <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/require.js/1.0.1/require.min.js"></script>
- <script type="text/javascript" src="http://jbeard4.github.com/SCION/builds/scion-browser-0.1.js"></script>
- <script type="text/javascript">
- require(['util/browser/parseOnLoad'],function(parseOnLoad){
- parseOnLoad()
- });
- </script>
+ <head>
+ <style type="text/css">
+ html, body {
+ height:100%;
+ margin: 0;
+ padding: 0;
+ }
+ </style>
+ <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/require.js/1.0.1/require.min.js"></script>
+ <script type="text/javascript" src="http://jbeard4.github.com/SCION/builds/scion-browser-0.1.js"></script>
+ <script type="text/javascript">
+ require(['util/browser/parseOnLoad'],function(parseOnLoad){
+ parseOnLoad()
+ });
+ </script>
- </head>
- <body>
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:scion="https://github.com/jbeard4/SCION" width="100%" height="99%" >
+ </head>
+ <body>
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:scion="https://github.com/jbeard4/SCION" width="100%" height="99%" >
- <rect width="100" height="100" stroke="black" fill="red" id="rectToTranslate" >
- <!-- the domEventsToConnect attribute is just some syntactic sugar provided by the scion parseOnLoad module -->
- <scxml
- xmlns="http://www.w3.org/2005/07/scxml"
- version="1.0"
- profile="ecmascript"
- id="scxmlRoot"
- initial="idle"
- scion:domEventsToConnect="mousedown,mouseup,mousemove">
+ <rect width="100" height="100" stroke="black" fill="red" id="rectToTranslate" >
+ <!-- the domEventsToConnect attribute is just some syntactic sugar provided by the scion parseOnLoad module -->
+ <scxml
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ profile="ecmascript"
+ id="scxmlRoot"
+ initial="idle"
+ scion:domEventsToConnect="mousedown,mouseup,mousemove">
- <script>
- function computeTDelta(oldEvent,newEvent){
- //summary:computes the offset between two events; to be later used with this.translate
- var dx = newEvent.clientX - oldEvent.clientX;
- var dy = newEvent.clientY - oldEvent.clientY;
+ <script>
+ function computeTDelta(oldEvent,newEvent){
+ //summary:computes the offset between two events; to be later used with this.translate
+ var dx = newEvent.clientX - oldEvent.clientX;
+ var dy = newEvent.clientY - oldEvent.clientY;
- return {'dx':dx,'dy':dy};
- }
+ return {'dx':dx,'dy':dy};
+ }
- function translate(rawNode,tDelta){
- var tl = rawNode.transform.baseVal;
- var t = tl.numberOfItems ? tl.getItem(0) : rawNode.ownerSVGElement.createSVGTransform();
- var m = t.matrix;
- var newM = rawNode.ownerSVGElement.createSVGMatrix().translate(tDelta.dx,tDelta.dy).multiply(m);
- t.setMatrix(newM);
- tl.initialize(t);
- return newM;
- }
- </script>
+ function translate(rawNode,tDelta){
+ var tl = rawNode.transform.baseVal;
+ var t = tl.numberOfItems ? tl.getItem(0) : rawNode.ownerSVGElement.createSVGTransform();
+ var m = t.matrix;
+ var newM = rawNode.ownerSVGElement.createSVGMatrix().translate(tDelta.dx,tDelta.dy).multiply(m);
+ t.setMatrix(newM);
+ tl.initialize(t);
+ return newM;
+ }
+ </script>
- <datamodel>
- <data id="firstEvent"/>
- <data id="eventStamp"/>
- <data id="tDelta"/>
- </datamodel>
+ <datamodel>
+ <data id="firstEvent"/>
+ <data id="eventStamp"/>
+ <data id="tDelta"/>
+ </datamodel>
- <state id="idle">
- <transition event="mousedown" target="dragging">
- <assign location="firstEvent" expr="_event.data"/>
- <assign location="eventStamp" expr="_event.data"/>
- </transition>
- </state>
+ <state id="idle">
+ <transition event="mousedown" target="dragging">
+ <assign location="firstEvent" expr="_event.data"/>
+ <assign location="eventStamp" expr="_event.data"/>
+ </transition>
+ </state>
- <state id="dragging">
- <transition event="mouseup" target="idle"/>
+ <state id="dragging">
+ <transition event="mouseup" target="idle"/>
- <transition event="mousemove" target="dragging">
- <script>
- //This assignment to tDelta looks like it would assign to the global object,
- //but will in fact be assigned to the statechart's datamodel. Internally, the
- //script block is being evaluated inside of a JavaScript "with" statement,
- //where the datamodel object is the clause to "with".
- tDelta = computeTDelta(eventStamp,_event.data);
+ <transition event="mousemove" target="dragging">
+ <script>
+ //This assignment to tDelta looks like it would assign to the global object,
+ //but will in fact be assigned to the statechart's datamodel. Internally, the
+ //script block is being evaluated inside of a JavaScript "with" statement,
+ //where the datamodel object is the clause to "with".
+ tDelta = computeTDelta(eventStamp,_event.data);
- //The "this" object hereis the parent rect node.
- //This is syntactic sugar, provided by the scion interpreter's evaluationContext
- //parameter, and the parseOnLoad script. See util/browser/parseOnLoad for more details.
- translate(this,tDelta);
- </script>
- <assign location="eventStamp" expr="_event.data"/>
- </transition>
- </state>
+ //The "this" object hereis the parent rect node.
+ //This is syntactic sugar, provided by the scion interpreter's evaluationContext
+ //parameter, and the parseOnLoad script. See util/browser/parseOnLoad for more details.
+ translate(this,tDelta);
+ </script>
+ <assign location="eventStamp" expr="_event.data"/>
+ </transition>
+ </state>
- </scxml>
- </rect>
- </svg>
- </body>
+ </scxml>
+ </rect>
+ </svg>
+ </body>
</html>
@@ -24,113 +24,113 @@ own state.
-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg">
- <head>
- <style type="text/css">
- html, body {
- height:100%;
- margin: 0;
- padding: 0;
- }
- </style>
- <!-- we use jquery for jQuery.get and jQuery.globalEval (globalEval can optionally be used by the statechart) -->
- <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.7/jquery.min.js" type="text/javascript"></script>
- <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/require.js/1.0.1/require.min.js"></script>
- <script type="text/javascript" src="http://jbeard4.github.com/SCION/builds/scion-browser-0.1.js"></script>
- </head>
- <body>
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="99%" id="canvas"/>
- <button id="elementButton" style="position:absolute;bottom:0px;left:0px;">Make draggable SVG Element</button>
- <script><![CDATA[
- var svgCanvas = document.getElementById("canvas"),
- elementButton = document.getElementById("elementButton"),
- SVG_NS = "http://www.w3.org/2000/svg";
-
- //hook up minimal console api
- if(typeof console == "undefined"){
- console = {};
- ["log","info","error","dirxml"].forEach(function(m){console[m] = console[m] || function(){} });
- }
-
- //the steps 1-7 referenced here are described in full detail in src/main/coffeescript/util/browser/parseOnLoad.coffee
- require(["scxml/SCXML","util/annotate-scxml-json","scxml/json2model","scxml/event","lib/JsonML_DOM"],function(scxml,jsonAnnotator,json2model,Event,JsonML){
- var BrowserInterpreter = scxml.BrowserInterpreter;
-
- //step 1 - get the scxml document
- jQuery.get("drag-and-drop2.xml" , function(scxmlToTransform, textStatus, jqXHR){
-
- console.log("scxmlToTransform",scxmlToTransform);
-
- //step 2 - transform scxmlToTransform to JSON
- var arr = JsonML.parseDOM(scxmlToTransform);
- var scxmlJson = arr[1];
- console.log("scxmlJson",scxmlJson);
-
- //step 3 - transform the parsed JSON model so it is friendlier to interpretation
- var annotatedScxmlJson = jsonAnnotator(scxmlJson);
- console.log("annotatedScxmlJson",annotatedScxmlJson);
-
- //step 4 - initialize sc object model
- var model = json2model(annotatedScxmlJson);
- console.log("model",model);
-
-
- //just for fun, random color generator, courtesy of http://stackoverflow.com/questions/1484506/random-color-generator-in-javascript
- function get_random_color() {
- var letters = '0123456789ABCDEF'.split('');
- var color = '#';
- for (var i = 0; i < 6; i++ ) {
- color += letters[Math.round(Math.random() * 15)];
- }
- return color;
- }
-
- //hook up button UI control
- elementButton.addEventListener("click",function(e){
-
- //do DOM stuff- create new blue circle
- var newGNode = document.createElementNS(SVG_NS,"g");
- var newTextNode = document.createElementNS(SVG_NS,"text");
- var newNode = document.createElementNS(SVG_NS,"circle");
- newNode.setAttributeNS(null,"cx",50);
- newNode.setAttributeNS(null,"cy",50);
- newNode.setAttributeNS(null,"r",50);
- newNode.setAttributeNS(null,"fill",get_random_color());
- newNode.setAttributeNS(null,"stroke","black");
-
- newGNode.appendChild(newNode);
- newGNode.appendChild(newTextNode);
-
- //step 5 - instantiate statechart
- var interpreter = new BrowserInterpreter(model,
- {
- //globalEval is used to execute any top-level script children of the scxml element
- //use of jQuery's global-eval is optional
- //TODO: cite that blog post about global-eval
- globalEval : jQuery.globalEval
- });
- console.log("interpreter",interpreter);
-
- //step 6 - connect all relevant event listeners
- ["mousedown","mouseup","mousemove"].forEach(function(eventName){
- newGNode.addEventListener( eventName, function(e){
- e.preventDefault();
- interpreter.gen(new Event(eventName,e))
- },false)
- });
-
- //step 7 - start statechart
- interpreter.start()
-
- //step 8 - initialize his variables by sending an "init" event and passing the nodes in as data
- interpreter.gen(new Event("init",{rawNode:newGNode,textNode:newTextNode}));
-
- svgCanvas.appendChild(newGNode);
- },false);
-
- },"xml");
- });
- ]]></script>
- </body>
+ <head>
+ <style type="text/css">
+ html, body {
+ height:100%;
+ margin: 0;
+ padding: 0;
+ }
+ </style>
+ <!-- we use jquery for jQuery.get and jQuery.globalEval (globalEval can optionally be used by the statechart) -->
+ <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.7/jquery.min.js" type="text/javascript"></script>
+ <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/require.js/1.0.1/require.min.js"></script>
+ <script type="text/javascript" src="http://jbeard4.github.com/SCION/builds/scion-browser-0.1.js"></script>
+ </head>
+ <body>
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="99%" id="canvas"/>
+ <button id="elementButton" style="position:absolute;bottom:0px;left:0px;">Make draggable SVG Element</button>
+ <script><![CDATA[
+ var svgCanvas = document.getElementById("canvas"),
+ elementButton = document.getElementById("elementButton"),
+ SVG_NS = "http://www.w3.org/2000/svg";
+
+ //hook up minimal console api
+ if(typeof console == "undefined"){
+ console = {};
+ ["log","info","error","dirxml"].forEach(function(m){console[m] = console[m] || function(){} });
+ }
+
+ //the steps 1-7 referenced here are described in full detail in src/main/coffeescript/util/browser/parseOnLoad.coffee
+ require(["scxml/SCXML","util/annotate-scxml-json","scxml/json2model","scxml/event","lib/JsonML_DOM"],function(scxml,jsonAnnotator,json2model,Event,JsonML){
+ var BrowserInterpreter = scxml.BrowserInterpreter;
+
+ //step 1 - get the scxml document
+ jQuery.get("drag-and-drop2.xml" , function(scxmlToTransform, textStatus, jqXHR){
+
+ console.log("scxmlToTransform",scxmlToTransform);
+
+ //step 2 - transform scxmlToTransform to JSON
+ var arr = JsonML.parseDOM(scxmlToTransform);
+ var scxmlJson = arr[1];
+ console.log("scxmlJson",scxmlJson);
+
+ //step 3 - transform the parsed JSON model so it is friendlier to interpretation
+ var annotatedScxmlJson = jsonAnnotator(scxmlJson);
+ console.log("annotatedScxmlJson",annotatedScxmlJson);
+
+ //step 4 - initialize sc object model
+ var model = json2model(annotatedScxmlJson);
+ console.log("model",model);
+
+
+ //just for fun, random color generator, courtesy of http://stackoverflow.com/questions/1484506/random-color-generator-in-javascript
+ function get_random_color() {
+ var letters = '0123456789ABCDEF'.split('');
+ var color = '#';
+ for (var i = 0; i < 6; i++ ) {
+ color += letters[Math.round(Math.random() * 15)];
+ }
+ return color;
+ }
+
+ //hook up button UI control
+ elementButton.addEventListener("click",function(e){
+
+ //do DOM stuff- create new blue circle
+ var newGNode = document.createElementNS(SVG_NS,"g");
+ var newTextNode = document.createElementNS(SVG_NS,"text");
+ var newNode = document.createElementNS(SVG_NS,"circle");
+ newNode.setAttributeNS(null,"cx",50);
+ newNode.setAttributeNS(null,"cy",50);
+ newNode.setAttributeNS(null,"r",50);
+ newNode.setAttributeNS(null,"fill",get_random_color());
+ newNode.setAttributeNS(null,"stroke","black");
+
+ newGNode.appendChild(newNode);
+ newGNode.appendChild(newTextNode);
+
+ //step 5 - instantiate statechart
+ var interpreter = new BrowserInterpreter(model,
+ {
+ //globalEval is used to execute any top-level script children of the scxml element
+ //use of jQuery's global-eval is optional
+ //TODO: cite that blog post about global-eval
+ globalEval : jQuery.globalEval
+ });
+ console.log("interpreter",interpreter);
+
+ //step 6 - connect all relevant event listeners
+ ["mousedown","mouseup","mousemove"].forEach(function(eventName){
+ newGNode.addEventListener( eventName, function(e){
+ e.preventDefault();
+ interpreter.gen(new Event(eventName,e))
+ },false)
+ });
+
+ //step 7 - start statechart
+ interpreter.start()
+
+ //step 8 - initialize his variables by sending an "init" event and passing the nodes in as data
+ interpreter.gen(new Event("init",{rawNode:newGNode,textNode:newTextNode}));
+
+ svgCanvas.appendChild(newGNode);
+ },false);
+
+ },"xml");
+ });
+ ]]></script>
+ </body>
</html>
Oops, something went wrong.

0 comments on commit f896158

Please sign in to comment.