MINT-core 1.0.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. data/Gemfile +22 -3
  2. data/Gemfile.lock +98 -22
  3. data/History.txt +262 -0
  4. data/LICENSE +30 -0
  5. data/MINT-core.gemspec +25 -80
  6. data/Manifest.txt +145 -30
  7. data/README.rdoc +6 -163
  8. data/Rakefile +16 -17
  9. data/bin/mint-aui +3 -3
  10. data/bin/mint-cui-gfx +3 -2
  11. data/bin/mint-juggernaut.sh +0 -0
  12. data/bin/mint-tuplespace +0 -0
  13. data/lib/MINT-core.rb +53 -15
  14. data/lib/MINT-core/agent/agent.rb +1 -1
  15. data/lib/MINT-core/agent/aui.rb +0 -14
  16. data/lib/MINT-core/agent/auicontrol.rb +91 -38
  17. data/lib/MINT-core/agent/cui-gfx.rb +3 -3
  18. data/lib/MINT-core/agent/cuicontrol.rb +94 -24
  19. data/lib/MINT-core/connector/redis_connector.rb +16 -0
  20. data/lib/MINT-core/manager/mapping_manager.rb +101 -0
  21. data/lib/MINT-core/manager/mapping_parser.rb +89 -0
  22. data/lib/MINT-core/manager/mapping_server.rb +99 -0
  23. data/lib/MINT-core/manager/position_updater.rb +33 -0
  24. data/lib/MINT-core/manager/scxml_client.rb +118 -0
  25. data/lib/MINT-core/manager/scxml_server.rb +86 -0
  26. data/lib/MINT-core/mapping/action/action.rb +32 -0
  27. data/lib/MINT-core/mapping/action/backend_action.rb +32 -0
  28. data/lib/MINT-core/mapping/action/bind_action.rb +88 -0
  29. data/lib/MINT-core/mapping/action/event_action.rb +40 -0
  30. data/lib/MINT-core/mapping/complementary_mapping.rb +31 -0
  31. data/lib/MINT-core/mapping/mapping.rb +170 -34
  32. data/lib/MINT-core/mapping/observation/negation_observation.rb +64 -0
  33. data/lib/MINT-core/mapping/observation/observation.rb +219 -0
  34. data/lib/MINT-core/mapping/sequential.rb +1 -2
  35. data/lib/MINT-core/mapping/sequential_mapping.rb +60 -0
  36. data/lib/MINT-core/model/aui/AIChoiceElement.rb +17 -0
  37. data/lib/MINT-core/model/aui/AICommand.rb +7 -0
  38. data/lib/MINT-core/model/aui/AIContainer.rb +73 -0
  39. data/lib/MINT-core/model/aui/AIContext.rb +12 -0
  40. data/lib/MINT-core/model/aui/AIIN.rb +8 -0
  41. data/lib/MINT-core/model/aui/AIINContinuous.rb +56 -0
  42. data/lib/MINT-core/model/aui/AIINDiscrete.rb +8 -0
  43. data/lib/MINT-core/model/aui/AIMultiChoice.rb +1 -2
  44. data/lib/MINT-core/model/aui/AIMultiChoiceElement.rb +4 -51
  45. data/lib/MINT-core/model/aui/AIO.rb +76 -123
  46. data/lib/MINT-core/model/aui/AIOUT.rb +8 -0
  47. data/lib/MINT-core/model/aui/AIOUTContinuous.rb +61 -0
  48. data/lib/MINT-core/model/aui/AIReference.rb +16 -0
  49. data/lib/MINT-core/model/aui/AISingleChoice.rb +18 -1
  50. data/lib/MINT-core/model/aui/AISingleChoiceElement.rb +10 -56
  51. data/lib/MINT-core/model/aui/AISinglePresence.rb +39 -71
  52. data/lib/MINT-core/model/aui/aicommand.scxml +47 -0
  53. data/lib/MINT-core/model/aui/aicontainer.scxml +41 -0
  54. data/lib/MINT-core/model/aui/aicontext.scxml +34 -0
  55. data/lib/MINT-core/model/aui/aiincontinuous.scxml +59 -0
  56. data/lib/MINT-core/model/aui/aiinrange.scxml +86 -0
  57. data/lib/MINT-core/model/aui/aimultichoice.scxml +67 -0
  58. data/lib/MINT-core/model/aui/aimultichoiceelement.scxml +51 -0
  59. data/lib/MINT-core/model/aui/aio.scxml +18 -27
  60. data/lib/MINT-core/model/aui/aioutcontinuous.scxml +66 -0
  61. data/lib/MINT-core/model/aui/aireference.scxml +28 -0
  62. data/lib/MINT-core/model/aui/aisinglechoice.scxml +60 -0
  63. data/lib/MINT-core/model/aui/aisinglechoiceelement.scxml +45 -60
  64. data/lib/MINT-core/model/aui/aisinglepresence.scxml +15 -24
  65. data/lib/MINT-core/model/aui/model.rb +15 -38
  66. data/lib/MINT-core/model/cui/gfx/CIC.rb +34 -10
  67. data/lib/MINT-core/model/cui/gfx/CIO.rb +66 -115
  68. data/lib/MINT-core/model/cui/gfx/CarouFredSel.scxml +58 -0
  69. data/lib/MINT-core/model/cui/gfx/MarkableRadioButton.rb +8 -0
  70. data/lib/MINT-core/model/cui/gfx/RadioButton.rb +8 -0
  71. data/lib/MINT-core/model/cui/gfx/RadioButtonGroup.rb +6 -0
  72. data/lib/MINT-core/model/cui/gfx/button.rb +16 -0
  73. data/lib/MINT-core/model/cui/gfx/button.scxml +58 -0
  74. data/lib/MINT-core/model/cui/gfx/caroufredsel.rb +48 -0
  75. data/lib/MINT-core/model/cui/gfx/cic.scxml +57 -0
  76. data/lib/MINT-core/model/cui/gfx/cio.scxml +54 -0
  77. data/lib/MINT-core/model/cui/gfx/markableradiobutton.scxml +67 -0
  78. data/lib/MINT-core/model/cui/gfx/model.rb +39 -176
  79. data/lib/MINT-core/model/cui/gfx/radiobutton.scxml +59 -0
  80. data/lib/MINT-core/model/interactor.rb +167 -46
  81. data/lib/MINT-core/model/interactor.scxml +3 -0
  82. data/lib/MINT-core/model/interactor_helpers.rb +25 -0
  83. data/lib/MINT-core/model/ir/body/OneHandPoseNavigation.rb +15 -0
  84. data/lib/MINT-core/model/ir/body/body.rb +5 -0
  85. data/lib/MINT-core/model/ir/body/fingertip.rb +114 -0
  86. data/lib/MINT-core/model/ir/body/fingertip.scxml +43 -0
  87. data/lib/MINT-core/model/{body → ir/body}/gesture_button.rb +0 -0
  88. data/lib/MINT-core/model/ir/body/hand.rb +5 -0
  89. data/lib/MINT-core/model/ir/body/head.rb +102 -0
  90. data/lib/MINT-core/model/ir/body/head.scxml +92 -0
  91. data/lib/MINT-core/model/ir/body/onehandposenavigation.scxml +53 -0
  92. data/lib/MINT-core/model/ir/body/pose.rb +99 -0
  93. data/lib/MINT-core/model/ir/browserscreen.rb +27 -0
  94. data/lib/MINT-core/model/ir/browserscreen.scxml +14 -0
  95. data/lib/MINT-core/model/{device → ir}/button.rb +1 -1
  96. data/lib/MINT-core/model/ir/ir.rb +5 -0
  97. data/lib/MINT-core/model/ir/irmedia.rb +5 -0
  98. data/lib/MINT-core/model/ir/irmode.rb +5 -0
  99. data/lib/MINT-core/model/{device → ir}/joypad.rb +1 -1
  100. data/lib/MINT-core/model/ir/mouse.rb +44 -0
  101. data/lib/MINT-core/model/ir/mouse.scxml +35 -0
  102. data/lib/MINT-core/model/{device/mouse.rb → ir/mouse_old.rb} +2 -2
  103. data/lib/MINT-core/model/{device → ir}/pointer.rb +20 -22
  104. data/lib/MINT-core/model/ir/pointer.scxml +19 -0
  105. data/lib/MINT-core/model/ir/screen.rb +5 -0
  106. data/lib/MINT-core/model/{device → ir}/wheel.rb +1 -1
  107. data/lib/MINT-core/model/mim/aicommand_activate_to_button_press.xml +13 -0
  108. data/lib/MINT-core/model/mim/aicommand_deactivate_to_button_release.xml +13 -0
  109. data/lib/MINT-core/model/mim/aio_defocus_to_cio_unhighlight.xml +13 -0
  110. data/lib/MINT-core/model/mim/aio_focus_to_cio_highlight.xml +14 -0
  111. data/lib/MINT-core/model/mim/aio_present_to_cio_display.xml +14 -0
  112. data/lib/MINT-core/model/mim/aio_suspend_to_cio_hide.xml +13 -0
  113. data/lib/MINT-core/model/mim/aisinglechoice_present_to_child_present.xml +14 -0
  114. data/lib/MINT-core/model/mim/aisinglechoiceelement_chosen_to_radiobutton_select.xml +13 -0
  115. data/lib/MINT-core/model/mim/aisinglechoiceelement_unchosen_to_radiobutton_unselect.xml +13 -0
  116. data/lib/MINT-core/model/mim/aisinglepresence_children_finished_to_caroufredsel_init_js.xml +14 -0
  117. data/lib/MINT-core/model/mim/aisinglepresence_present_to_child_present.xml +15 -0
  118. data/lib/MINT-core/model/mim/browserscreen_reload_to_cuicontrol_refresh_all.xml +12 -0
  119. data/lib/MINT-core/model/mim/button_press_to_aicommand_activate.xml +12 -0
  120. data/lib/MINT-core/model/mim/button_release_to_aicommand_deactivate.xml +12 -0
  121. data/lib/MINT-core/model/mim/caroufredsel_refreshing_to_caroufredsel_init_js.xml +14 -0
  122. data/lib/MINT-core/model/mim/cio_display_to_aio_defocus.xml +13 -0
  123. data/lib/MINT-core/model/mim/cio_display_to_aio_present.xml +12 -0
  124. data/lib/MINT-core/model/mim/cio_display_to_cio_display_cache_add.xml +11 -0
  125. data/lib/MINT-core/model/mim/cio_hide_to_aio_suspend.xml +12 -0
  126. data/lib/MINT-core/model/mim/cio_hide_to_cio_display_cache_remove.xml +12 -0
  127. data/lib/MINT-core/model/mim/cio_highlight_to_aio_focus.xml +13 -0
  128. data/lib/MINT-core/model/mim/head_looking_left_to_aisinglepresence_prev.xml +14 -0
  129. data/lib/MINT-core/model/mim/head_looking_right_to_aisinglepresence_next.xml +15 -0
  130. data/lib/MINT-core/model/mim/head_nodding_to_aisinglepresence_next.xml +15 -0
  131. data/lib/MINT-core/model/mim/head_tilting_left_to_aisinglepresence_prev.xml +14 -0
  132. data/lib/MINT-core/model/mim/head_tilting_right_to_aisinglepresence_next.xml +15 -0
  133. data/lib/MINT-core/model/mim/left_button_aisinglepresence_enter.xml +15 -0
  134. data/lib/MINT-core/model/mim/left_button_aisinglepresence_next.xml +15 -0
  135. data/lib/MINT-core/model/mim/mim_default.xml +52 -0
  136. data/lib/MINT-core/model/mim/mint-mappings.xsd +127 -0
  137. data/lib/MINT-core/model/mim/mouse_press_to_aicommand_activate.xml +17 -0
  138. data/lib/MINT-core/model/mim/mouse_press_to_aisinglechoiceelement_choose.xml +17 -0
  139. data/lib/MINT-core/model/mim/mouse_press_to_aisinglechoiceelement_unchoose.xml +17 -0
  140. data/lib/MINT-core/model/mim/mouse_release_to_aicommand_deactivate.xml +16 -0
  141. data/lib/MINT-core/model/mim/mouse_stop_to_cio_highlight.xml +13 -0
  142. data/lib/MINT-core/model/mim/onehandposnav_confirm_to_aichoiceelement_choose.xml +14 -0
  143. data/lib/MINT-core/model/mim/onehandposnav_next_to_aio_next.xml +14 -0
  144. data/lib/MINT-core/model/mim/onehandposnav_previous_to_aio_prev.xml +14 -0
  145. data/lib/MINT-core/model/mim/radiobutton_selected_to_aisinglechoiceelement_choose.xml +13 -0
  146. data/lib/MINT-core/model/mim/radiobutton_unselected_to_aisinglechoiceelement_unchoose.xml +13 -0
  147. data/lib/MINT-core/model/mim/right_button_aisinglepresence_prev.xml +15 -0
  148. data/lib/MINT-core/model/task.rb +6 -6
  149. data/script/console +0 -0
  150. data/script/destroy +0 -0
  151. data/script/generate +0 -0
  152. data/spec/AICommand_spec.rb +20 -0
  153. data/spec/AIContainer_spec.rb +161 -0
  154. data/spec/AIINContinuous_spec.rb +92 -0
  155. data/spec/AIOUTContinuous_spec.rb +93 -0
  156. data/spec/AIO_spec.rb +73 -0
  157. data/spec/AIReference_spec.rb +105 -0
  158. data/spec/AISinglePresence_spec.rb +204 -60
  159. data/spec/Button_spec.rb +114 -0
  160. data/spec/CIO_spec.rb +145 -0
  161. data/spec/Interactor_spec.rb +95 -0
  162. data/spec/MappingManager_spec.rb +126 -0
  163. data/spec/Spontaneous_spec.rb +53 -0
  164. data/spec/aio_agent_spec.rb +215 -186
  165. data/spec/aisinglechoice_spec.rb +147 -88
  166. data/spec/aisinglechoiceelement_spec.rb +154 -70
  167. data/spec/complementary_mapping_spec.rb +158 -0
  168. data/spec/core_spec.rb +27 -15
  169. data/spec/cui_helper.rb +100 -0
  170. data/spec/examples/browserscreen_reload_to_cuicontrol_refresh_all.xml +12 -0
  171. data/spec/examples/mim_streaming_example.xml +9 -0
  172. data/spec/examples/mouse_highlight.xml +22 -0
  173. data/spec/examples/performance_mapping.xml +15 -0
  174. data/spec/examples/reset_click.xml +24 -0
  175. data/spec/interactor_test.scxml +32 -0
  176. data/spec/interactor_test_2.scxml +16 -0
  177. data/spec/mapping_performance_spec.rb +118 -0
  178. data/spec/mapping_server_spec.rb +161 -0
  179. data/spec/mapping_spec.rb +307 -0
  180. data/spec/music_spec.rb +301 -135
  181. data/spec/performance_counter.scxml +9 -0
  182. data/spec/sequential_mappings_spec.rb +69 -0
  183. data/spec/shared/aio_shared.rb +144 -0
  184. data/spec/spec_helper.rb +22 -3
  185. data/spec/spontaneous.scxml +11 -0
  186. data/spec/support/connection_helper.rb +19 -0
  187. data/spec/support/redis_connector_monkey_patch.rb +1 -0
  188. data/spec/support/statemachine_helper.rb +84 -0
  189. data/spec/sync_mappings_spec.rb +96 -0
  190. metadata +219 -354
  191. data/lib/MINT-core/mapping/complementary.rb +0 -100
  192. data/lib/MINT-core/mapping/on_state_change.rb +0 -65
  193. data/lib/MINT-core/model/aui/AIC.rb +0 -86
  194. data/lib/MINT-core/model/aui/AIChoice.rb +0 -65
  195. data/lib/MINT-core/model/aui/AIINChoose.rb +0 -54
  196. data/lib/MINT-core/model/aui/AIOUTDiscrete.rb +0 -43
  197. data/lib/MINT-core/model/aui/aic.png +0 -0
  198. data/lib/MINT-core/model/aui/aic.scxml +0 -50
  199. data/lib/MINT-core/model/aui/aichoice.png +0 -0
  200. data/lib/MINT-core/model/aui/aichoice.scxml +0 -60
  201. data/lib/MINT-core/model/aui/aio.png +0 -0
  202. data/lib/MINT-core/model/aui/aisinglechoiceelement.png +0 -0
  203. data/lib/MINT-core/model/aui/aisinglepresence.png +0 -0
  204. data/lib/MINT-core/model/body/handgesture.rb +0 -279
  205. data/lib/MINT-core/model/body/head.png +0 -0
  206. data/lib/MINT-core/model/body/head.rb +0 -51
  207. data/lib/MINT-core/model/body/head.scxml +0 -28
  208. data/lib/MINT-core/model/cui/gfx/screen.rb +0 -18
  209. data/lib/MINT-core/overrides/rinda.rb +0 -34
  210. data/spec/AIC_spec.rb +0 -69
  211. data/spec/MINT-core_spec.rb +0 -11
  212. data/spec/aio_spec.rb +0 -144
  213. data/spec/cio_spec.rb +0 -369
  214. data/tasks/rspec.rake +0 -21
