Package weka.gui.sql
Class ResultSetTableModel
- java.lang.Object
-
- weka.gui.sql.ResultSetTableModel
-
- All Implemented Interfaces:
javax.swing.table.TableModel
public class ResultSetTableModel extends java.lang.Object implements javax.swing.table.TableModelThe model for an SQL ResultSet.- Version:
- $Revision: 7059 $
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description ResultSetTableModel(java.sql.ResultSet rs)initializes the model, retrieves all rows.ResultSetTableModel(java.sql.ResultSet rs, int rows)initializes the model, retrieves only the given amount of rows (0 means all).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTableModelListener(javax.swing.event.TableModelListener l)adds a listener to the list that is notified each time a change to data model occurs.voidfinalize()frees up the memory.java.lang.ClassgetColumnClass(int columnIndex)returns the most specific superclass for all the cell values in the column (always String).intgetColumnCount()returns the number of columns in the model.java.lang.StringgetColumnName(int columnIndex)returns the name of the column at columnIndex.intgetRowCount()returns the number of rows in the model.java.lang.ObjectgetValueAt(int rowIndex, int columnIndex)returns the value for the cell at columnindex and rowIndex.booleanisCellEditable(int rowIndex, int columnIndex)returns true if the cell at rowindex and columnindexis editable.booleanisNullAt(int rowIndex, int columnIndex)checks whether the value of the cell is NULL.booleanisNumericAt(int columnIndex)returns whether the column at the given index is numeric.voidremoveTableModelListener(javax.swing.event.TableModelListener l)removes a listener from the list that is notified each time a change to the data model occurs.voidsetValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)sets the value in the cell at columnIndex and rowIndex to aValue.
-
-
-
Constructor Detail
-
ResultSetTableModel
public ResultSetTableModel(java.sql.ResultSet rs)
initializes the model, retrieves all rows.- Parameters:
rs- the ResultSet to get the data from
-
ResultSetTableModel
public ResultSetTableModel(java.sql.ResultSet rs, int rows)initializes the model, retrieves only the given amount of rows (0 means all).- Parameters:
rs- the ResultSet to get the data fromrows- the maximum number of rows to retrieve, 0 retrieves all
-
-
Method Detail
-
addTableModelListener
public void addTableModelListener(javax.swing.event.TableModelListener l)
adds a listener to the list that is notified each time a change to data model occurs.- Specified by:
addTableModelListenerin interfacejavax.swing.table.TableModel- Parameters:
l- the listener to add
-
getColumnClass
public java.lang.Class getColumnClass(int columnIndex)
returns the most specific superclass for all the cell values in the column (always String).- Specified by:
getColumnClassin interfacejavax.swing.table.TableModel- Parameters:
columnIndex- the index of the column- Returns:
- the class
-
getColumnCount
public int getColumnCount()
returns the number of columns in the model.- Specified by:
getColumnCountin interfacejavax.swing.table.TableModel- Returns:
- the number of columns
-
getColumnName
public java.lang.String getColumnName(int columnIndex)
returns the name of the column at columnIndex.- Specified by:
getColumnNamein interfacejavax.swing.table.TableModel- Parameters:
columnIndex- the index of the column- Returns:
- the name
-
getRowCount
public int getRowCount()
returns the number of rows in the model.- Specified by:
getRowCountin interfacejavax.swing.table.TableModel- Returns:
- the number of data rows
-
getValueAt
public java.lang.Object getValueAt(int rowIndex, int columnIndex)returns the value for the cell at columnindex and rowIndex.- Specified by:
getValueAtin interfacejavax.swing.table.TableModel- Parameters:
rowIndex- the row of the cellcolumnIndex- the column of the cell- Returns:
- the data value
-
isNullAt
public boolean isNullAt(int rowIndex, int columnIndex)checks whether the value of the cell is NULL.- Parameters:
rowIndex- the row of the cellcolumnIndex- the column of the cell- Returns:
- true if the cell value is NULL
-
isNumericAt
public boolean isNumericAt(int columnIndex)
returns whether the column at the given index is numeric.- Parameters:
columnIndex- the column to check- Returns:
- whether the column is numeric
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex)returns true if the cell at rowindex and columnindexis editable.- Specified by:
isCellEditablein interfacejavax.swing.table.TableModel- Parameters:
rowIndex- the row of the cellcolumnIndex- the column of the cell- Returns:
- always false
-
removeTableModelListener
public void removeTableModelListener(javax.swing.event.TableModelListener l)
removes a listener from the list that is notified each time a change to the data model occurs.- Specified by:
removeTableModelListenerin interfacejavax.swing.table.TableModel- Parameters:
l- the listener to remove
-
setValueAt
public void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)sets the value in the cell at columnIndex and rowIndex to aValue. Ignored.- Specified by:
setValueAtin interfacejavax.swing.table.TableModel- Parameters:
aValue- the value to set - ignoredrowIndex- the row of the cellcolumnIndex- the column of the cell
-
finalize
public void finalize() throws java.lang.Throwablefrees up the memory.- Throws:
java.lang.Throwable- if something goes wrong
-
-