Class: Demos::Spreadsheet::Row

Inherits:
Hokusai::Block show all
Defined in:
ui/examples/spreadsheet/csv.rb

Instance Attribute Summary

Attributes inherited from Hokusai::Block

#node, #provides, #publisher

Instance Method Summary collapse

Methods inherited from Hokusai::Block

#children, #children?, compile, computed, computed!, #draw, #draw_with, #dump, #emit, #initialize, inject, inject!, #method_missing, mount, #on_resize, provide, provides, #render, style, styles_get, template, template_from_file, template_get, #update, use, uses

Constructor Details

This class inherits a constructor from Hokusai::Block

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Hokusai::Block

Instance Method Details

#cell_key(index) ⇒ Object



132
133
134
# File 'ui/examples/spreadsheet/csv.rb', line 132

def cell_key(index)
  "cell-#{index}"
end

#emit_changed_cell(cell_index, value) ⇒ Object



116
117
118
# File 'ui/examples/spreadsheet/csv.rb', line 116

def emit_changed_cell(cell_index, value)
  emit("cell_updated", index, cell_index, value)
end

#emit_formula(target, cell_1, cell_2) ⇒ Object



108
109
110
# File 'ui/examples/spreadsheet/csv.rb', line 108

def emit_formula(target, cell_1, cell_2)
  emit("cell_formula", index, target, cell_1, cell_2)
end

#emit_modified_cell(cell_index) ⇒ Object



112
113
114
# File 'ui/examples/spreadsheet/csv.rb', line 112

def emit_modified_cell(cell_index)
  emit("cell_modified", index, cell_index)
end

#max_heightObject



120
121
122
123
# File 'ui/examples/spreadsheet/csv.rb', line 120

def max_height
  @heights ||= {}
  @heights.values.max || 30.0
end

#update_height(height, idx) ⇒ Object



125
126
127
128
129
130
# File 'ui/examples/spreadsheet/csv.rb', line 125

def update_height(height, idx)
  @heights ||= {}
  @heights[idx] = height

  node.meta.set_prop(:height, max_height)
end