@@ -1,4 +1,4 @@
1
- <scxml initial="initialized" name="AISinglePresence" version="0.9" xmlns="http://www.w3.org/2005/07/scxml"><!-- node-size-and-position x=0.0 y=0.0 w=370.0 h=420.0 -->
1
+ <scxml initial="initialized" name="AISinglePresence" version="0.9" xmlns="http://www.w3.org/2005/07/scxml"><!-- node-size-and-position x=0.0 y=0.0 w=470.0 h=480.0 -->
2
2
  <state id="initialized"><!-- node-size-and-position x=10.0 y=30.0 w=100.0 h=30.0 -->
3
3
  <transition event="organize" target="organized"></transition>
4
4
  </state>
@@ -7,42 +7,27 @@
7
7
  <transition event="suspend" target="suspended"></transition>
8
8
  </state>
9
9
  <state id="suspended"><!-- node-size-and-position x=230.0 y=30.0 w=100.0 h=30.0 -->
10
- <onentry>
11
- <invoke src="sync_cio_to_hidden" type="x-mint"></invoke>
12
- </onentry>
13
10
  <transition event="present" target="presenting"><!-- edge-path [presenting] x=220.0 y=90.0 pointx=0.0 pointy=-5.0 offsetx=0.0 offsety=0.0 --></transition>
