Class: Clevic::RowHeaderModel

Inherits:
Object
  • Object
show all
Defined in:
lib/clevic/swing/row_header.rb

Overview

TODO Weirdness with deleting a row. Takes a long time to get back to user TODO TextArea not working. TODO make sure a click in the main table when a row selection is active selects the main table cell TODO allow for clevic/table_view to access the row selection for deletes

Instance Method Summary collapse

Constructor Details

#initialize(table_model) ⇒ RowHeaderModel

Need a Clevic::TableModel here because the underlying connection isn’t always the same instance. Because of CacheTable#renew



11
12
13
14
15
16
17
18
19
# File 'lib/clevic/swing/row_header.rb', line 11

def initialize( table_model )
  super()
  @table_model = table_model

  # re-fire events
  table_model.add_table_model_listener do |event|
    fireTableChanged( event )
  end
end

Instance Method Details

#getColumnClass(column_index) ⇒ Object



36
37
38
# File 'lib/clevic/swing/row_header.rb', line 36

def getColumnClass( column_index )
  java.lang.Object
end

#getColumnCountObject

override TableModel method



27
28
29
# File 'lib/clevic/swing/row_header.rb', line 27

def getColumnCount
  1
end

#getColumnName(column_index) ⇒ Object

override TableModel method



32
33
34
# File 'lib/clevic/swing/row_header.rb', line 32

def getColumnName( column_index )
  "row"
end

#getRowCountObject

override TableModel method



22
23
24
# File 'lib/clevic/swing/row_header.rb', line 22

def getRowCount
  @table_model.getRowCount
end

#getValueAt(row_index, column_index) ⇒ Object



44
45
46
# File 'lib/clevic/swing/row_header.rb', line 44

def getValueAt( row_index, column_index )
  row_index+1
end

#id_value(row_index, column_index) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/clevic/swing/row_header.rb', line 48

def id_value( row_index, column_index )
  if @table_model.collection.cached_at?( row_index )
    "#{row_index+1} [id=#{@table_model.collection[row_index].id}]"
  else
    row_index+1
  end
end

#isCellEditable(row_index, column_index) ⇒ Object



40
41
42
# File 'lib/clevic/swing/row_header.rb', line 40

def isCellEditable( row_index, column_index )
  false
end

#setValueAt(value, row_index, column_index) ⇒ Object



56
57
58
# File 'lib/clevic/swing/row_header.rb', line 56

def setValueAt( value, row_index, column_index )
  raise "Can't set values in the row header"
end