gui
Class DataTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by gui.DataTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class DataTableModel
extends javax.swing.table.AbstractTableModel

The dataTable model class extends AbstractTableModel, and provides the ability to update the corresponding element when a cell value has been changed.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
DataTableModel()
           
 
Method Summary
 java.lang.Class getColumnClass(int colNumber)
          Get the Class of the selected column
 int getColumnCount()
          Gets the number of columns in the data model
 java.lang.String getColumnName(int col)
          Gets the name of the column at position col
 int getRowCount()
          Gets the number of rows of data in the data model
 java.lang.Object getValueAt(int row, int col)
          Gets the value of the cell at given table co-ordinates
 boolean isCellEditable(int row, int col)
          Sets whether the given cell position is editable
 void setValueAt(java.lang.Object data, int row, int col)
          Sets the value of the object at the given table position
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataTableModel

public DataTableModel()
Method Detail

getColumnCount

public int getColumnCount()
Gets the number of columns in the data model

Returns:
int - Number of columns

getRowCount

public int getRowCount()
Gets the number of rows of data in the data model

Returns:
int - Number of rows

getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
Gets the value of the cell at given table co-ordinates

Parameters:
row -
col -
Returns:
Object at given table position

getColumnName

public java.lang.String getColumnName(int col)
Gets the name of the column at position col

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
col -
Returns:
string - column name

isCellEditable

public boolean isCellEditable(int row,
                              int col)
Sets whether the given cell position is editable

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel
Parameters:
row -
col -
Returns:
true

setValueAt

public void setValueAt(java.lang.Object data,
                       int row,
                       int col)
Sets the value of the object at the given table position

Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel
Parameters:
data -
row -
col -

getColumnClass

public java.lang.Class getColumnClass(int colNumber)
Get the Class of the selected column

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel
Parameters:
colNumber -
Returns:
Class