14
11
  <transition event="organize" target="organized"><!-- edge-path [organized] x=150.0 y=60.0 --></transition>
15
12
  </state>
16
- <state id="presenting" initial="defocused"><!-- node-size-and-position x=130.0 y=120.0 w=230.0 h=290.0 -->
17
- <onentry>
18
- <invoke src="present_first_child" type="x-mint"></invoke>
19
- </onentry>
20
- <onexit>
21
- <invoke src="hide_children" type="x-mint"></invoke>
22
- </onexit>
13
+ <state id="presenting" initial="wait_for_children"><!-- node-size-and-position x=130.0 y=120.0 w=330.0 h=350.0 -->
23
14
  <transition event="suspend" target="suspended"><!-- edge-path [suspended] x=330.0 y=90.0 --></transition>
24
- <state id="defocused"><!-- node-size-and-position x=10.0 y=30.0 w=100.0 h=30.0 -->
25
- <onentry>
26
- <invoke src="sync_cio_to_displayed" type="x-mint"></invoke>
27
- </onentry>
28
- <transition event="focus" target="focused"><!-- edge-path [focused] x=20.0 y=90.0 --></transition>
15
+ <state id="defocused"><!-- node-size-and-position x=120.0 y=90.0 w=100.0 h=30.0 -->
16
+ <transition event="focus" target="focused"><!-- edge-path [focused] x=130.0 y=150.0 --></transition>
29
17
  </state>
