Class: IronNails::Controller::Base
Instance Attribute Summary collapse
#nails_engine
Class Method Summary
collapse
Instance Method Summary
collapse
-
#__init_controller__ ⇒ Object
-
#child_view(view_name, options) ⇒ Object
def from_view(name, options) name ||= view_name.to_sym nails_engine.from_view(controller_name, name, options, options) end.
-
#configure_viewmodel_for_showing ⇒ Object
-
#controller_name ⇒ Object
-
#init_controller ⇒ Object
-
#on_ui_thread(options = nil, &b) ⇒ Object
-
#on_view(name = nil, options = {}, &b) ⇒ Object
-
#play_storyboard(name = nil, storyboard = nil) ⇒ Object
-
#refresh_view(name = nil) ⇒ Object
-
#show_view ⇒ Object
-
#stop_storyboard(name = nil, storyboard = nil) ⇒ Object
-
#to_update_ui_after(options, &b) ⇒ Object
-
#view_model(model_name, value) ⇒ Object
#add_observer, #count_observers, #delete_observer, #delete_observers, #notify_observers
#log_on_error, #logger
#add_action, #copy_vars, #init_view_manager, #instance_variable_copy, #refresh_instance_variables, #refresh_objects, #setup_for_showing_view, #synchronise_with_view_model, #view_model_name, #view_name
Instance Attribute Details
#commands ⇒ Object
Gets or sets the commands for the presenter
20
21
22
|
# File 'lib/ironnails/controller/base.rb', line 20
def commands
@commands
end
|
#objects ⇒ Object
Gets or sets the objects for the presenter
14
15
16
|
# File 'lib/ironnails/controller/base.rb', line 14
def objects
@objects
end
|
#presenters ⇒ Object
Gets or sets the presenters collection for this controller
23
24
25
|
# File 'lib/ironnails/controller/base.rb', line 23
def presenters
@presenters
end
|
#view_properties ⇒ Object
Gets or sets the meta data for binding ui stuff we can’t with Xaml (like Password on the PasswordBox)
17
18
19
|
# File 'lib/ironnails/controller/base.rb', line 17
def view_properties
@view_properties
end
|
Class Method Details
.new ⇒ Object
107
108
109
110
111
|
# File 'lib/ironnails/controller/base.rb', line 107
def new
ctrlr = old_nails_controller_new
ctrlr.__init_controller__
ctrlr
end
|
.old_nails_controller_new ⇒ Object
105
|
# File 'lib/ironnails/controller/base.rb', line 105
alias_method :old_nails_controller_new, :new
|
.view_action(name, options = {}, &b) ⇒ Object
113
114
115
116
117
|
# File 'lib/ironnails/controller/base.rb', line 113
def view_action(name, options={}, &b)
@commands ||= {}
options[:action] = b if block_given?
@commands[name] = options
end
|
.view_object(name, options = nil) ⇒ Object
119
120
121
122
123
124
125
126
127
128
|
# File 'lib/ironnails/controller/base.rb', line 119
def view_object(name, options = nil)
@objects ||= {}
@view_properties ||={}
unless options.is_a?(Hash) && !options[:element].nil?
@objects[name] = options.is_a?(Hash) ? options[:value] : options
else
@view_properties[name] = options
end
end
|
Instance Method Details
#__init_controller__ ⇒ Object
97
98
99
100
|
# File 'lib/ironnails/controller/base.rb', line 97
def __init_controller__
@command_builder = CommandBuilder.new self
init_controller
end
|
#child_view(view_name, options) ⇒ Object
def from_view(name, options)
name ||= view_name.to_sym
nails_engine.from_view(controller_name, name, options[:from], options[:get])
end
64
65
66
|
# File 'lib/ironnails/controller/base.rb', line 64
def child_view(view_name, options)
nails_engine.register_child_view :controller => controller_name, :container => options[:in], :name => view_name
end
|
74
75
76
|
# File 'lib/ironnails/controller/base.rb', line 74
def configure_viewmodel_for_showing
nails_engine.configure_view_for_showing
end
|
#controller_name ⇒ Object
25
26
27
|
# File 'lib/ironnails/controller/base.rb', line 25
def controller_name
self.class.to_s.underscore.to_sym
end
|
#init_controller ⇒ Object
94
95
|
# File 'lib/ironnails/controller/base.rb', line 94
def init_controller
end
|
#on_ui_thread(options = nil, &b) ⇒ Object
82
83
84
|
# File 'lib/ironnails/controller/base.rb', line 82
def on_ui_thread(options=nil, &b)
nails_engine.on_ui_thread self, options, &b
end
|
#on_view(name = nil, options = {}, &b) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/ironnails/controller/base.rb', line 45
def on_view(name=nil, options={}, &b)
name ||= view_name.to_sym
if block_given?
setup_for_showing_view
nails_engine.on_view(controller_name, name, &b)
else
if options[:set].nil?
nails_engine.from_view(controller_name, name, options[:from], options[:get])
else
nails_engine.set_on_view(controller_name, name, options[:from], options[:set], options[:value])
end
end
end
|
#play_storyboard(name = nil, storyboard = nil) ⇒ Object
86
87
88
|
# File 'lib/ironnails/controller/base.rb', line 86
def play_storyboard(name=nil, storyboard=nil)
nails_engine.play_storyboard self, (storyboard.nil? ? view_name : name), (storyboard.nil? ? name : storyboard)
end
|
#refresh_view(name = nil) ⇒ Object
36
37
38
39
40
41
42
43
|
# File 'lib/ironnails/controller/base.rb', line 36
def refresh_view(name=nil)
name ||= view_name.to_sym
setup_for_showing_view
nails_engine.refresh_view(nails_engine.find_view(controller_name, name))
on_view(name) do |proxy|
proxy.refresh
end
end
|
#show_view ⇒ Object
29
30
31
32
33
34
|
# File 'lib/ironnails/controller/base.rb', line 29
def show_view
setup_for_showing_view
main_presenter.show_view
end
|
#stop_storyboard(name = nil, storyboard = nil) ⇒ Object
90
91
92
|
# File 'lib/ironnails/controller/base.rb', line 90
def stop_storyboard(name=nil, storyboard=nil)
nails_engine.stop_storyboard self, (storyboard.nil? ? view_name : name), (storyboard.nil? ? name : storyboard)
end
|
#to_update_ui_after(options, &b) ⇒ Object
78
79
80
|
# File 'lib/ironnails/controller/base.rb', line 78
def to_update_ui_after(options, &b)
nails_engine.to_update_ui_after self, options, &b
end
|
#view_model(model_name, value) ⇒ Object
68
69
70
71
72
|
# File 'lib/ironnails/controller/base.rb', line 68
def view_model(model_name, value)
instance_variable_set "@#{model_name}", value
refresh_objects
nails_engine.set_viewmodel_for self, model_name, value
end
|