Class: Aurita::GUI::Table_Cell

Inherits:
Element
  • Object
show all
Defined in:
lib/aurita-gui/table.rb

Overview

Accessor for a table cell. Usage:

cell = my_table[row][column]
cell.content = 'New cell content'
cell.class   = 'table_cell_css_class'

Instance Attribute Summary collapse

Attributes inherited from Element

#attrib, #force_closing_tag, #gui_element_id, #tag

Instance Method Summary collapse

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, #string, #swap, #to_ary, #touch, #touched?, #type=, #untouch

Methods included from Marshal_Helper_Class_Methods

#marshal_load

Methods included from Marshal_Helper

#marshal_dump

Constructor Details

#initialize(cell_element, params = {}) ⇒ Table_Cell

Returns a new instance of Table_Cell.



226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/aurita-gui/table.rb', line 226

def initialize(cell_element, params={})
  params[:tag]          = :td
  @content            ||= cell_element
  @value              ||= cell_element
  @presentation_class ||= false
  @column_index         = params[:column_index]
  @parent             ||= params[:parent]
  params.delete(:column_index)
  super(params)
  column_css_classes = @parent.parent.column_css_classes[@column_index]
  add_css_classes(column_css_classes) if column_css_classes
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Aurita::GUI::Element

Instance Attribute Details

#parentObject

Returns the value of attribute parent.



224
225
226
# File 'lib/aurita-gui/table.rb', line 224

def parent
  @parent
end

#presentation_classObject

Returns the value of attribute presentation_class.



224
225
226
# File 'lib/aurita-gui/table.rb', line 224

def presentation_class
  @presentation_class
end

#valueObject

Returns the value of attribute value.



224
225
226
# File 'lib/aurita-gui/table.rb', line 224

def value
  @value
end

Instance Method Details

#inspectObject



250
251
252
# File 'lib/aurita-gui/table.rb', line 250

def inspect
  'Cell[' << @value + ']'
end

#set_presentation(presentation_class) ⇒ Object Also known as: presentation=



239
240
241
# File 'lib/aurita-gui/table.rb', line 239

def set_presentation(presentation_class)
  @presentation_class = presentation_class
end