sg.edu.nus.gui.dbview
Class DBTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by sg.edu.nus.gui.dbview.DBTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class DBTableModel
extends javax.swing.table.AbstractTableModel

This class simply wraps the AbstractTableModel for the purpose of show data in table or schema info of table.

If necessary, some derived funtions of the AbstractTableModel should be customized for our own purpose.

Version:
1.0 2006-12-26
Author:
Huang Yukai
See Also:
AbstractTableModel, Serialized Form

Field Summary
 java.lang.Boolean[] shared
           
 
Method Summary
 java.lang.Class getColumnClass(int columnIndex)
           
 int getColumnCount()
          Return the number of columns in the model.
 java.lang.String getColumnName(int columnIndex)
          Return the name of column at columnIndex.
 int getRowCount()
          return the number of rows in the model.
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
          Return the value for the cell at columnIndex and rowIndex
 boolean isCellEditable(int rowIndex, int columnIndex)
          only the first column can be modified
 void setValueAt(java.lang.Object value, int rowIndex, int columnIndex)
           
 
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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shared

public java.lang.Boolean[] shared
Method Detail

getRowCount

public int getRowCount()
return the number of rows in the model. The DBTree uses this method to determine how many rows it should display.

Returns:
the number of rows in the model

getColumnCount

public int getColumnCount()
Return the number of columns in the model. The DBTree uses this method to determine how many columns it should create and display.

Returns:
the number of columns in the model

getColumnName

public java.lang.String getColumnName(int columnIndex)
Return the name of column at columnIndex. This is used to initialize the table's column header name.

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
columnIndex - - the index of the column
Returns:
the name of column

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Return the value for the cell at columnIndex and rowIndex

Parameters:
rowIndex - - the row whose value is to be queried.
columnIndex - - the column whose value is to be queried.
Returns:
the value Object at the specified cell

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
only the first column can be modified

Specified by:
isCellEditable in interface javax.swing.table.TableModel
Overrides:
isCellEditable in class javax.swing.table.AbstractTableModel

setValueAt

public void setValueAt(java.lang.Object value,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel

getColumnClass

public java.lang.Class getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel