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, #content, #parent, #tag, #type

Instance Method Summary collapse

Methods inherited from Element

#+, #[], #[]=, #clear_floating, #dom_id, #dom_id=, #each, #empty?, #id, #id=, #length, #method_missing, #to_ary

Constructor Details

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

Returns a new instance of Table_Cell.



157
158
159
160
161
162
163
# File 'lib/aurita-gui/table.rb', line 157

def initialize(cell_element, params={})
  params[:tag] = 'td'
  @presentation_class = false
  super(params)
  @value = cell_element
  @content = cell_element
end

Dynamic Method Handling

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

Instance Attribute Details

#presentation_classObject

Returns the value of attribute presentation_class.



155
156
157
# File 'lib/aurita-gui/table.rb', line 155

def presentation_class
  @presentation_class
end

#valueObject

Returns the value of attribute value.



155
156
157
# File 'lib/aurita-gui/table.rb', line 155

def value
  @value
end

Instance Method Details

#set_presentation(presentation_class) ⇒ Object



175
176
177
# File 'lib/aurita-gui/table.rb', line 175

def set_presentation(presentation_class)
  @presentation_class = presentation_class
end

#stringObject



179
180
181
182
183
184
185
186
# File 'lib/aurita-gui/table.rb', line 179

def string
  if @presentation_class then
    @content = @presentation_class.new(@value).string 
  else
    @content = @value.to_s 
  end
  super()
end