edu.iastate.metnet.newgui
Class NoneditableTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by edu.iastate.metnet.newgui.NoneditableTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class NoneditableTableModel
extends javax.swing.table.AbstractTableModel

Class used to create a non-editable table. The cells cannot be altered, and the data is formatted appropriately.

Author:
Nick Ransom
See Also:
Serialized Form

Field Summary
(package private)  java.lang.String[] columnNames
           
(package private)  java.lang.Object[][] data
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
NoneditableTableModel(java.lang.Object[][] data, java.lang.String[] columnNames)
          Constructs a non-editable table with the given data/columns.
 
Method Summary
 java.lang.Class getColumnClass(int c)
           
 int getColumnCount()
           
 java.lang.String getColumnName(int col)
           
 int getRowCount()
           
 java.lang.Object getValueAt(int row, int col)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

columnNames

java.lang.String[] columnNames

data

java.lang.Object[][] data
Constructor Detail

NoneditableTableModel

public NoneditableTableModel(java.lang.Object[][] data,
                             java.lang.String[] columnNames)
Constructs a non-editable table with the given data/columns.

Parameters:
data - The data to display.
columnNames - Column headers.
Method Detail

getColumnCount

public int getColumnCount()
Returns:
The number of columns.

getRowCount

public int getRowCount()
Returns:
The number of rows.

getColumnName

public java.lang.String getColumnName(int col)
Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
col - The number of the column
Returns:
The name of the given column, as specified by the column header.

getValueAt

public java.lang.Object getValueAt(int row,
                                   int col)
Parameters:
row - A row value
col - A column value
Returns:
The value in the cell at the given coordinate.

getColumnClass

public java.lang.Class getColumnClass(int c)
Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel
Parameters:
c - A column value
Returns:
The class of the data in the column.