30
- <state id="focused" initial="waiting"><!-- node-size-and-position x=10.0 y=120.0 w=180.0 h=160.0 -->
31
- <transition event="defocus" target="defocused"><!-- edge-path [defocused] x=93.0 y=93.0 --></transition>
18
+ <state id="focused" initial="waiting"><!-- node-size-and-position x=120.0 y=180.0 w=180.0 h=160.0 -->
19
+ <transition event="defocus" target="defocused"><!-- edge-path [defocused] x=203.0 y=153.0 --></transition>
32
20
  <state id="waiting"><!-- node-size-and-position x=10.0 y=30.0 w=100.0 h=30.0 -->
33
- <onentry>
34
- <invoke src="sync_cio_to_highlighted" type="x-mint"></invoke>
35
- </onentry>
36
21
  <transition event="enter" target="entered"><!-- edge-path [entered] x=20.0 y=90.0 --></transition>
37
22
  <transition cond="exists_next" event="next" target="defocused">
38
23
  <invoke src="focus_next" type="x-mint"></invoke>
39
- <!-- edge-path [defocused] x=150.0 y=170.0 x=150.0 y=40.0 --></transition>
24
+ <!-- edge-path [defocused] x=260.0 y=230.0 x=260.0 y=100.0 --></transition>
40
25
  <transition cond="exists_prev" event="prev" target="defocused">
