|
SPT Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnextapp.echo2.app.table.AbstractTableModel
com.sptci.echo2.table.AbstractTableModel<RowSet>
com.sptci.echo2.table.RowSetTableModel
public class RowSetTableModel
A custom TableModel used to represent
data contained in RowSet objects.
© Copyright 2007 Sans Pareil Technologies, Inc.
| Field Summary | |
|---|---|
protected List<ColumnMetaData> |
columns
The list of columns displayed in the Table. |
protected String |
prefix
The prefix to use to look up localised column headers. |
protected int |
rowCount
The rowCount number of records available in rowSet. |
protected RowSet |
rowSet
The RowSet backing this table model. |
| Fields inherited from class com.sptci.echo2.table.AbstractTableModel |
|---|
sortDirection, sortIndex |
| Constructor Summary | |
|---|---|
protected |
RowSetTableModel()
Default constructor. |
protected |
RowSetTableModel(String prefix)
Create a new instance of the model configured to use the specified prefix for localised column names. |
|
RowSetTableModel(String prefix,
RowSet rowSet)
Create a new instance of the model using the specified collection of data objects. |
| Method Summary | |
|---|---|
void |
addRow(Map<String,Object> row)
Add the specified row to the end of the model. |
void |
deleteRow(int row)
Delete the specified row from the model. |
void |
dispose()
Close the rowSet and release any resources held by it. |
Class |
getColumnClass(int column)
Returns the class of the objects displayed in the specified column. |
int |
getColumnCount()
Returns the number of columns displayed in the table. |
String |
getColumnName(int column)
Returns the name of the specified column. |
RowSet |
getObjectAt(int row)
Return the object stored at the specified index in rowSet. |
String |
getPrefix()
Returns prefix. |
int |
getRowCount()
Return the rowCount number of entries in rowSet. |
Object |
getValueAt(int column,
int row)
Return the value at the specified coordinate in the table. |
void |
init()
Initialise this table model. |
protected void |
processColumns()
Process the RowSetMetaData associated with
rowSet and populate columns. |
protected void |
setColumn(Map.Entry<String,Object> column)
Set the value of the specified cell in rowSet. |
void |
setPrefix(String prefix)
Set prefix. |
protected void |
setRowCount()
Sets the value of rowCount from rowSet. |
protected void |
setRowCount(int rowCount)
Sets the value of rowCount. |
void |
updateRow(int row,
Map<String,Object> rowData)
Replace the row specified with the object specified. |
| Methods inherited from class com.sptci.echo2.table.AbstractTableModel |
|---|
getSortDirection |
| Methods inherited from class nextapp.echo2.app.table.AbstractTableModel |
|---|
addTableModelListener, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getEventListenerList, removeTableModelListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected RowSet rowSet
RowSet backing this table model.
protected String prefix
protected int rowCount
rowSet.
protected List<ColumnMetaData> columns
Table.
This is used by the getColumnName(int) and getColumnCount()
methods.
| Constructor Detail |
|---|
protected RowSetTableModel()
protected RowSetTableModel(String prefix)
prefix - The prefix to use to look up localised titles for the
column names. The prefix should not have a trailing dot.
public RowSetTableModel(String prefix,
RowSet rowSet)
prefix - The prefix to use to look up localised titles for the
column names. The prefix should not have a trailing dot.rowSet - The rowSet to use as the backing data store.| Method Detail |
|---|
public void init()
throws RuntimeException
init in class AbstractTableModel<RowSet>RuntimeException - If a SQLException is thrown
by the methods invoked.processColumns(),
setRowCount()
public void addRow(Map<String,Object> row)
throws SQLException
key values in the row match the column
names in rowSet and that the value objects
match the appropriate type required for the column.
row - The data object that is to be added to the model.
SQLException - If errors are encountered while adding the data.setColumn(java.util.Map.Entry) ,
AbstractTableModel.fireTableRowsInserted(int, int)
public void deleteRow(int row)
throws SQLException
row - The index of the row that is to be deleted.
SQLException - If errors are encountered while deleting the data.AbstractTableModel.fireTableRowsDeleted(int, int)
public void updateRow(int row,
Map<String,Object> rowData)
throws SQLException
row - The index at which the object is to be updated.rowData - The data object that is to be updated to the model.
SQLException - If errors are encountered while updating the
rowSet.setColumn(java.util.Map.Entry) ,
AbstractTableModel.fireTableRowsUpdated(int, int)public Class getColumnClass(int column)
getColumnClass in interface TableModelgetColumnClass in class AbstractTableModelcolumn - The column whose class is to be returned.
TableModel.getColumnClass(int)public int getColumnCount()
TableModel.getColumnCount()public String getColumnName(int column)
getColumnName in interface TableModelgetColumnName in class AbstractTableModelcolumn - The index of the column whose name is to be returned.
TableModel.getColumnName(int)public int getRowCount()
rowSet.
TableModel.getRowCount()
public Object getValueAt(int column,
int row)
throws RuntimeException
column - The column index.row - The row index.
IllegalArgumentException - If column or
row indices are invalid for this model.
RuntimeException - If errors are encountered while fetching the
value from the underlying data object at index row in
rowSet.TableModel.getValueAt(int, int)
public RowSet getObjectAt(int row)
throws SQLException
rowSet.
This is equivalent to returning the rowSet with the row set
to the specified index.
row - The index of the row whose underlying object is to be
returned.
rowSet pointing to the row number specified.
SQLException - If errors are encountered while setting the
cursor position to the row specified.
protected void processColumns()
throws SQLException
RowSetMetaData associated with
rowSet and populate columns.
SQLException - If errors are encountered while introspecting the
meta data.
protected void setRowCount()
throws SQLException
rowCount from rowSet.
SQLException - If errors are encountered while traversing the
rowset.protected void setRowCount(int rowCount)
rowCount.
rowCount - The value to set.
protected void setColumn(Map.Entry<String,Object> column)
throws SQLException
rowSet.
column - A Map.Entry that contains the name of
the column and its value.
SQLException - If errors are encountered while setting the
value of the column.public void dispose()
rowSet and release any resources held by it.
public String getPrefix()
prefix.
public void setPrefix(String prefix)
prefix.
prefix - The value to set.
|
SPT Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||