|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
com.sciapp.table.db.AbstractDatabaseTableModel
public abstract class AbstractDatabaseTableModel
AbstractDatabaseTableModel represents a sortable and filterable database model that is also cached. Sorting is provided via an internal SortTableModel instance, whereas filtering through an internal FilterTableModel instance. Finally, caching is handled by a TableCache object.
| Field Summary | |
|---|---|
protected TableCache |
cache
the cache |
protected FilterTableModel |
dbFilter
the internal filter tablemodel instance |
protected SortTableModel |
dbSorter
the internal sort tablemodel instance |
protected boolean |
rangedModel
true if the model is going to fetch data in ranges |
protected int |
rowCount
an index holding the last row count |
| Fields inherited from class javax.swing.table.AbstractTableModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
AbstractDatabaseTableModel(TableCache cache)
Constructs an AbstractDatabaseTableModel. |
|
| Method Summary | |
|---|---|
void |
fireTableChanged(TableModelEvent e)
Forwards the given notification event to all TableModelListeners that registered
themselves as listeners for this table model. |
TableCache |
getCache()
Retrieves the cache. |
abstract Class |
getColumnClass(int columnIndex)
Returns Object.class regardless of columnIndex. |
abstract String |
getColumnName(int column)
Returns a default name for the column using spreadsheet conventions: A, B, C, ... |
FilterTableModel |
getFilterTableModel()
Returns the internal filter tablemodel instance. |
int |
getRowCount()
Returns the number of rows in the model. |
SortTableModel |
getSortTableModel()
Returns the internal sort tablemodel instance. |
List |
getUncachedRows(int fromRow,
int toRow)
Retrieves the rows from the table model by specifying a row interval. |
Object |
getValueAt(int row,
int column)
Returns the value for the cell at columnIndex and
rowIndex. |
boolean |
isCountCached()
Determines whether the row count has been evaluated. |
boolean |
isRangedModel()
Determines whether the cache model can fetch data in ranges. |
boolean |
isValueCached(int row,
int column)
Determines whether the value at the specified cell has been evaluated. |
abstract void |
orderByClause()
This method is called whenever sorting is requested. |
protected Object |
retrieveFromDB(ResultSet rs,
int column)
Performs the binding from a database value to a java value using the supplied resultset and the column's index, and returns the result. |
protected Object |
retrieveFromDB(ResultSet rs,
int column,
Class c)
Performs the binding from a database value to a java value using the supplied resultset and the column's class, and returns the result. |
void |
setCache(TableCache newCache)
Assigns a new cache. |
void |
setRangedModel(boolean rangedModel)
Tells the database model whether to use ranges when fetching data from the database. |
abstract void |
whereClause()
This method is called whenever filtering is requested. |
| Methods inherited from class javax.swing.table.AbstractTableModel |
|---|
addTableModelListener, findColumn, fireTableCellUpdated, 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 com.sciapp.table.db.DatabaseTableModel |
|---|
readRowCount, retrieveRows |
| Methods inherited from interface javax.swing.table.TableModel |
|---|
addTableModelListener, getColumnCount, isCellEditable, removeTableModelListener, setValueAt |
| Methods inherited from interface javax.swing.table.TableModel |
|---|
addTableModelListener, getColumnCount, isCellEditable, removeTableModelListener, setValueAt |
| Field Detail |
|---|
protected int rowCount
protected SortTableModel dbSorter
protected FilterTableModel dbFilter
protected TableCache cache
protected boolean rangedModel
| Constructor Detail |
|---|
public AbstractDatabaseTableModel(TableCache cache)
| Method Detail |
|---|
public void fireTableChanged(TableModelEvent e)
TableModelListeners that registered
themselves as listeners for this table model.
fireTableChanged in class AbstractTableModele - the event to be forwardedAbstractTableModel.addTableModelListener(javax.swing.event.TableModelListener),
TableModelEvent,
EventListenerListpublic TableCache getCache()
public abstract Class getColumnClass(int columnIndex)
Object.class regardless of columnIndex.
getColumnClass in interface TableModelgetColumnClass in class AbstractTableModelcolumnIndex - the column being queried
public abstract String getColumnName(int column)
column cannot be found,
returns an empty string.
getColumnName in interface TableModelgetColumnName in class AbstractTableModelcolumn - the column being queried
columnpublic FilterTableModel getFilterTableModel()
public int getRowCount()
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 TableModelTableModel.getColumnCount()public SortTableModel getSortTableModel()
public List getUncachedRows(int fromRow,
int toRow)
getUncachedRows in interface CacheableTableModelfromRow - the starting rowtoRow - the ending row
public Object getValueAt(int row,
int column)
columnIndex and
rowIndex.
getValueAt in interface TableModelrow - the row whose value is to be queriedcolumn - the column whose value is to be queried
public boolean isCountCached()
isCountCached in interface CacheableTableModelpublic boolean isRangedModel()
isRangedModel in interface CacheableTableModel
public boolean isValueCached(int row,
int column)
isValueCached in interface CacheableTableModelrow - the cell's row indexcolumn - the cell's column index
public abstract void orderByClause()
protected Object retrieveFromDB(ResultSet rs,
int column)
throws SQLException
rs - the current result setcolumn - the column being fetched
column
SQLException
protected Object retrieveFromDB(ResultSet rs,
int column,
Class c)
throws SQLException
rs - the current result setcolumn - the column being fetchedc - the column's class
column
SQLExceptionpublic void setCache(TableCache newCache)
newCache - the new cache to assign.public void setRangedModel(boolean rangedModel)
rangedModel - true if the database model is to return data in ranges, false otherwise.public abstract void whereClause()
|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||