41
26
  <invoke src="focus_previous" type="x-mint"></invoke>
42
- <!-- edge-path [defocused] x=180.0 y=170.0 x=180.0 y=40.0 --></transition>
27
+ <!-- edge-path [defocused] x=290.0 y=230.0 x=290.0 y=100.0 --></transition>
43
28
  <transition event="parent" target="defocused">
44
29
  <invoke src="focus_parent" type="x-mint"></invoke>
45
- <!-- edge-path [defocused] x=210.0 y=170.0 x=210.0 y=40.0 --></transition>
30
+ <!-- edge-path [defocused] x=320.0 y=230.0 x=320.0 y=100.0 --></transition>
46
31
  </state>
47
32
  <state id="entered"><!-- node-size-and-position x=10.0 y=110.0 w=100.0 h=30.0 -->
48
33
  <transition event="leave" target="waiting"><!-- edge-path [waiting] x=100.0 y=90.0 --></transition>
@@ -54,5 +39,11 @@
54
39
  <!-- edge-path [entered] x=150.0 y=40.0 --></transition>
55
40
  </state>
56
41
  </state>
42
+ <state id="wait_for_children"><!-- node-size-and-position x=10.0 y=30.0 w=100.0 h=40.0 -->
43
+ <transition event="children_finished" target="children_finished"></transition>
44
+ </state>
45
+ <state id="children_finished"><!-- node-size-and-position x=200.0 y=30.0 w=100.0 h=40.0 -->
46
+ <transition target="defocused"></transition>
47
+ </state>
57
48
  </state>
58
49
  </scxml>
