|
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.Objectjavax.swing.table.AbstractTableModel
net.sf.japi.sql.ScrollResultSetTableModel
public class ScrollResultSetTableModel
An implementation of javax.swing.TableModel for an SQL ResultSet.
It is required that the ResultSet is absolutely navigatable.
That feature heavily depends on the JDBC Driver implementation.
Please note that though this class does NOT store the ResultSet data except some meta data, the JTable probably will in its own private shadow copy table model.
ResultSet,
TableModel,
Serialized Form| Field Summary |
|---|
| Fields inherited from class javax.swing.table.AbstractTableModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
ScrollResultSetTableModel()
Create a ResultSetTableModel. |
|
ScrollResultSetTableModel(ResultSet rs)
Create a ResultSetTableModel. |
|
| Method Summary | |
|---|---|
void |
addThrowableHandler(ThrowableHandler<? super SQLException> throwableHandler)
Adds a ThrowableHandler to this model. |
void |
cursorMoved(RowSetEvent event)
Notifies registered listeners that a RowSet object's
cursor has moved. |
void |
deleteRow(int n)
Delete a row. |
Class<?> |
getColumnClass(int columnIndex)
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, ... |
ResultSetMetaData |
getMetaData()
Get the meta data. |
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 |
insert(String[] rowData)
Insert a row. |
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns false. |
void |
removeThrowableHandler(ThrowableHandler<? super SQLException> throwableHandler)
Removes a ThrowableHandler from this model. |
void |
rowChanged(RowSetEvent event)
Notifies registered listeners that a RowSet object
has had a change in one of its rows. |
void |
rowSetChanged(RowSetEvent event)
Notifies registered listeners that a RowSet object
in the given RowSetEvent object has changed its entire contents. |
void |
setResultSet(ResultSet resultSet)
Set the ResultSet. |
void |
setValueAt(Object aValue,
int rowIndex,
int columnIndex)
This empty implementation is provided so users don't have to implement this method if their data model is not editable. |
| 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 ScrollResultSetTableModel()
public ScrollResultSetTableModel(ResultSet rs)
rs - Initial ResultSet| Method Detail |
|---|
public void setResultSet(ResultSet resultSet)
setResultSet in interface ResultSetTableModelresultSet - ResultSet, maybe nullpublic ResultSet getResultSet()
getResultSet in interface ResultSetTableModelnull if there is no current result setpublic void addThrowableHandler(ThrowableHandler<? super SQLException> throwableHandler)
addThrowableHandler in interface ResultSetTableModelthrowableHandler - ThrowableHandler to addpublic void removeThrowableHandler(ThrowableHandler<? super SQLException> throwableHandler)
removeThrowableHandler in interface ResultSetTableModelthrowableHandler - ThrowableHandler to addpublic void rowSetChanged(RowSetEvent event)
RowSet object
in the given RowSetEvent object has changed its entire contents.
The source of the event can be retrieved with the method
event.getSource.
rowSetChanged in interface RowSetListenerevent - a RowSetEvent object that contains
the RowSet object that is the source of the eventpublic void rowChanged(RowSetEvent event)
RowSet object
has had a change in one of its rows.
The source of the event can be retrieved with the method
event.getSource.
rowChanged in interface RowSetListenerevent - a RowSetEvent object that contains
the RowSet object that is the source of the eventpublic void cursorMoved(RowSetEvent event)
RowSet object's
cursor has moved.
The source of the event can be retrieved with the method
event.getSource.
cursorMoved in interface RowSetListenerevent - a RowSetEvent object that contains
the RowSet object that is the source of the eventpublic 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 int getColumnCount()
JTable uses this method to determine how many columns it
should create and display by default.
getColumnCount in interface TableModelTableModel.getRowCount()
@Nullable
public Object getValueAt(int rowIndex,
int columnIndex)
columnIndex and
rowIndex.
getValueAt in interface TableModelrowIndex - the row whose value is to be queriedcolumnIndex - the column whose value is to be queried
public Class<?> getColumnClass(int columnIndex)
Object.class regardless of columnIndex.
getColumnClass in interface TableModelgetColumnClass in class AbstractTableModelcolumnIndex - the column being queried
@Nullable public String getColumnName(int column)
column cannot be found,
returns an empty string.
getColumnName in interface TableModelgetColumnName in class AbstractTableModelcolumn - the column being queried
column
public void insert(String[] rowData)
throws SQLException
rowData - data for new row
SQLException - in case of SQL problems
public boolean isCellEditable(int rowIndex,
int columnIndex)
isCellEditable in interface TableModelisCellEditable in class AbstractTableModelrowIndex - the row being queriedcolumnIndex - the column being queried
TableModel.setValueAt(java.lang.Object, int, int)
public void setValueAt(Object aValue,
int rowIndex,
int columnIndex)
setValueAt in interface TableModelsetValueAt in class AbstractTableModelaValue - value to assign to cellrowIndex - row of cellcolumnIndex - column of cellTableModel.getValueAt(int, int),
TableModel.isCellEditable(int, int)
public void deleteRow(int n)
throws SQLException
n - row number to delete (Java row number, 0 .. (number of rows - 1))
SQLException - in case of SQL problemspublic ResultSetMetaData getMetaData()
|
JAPI Yet another Java API API Documentation |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||