Class: Aurita::GUI::Table_Row
- Defined in:
- lib/aurita-gui/table.rb
Instance Attribute Summary collapse
-
#cells ⇒ Object
Returns the value of attribute cells.
-
#parent ⇒ Object
Returns the value of attribute parent.
Attributes inherited from Element
#attrib, #force_closing_tag, #gui_element_id, #tag
Instance Method Summary collapse
- #[](column_index) ⇒ Object
- #[]=(column_index, cell_data) ⇒ Object
-
#initialize(cell_data, params = {}) ⇒ Table_Row
constructor
A new instance of Table_Row.
- #inspect ⇒ Object
- #string ⇒ Object
- #table ⇒ Object
Methods inherited from Element
#+, #<<, #add_class, #aurita_gui_element, #clear_floating, #css_classes, #find_by_dom_id, #get_content, #has_content?, #id, #id=, #js_init_code, #length, #method_missing, #recurse, #remove_class, #set_content, #swap, #to_ary, #touch, #touched?, #type=, #untouch
Methods included from Marshal_Helper_Class_Methods
Methods included from Marshal_Helper
Constructor Details
#initialize(cell_data, params = {}) ⇒ Table_Row
Returns a new instance of Table_Row.
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/aurita-gui/table.rb', line 150 def initialize(cell_data, params={}) params[:tag] = :tr @parent ||= params[:parent] @cell_class ||= Table_Cell @cell_data ||= cell_data @cells ||= [] @touched = false column_index = 0 @cell_data.each { |cell| @cells << @cell_class.new(cell, :parent => self, :column_index => column_index) column_index += 1 } set_content(@cells) @content = @cells super(params) add_css_classes(@parent.row_css_classes) if @parent.row_css_classes.length > 0 end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Aurita::GUI::Element
Instance Attribute Details
#cells ⇒ Object
Returns the value of attribute cells.
148 149 150 |
# File 'lib/aurita-gui/table.rb', line 148 def cells @cells end |
#parent ⇒ Object
Returns the value of attribute parent.
148 149 150 |
# File 'lib/aurita-gui/table.rb', line 148 def parent @parent end |
Instance Method Details
#[](column_index) ⇒ Object
175 176 177 |
# File 'lib/aurita-gui/table.rb', line 175 def [](column_index) @cells[column_index] end |
#[]=(column_index, cell_data) ⇒ Object
178 179 180 181 |
# File 'lib/aurita-gui/table.rb', line 178 def []=(column_index, cell_data) touch() @cells[column_index].value = cell_data end |
#inspect ⇒ Object
196 197 198 |
# File 'lib/aurita-gui/table.rb', line 196 def inspect 'Row[' << @cells.collect { |c| c.inspect }.join(',') + ']' end |
#string ⇒ Object
183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/aurita-gui/table.rb', line 183 def string if touched? then @cells = [] @cell_data.each { |cell| @cells << @cell_class.new(cell, :parent => self, :column_index => column_index) column_index += 1 } set_content(@cells) @touched = false end super() end |
#table ⇒ Object
171 172 173 |
# File 'lib/aurita-gui/table.rb', line 171 def table @parent end |