public class ResultSetTableModel extends Object implements TableModel
Constructor and Description |
---|
ResultSetTableModel(ResultSet rs)
initializes the model, retrieves all rows.
|
ResultSetTableModel(ResultSet rs,
int rows)
initializes the model, retrieves only the given amount of rows (0 means
all).
|
Modifier and Type | Method and Description |
---|---|
void |
addTableModelListener(TableModelListener l)
adds a listener to the list that is notified each time a change to data
model occurs.
|
void |
finalize()
frees up the memory.
|
Class |
getColumnClass(int columnIndex)
returns the most specific superclass for all the cell values in the
column (always String).
|
int |
getColumnCount()
returns the number of columns in the model.
|
String |
getColumnName(int columnIndex)
returns the name of the column at columnIndex.
|
int |
getRowCount()
returns the number of rows in the model.
|
Object |
getValueAt(int rowIndex,
int columnIndex)
returns the value for the cell at columnindex and rowIndex.
|
boolean |
isCellEditable(int rowIndex,
int columnIndex)
returns true if the cell at rowindex and columnindexis editable.
|
boolean |
isNullAt(int rowIndex,
int columnIndex)
checks whether the value of the cell is NULL.
|
boolean |
isNumericAt(int columnIndex)
returns whether the column at the given index is numeric.
|
void |
removeTableModelListener(TableModelListener l)
removes a listener from the list that is notified each time a change to
the data model occurs.
|
void |
setValueAt(Object aValue,
int rowIndex,
int columnIndex)
sets the value in the cell at columnIndex and rowIndex to aValue.
|
public ResultSetTableModel(ResultSet rs)
rs
- the ResultSet to get the data frompublic ResultSetTableModel(ResultSet rs, int rows)
rs
- the ResultSet to get the data fromrows
- the maximum number of rows to retrieve, 0 retrieves allpublic void addTableModelListener(TableModelListener l)
addTableModelListener
in interface TableModel
l
- the listener to addpublic Class getColumnClass(int columnIndex)
getColumnClass
in interface TableModel
columnIndex
- the index of the columnpublic int getColumnCount()
getColumnCount
in interface TableModel
public String getColumnName(int columnIndex)
getColumnName
in interface TableModel
columnIndex
- the index of the columnpublic int getRowCount()
getRowCount
in interface TableModel
public Object getValueAt(int rowIndex, int columnIndex)
getValueAt
in interface TableModel
rowIndex
- the row of the cellcolumnIndex
- the column of the cellpublic boolean isNullAt(int rowIndex, int columnIndex)
rowIndex
- the row of the cellcolumnIndex
- the column of the cellpublic boolean isNumericAt(int columnIndex)
columnIndex
- the column to checkpublic boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface TableModel
rowIndex
- the row of the cellcolumnIndex
- the column of the cellpublic void removeTableModelListener(TableModelListener l)
removeTableModelListener
in interface TableModel
l
- the listener to removepublic void setValueAt(Object aValue, int rowIndex, int columnIndex)
setValueAt
in interface TableModel
aValue
- the value to set - ignoredrowIndex
- the row of the cellcolumnIndex
- the column of the cellCopyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.