@@ -1,50 +1,27 @@
1
1
  # AUI MODEL
2
- module MINT
3
-
4
-
5
-
6
2
  require "MINT-core/model/aui/AIO"
7
3
 
8
- class AIIN < AIO
9
- end
10
-
11
- class AIINContinous < AIIN
12
- end
13
-
14
- class AIINDiscrete <AIIN
15
- end
16
-
17
- class AIINReference < AIINDiscrete
18
- end
19
-
20
- class AICommand <AIINDiscrete
21
- end
22
-
23
-
24
- require "MINT-core/model/aui/AIINChoose"
25
-
26
- class AIOUT <AIO
27
- end
4
+ require "MINT-core/model/aui/AIIN"
5
+ require "MINT-core/model/aui/AIINDiscrete"
28
6
 
29
- require "MINT-core/model/aui/AIOUTDiscrete"
7
+ require "MINT-core/model/aui/AIReference"
30
8
 
31
- class AIOUTContext < AIOUTDiscrete
32
- property :text, String
33
- end
9
+ require "MINT-core/model/aui/AICommand"
34
10
 
35
- class AIOUTContinous < AIOUT
36
- end
11
+ require "MINT-core/model/aui/AIOUT"
12
+ require "MINT-core/model/aui/AIContext"
37
13
 
38
- require "MINT-core/model/aui/AIC"
14
+ require "MINT-core/model/aui/AIContainer"
39
15
 
40
- end
16
+ require "MINT-core/model/aui/AIOUTContinuous"
17
+ require "MINT-core/model/aui/AIINContinuous"
41
18
 
42
- require "MINT-core/model/aui/AIChoice"
19
+ require "MINT-core/model/aui/AIChoiceElement"
43
20
 
44
- require "MINT-core/model/aui/AISingleChoiceElement"
45
- require "MINT-core/model/aui/AISingleChoice"
21
+ require "MINT-core/model/aui/AISingleChoiceElement"
22
+ require "MINT-core/model/aui/AISingleChoice"
46
23
 
47
- require "MINT-core/model/aui/AIMultiChoiceElement"
48
- require "MINT-core/model/aui/AIMultiChoice"
24
+ require "MINT-core/model/aui/AIMultiChoiceElement"
25
+ require "MINT-core/model/aui/AIMultiChoice"
49
26
 
50
- require "MINT-core/model/aui/AISinglePresence"
27
+ require "MINT-core/model/aui/AISinglePresence"
@@ -3,18 +3,39 @@ module MINT
3
3
  property :rows, Integer
4
4
  property :cols, Integer
5
5
 
6
+ def getSCXML
7
+ "#{File.dirname(__FILE__)}/cic.scxml"
8
+ end
9
+ def getChildren
10
+ aio = getAIO()
11
+ children = aio.children.map &:name
12
+ cios = []
13
+ children.each do |name|
14
+ cios << CIO.get(CIO.getModel(),name)
15
+ end
16
+ cios
17
+ end
18
+
19
+ def refresh_children
20
+ p "i refresh children"
21
+ getChildren.each do |cio|
22
+ p "refreshing #{cio.name}"
23
+ cio.process_event :refresh
24
+ end
25
+ end
26
+
6
27
  def calculate_position(parent_cic,elements,solver,i,b,layer=0)
7
28
  p "container #{self.name} #{b}"
8
- aic = AIC.first(:name=>self.name)
29
+ aic = AIContainer.first(:name=>self.name)
9
30
  elements = []
10
31
 
11
32
 
12
- if aic.childs && aic.childs.length>0
33
+ if aic.children && aic.children.length>0
13
34
 
14
- calculateColsAndRows(aic.childs.length)
35
+ calculateColsAndRows(aic.children.length)
15
36
  grid_hash= mda(self.rows,self.cols)
16
37
 
17
- aic.childs.each_with_index do |e,i|
38
+ aic.children.each_with_index do |e,i|
18
39
  cio = CIO.first(:name=>e.name)
19
40
  elements << cio
20
41
  if (not cio)
@@ -82,9 +103,9 @@ module MINT
82
103
  if self.process_event!("position")
83
104
  # p "in positionion #{self.name}"
84
105
  self.layer = layer
85
- aic = AIC.first(:name=>self.name)
106
+ aic = AIContainer.first(:name=>self.name)
86
107
 
87
- elements_count = aic.childs.length
108
+ elements_count = aic.children.length
88
109
 
89
110
  calculateColsAndRows(elements_count)
90
111
 
@@ -95,10 +116,12 @@ module MINT
95
116
  grid_hash= mda(self.rows,self.cols)
96
117
  # p "hash #{ self.name} rows #{self.rows} cols #{self.cols}"
