class RETerm::Components::Matrix

CDK Matrix Component

Public Class Methods

new(args={}) click to toggle source

Initialize the Matrix component

@param [Hash] args matrix params

Calls superclass method RETerm::Component::new
# File lib/reterm/components/matrix.rb, line 10
def initialize(args={})
  super
  @rows  = args[:rows]
  @cols  = args[:cols]
  @title = args[:title]

  @rowtitles = args[:rowtitles] || args[:row_titles] || Array.new(@rows) { "" }
  @coltitles = args[:coltitles] || args[:col_titles] || Array.new(@cols+1) { "" }
  @colwidths = args[:colwidths] || args[:col_widths] || Array.new(@cols+1) { 5 }
  @coltypes  = args[:coltypes]  || args[:col_types]  || Array.new(@cols+1) { :UMIXED }
end

Public Instance Methods

get(x, y) click to toggle source
# File lib/reterm/components/matrix.rb, line 22
def get(x, y)
  component.getCell(x, y)
end
requeseted_rows() click to toggle source
# File lib/reterm/components/matrix.rb, line 26
def requeseted_rows
  4 + 2 * rows + 1
end
requested_cols() click to toggle source
# File lib/reterm/components/matrix.rb, line 30
def requested_cols
  2 + 2 * rows + 1
end

Private Instance Methods

_component() click to toggle source
# File lib/reterm/components/matrix.rb, line 36
def _component
  CDK::MATRIX.new(window.cdk_scr,
                  2, 2,                                # xpos, ypos
                  @rows, @cols,                        # matrix rows, cols
                  [(window.rows - 2), @rows].min,      # screen rows
                  [(window.cols - 2), @cols].min,      # screen cols
                  @title,                              # title
                  @rowtitles, @coltitles,              # row/col titles
                  @colwidths, @coltypes,               # col widths and types
                  -1, -1,                              # row/col spacing
                  '.',                                 # filler
                  2,                                   # dominant attribute
                  true, true, false)                   # box matrix, box cell, shadow
end