Class: Sirens::Splitter
- Inherits:
-
PrimitiveComponent
- Object
- AbstractComponent
- PrimitiveComponent
- Sirens::Splitter
- Defined in:
- lib/components/containers/splitter.rb
Overview
Component that wraps a StackView.
Class Method Summary collapse
Instance Method Summary collapse
-
#create_view ⇒ Object
Returns a SplitterView.
- #on_component_added(child_component) ⇒ Object
-
#orientation ⇒ Object
Asking.
Methods inherited from PrimitiveComponent
#apply_props, #initialize, #on_model_changed, #on_value_changed, #populate_popup_menu, #set_props, #subscribe_to_model_events, #sync_ui_from_model
Methods inherited from AbstractComponent
#add_all_components, #add_component, #child_components, #default_model, #initialize, #model, #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
Class Method Details
.horizontal(props = Hash[]) ⇒ Object
10 11 12 13 14 |
# File 'lib/components/containers/splitter.rb', line 10 def horizontal(props = Hash[]) props[:orientation] = :horizontal self.new(props) end |
.vertical(props = ) ⇒ Object
16 17 18 19 20 |
# File 'lib/components/containers/splitter.rb', line 16 def vertical(props = Hash[]) props[:orientation] = :vertical self.new(props) end |
Instance Method Details
#create_view ⇒ Object
Returns a SplitterView.
34 35 36 37 38 |
# File 'lib/components/containers/splitter.rb', line 34 def create_view() SplitterView.new( orientation: orientation ) end |
#on_component_added(child_component) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/components/containers/splitter.rb', line 23 def on_component_added(child_component) splitter_proportion = child_component.props.fetch(:splitter_proportion) child_component.view.set_attribute(:splitter_proportion, splitter_proportion) super(child_component) end |
#orientation ⇒ Object
Asking
42 43 44 |
# File 'lib/components/containers/splitter.rb', line 42 def orientation() props.fetch(:orientation) end |