|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
com.antelmann.sql.ResultSetTableModel
public class ResultSetTableModel
ResultSetTableModel provides a convenient way to display (or otherwise use) a query result in table format. SQLExceptions that might occur are wrapped into RuntimeExceptions.
JTable,
JDBCTableModel,
Serialized Form| Field Summary |
|---|
| Fields inherited from class javax.swing.table.AbstractTableModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
ResultSetTableModel(ResultSet rs)
the result set must NOT be of type ResultSet.TYPE_FORWARD_ONLY |
|
ResultSetTableModel(ResultSet rs,
String idField)
|
|
| Method Summary | |
|---|---|
Class<?> |
getColumnClass(int column)
|
int |
getColumnCount()
|
String |
getColumnName(int column)
|
String |
getIdField()
|
ResultSet |
getResultSet()
|
RowItem |
getRow(int row)
this only works if the idField has been set correctly |
int |
getRowCount()
|
int |
getRowFor(RowItem entry)
only works if the idField is set |
RowItem |
getRowValue(int row)
retrieves the value that is represented by the given row in this model. |
Object |
getValueAt(int row,
int column)
|
boolean |
isCellEditable(int row,
int column)
|
boolean |
isEditable()
determines whether the embedded ResultSet allows updates |
boolean |
isInsertMode()
|
ResultSet |
refresh(ResultSet rs,
String idField)
returns the previous ResultSet so that it can be closed according to the application needs |
void |
refreshContent()
refreshes the embedded content |
void |
setIdField(String idField)
|
void |
setInsertMode(boolean flag)
|
void |
setRowValues(Iterable<? extends RowItem> updatedList)
allows to change the underlying table data based on the given collection. |
void |
setValueAt(Object value,
int row,
int column)
the display after update doesn't work well for e.g. |
ResultSet |
unwrap()
returns the embedded instance that this wrapper encloses |
| Methods inherited from class javax.swing.table.AbstractTableModel |
|---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener |
| 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, removeTableModelListener |
| Constructor Detail |
|---|
public ResultSetTableModel(ResultSet rs)
throws SQLException
SQLException
public ResultSetTableModel(ResultSet rs,
String idField)
throws SQLException
SQLException| Method Detail |
|---|
public ResultSet unwrap()
Wrapped
unwrap in interface Wrapped<ResultSet>
public void refreshContent()
throws IOException
Refreshable
refreshContent in interface RefreshableIOException - if the refresh failed
public ResultSet refresh(ResultSet rs,
String idField)
throws SQLException
SQLExceptionpublic String getIdField()
public void setIdField(String idField)
public RowItem getRow(int row)
throws SQLException
SQLExceptionpublic ResultSet getResultSet()
public boolean isEditable()
throws RuntimeException
RuntimeExceptionpublic boolean isInsertMode()
public void setInsertMode(boolean flag)
public int getRowCount()
getRowCount in interface TableModel
public int getColumnCount()
throws RuntimeException
getColumnCount in interface TableModelRuntimeException
public Object getValueAt(int row,
int column)
throws RuntimeException
getValueAt in interface TableModelRuntimeExceptionpublic String getColumnName(int column)
getColumnName in interface TableModelgetColumnName in class AbstractTableModelpublic Class<?> getColumnClass(int column)
getColumnClass in interface TableModelgetColumnClass in class AbstractTableModel
public boolean isCellEditable(int row,
int column)
isCellEditable in interface TableModelisCellEditable in class AbstractTableModel
public void setValueAt(Object value,
int row,
int column)
throws RuntimeException
setValueAt in interface TableModelsetValueAt in class AbstractTableModelRuntimeExceptionpublic RowItem getRowValue(int row)
ObjectTableModel
getRowValue in interface ObjectTableModel<RowItem>public int getRowFor(RowItem entry)
getRowFor in interface ObjectTableModel<RowItem>
public void setRowValues(Iterable<? extends RowItem> updatedList)
throws UnsupportedOperationException
ObjectTableModel
setRowValues in interface ObjectTableModel<RowItem>UnsupportedOperationException - if this model doesn't allow such changes
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||