|
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
com.sciapp.table.db.DistinctDatabaseTableModel
public class DistinctDatabaseTableModel
DistinctDatabaseTableModel behaves just like DefaultDatabaseTableModel
, with the
difference that it queries a database for unique rows, using the 'distinct' keyword.
Field Summary | |
---|---|
protected Connection |
c
The current connection to the database |
protected SQLFilterConverter |
converter
utility class that converts a TableFilter to an sql 'where' clause. |
protected DatabaseTableDefinition |
definition
the database definition. |
protected String |
joinStatement
a string representing the table or tables and the criteria (if any) that will be used to fetch the database data. |
protected String |
orderSQL
a string which is used to hold the order byclause of the sql statement |
protected String |
whereSQL
a string which is used to hold the where clause of the sql statement |
Fields inherited from class com.sciapp.table.db.AbstractDatabaseTableModel |
---|
cache, dbFilter, dbSorter, rangedModel, rowCount |
Fields inherited from class javax.swing.table.AbstractTableModel |
---|
listenerList |
Constructor Summary | |
---|---|
DistinctDatabaseTableModel(Connection c,
String joinStatement,
DatabaseTableDefinition def)
Constructs a DistinctDatabaseTableModel. |
|
DistinctDatabaseTableModel(Connection c,
String table,
String[] columns)
Constructs a DistinctDatabaseTableModel. |
|
DistinctDatabaseTableModel(Connection c,
String table,
String[] columns,
Class[] classes)
Constructs a DistinctDatabaseTableModel. |
|
DistinctDatabaseTableModel(Connection c,
String table,
TableModel model)
Constructs a DistinctDatabaseTableModel. |
Method Summary | |
---|---|
Class |
getColumnClass(int column)
Returns Object.class regardless of columnIndex . |
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, ... Z, AA, AB, etc. If column cannot be found,
returns an empty string. |
SQLFilterConverter |
getSQLFilterConverter()
Returns the object that will be used to convert a TableFilter to an sql 'where' clause. |
boolean |
isRangedModel()
Determines whether the cache model can fetch data in ranges. |
void |
orderByClause()
This method is called whenever sorting is requested. |
int |
readRowCount()
Reads and returns the row count from the underlying data source. |
int |
readRowCount(int column)
Reads and returns the row count from the underlying data source for the distinct column supplied. |
protected String |
readRowCountStatement(int column)
Retrieves the sql statement for the readRowCount method. |
List |
retrieveRows(int column)
Fetches distinct rows from the underlying data source for the supplied column argument. |
List |
retrieveRows(int from,
int to)
Fetches multiple rows from the underlying data source. |
protected String |
retrieveRowsStatement(int column)
Retrieves the sql statement for the retrieveRows method. |
void |
setRangedModel(boolean rangedModel)
Tells the database model whether to use ranges when fetching data from the database. |
void |
setSQLFilterConverter(SQLFilterConverter converter)
Assigns the object that will be used to convert a TableFilter to an sql 'where' clause. |
void |
whereClause()
This method is called whenever filtering is requested. |
Methods inherited from class com.sciapp.table.db.AbstractDatabaseTableModel |
---|
fireTableChanged, getCache, getFilterTableModel, getRowCount, getSortTableModel, getUncachedRows, getValueAt, isCountCached, isValueCached, retrieveFromDB, retrieveFromDB, setCache |
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 javax.swing.table.TableModel |
---|
addTableModelListener, isCellEditable, removeTableModelListener, setValueAt |
Methods inherited from interface javax.swing.table.TableModel |
---|
addTableModelListener, isCellEditable, removeTableModelListener, setValueAt |
Field Detail |
---|
protected String joinStatement
protected transient SQLFilterConverter converter
TableFilter
to an sql 'where' clause.
protected DatabaseTableDefinition definition
protected transient Connection c
protected String whereSQL
protected String orderSQL
Constructor Detail |
---|
public DistinctDatabaseTableModel(Connection c, String table, String[] columns)
public DistinctDatabaseTableModel(Connection c, String table, String[] columns, Class[] classes)
public DistinctDatabaseTableModel(Connection c, String joinStatement, DatabaseTableDefinition def)
c
- the database connectionjoinStatement
- a string epresenting the table or tables and the criteria (if any) that will be used to fetch the database data.def
- the column defintionpublic DistinctDatabaseTableModel(Connection c, String table, TableModel model)
Method Detail |
---|
public Class getColumnClass(int column)
Object.class
regardless of columnIndex
.
getColumnClass
in interface TableModel
getColumnClass
in class AbstractDatabaseTableModel
column
- the column being queried
public int getColumnCount()
JTable
uses this method to determine how many columns it
should create and display by default.
TableModel.getRowCount()
public String getColumnName(int column)
column
cannot be found,
returns an empty string.
getColumnName
in interface TableModel
getColumnName
in class AbstractDatabaseTableModel
column
- the column being queried
column
public SQLFilterConverter getSQLFilterConverter()
public boolean isRangedModel()
isRangedModel
in interface CacheableTableModel
isRangedModel
in class AbstractDatabaseTableModel
public void orderByClause()
orderByClause
in class AbstractDatabaseTableModel
public int readRowCount()
public int readRowCount(int column)
column
- the database column for which the distinct count is read
protected String readRowCountStatement(int column)
readRowCount
method.
column
- the database column for which the distinct count is read
public List retrieveRows(int column)
column
- the database column for which distinct rows are read
public List retrieveRows(int from, int to)
from
- the starting rowto
- the ending row
protected String retrieveRowsStatement(int column)
retrieveRows
method.
column
- the database column for which distinct rows are read
public void setRangedModel(boolean rangedModel)
setRangedModel
in class AbstractDatabaseTableModel
rangedModel
- true if the database model is to return data in ranges, false otherwise.public void setSQLFilterConverter(SQLFilterConverter converter)
converter
- the sql filter converter to assign.public void whereClause()
whereClause
in class AbstractDatabaseTableModel
|
Copyright © 2005 Scientific Applications. All Rights Reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |