Class: Freightrain::FreightViewModel
Class Method Summary
collapse
Instance Method Summary
collapse
classes, container_options, extended, inherited, subclasses
extended, service
Methods included from RegionHost
extended, region
Methods included from SignalHost
extended, signal
Class Method Details
.container_options ⇒ Object
10
11
12
|
# File 'lib/freightrain/viewmodels/freight_view_model.rb', line 10
def self.container_options
return { :model => :prototype }
end
|
.new(*args, &block) ⇒ Object
21
22
23
24
25
26
|
# File 'lib/freightrain/viewmodels/freight_view_model.rb', line 21
def self.new(*args, &block)
viewmodel = allocate
viewmodel.bootstrap
viewmodel.send(:initialize, *args, &block)
return viewmodel
end
|
Instance Method Details
#bootstrap ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/freightrain/viewmodels/freight_view_model.rb', line 28
def bootstrap
view = Freightrain[self.class.name.sub("Model", "").to_convention_sym]
self.get_services
self.build_regions
self.create_signals
view.hook_to_signals(self)
self.services.each do |service_key|
service = self.instance_variable_get("@#{service_key}")
service.hook_to_signals(self, service_key)
end
view.data_source = self
@view = view
end
|
#dialog(viewmodel_name, *args) ⇒ Object
14
15
16
17
18
19
|
# File 'lib/freightrain/viewmodels/freight_view_model.rb', line 14
def dialog(viewmodel_name, *args)
dialog = Freightrain["#{viewmodel_name}_view_model".to_sym]
dialog.show_dialog(*args) do |*params|
yield(*params) if block_given?
end
end
|
#hide ⇒ Object
51
52
53
|
# File 'lib/freightrain/viewmodels/freight_view_model.rb', line 51
def hide
@view.control.hide
end
|
#show ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'lib/freightrain/viewmodels/freight_view_model.rb', line 42
def show
@view.control.show
@regions.values.each do |region|
region.on_show(@view)
region.viewmodel.show
end
return @view.control
end
|
#view ⇒ Object
55
56
57
|
# File 'lib/freightrain/viewmodels/freight_view_model.rb', line 55
def view
return @view
end
|