Class: Sirens::Text
- Inherits:
-
PrimitiveComponent
- Object
- AbstractComponent
- PrimitiveComponent
- Sirens::Text
- Defined in:
- lib/components/widgets/text.rb
Instance Method Summary collapse
-
#create_view ⇒ Object
Returns a TextView.
-
#default_model ⇒ Object
Returns a default model if none is given during the initialization of this component.
-
#on_value_changed(announcement) ⇒ Object
Events.
- #selected_text ⇒ Object
- #sync_ui_from_model ⇒ Object
Methods inherited from PrimitiveComponent
#apply_props, #initialize, #on_component_added, #on_model_changed, #populate_popup_menu, #set_props, #subscribe_to_model_events
Methods inherited from AbstractComponent
#add_all_components, #add_component, #child_components, #initialize, #model, #on_component_added, #on_model_changed, open, #props, #remove_component_at, #remove_last_component, #set_model, #set_props, #view
Constructor Details
This class inherits a constructor from Sirens::PrimitiveComponent
Instance Method Details
#create_view ⇒ Object
Returns a TextView.
6 7 8 |
# File 'lib/components/widgets/text.rb', line 6 def create_view() TextView.new end |
#default_model ⇒ Object
Returns a default model if none is given during the initialization of this component.
13 14 15 |
# File 'lib/components/widgets/text.rb', line 13 def default_model() ValueModel.on('') end |
#on_value_changed(announcement) ⇒ Object
Events
27 28 29 |
# File 'lib/components/widgets/text.rb', line 27 def on_value_changed(announcement) view.set_text(announcement.new_value) end |
#selected_text ⇒ Object
21 22 23 |
# File 'lib/components/widgets/text.rb', line 21 def selected_text() view.selected_text end |
#sync_ui_from_model ⇒ Object
17 18 19 |
# File 'lib/components/widgets/text.rb', line 17 def sync_ui_from_model() view.set_text(model.value) unless view.nil? end |