Class: OMF::Web::Widget::Layout::FlowLayout

Inherits:
AbstractWidget
  • Object
show all
Defined in:
lib/omf-web/widget/layout/flow_layout.rb

Overview

Implements a layout which displays widgets in a horizontal layout which should wrap around.

Instance Attribute Summary

Attributes inherited from AbstractWidget

#opts, #widget_id, #widget_type

Instance Method Summary collapse

Methods inherited from AbstractWidget

#mime_type, #title, #tools_menu, #widget_info

Constructor Details

#initialize(opts) ⇒ FlowLayout

Returns a new instance of FlowLayout.



10
11
12
13
14
# File 'lib/omf-web/widget/layout/flow_layout.rb', line 10

def initialize(opts)
  super opts
  widgets = opts[:widgets]
  @widgets = widgets.collect {|w| OMF::Web::Widget.create_widget(w) }
end

Instance Method Details

#collect_data_sources(ds_set) ⇒ Object



22
23
24
25
# File 'lib/omf-web/widget/layout/flow_layout.rb', line 22

def collect_data_sources(ds_set)
  @widgets.each {|w| w.collect_data_sources(ds_set) }
  ds_set
end

#contentObject



16
17
18
19
# File 'lib/omf-web/widget/layout/flow_layout.rb', line 16

def content()
  OMF::Web::Theme.require 'flow_renderer'
  OMF::Web::Theme::FlowRenderer.new(self, @widgets, @opts)
end

#layout?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/omf-web/widget/layout/flow_layout.rb', line 31

def layout?
  return true
end

#nameObject



27
28
29
# File 'lib/omf-web/widget/layout/flow_layout.rb', line 27

def name
  @opts[:name] || "Unknown - Set :name property"
end