97
118
 
98
- ai_childs = aic.childs.all(:abstract_states=> /#{Regexp.quote("organized")}/)
119
+ ai_childs = aic.children
99
120
  # p aic.name
100
121
  elements=[]
101
122
  ai_childs.each_with_index do |e,i|
123
+ if e.states == [:organized]
124
+
102
125
  cio = CIO.first(:name=>e.name)
103
126
 
104
127
  if (not cio)
@@ -131,6 +154,7 @@ module MINT
131
154
  if (cio.kind_of? MINT::CIC)
132
155
  cio.calculate_container(solver,b,layer+1)
133
156
  end
157
+ end
134
158
 
135
159
  end
136
160
 
@@ -163,16 +187,16 @@ module MINT
163
187
  }
164
188
  self.process_event("calculated")
165
189
  else
166
- aic = AIC.first(:name=>name)
190
+ aic = AIContainer.first(:name=>name)
167
191
  elements = []
168
- aic.childs.each_with_index do |e,i|
192
+ aic.children.each_with_index do |e,i|
169
193
  cio = CIO.first(:name=>e.name)
170
194
  elements << cio
171
195
  if (not cio)
172
196
  cio = CIO.createCIOfromAIO(e,layer)
173
197
  end
174
198
 
175
- calculateColsAndRows(aic.childs.length)
199
+ calculateColsAndRows(aic.children.length)
176
200
 
177
201
  # Save the actual row,column, and layer to the element
178
202
  cio.col = i % self.cols
@@ -1,37 +1,11 @@
1
1
  module MINT
2
- class CIO_sync_callback
3
- def sync_aio_to_focused
4
- true
5
- end
6
-
7
- def sync_aio_to_presented
8
- true
9
- end
10
- def sync_aio_to_defocus
11
- true
12
- end
13
-
14
- def sync_aio_to_suspended
15
- true
16
- end
17
-
18
- end
19
2
 
20
- class CIO < Element
3
+ class CIO < Interactor
21
4
  include Cassowary
22
5
 
23
- has 1, :up, self,
24
- :parent_key => [ :id ], # in the remote model (Blog)
25
- :child_key => [ :up_id ] # local to this model (Post)
26
- has 1, :down, self,
27
- :parent_key => [ :id ], # in the remote model (Blog)
28
- :child_key => [ :down_id ] # local to this model (Post)
29
- has 1, :left, self,
30
- :parent_key => [ :id ], # in the remote model (Blog)
31
- :child_key => [ :left_id ] # local to this model (Post)
32
- has 1, :right, self,
33
- :parent_key => [ :id ], # in the remote model (Blog)
34
- :child_key => [ :right_id ] # local to this model (Post)
6
+ def self.getModel
7
+ "cui-gfx"
8
+ end
35
9
 
36
10
  property :text, Text, :lazy => false
37
11
  property :fontname, String, :default => "Helvetica"
@@ -48,6 +22,17 @@ module MINT
48
22
  property :row, Integer
49
23
  property :col,Integer
50
24
 
25
+ # TODO navigation does not user DataMapper because of problems with cycles and self referencing
26
+ property :left, String
27
+ property :right, String
28
+ property :up, String
29
+ property :down, String
30
+
31
+ # Dependencies to otehr CIO elements that need to be shown/instantiated before this one
32
+ property :depends, String
33
+
34
+ property :highlightable, Boolean, :default => false
35
+
51
36
 
52
37
  # before :create, :recover_statemachine
53
38
 
@@ -58,6 +43,51 @@ module MINT
58
43
 
59
44
  before :update!, :initialize_points
60
45
  public
46
+
47
+
48
+ PUBLISH_ATTRIBUTES += [:x,:y,:width,:height,:highlightable,:depends]
49
+
50
+ def getAIO
51
+ AIO.get(AIO.getModel(),name)
52
+ end
53
+
54
+ def left
55
+ p = super
56
+ if p
57
+ CIO.get(CIO.getModel,p)
58
+ else
59
+ nil
60
+ end
61
+ end
62
+
63
+ def right
64
+ p = super
65
+ if p
66
+ CIO.get(CIO.getModel,p)
67
+ else
68
+ nil
69
+ end
70
+ end
71
+
72
+ def up
73
+ p = super
74
+ if p
75
+ CIO.get(CIO.getModel,p)
76
+ else
77
+ nil
78
+ end
79
+ end
80
+
81
+ def down
82
+ p = super
83
+ if p
84
+ CIO.get(CIO.getModel,p)
85
+ else
86
+ nil
87
+ end
88
+ end
89
+
90
+
61
91
  def initialize_points
