Class: Freightrain::FreightElementViewModel

Inherits:
FreightViewModel show all
Extended by:
ContainerHookable
Defined in:
lib/freightrain/elements/freight_element_view_model.rb

Overview

TODO: make this an extension

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ContainerHookable

classes, container_options, extended, inherited, subclasses

Methods inherited from FreightViewModel

#bootstrap, #dialog, #hide, new, #show, #view

Methods included from ServiceHost

extended, #service

Methods included from RegionHost

extended, #region

Methods included from SignalHost

extended, #signal

Constructor Details

#initializeFreightElementViewModel

Returns a new instance of FreightElementViewModel.



32
33
34
35
# File 'lib/freightrain/elements/freight_element_view_model.rb', line 32

def initialize
  super
  @signals[:selected] = FreightSignal.new
end

Instance Attribute Details

#selectedObject (readonly)

Returns the value of attribute selected.



8
9
10
# File 'lib/freightrain/elements/freight_element_view_model.rb', line 8

def selected
  @selected
end

Class Method Details

.container_optionsObject



10
11
12
# File 'lib/freightrain/elements/freight_element_view_model.rb', line 10

def self.container_options
  return { :model => :prototype }
end

Instance Method Details

#controlObject



28
29
30
# File 'lib/freightrain/elements/freight_element_view_model.rb', line 28

def control
  return @view.control
end

#on_selectedObject



23
24
25
26
# File 'lib/freightrain/elements/freight_element_view_model.rb', line 23

def on_selected      
  fire :selected, @value
  @view.update
end

#set_selection(bool) ⇒ Object



37
38
39
40
# File 'lib/freightrain/elements/freight_element_view_model.rb', line 37

def set_selection(bool)
  @selected = bool
  @view.update
end

#valueObject



19
20
21
# File 'lib/freightrain/elements/freight_element_view_model.rb', line 19

def value
  return @value
end

#value=(val) ⇒ Object



14
15
16
17
# File 'lib/freightrain/elements/freight_element_view_model.rb', line 14

def value=(val)
  @value = val
  @view.update
end