|
JAPI 0.9.0 Yet another Java API API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.table.AbstractTableModel net.sf.japi.sql.CachedResultSetTableModel
public class CachedResultSetTableModel
An implementation of javax.swing.TableModel
for an SQL ResultSet.
In contrast to @see ResultSetTableModel this implementation reads all data upon setting the ResultSet.
The advantage is that reading the ResultSet does not require the database connection anymore.
The disadvantage is that this class requires much memory on large results and may fail for OutOfMemory on huge results.
This class is fully serializable, at least in the way Swing classes are at all serializable.
ResultSet
,
TableModel
,
Serialized FormField Summary |
---|
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
CachedResultSetTableModel()
Create a CachedResultSetTableModel. |
|
CachedResultSetTableModel(ResultSet rs)
Create a CachedResultSetTableModel. |
Method Summary | |
---|---|
void |
addThrowableHandler(ThrowableHandler<? super SQLException> throwableHandler)
Adds a ThrowableHandler to this model. |
Class<?> |
getColumnClass(int columnIndex)
Returns Object.class regardless of columnIndex .
Always returns String.class . |
int |
getColumnCount()
Returns the number of columns in the model. |
String |
getColumnName(int column)
Returns a default name for the column using spreadsheet conventions: A, B, C, ... |
ResultSet |
getResultSet()
Get the ResultSet. |
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 . |
void |
removeThrowableHandler(ThrowableHandler<? super SQLException> throwableHandler)
Removes a ThrowableHandler from this model. |
void |
setResultSet(ResultSet resultSet)
Set the ResultSet. |
Methods inherited from class javax.swing.table.AbstractTableModel |
---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.swing.table.TableModel |
---|
addTableModelListener, isCellEditable, removeTableModelListener, setValueAt |
Constructor Detail |
---|
public CachedResultSetTableModel()
public CachedResultSetTableModel(ResultSet rs)
rs
- Initial ResultSetMethod Detail |
---|
public void setResultSet(ResultSet resultSet)
setResultSet
in interface ResultSetTableModel
resultSet
- ResultSet, maybe null
public ResultSet getResultSet()
getResultSet
in interface ResultSetTableModel
null
if there is no current result setpublic void addThrowableHandler(ThrowableHandler<? super SQLException> throwableHandler)
addThrowableHandler
in interface ResultSetTableModel
throwableHandler
- ThrowableHandler to addpublic void removeThrowableHandler(ThrowableHandler<? super SQLException> throwableHandler)
removeThrowableHandler
in interface ResultSetTableModel
throwableHandler
- ThrowableHandler to addpublic int getColumnCount()
javax.swing.table.TableModel
JTable
uses this method to determine how many columns it
should create and display by default.
getColumnCount
in interface TableModel
TableModel
public int getRowCount()
javax.swing.table.TableModel
JTable
uses this method to determine how many rows it
should display. This method should be quick, as it
is called frequently during rendering.
getRowCount
in interface TableModel
TableModel
@Nullable public Object getValueAt(int rowIndex, int columnIndex)
javax.swing.table.TableModel
columnIndex
and
rowIndex
.
getValueAt
in interface TableModel
rowIndex
- the row whose value is to be queriedcolumnIndex
- the column whose value is to be queried
TableModel
public Class<?> getColumnClass(int columnIndex)
Object.class
regardless of columnIndex
.
Always returns String.class
.
getColumnClass
in interface TableModel
getColumnClass
in class AbstractTableModel
columnIndex
- the column being queried
public String getColumnName(int column)
column
cannot be found,
returns an empty string.
getColumnName
in interface TableModel
getColumnName
in class AbstractTableModel
column
- the column being queried
column
|
JAPI Yet another Java API API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |