Class: Aurita::GUI::Table
- Defined in:
- lib/aurita-gui/table.rb
Overview
t.class = ‘highlighted’
Instance Attribute Summary collapse
-
#column_css_classes ⇒ Object
Returns the value of attribute column_css_classes.
-
#columns ⇒ Object
Returns the value of attribute columns.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#options ⇒ Object
Returns the value of attribute options.
-
#row_css_classes ⇒ Object
Returns the value of attribute row_css_classes.
-
#rows ⇒ Object
Returns the value of attribute rows.
-
#template ⇒ Object
Returns the value of attribute template.
Attributes inherited from Element
#attrib, #force_closing_tag, #parent, #tag
Instance Method Summary collapse
- #[](row_index) ⇒ Object
- #[]=(row_index, row_data) ⇒ Object
- #add_row(row_data) ⇒ Object
- #cell(column, row) ⇒ Object
-
#initialize(params = {}, &block) ⇒ Table
constructor
A new instance of Table.
- #set_column_decorator(column_index, decorator) ⇒ Object
- #set_data(row_array) ⇒ Object
- #string ⇒ Object (also: #to_s)
Methods inherited from Element
#+, #<<, #add_class, #clear_floating, #css_classes, #find_by_dom_id, #get_content, #has_content?, #id, #id=, #method_missing, #recurse, #remove_class, #set_content, #swap, #to_ary, #type=
Methods included from Marshal_Helper_Class_Methods
Methods included from Marshal_Helper
Constructor Details
#initialize(params = {}, &block) ⇒ Table
Returns a new instance of Table.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/aurita-gui/table.rb', line 39 def initialize(params={}, &block) @options = params[:options] @options[:tag] = 'table' @headers = params[:headers] @num_columns = params[:num_columns] @num_columns = @headers.length if (!@columns && @headers) @columns = [] @rows = [] @row_css_classes = params[:row_css_classes] @row_css_classes ||= [] @column_css_classes = params[:column_css_classes] @column_css_classes ||= [] super(@options, &block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Aurita::GUI::Element
Instance Attribute Details
#column_css_classes ⇒ Object
Returns the value of attribute column_css_classes.
37 38 39 |
# File 'lib/aurita-gui/table.rb', line 37 def column_css_classes @column_css_classes end |
#columns ⇒ Object
Returns the value of attribute columns.
37 38 39 |
# File 'lib/aurita-gui/table.rb', line 37 def columns @columns end |
#headers ⇒ Object
Returns the value of attribute headers.
37 38 39 |
# File 'lib/aurita-gui/table.rb', line 37 def headers @headers end |
#options ⇒ Object
Returns the value of attribute options.
37 38 39 |
# File 'lib/aurita-gui/table.rb', line 37 def @options end |
#row_css_classes ⇒ Object
Returns the value of attribute row_css_classes.
37 38 39 |
# File 'lib/aurita-gui/table.rb', line 37 def row_css_classes @row_css_classes end |
#rows ⇒ Object
Returns the value of attribute rows.
37 38 39 |
# File 'lib/aurita-gui/table.rb', line 37 def rows @rows end |
#template ⇒ Object
Returns the value of attribute template.
37 38 39 |
# File 'lib/aurita-gui/table.rb', line 37 def template @template end |
Instance Method Details
#[](row_index) ⇒ Object
87 88 89 |
# File 'lib/aurita-gui/table.rb', line 87 def [](row_index) @rows[row_index] end |
#[]=(row_index, row_data) ⇒ Object
90 91 92 |
# File 'lib/aurita-gui/table.rb', line 90 def []=(row_index, row_data) @rows[row_index] = row_data end |
#add_row(row_data) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/aurita-gui/table.rb', line 54 def add_row(row_data) row = Table_Row.new(row_data, :parent => self) @rows << row # Add row content to columns row_index = 0 @columns.each { |c| c.add[row[row_index]] row_index += 1 } end |
#cell(column, row) ⇒ Object
83 84 85 |
# File 'lib/aurita-gui/table.rb', line 83 def cell(column, row) @rows[row][column] end |
#set_column_decorator(column_index, decorator) ⇒ Object
74 75 |
# File 'lib/aurita-gui/table.rb', line 74 def set_column_decorator(column_index, decorator) end |