Class: MINT::AISinglePresence

Inherits:
AIContainer show all
Defined in:
lib/MINT-core/model/aui/AISinglePresence.rb

Constant Summary

Constants inherited from Interactor

Interactor::PUBLISH_ATTRIBUTES

Instance Method Summary collapse

Methods inherited from AIContainer

#children, #children=, #focus_child, #present_children, #suspend_children

Methods inherited from AIO

#exists_next, #exists_parent, #exists_prev, #focus_next, #focus_parent, #focus_previous, getModel, #inform_parent_presenting, #next, #next2str, #parent, #parent2str, #parent=, #previous, #previous2str

Methods inherited from Interactor

class_from_channel_name, #create_attribute_channel_name, create_channel_name, #create_channel_w_name, get, getModel, get_dm, #init_statemachine, #is_in?, #new_states, notify, #process_event, #process_event!, #process_event_vars, #publish_update, #states, #states=, #sync_event, #sync_states, #to_dot, wait

Methods included from InteractorHelpers

#restart_timeout, #start_timeout, #stop_timeout

Instance Method Details

#active_childObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/MINT-core/model/aui/AISinglePresence.rb', line 9

def active_child
  p = super

  if p == nil
    p = children.first
    attribute_set(:active_child,p.name)

    return p
  else
    r = AIO.get("aui",p)
    return r
  end

end

#add_elementObject



46
47
48
49
50
51
52
# File 'lib/MINT-core/model/aui/AISinglePresence.rb', line 46

def add_element
  f = AISingleChoiceElement.first(:new_states=> /#{Regexp.quote("dragging")}/)
  self.children << f
  self.children.save
  f.process_event(:drop)
  f.destroy
end

#child_to_presenting(child) ⇒ Object

hook that is called from a child if it enters presenting state



27
28
# File 'lib/MINT-core/model/aui/AISinglePresence.rb', line 27

def child_to_presenting(child)
end

#exists_next_childObject

these methods implemenent navigation inside singlepresence (if entered) and do not permit to leave the interactor



56
57
58
59
# File 'lib/MINT-core/model/aui/AISinglePresence.rb', line 56

def exists_next_child
  return true if active_child and active_child.next and not active_child.name.eql? children.last.name
  false
end

#exists_prev_childObject



61
62
63
64
# File 'lib/MINT-core/model/aui/AISinglePresence.rb', line 61

def exists_prev_child
  return true if active_child and active_child.previous and not active_child.name.eql? children.first.name
  false
end

#getSCXMLObject



5
6
7
# File 'lib/MINT-core/model/aui/AISinglePresence.rb', line 5

def getSCXML
  "#{File.dirname(__FILE__)}/aisinglepresence.scxml"
end

#present_next_childObject



30
31
32
33
34
35
36
# File 'lib/MINT-core/model/aui/AISinglePresence.rb', line 30

def present_next_child
  a= active_child
  a.process_event :suspend
  n = a.next
  attribute_set(:active_child,n.name)
  n.process_event :present
end

#present_previous_childObject



38
39
40
41
42
43
44
# File 'lib/MINT-core/model/aui/AISinglePresence.rb', line 38

def present_previous_child
  a= active_child
        a.process_event :suspend
        n = a.previous
        attribute_set(:active_child,n.name)
        n.process_event :present
end