public class ScrollableResultSetTableModel extends javax.swing.table.AbstractTableModel implements CloseableTableModel
ResultSetTableModelFactory.generateDefaultTableModel (ResultSet rs)
. That
implementation will read all data from the given ResultSet and keep that data in
memory.
Use the close() function to close the ResultSet contained in this model.Modifier | Constructor and Description |
---|---|
protected |
ScrollableResultSetTableModel(boolean labelMapMode)
Creates a new scrollable result set with no resultset assigned and the specified
label map mode.
|
|
ScrollableResultSetTableModel(java.sql.ResultSet resultset,
boolean labelMapMode)
Constructs the model.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Clears the model of the current result set.
|
java.lang.Class |
getColumnClass(int column)
Returns the class of the resultset column.
|
java.lang.String |
getColumnClassName(int column)
Returns the classname of the resultset column.
|
int |
getColumnCount()
Returns the number of columns in the ResultSet.
|
java.lang.String |
getColumnName(int column)
Returns the columnLabel or column name for the given column.
|
int |
getRowCount()
Get a rowCount.
|
java.lang.Object |
getValueAt(int row,
int column)
Returns the value of the specified row and the specified column from within the
resultset.
|
boolean |
isLabelMapMode()
Returns the column name mode used to map column names into column indices.
|
void |
updateResultSet(java.sql.ResultSet resultset)
Updates the result set in this model with the given ResultSet object.
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
public ScrollableResultSetTableModel(java.sql.ResultSet resultset, boolean labelMapMode) throws java.sql.SQLException
resultset
- the result set.labelMapMode
- defines, whether to use column names or column labels to compute
the column index.java.sql.SQLException
- if there is a problem with the result set.protected ScrollableResultSetTableModel(boolean labelMapMode)
labelMapMode
- defines, whether to use column names or column labels to compute
the column index.public boolean isLabelMapMode()
ResultSetMetaData.getColumnLabel(int)
,
ResultSetMetaData.getColumnName(int)
public void updateResultSet(java.sql.ResultSet resultset) throws java.sql.SQLException
resultset
- the new result set.java.sql.SQLException
- if there is a problem with the result set.public void close()
close
in interface CloseableTableModel
public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
ResultSetMetaData.getColumnCount()
public java.lang.String getColumnName(int column)
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
column
- the column index.ResultSetMetaData.getColumnLabel(int)
public java.lang.Object getValueAt(int row, int column)
getValueAt
in interface javax.swing.table.TableModel
row
- the row index.column
- the column index.public java.lang.Class getColumnClass(int column)
getColumnClass
in interface javax.swing.table.TableModel
getColumnClass
in class javax.swing.table.AbstractTableModel
column
- the column index.public java.lang.String getColumnClassName(int column)
column
- the column index.