public class ScrollableResultSetTableModel extends AbstractTableModel implements CloseableTableModel, MetaTableModel
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 and Type | Field and Description |
---|---|
static String |
COL_MAPPING_KEY |
Constructor and Description |
---|
ScrollableResultSetTableModel(ResultSet resultset,
boolean columnNameMapping,
boolean closeStatement)
Constructs the model.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Clears the model of the current result set.
|
DataAttributes |
getCellDataAttributes(int row,
int column)
Returns the meta-attribute as Java-Object.
|
DataAttributes |
getColumnAttributes(int column)
Returns the column-level attributes for the given column.
|
Class |
getColumnClass(int column)
Returns the class of the resultset column.
|
int |
getColumnCount()
Returns the number of columns in the ResultSet.
|
String |
getColumnName(int column)
Returns the columnLabel or column name for the given column.
|
int |
getRowCount()
Get a rowCount.
|
DataAttributes |
getTableAttributes()
Returns table-wide attributes.
|
Object |
getValueAt(int row,
int column)
Returns the value of the specified row and the specified column from within the resultset.
|
boolean |
isCellDataAttributesSupported()
Checks, whether cell-data attributes are supported by this tablemodel implementation.
|
boolean |
isColumnNameMapping()
Returns the column name mode used to map column names into column indices.
|
void |
updateResultSet(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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addTableModelListener, isCellEditable, removeTableModelListener, setValueAt
public static final String COL_MAPPING_KEY
public ScrollableResultSetTableModel(ResultSet resultset, boolean columnNameMapping, boolean closeStatement) throws SQLException
resultset
- the result set.columnNameMapping
- defines, whether to use column names or column labels to compute the column index.closeStatement
- a flag indicating whether the statement, that created the resultset should be closed when
the resultset gets closed.SQLException
- if there is a problem with the result set.public boolean isColumnNameMapping()
ResultSetMetaData.getColumnLabel(int)
,
ResultSetMetaData.getColumnName(int)
public void updateResultSet(ResultSet resultset) throws SQLException
resultset
- the new result set.SQLException
- if there is a problem with the result set.public void close()
close
in interface CloseableTableModel
public int getRowCount()
getRowCount
in interface TableModel
public int getColumnCount()
getColumnCount
in interface TableModel
ResultSetMetaData.getColumnCount()
public String getColumnName(int column)
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
column
- the column index.ResultSetMetaData.getColumnLabel(int)
public Object getValueAt(int row, int column)
getValueAt
in interface TableModel
row
- the row index.column
- the column index.public Class getColumnClass(int column)
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
column
- the column index.public DataAttributes getCellDataAttributes(int row, int column)
getCellDataAttributes
in interface MetaTableModel
row
- the row of the cell for which the meta-data is queried.column
- the index of the column for which the meta-data is queried.public boolean isCellDataAttributesSupported()
MetaTableModel
isCellDataAttributesSupported
in interface MetaTableModel
public DataAttributes getColumnAttributes(int column)
MetaTableModel
getColumnAttributes
in interface MetaTableModel
column
- the column.public DataAttributes getTableAttributes()
getTableAttributes
in interface MetaTableModel