Class: OMF::Web::Widget::Layout::StackedLayout
- Inherits:
-
AbstractWidget
- Object
- Erector::Widget
- AbstractWidget
- OMF::Web::Widget::Layout::StackedLayout
- Defined in:
- lib/omf-web/widget/layout/stacked_layout.rb
Overview
Implements a layout which displays only one of the widget it contains but provides theme specific means to switch between them.
Instance Attribute Summary collapse
-
#active_index ⇒ Object
readonly
Returns the value of attribute active_index.
Attributes inherited from AbstractWidget
#opts, #widget_id, #widget_type
Instance Method Summary collapse
- #collect_data_sources(ds_set) ⇒ Object
- #content ⇒ Object
-
#initialize(opts) ⇒ StackedLayout
constructor
A new instance of StackedLayout.
- #layout? ⇒ Boolean
- #name ⇒ Object
Methods inherited from AbstractWidget
#mime_type, #title, #tools_menu, #widget_info
Constructor Details
#initialize(opts) ⇒ StackedLayout
Returns a new instance of StackedLayout.
11 12 13 14 15 16 17 |
# File 'lib/omf-web/widget/layout/stacked_layout.rb', line 11 def initialize(opts) super opts = opts[:widgets] @widgets = .collect {|w| OMF::Web::Widget.(w) } @active_index = 0 @active_widget = @widgets[0] end |
Instance Attribute Details
#active_index ⇒ Object (readonly)
Returns the value of attribute active_index.
9 10 11 |
# File 'lib/omf-web/widget/layout/stacked_layout.rb', line 9 def active_index @active_index end |
Instance Method Details
#collect_data_sources(ds_set) ⇒ Object
25 26 27 28 29 |
# File 'lib/omf-web/widget/layout/stacked_layout.rb', line 25 def collect_data_sources(ds_set) #puts "ACTIVE>>> #{@active_widget.class}" @active_widget.collect_data_sources(ds_set) ds_set end |
#content ⇒ Object
19 20 21 22 |
# File 'lib/omf-web/widget/layout/stacked_layout.rb', line 19 def content() OMF::Web::Theme.require 'stacked_renderer' OMF::Web::Theme::StackedRenderer.new(self, @widgets, @active_index, @opts) end |
#layout? ⇒ Boolean
35 36 37 |
# File 'lib/omf-web/widget/layout/stacked_layout.rb', line 35 def layout? return true end |
#name ⇒ Object
31 32 33 |
# File 'lib/omf-web/widget/layout/stacked_layout.rb', line 31 def name @opts[:name] || @active_widget.name end |