62
92
  @pos = Cassowary::ClPoint.new()
63
93
  if (self.x and self.y)
@@ -97,7 +127,7 @@ module MINT
97
127
 
98
128
  def size(width=-1,height=-1)
99
129
  if (width > -1 and height> -1)
100
- @size = Cassowary::ClPoint.new(with,height)
130
+ @size = Cassowary::ClPoint.new(width,height)
101
131
  elsif not @size
102
132
  #if not @size
103
133
  @size = Cassowary::ClPoint.new
@@ -222,10 +252,10 @@ module MINT
222
252
  def CIO.createCIOfromAIO(e,layer)
223
253
  p "creating CIO for #{e.class}"
224
254
  case e.class.name
225
- when "MINT::AIC","MINT::AISinglePresence"
226
- aic = AIC.first(:name=>e.name) # TODO: if its not retrieved again, childs.length returns 0!
255
+ when "MINT::AIContainer","MINT::AISinglePresence"
256
+ aic = AIContainer.first(:name=>e.name) # TODO: if its not retrieved again, childs.length returns 0!
227
257
 
228
- elements_count = aic.childs.length
258
+ elements_count = aic.children.length
229
259
  elements_count = 1 if elements_count== 0
230
260
  cio = CIC.create(:name=>e.name,:cols=>1,:rows=>elements_count,:layer =>layer+1)
231
261
 
@@ -253,56 +283,12 @@ module MINT
253
283
  return cio
254
284
  end
255
285
 
256
- def initialize_statemachine
257
- if @statemachine.blank?
258
-
259
- @statemachine = Statemachine.build do
260
-
261
- superstate :CIO do
262
- trans :initialized,:position,:positioning
263
- trans :positioning,:calculated,:positioned, :store_calculated_values_in_model
264
- trans :positioned, :display, :presenting
265
- trans :disabled, :hide, :hidden
266
- trans :hidden,:display, :presenting
267
286
 
268
- state :hidden do
269
- on_entry :sync_aio_to_suspended
270
- end
271
-
272
- superstate :presenting do
273
- on_entry :sync_aio_to_presented
274
-
275
- state :displayed do
276
- on_entry :sync_aio_to_defocus
277
- end
278
-
279
- state :highlighted do
280
- on_entry :sync_aio_to_focused
281
- end
282
-
283
- trans :displayed, :highlight, :highlighted
284
- #trans :displayed, :display, :displayed # a display request can be issued several times even if the object is already displayed (in case of refresh or multimple presentations
285
- #trans :highlighted, :display, :highlighted # this is because display requests should not change the highlighting
286
- trans :highlighted,:unhighlight, :displayed
287
- trans :highlighted, :up, :displayed, :highlight_up
288
- trans :highlighted, :down, :displayed, :highlight_down
289
- trans :highlighted, :left, :displayed, :highlight_left
290
- trans :highlighted, :right, :displayed, :highlight_right
291
-
292
- event :disable, :disabled
293
- event :hide, :hidden
294
-
295
- end
296
- end
297
- end
298
- end
287
+ def getSCXML
288
+ "#{File.dirname(__FILE__)}/cio.scxml"
299
289
  end
300
290
 
301
291
 
302
- def sync_event(event)
303
- process_event(event, CIO_sync_callback.new)
304
- end
305
-
306
292
  # callbacks
307
293
 
308
294
  def highlight_up
@@ -338,41 +324,6 @@ module MINT
338
324
  end
339
325
 
340
326
 
341
- def sync_aio_to_presented
342
- aio = MINT::AIO.first(:name=>self.name)
343
- if (aio and not aio.is_in? :presenting)
344
- aio.sync_event(:present)
345
- end
346
- true
347
- end
348
-
349
-
350
- def sync_aio_to_defocus
351
- aio = MINT::AIO.first(:name=>self.name)
352
- if (aio and not aio.is_in? :defocused)
353
- aio.sync_event(:defocus)
354
- end
355
- true
356
- end
357
-
358
- def sync_aio_to_focused
359
- aio = MINT::AIO.first(:name=>self.name)
360
- if (aio and not aio.is_in? :focused)
361
- aio.sync_event(:focus)
362
- end
363
- true
364
- end
365
-
366
- def sync_aio_to_suspended
367
- aio = MINT::AIO.first(:name=>self.name)
368
- if (aio and not aio.is_in? :suspended)
369
- aio.sync_event(:suspend)
370
- end
371
- true
372
- end
373
-
374
-
375
-
376
327
  def print
377
328
  puts "\"#{self.name}\",#{pos.Xvalue}, #{pos.Yvalue}, #{size.Xvalue}, #{size.Yvalue}"
378
329
  end