MINT-core 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +22 -3
- data/Gemfile.lock +98 -22
- data/History.txt +262 -0
- data/LICENSE +30 -0
- data/MINT-core.gemspec +25 -80
- data/Manifest.txt +145 -30
- data/README.rdoc +6 -163
- data/Rakefile +16 -17
- data/bin/mint-aui +3 -3
- data/bin/mint-cui-gfx +3 -2
- data/bin/mint-juggernaut.sh +0 -0
- data/bin/mint-tuplespace +0 -0
- data/lib/MINT-core.rb +53 -15
- data/lib/MINT-core/agent/agent.rb +1 -1
- data/lib/MINT-core/agent/aui.rb +0 -14
- data/lib/MINT-core/agent/auicontrol.rb +91 -38
- data/lib/MINT-core/agent/cui-gfx.rb +3 -3
- data/lib/MINT-core/agent/cuicontrol.rb +94 -24
- data/lib/MINT-core/connector/redis_connector.rb +16 -0
- data/lib/MINT-core/manager/mapping_manager.rb +101 -0
- data/lib/MINT-core/manager/mapping_parser.rb +89 -0
- data/lib/MINT-core/manager/mapping_server.rb +99 -0
- data/lib/MINT-core/manager/position_updater.rb +33 -0
- data/lib/MINT-core/manager/scxml_client.rb +118 -0
- data/lib/MINT-core/manager/scxml_server.rb +86 -0
- data/lib/MINT-core/mapping/action/action.rb +32 -0
- data/lib/MINT-core/mapping/action/backend_action.rb +32 -0
- data/lib/MINT-core/mapping/action/bind_action.rb +88 -0
- data/lib/MINT-core/mapping/action/event_action.rb +40 -0
- data/lib/MINT-core/mapping/complementary_mapping.rb +31 -0
- data/lib/MINT-core/mapping/mapping.rb +170 -34
- data/lib/MINT-core/mapping/observation/negation_observation.rb +64 -0
- data/lib/MINT-core/mapping/observation/observation.rb +219 -0
- data/lib/MINT-core/mapping/sequential.rb +1 -2
- data/lib/MINT-core/mapping/sequential_mapping.rb +60 -0
- data/lib/MINT-core/model/aui/AIChoiceElement.rb +17 -0
- data/lib/MINT-core/model/aui/AICommand.rb +7 -0
- data/lib/MINT-core/model/aui/AIContainer.rb +73 -0
- data/lib/MINT-core/model/aui/AIContext.rb +12 -0
- data/lib/MINT-core/model/aui/AIIN.rb +8 -0
- data/lib/MINT-core/model/aui/AIINContinuous.rb +56 -0
- data/lib/MINT-core/model/aui/AIINDiscrete.rb +8 -0
- data/lib/MINT-core/model/aui/AIMultiChoice.rb +1 -2
- data/lib/MINT-core/model/aui/AIMultiChoiceElement.rb +4 -51
- data/lib/MINT-core/model/aui/AIO.rb +76 -123
- data/lib/MINT-core/model/aui/AIOUT.rb +8 -0
- data/lib/MINT-core/model/aui/AIOUTContinuous.rb +61 -0
- data/lib/MINT-core/model/aui/AIReference.rb +16 -0
- data/lib/MINT-core/model/aui/AISingleChoice.rb +18 -1
- data/lib/MINT-core/model/aui/AISingleChoiceElement.rb +10 -56
- data/lib/MINT-core/model/aui/AISinglePresence.rb +39 -71
- data/lib/MINT-core/model/aui/aicommand.scxml +47 -0
- data/lib/MINT-core/model/aui/aicontainer.scxml +41 -0
- data/lib/MINT-core/model/aui/aicontext.scxml +34 -0
- data/lib/MINT-core/model/aui/aiincontinuous.scxml +59 -0
- data/lib/MINT-core/model/aui/aiinrange.scxml +86 -0
- data/lib/MINT-core/model/aui/aimultichoice.scxml +67 -0
- data/lib/MINT-core/model/aui/aimultichoiceelement.scxml +51 -0
- data/lib/MINT-core/model/aui/aio.scxml +18 -27
- data/lib/MINT-core/model/aui/aioutcontinuous.scxml +66 -0
- data/lib/MINT-core/model/aui/aireference.scxml +28 -0
- data/lib/MINT-core/model/aui/aisinglechoice.scxml +60 -0
- data/lib/MINT-core/model/aui/aisinglechoiceelement.scxml +45 -60
- data/lib/MINT-core/model/aui/aisinglepresence.scxml +15 -24
- data/lib/MINT-core/model/aui/model.rb +15 -38
- data/lib/MINT-core/model/cui/gfx/CIC.rb +34 -10
- data/lib/MINT-core/model/cui/gfx/CIO.rb +66 -115
- data/lib/MINT-core/model/cui/gfx/CarouFredSel.scxml +58 -0
- data/lib/MINT-core/model/cui/gfx/MarkableRadioButton.rb +8 -0
- data/lib/MINT-core/model/cui/gfx/RadioButton.rb +8 -0
- data/lib/MINT-core/model/cui/gfx/RadioButtonGroup.rb +6 -0
- data/lib/MINT-core/model/cui/gfx/button.rb +16 -0
- data/lib/MINT-core/model/cui/gfx/button.scxml +58 -0
- data/lib/MINT-core/model/cui/gfx/caroufredsel.rb +48 -0
- data/lib/MINT-core/model/cui/gfx/cic.scxml +57 -0
- data/lib/MINT-core/model/cui/gfx/cio.scxml +54 -0
- data/lib/MINT-core/model/cui/gfx/markableradiobutton.scxml +67 -0
- data/lib/MINT-core/model/cui/gfx/model.rb +39 -176
- data/lib/MINT-core/model/cui/gfx/radiobutton.scxml +59 -0
- data/lib/MINT-core/model/interactor.rb +167 -46
- data/lib/MINT-core/model/interactor.scxml +3 -0
- data/lib/MINT-core/model/interactor_helpers.rb +25 -0
- data/lib/MINT-core/model/ir/body/OneHandPoseNavigation.rb +15 -0
- data/lib/MINT-core/model/ir/body/body.rb +5 -0
- data/lib/MINT-core/model/ir/body/fingertip.rb +114 -0
- data/lib/MINT-core/model/ir/body/fingertip.scxml +43 -0
- data/lib/MINT-core/model/{body → ir/body}/gesture_button.rb +0 -0
- data/lib/MINT-core/model/ir/body/hand.rb +5 -0
- data/lib/MINT-core/model/ir/body/head.rb +102 -0
- data/lib/MINT-core/model/ir/body/head.scxml +92 -0
- data/lib/MINT-core/model/ir/body/onehandposenavigation.scxml +53 -0
- data/lib/MINT-core/model/ir/body/pose.rb +99 -0
- data/lib/MINT-core/model/ir/browserscreen.rb +27 -0
- data/lib/MINT-core/model/ir/browserscreen.scxml +14 -0
- data/lib/MINT-core/model/{device → ir}/button.rb +1 -1
- data/lib/MINT-core/model/ir/ir.rb +5 -0
- data/lib/MINT-core/model/ir/irmedia.rb +5 -0
- data/lib/MINT-core/model/ir/irmode.rb +5 -0
- data/lib/MINT-core/model/{device → ir}/joypad.rb +1 -1
- data/lib/MINT-core/model/ir/mouse.rb +44 -0
- data/lib/MINT-core/model/ir/mouse.scxml +35 -0
- data/lib/MINT-core/model/{device/mouse.rb → ir/mouse_old.rb} +2 -2
- data/lib/MINT-core/model/{device → ir}/pointer.rb +20 -22
- data/lib/MINT-core/model/ir/pointer.scxml +19 -0
- data/lib/MINT-core/model/ir/screen.rb +5 -0
- data/lib/MINT-core/model/{device → ir}/wheel.rb +1 -1
- data/lib/MINT-core/model/mim/aicommand_activate_to_button_press.xml +13 -0
- data/lib/MINT-core/model/mim/aicommand_deactivate_to_button_release.xml +13 -0
- data/lib/MINT-core/model/mim/aio_defocus_to_cio_unhighlight.xml +13 -0
- data/lib/MINT-core/model/mim/aio_focus_to_cio_highlight.xml +14 -0
- data/lib/MINT-core/model/mim/aio_present_to_cio_display.xml +14 -0
- data/lib/MINT-core/model/mim/aio_suspend_to_cio_hide.xml +13 -0
- data/lib/MINT-core/model/mim/aisinglechoice_present_to_child_present.xml +14 -0
- data/lib/MINT-core/model/mim/aisinglechoiceelement_chosen_to_radiobutton_select.xml +13 -0
- data/lib/MINT-core/model/mim/aisinglechoiceelement_unchosen_to_radiobutton_unselect.xml +13 -0
- data/lib/MINT-core/model/mim/aisinglepresence_children_finished_to_caroufredsel_init_js.xml +14 -0
- data/lib/MINT-core/model/mim/aisinglepresence_present_to_child_present.xml +15 -0
- data/lib/MINT-core/model/mim/browserscreen_reload_to_cuicontrol_refresh_all.xml +12 -0
- data/lib/MINT-core/model/mim/button_press_to_aicommand_activate.xml +12 -0
- data/lib/MINT-core/model/mim/button_release_to_aicommand_deactivate.xml +12 -0
- data/lib/MINT-core/model/mim/caroufredsel_refreshing_to_caroufredsel_init_js.xml +14 -0
- data/lib/MINT-core/model/mim/cio_display_to_aio_defocus.xml +13 -0
- data/lib/MINT-core/model/mim/cio_display_to_aio_present.xml +12 -0
- data/lib/MINT-core/model/mim/cio_display_to_cio_display_cache_add.xml +11 -0
- data/lib/MINT-core/model/mim/cio_hide_to_aio_suspend.xml +12 -0
- data/lib/MINT-core/model/mim/cio_hide_to_cio_display_cache_remove.xml +12 -0
- data/lib/MINT-core/model/mim/cio_highlight_to_aio_focus.xml +13 -0
- data/lib/MINT-core/model/mim/head_looking_left_to_aisinglepresence_prev.xml +14 -0
- data/lib/MINT-core/model/mim/head_looking_right_to_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/head_nodding_to_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/head_tilting_left_to_aisinglepresence_prev.xml +14 -0
- data/lib/MINT-core/model/mim/head_tilting_right_to_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/left_button_aisinglepresence_enter.xml +15 -0
- data/lib/MINT-core/model/mim/left_button_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/mim_default.xml +52 -0
- data/lib/MINT-core/model/mim/mint-mappings.xsd +127 -0
- data/lib/MINT-core/model/mim/mouse_press_to_aicommand_activate.xml +17 -0
- data/lib/MINT-core/model/mim/mouse_press_to_aisinglechoiceelement_choose.xml +17 -0
- data/lib/MINT-core/model/mim/mouse_press_to_aisinglechoiceelement_unchoose.xml +17 -0
- data/lib/MINT-core/model/mim/mouse_release_to_aicommand_deactivate.xml +16 -0
- data/lib/MINT-core/model/mim/mouse_stop_to_cio_highlight.xml +13 -0
- data/lib/MINT-core/model/mim/onehandposnav_confirm_to_aichoiceelement_choose.xml +14 -0
- data/lib/MINT-core/model/mim/onehandposnav_next_to_aio_next.xml +14 -0
- data/lib/MINT-core/model/mim/onehandposnav_previous_to_aio_prev.xml +14 -0
- data/lib/MINT-core/model/mim/radiobutton_selected_to_aisinglechoiceelement_choose.xml +13 -0
- data/lib/MINT-core/model/mim/radiobutton_unselected_to_aisinglechoiceelement_unchoose.xml +13 -0
- data/lib/MINT-core/model/mim/right_button_aisinglepresence_prev.xml +15 -0
- data/lib/MINT-core/model/task.rb +6 -6
- data/script/console +0 -0
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/spec/AICommand_spec.rb +20 -0
- data/spec/AIContainer_spec.rb +161 -0
- data/spec/AIINContinuous_spec.rb +92 -0
- data/spec/AIOUTContinuous_spec.rb +93 -0
- data/spec/AIO_spec.rb +73 -0
- data/spec/AIReference_spec.rb +105 -0
- data/spec/AISinglePresence_spec.rb +204 -60
- data/spec/Button_spec.rb +114 -0
- data/spec/CIO_spec.rb +145 -0
- data/spec/Interactor_spec.rb +95 -0
- data/spec/MappingManager_spec.rb +126 -0
- data/spec/Spontaneous_spec.rb +53 -0
- data/spec/aio_agent_spec.rb +215 -186
- data/spec/aisinglechoice_spec.rb +147 -88
- data/spec/aisinglechoiceelement_spec.rb +154 -70
- data/spec/complementary_mapping_spec.rb +158 -0
- data/spec/core_spec.rb +27 -15
- data/spec/cui_helper.rb +100 -0
- data/spec/examples/browserscreen_reload_to_cuicontrol_refresh_all.xml +12 -0
- data/spec/examples/mim_streaming_example.xml +9 -0
- data/spec/examples/mouse_highlight.xml +22 -0
- data/spec/examples/performance_mapping.xml +15 -0
- data/spec/examples/reset_click.xml +24 -0
- data/spec/interactor_test.scxml +32 -0
- data/spec/interactor_test_2.scxml +16 -0
- data/spec/mapping_performance_spec.rb +118 -0
- data/spec/mapping_server_spec.rb +161 -0
- data/spec/mapping_spec.rb +307 -0
- data/spec/music_spec.rb +301 -135
- data/spec/performance_counter.scxml +9 -0
- data/spec/sequential_mappings_spec.rb +69 -0
- data/spec/shared/aio_shared.rb +144 -0
- data/spec/spec_helper.rb +22 -3
- data/spec/spontaneous.scxml +11 -0
- data/spec/support/connection_helper.rb +19 -0
- data/spec/support/redis_connector_monkey_patch.rb +1 -0
- data/spec/support/statemachine_helper.rb +84 -0
- data/spec/sync_mappings_spec.rb +96 -0
- metadata +219 -354
- data/lib/MINT-core/mapping/complementary.rb +0 -100
- data/lib/MINT-core/mapping/on_state_change.rb +0 -65
- data/lib/MINT-core/model/aui/AIC.rb +0 -86
- data/lib/MINT-core/model/aui/AIChoice.rb +0 -65
- data/lib/MINT-core/model/aui/AIINChoose.rb +0 -54
- data/lib/MINT-core/model/aui/AIOUTDiscrete.rb +0 -43
- data/lib/MINT-core/model/aui/aic.png +0 -0
- data/lib/MINT-core/model/aui/aic.scxml +0 -50
- data/lib/MINT-core/model/aui/aichoice.png +0 -0
- data/lib/MINT-core/model/aui/aichoice.scxml +0 -60
- data/lib/MINT-core/model/aui/aio.png +0 -0
- data/lib/MINT-core/model/aui/aisinglechoiceelement.png +0 -0
- data/lib/MINT-core/model/aui/aisinglepresence.png +0 -0
- data/lib/MINT-core/model/body/handgesture.rb +0 -279
- data/lib/MINT-core/model/body/head.png +0 -0
- data/lib/MINT-core/model/body/head.rb +0 -51
- data/lib/MINT-core/model/body/head.scxml +0 -28
- data/lib/MINT-core/model/cui/gfx/screen.rb +0 -18
- data/lib/MINT-core/overrides/rinda.rb +0 -34
- data/spec/AIC_spec.rb +0 -69
- data/spec/MINT-core_spec.rb +0 -11
- data/spec/aio_spec.rb +0 -144
- data/spec/cio_spec.rb +0 -369
- data/tasks/rspec.rake +0 -21
@@ -1,100 +0,0 @@
|
|
1
|
-
module MINT
|
2
|
-
|
3
|
-
|
4
|
-
class ComplementaryCallMethod < ExecuteOnStateChange
|
5
|
-
def initialize(source_model,state,conditions,execute)
|
6
|
-
super(source_model,state,self.method(:executeWithConditions),nil)
|
7
|
-
@original_execute = execute
|
8
|
-
@conditions = conditions
|
9
|
-
p "initialized #{conditions.inspect}"
|
10
|
-
end
|
11
|
-
|
12
|
-
# TODO basic condition checker still without consideration of time span :-(
|
13
|
-
def checkConditions
|
14
|
-
p "in check AND cond #{@conditions.inspect}"
|
15
|
-
result = nil
|
16
|
-
@conditions.each do |model,state|
|
17
|
-
result=model.first( :abstract_states=> /(^|\|)#{Regexp.quote(state)}/)
|
18
|
-
if result.nil?
|
19
|
-
puts "Received #{@state} notify for model #{@source_model} but condition state #{state} of model #{model} not true"
|
20
|
-
return false
|
21
|
-
end
|
22
|
-
end
|
23
|
-
return result
|
24
|
-
end
|
25
|
-
|
26
|
-
def executeWithConditions(result)
|
27
|
-
p "Catched "
|
28
|
-
result = checkConditions
|
29
|
-
if result
|
30
|
-
p "executing #{@original_execute} on #{result.inspect}"
|
31
|
-
@original_execute.call result
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
class ComplementarySendEvent< ComplementaryCallMethod
|
38
|
-
def initialize(source_model,state,conditions,execute)
|
39
|
-
super(source_model,state,conditions,execute)
|
40
|
-
end
|
41
|
-
|
42
|
-
def executeWithConditions(result)
|
43
|
-
p "Catched "
|
44
|
-
result = checkConditions
|
45
|
-
if result
|
46
|
-
p "executing #{@original_execute} on #{result.inspect}"
|
47
|
-
p result.process_event(@original_execute)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
class ComplementarySendEvents< ComplementaryCallMethod
|
53
|
-
def initialize(source_model,state,conditions,execute)
|
54
|
-
super(source_model,state,conditions,execute)
|
55
|
-
end
|
56
|
-
|
57
|
-
def executeWithConditions(result)
|
58
|
-
publish_events(@original_execute)
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
class ComplementaryOR<ComplementarySendEvent
|
64
|
-
def initialize(source_model,state,conditions,execute)
|
65
|
-
super(source_model,state,conditions,execute)
|
66
|
-
end
|
67
|
-
|
68
|
-
def checkConditions
|
69
|
-
p "in check OR cond #{@conditions.inspect}"
|
70
|
-
result = nil
|
71
|
-
@conditions.each do |model,state|
|
72
|
-
state.each do |s|
|
73
|
-
result=model.first( :abstract_states=> /(^|\|)#{Regexp.quote(s)}/)
|
74
|
-
if not result.nil?
|
75
|
-
return result
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
return false
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
class ComplementaryMethodCall < ComplementarySendEvent
|
85
|
-
def initialize(source_model,state,conditions,execute,callback)
|
86
|
-
super(source_model,state,conditions,execute)
|
87
|
-
@callback= callback
|
88
|
-
end
|
89
|
-
def executeWithConditions(result)
|
90
|
-
p "Catched "
|
91
|
-
result = checkConditions
|
92
|
-
if result
|
93
|
-
p "executing #{@orginal_execute} on #{result.inspect}"
|
94
|
-
r = result.process_event(@orginal_execute)
|
95
|
-
@callback.call r
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|
100
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
|
2
|
-
module MINT
|
3
|
-
|
4
|
-
# Basic mapping that observes state changes of elements in a model agents model.
|
5
|
-
#
|
6
|
-
class ExecuteOnStateChange < Mapping
|
7
|
-
attr_reader :state
|
8
|
-
|
9
|
-
def initialize(source_model,state,execute, initial=nil)
|
10
|
-
super(source_model,"write",execute,initial)
|
11
|
-
if (not state.is_a? Array)
|
12
|
-
@state = [state.to_s]
|
13
|
-
else
|
14
|
-
@state = state.map &:to_s
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def execute
|
19
|
-
# query existing state
|
20
|
-
if @initial
|
21
|
-
results = @source_model.all({ :abstract_states=> /(^|\|)#{Regexp.quote(@state.first)}/})
|
22
|
-
p "Found results by read: #{results.inspect}"
|
23
|
-
results.each do |result|
|
24
|
-
call_if_result_matches result, @initial
|
25
|
-
end
|
26
|
-
end
|
27
|
-
#register for further events
|
28
|
-
#observer = agent.storage.notify 'write', {"_model_"=> @source_model.to_s} + @conditions
|
29
|
-
|
30
|
-
p "registered for model #{@source_model} writes on state #{@state}"
|
31
|
-
@source_model.notify("write", { :new_states=> /(^|\|)#{Regexp.quote(@state.first)}/},self.method(:check_cond))
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
def check_cond(result)
|
36
|
-
call_if_result_matches(result,@execute)
|
37
|
-
end
|
38
|
-
|
39
|
-
def call_if_result_matches(result,method)
|
40
|
-
return if not result
|
41
|
-
states_to_check = Array.new @state
|
42
|
-
states_to_check.shift # we already hav checked for the first state
|
43
|
-
states_to_check.each do |state|
|
44
|
-
return false if not result.abstract_states =~/(^|\|)#{Regexp.quote(state)}/
|
45
|
-
end
|
46
|
-
method.call result
|
47
|
-
true
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
class ExecuteEventOnStateChange < ExecuteOnStateChange
|
53
|
-
def initialize(source_model,state,selector,event)
|
54
|
-
super(source_model,state,self.method(:process_event),nil)
|
55
|
-
@selector = selector
|
56
|
-
@event = event
|
57
|
-
end
|
58
|
-
|
59
|
-
def process_event(result)
|
60
|
-
@selector.each do |element|
|
61
|
-
element.process_event(@event)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
@@ -1,86 +0,0 @@
|
|
1
|
-
module MINT
|
2
|
-
class AIC < AIOUTDiscrete
|
3
|
-
# belongs_to :task @TODO - Mappings unklar
|
4
|
-
has n, :childs, 'AIO',
|
5
|
-
:parent_key => [ :id ], # local to this model (Blog)
|
6
|
-
:child_key => [ :aic_id ] # in the remote model (Post)
|
7
|
-
has 1, :entry, 'AIO'
|
8
|
-
|
9
|
-
def initialize_statemachine
|
10
|
-
super
|
11
|
-
parser = StatemachineParser.new(self)
|
12
|
-
@statemachine = parser.build_from_scxml "#{File.dirname(__FILE__)}/aic.scxml"
|
13
|
-
=begin
|
14
|
-
@statemachine = Statemachine.build do
|
15
|
-
superstate :AIC do
|
16
|
-
trans :initialized,:organize, :organized
|
17
|
-
trans :organized, :present, :presenting
|
18
|
-
trans :organized, :suspend, :suspended
|
19
|
-
trans :suspended, :present, :presenting
|
20
|
-
trans :suspended, :organize, :organized
|
21
|
-
|
22
|
-
state :suspended do
|
23
|
-
on_entry :sync_cio_to_hidden
|
24
|
-
end
|
25
|
-
|
26
|
-
superstate :presenting do
|
27
|
-
on_entry [:inform_parent_presenting, :present_children]
|
28
|
-
on_exit :hide_children
|
29
|
-
event :suspend, :suspended
|
30
|
-
|
31
|
-
state :defocused do
|
32
|
-
on_entry :sync_cio_to_displayed
|
33
|
-
end
|
34
|
-
state :focused do
|
35
|
-
on_entry :sync_cio_to_highlighted
|
36
|
-
end
|
37
|
-
trans :defocused,:focus,:focused
|
38
|
-
trans :focused,:defocus, :defocused
|
39
|
-
trans :focused, :next, :defocused, :focus_next, Proc.new { exists_next}
|
40
|
-
trans :focused, :prev, :defocused, :focus_previous, Proc.new { exists_prev}
|
41
|
-
trans :focused, :parent, :defocused, :focus_parent
|
42
|
-
trans :focused, :child, :defocused, :focus_child
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
=end
|
48
|
-
end
|
49
|
-
|
50
|
-
def hide_children
|
51
|
-
if (self.childs)
|
52
|
-
self.childs.each do |c|
|
53
|
-
c.process_event("suspend")
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def present_children
|
60
|
-
if (self.childs)
|
61
|
-
self.childs.each do |c|
|
62
|
-
c.process_event("present")
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
def focus_child
|
70
|
-
if (self.childs && self.childs.first)
|
71
|
-
self.childs.first.process_event("focus")
|
72
|
-
else
|
73
|
-
return nil # TODO not working, find abbruchbedingung!!!
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
|
78
|
-
# hook that is called from a child if it enters presenting state
|
79
|
-
def child_to_presenting(child)
|
80
|
-
true
|
81
|
-
end
|
82
|
-
|
83
|
-
end
|
84
|
-
|
85
|
-
|
86
|
-
end
|
@@ -1,65 +0,0 @@
|
|
1
|
-
module MINT
|
2
|
-
class AIChoice < AIC
|
3
|
-
def initialize_statemachine
|
4
|
-
if @statemachine.blank?
|
5
|
-
parser = StatemachineParser.new(self)
|
6
|
-
@statemachine = parser.build_from_scxml "#{File.dirname(__FILE__)}/aichoice.scxml"
|
7
|
-
=begin
|
8
|
-
@statemachine = Statemachine.build do
|
9
|
-
trans :initialized,:organize, :organized
|
10
|
-
trans :organized, :present, :p_t
|
11
|
-
trans :organized, :suspend, :suspended
|
12
|
-
trans :suspended, :present, :p_t
|
13
|
-
trans :suspended, :organize, :organized
|
14
|
-
state :suspended do
|
15
|
-
on_entry :sync_cio_to_hidden
|
16
|
-
end
|
17
|
-
|
18
|
-
superstate :p_t do # TODO artificial superstate required to get following event working!
|
19
|
-
event :suspend, :suspended
|
20
|
-
parallel :p do
|
21
|
-
statemachine :s1 do
|
22
|
-
superstate :presenting do
|
23
|
-
on_entry :present_children
|
24
|
-
on_exit :hide_children
|
25
|
-
state :defocused do
|
26
|
-
on_entry :sync_cio_to_displayed
|
27
|
-
end
|
28
|
-
state :focused do
|
29
|
-
on_entry :sync_cio_to_highlighted
|
30
|
-
end
|
31
|
-
trans :defocused,:focus,:focused
|
32
|
-
trans :focused,:defocus, :defocused
|
33
|
-
trans :focused, :next, :defocused, :focus_next, Proc.new { exists_next}
|
34
|
-
trans :focused, :prev, :defocused, :focus_previous, Proc.new { exists_prev}
|
35
|
-
trans :focused, :parent, :defocused, :focus_parent
|
36
|
-
trans :focused, :child, :defocused, :focus_child
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
40
|
-
statemachine :s2 do
|
41
|
-
superstate :l do
|
42
|
-
trans :listing, :drop, :listing, :add_element, "In(:focused)"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
=end
|
49
|
-
@statemachine.reset
|
50
|
-
end
|
51
|
-
end
|
52
|
-
def add_element
|
53
|
-
#if self.is_in? :focused
|
54
|
-
f = AISingleChoiceElement.first(:new_states=> /#{Regexp.quote("dragging")}/)
|
55
|
-
self.childs << f
|
56
|
-
self.childs.save
|
57
|
-
f.process_event(:drop)
|
58
|
-
f.process_event(:focus)
|
59
|
-
self.process_event(:defocus)
|
60
|
-
f.destroy
|
61
|
-
#end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
module MINT
|
2
|
-
class AIINChoose_sync_callback < AIO_sync_callback
|
3
|
-
def initialize(element)
|
4
|
-
@element=element
|
5
|
-
end
|
6
|
-
def sync_cio_to_listed
|
7
|
-
true
|
8
|
-
end
|
9
|
-
|
10
|
-
def sync_cio_to_selected
|
11
|
-
true
|
12
|
-
end
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
def unchoose_others
|
17
|
-
aios = @element.parent.childs.all(:states=>/\bchosen\b/)
|
18
|
-
aios.each do |aio|
|
19
|
-
aio.process_event("unchoose") if aio.is_in? :chosen
|
20
|
-
end
|
21
|
-
true
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class AIINChoose < AIINDiscrete
|
26
|
-
|
27
|
-
def sync_event(event)
|
28
|
-
process_event(event, AIINChoose_sync_callback.new(self))
|
29
|
-
end
|
30
|
-
def sync_cio_to_selected
|
31
|
-
cio = MINT::Selectable.first(:name=>self.name)
|
32
|
-
if (cio and not cio.is_in? :selected)
|
33
|
-
cio.sync_event(:select)
|
34
|
-
end
|
35
|
-
true
|
36
|
-
end
|
37
|
-
|
38
|
-
def sync_cio_to_listed
|
39
|
-
cio = MINT::Selectable.first(:name=>self.name)
|
40
|
-
if (cio and not cio.is_in? :listed)
|
41
|
-
cio.sync_event(:listed)
|
42
|
-
end
|
43
|
-
true
|
44
|
-
end
|
45
|
-
|
46
|
-
def unchoose_others
|
47
|
-
aios = self.parent.childs.all(:states=>/\bchosen\b/)
|
48
|
-
aios.each do |aio|
|
49
|
-
aio.process_event("unchoose")
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module MINT
|
2
|
-
|
3
|
-
class AIOUTDiscrete < AIOUT
|
4
|
-
def initialize_statemachine
|
5
|
-
if @statemachine.blank?
|
6
|
-
@statemachine = Statemachine.build do
|
7
|
-
trans :initialized,:organize, :organized
|
8
|
-
trans :organized, :present, :p
|
9
|
-
trans :suspended,:present, :p, :present_children
|
10
|
-
state :suspended do
|
11
|
-
on_entry :sync_cio_to_hidden
|
12
|
-
end
|
13
|
-
|
14
|
-
superstate :p_t do # TODO artificial superstate required to get following event working!
|
15
|
-
event :suspend, :suspended, :hide_children
|
16
|
-
parallel :p do
|
17
|
-
statemachine :s1 do
|
18
|
-
superstate :presenting do
|
19
|
-
state :defocused do
|
20
|
-
on_entry :sync_cio_to_displayed
|
21
|
-
end
|
22
|
-
state :focused do
|
23
|
-
on_entry :sync_cio_to_highlighted
|
24
|
-
end
|
25
|
-
trans :defocused,:focus,:focused
|
26
|
-
trans :focused, :defocus, :defocused
|
27
|
-
trans :focused, :next, :defocused, :focus_next, Proc.new { exists_next}
|
28
|
-
trans :focused, :prev, :defocused, :focus_previous, Proc.new { exists_prev}
|
29
|
-
trans :focused, :parent, :defocused, :focus_parent
|
30
|
-
end
|
31
|
-
end
|
32
|
-
statemachine :s2 do
|
33
|
-
superstate :l do
|
34
|
-
trans :listing, :update, :listing, :sync_cio_to_updated
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
Binary file
|
@@ -1,50 +0,0 @@
|
|
1
|
-
<scxml initial="initialized" name="AIC" 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=270.0 -->
|
2
|
-
<state id="organized"><!-- node-size-and-position x=10.0 y=100.0 w=70.0 h=20.0 -->
|
3
|
-
<transition event="suspend" target="suspended"><!-- edge-path [suspended] x=134.0 y=97.0 --></transition>
|
4
|
-
<transition event="present" target="presenting"><!-- edge-path [presenting] x=50.0 y=160.0 --></transition>
|
5
|
-
</state>
|
6
|
-
<state id="presenting" initial="defocused"><!-- node-size-and-position x=80.0 y=130.0 w=280.0 h=130.0 -->
|
7
|
-
<onentry>
|
8
|
-
<invoke src="inform_parent_presenting" type="x-mint"></invoke>
|
9
|
-
<invoke src="present_children" type="x-mint"></invoke>
|
10
|
-
</onentry>
|
11
|
-
<onexit>
|
12
|
-
<invoke src="hide_children" type="x-mint"></invoke>
|
13
|
-
</onexit>
|
14
|
-
<transition event="suspend" target="suspended"><!-- edge-path [suspended] x=184.0 y=107.0 --></transition>
|
15
|
-
<state id="focused"><!-- node-size-and-position x=210.0 y=50.0 w=60.0 h=20.0 -->
|
16
|
-
<onentry>
|
17
|
-
<invoke src="sync_cio_to_highlighted" type="x-mint"></invoke>
|
18
|
-
</onentry>
|
19
|
-
<transition event="defocus" target="defocused"><!-- edge-path [defocused] x=240.0 y=40.0 x=50.0 y=40.0 pointx=0.0 pointy=0.0 offsetx=-5.0 offsety=0.0 --></transition>
|
20
|
-
<transition cond="exists_next" event="next" target="defocused">
|
21
|
-
<invoke src="focus_next" type="x-mint"></invoke>
|
22
|
-
<!-- edge-path [defocused] x=240.0 y=90.0 x=50.0 y=90.0 --></transition>
|
23
|
-
<transition cond="exists_prev" event="prev" target="defocused">
|
24
|
-
<invoke src="focus_previous" type="x-mint"></invoke>
|
25
|
-
<!-- edge-path [defocused] x=240.0 y=100.0 x=50.0 y=100.0 --></transition>
|
26
|
-
<transition event="parent" target="defocused">
|
27
|
-
<invoke src="focus_parent" type="x-mint"></invoke>
|
28
|
-
<!-- edge-path [defocused] x=240.0 y=120.0 x=50.0 y=120.0 --></transition>
|
29
|
-
<transition event="child" target="defocused">
|
30
|
-
<invoke src="focus_child" type="x-mint"></invoke>
|
31
|
-
<!-- edge-path [defocused] x=240.0 y=110.0 x=50.0 y=110.0 --></transition>
|
32
|
-
</state>
|
33
|
-
<state id="defocused"><!-- node-size-and-position x=20.5 y=50.0 w=60.0 h=20.0 -->
|
34
|
-
<onentry>
|
35
|
-
<invoke src="sync_cio_to_displayed" type="x-mint"></invoke>
|
36
|
-
</onentry>
|
37
|
-
<transition event="focus" target="focused"><!-- edge-path [focused] x=140.0 y=60.0 --></transition>
|
38
|
-
</state>
|
39
|
-
</state>
|
40
|
-
<state id="suspended"><!-- node-size-and-position x=194.5 y=47.0 w=60.0 h=20.0 -->
|
41
|
-
<onentry>
|
42
|
-
<invoke src="sync_cio_to_hidden" type="x-mint"></invoke>
|
43
|
-
</onentry>
|
44
|
-
<transition event="present" target="presenting"><!-- edge-path [presenting] x=254.0 y=107.0 --></transition>
|
45
|
-
<transition event="organize" target="organized"><!-- edge-path [organized] x=114.0 y=67.0 --></transition>
|
46
|
-
</state>
|
47
|
-
<state id="initialized"><!-- node-size-and-position x=10.5 y=30.0 w=70.0 h=20.0 -->
|
48
|
-
<transition event="organize" target="organized"></transition>
|
49
|
-
</state>
|
50
|
-
</scxml>
|