|
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.JDBCTableModel
public class JDBCTableModel
JDBCTableModel provides a simple way to display/edit a table from a
JDBC connection. An additional feature is that this model is
also editable.
Todo: eventually use CachedRowSets to be able to scroll through hudge data sets
ResultSetTableModel,
JDBCRowModel,
JTable,
ConnectionHelper,
Serialized Form| Field Summary |
|---|
| Fields inherited from class javax.swing.table.AbstractTableModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
JDBCTableModel(Connection con,
String tableName)
|
|
JDBCTableModel(Connection con,
String tableName,
boolean updateable)
|
|
JDBCTableModel(Connection con,
String tableName,
int fetchSize)
|
|
JDBCTableModel(Connection con,
String tableName,
String[] columnNames)
|
|
JDBCTableModel(Connection con,
String tableName,
String[] columnNames,
boolean updateable)
|
|
JDBCTableModel(Connection con,
String tableName,
String[] columnNames,
boolean updateable,
int fetchSize)
|
|
| Method Summary | |
|---|---|
void |
close()
closes the embedded statement used |
protected void |
finalize()
|
Class<?> |
getColumnClass(int column)
|
int |
getColumnCount()
|
String |
getColumnName(int column)
|
String[] |
getColumns()
|
Connection |
getConnection()
|
Component |
getParentComponent()
|
ResultSet |
getResultSet()
|
int |
getRowCount()
|
RowItem |
getRowItem(int row,
int idColumn)
|
RowItem |
getRowItem(int row,
String idColumn)
|
String |
getTableName()
|
Object |
getValueAt(int row,
int column)
|
boolean |
isCellEditable(int row,
int column)
|
boolean |
isEditable()
|
boolean |
isInsertMode()
|
boolean |
isRefreshOnSQLException()
|
JDBCTableModel |
refresh()
|
void |
refreshContent()
refreshes the embedded content |
void |
setColumnNames(String[] columnNames)
the values must correspond to actual column names of the underlying table; setting null means to simply use all existing column names (the default). |
void |
setEditable(boolean flag)
|
void |
setInsertMode(boolean flag)
|
void |
setParentComponent(Component parent)
|
void |
setRefreshOnSQLException(boolean flag)
if set to true, getValueAt(int, int) tries to recover by calling refresh(). |
void |
setValueAt(Object value,
int row,
int column)
|
| 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, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JDBCTableModel(Connection con,
String tableName)
throws SQLException
SQLException
public JDBCTableModel(Connection con,
String tableName,
int fetchSize)
throws SQLException
SQLException
public JDBCTableModel(Connection con,
String tableName,
boolean updateable)
throws SQLException
SQLException
public JDBCTableModel(Connection con,
String tableName,
String[] columnNames)
throws SQLException
SQLException
public JDBCTableModel(Connection con,
String tableName,
String[] columnNames,
boolean updateable)
throws SQLException
SQLException
public JDBCTableModel(Connection con,
String tableName,
String[] columnNames,
boolean updateable,
int fetchSize)
throws SQLException
SQLException| Method Detail |
|---|
public Connection getConnection()
public String getTableName()
public void setColumnNames(String[] columnNames)
public void refreshContent()
throws IOException
Refreshable
refreshContent in interface RefreshableIOException - if the refresh failed
public JDBCTableModel refresh()
throws SQLException
SQLExceptionpublic boolean isRefreshOnSQLException()
setRefreshOnSQLException(boolean)public void setRefreshOnSQLException(boolean flag)
getValueAt(int, int) tries to recover by calling refresh().
This allows to use the result set over transaction boundaries.
public ResultSet getResultSet()
public boolean isEditable()
isEditable in interface EditableComponentpublic void setEditable(boolean flag)
setEditable in interface EditableComponentpublic boolean isInsertMode()
public void setInsertMode(boolean flag)
public void setParentComponent(Component parent)
public Component getParentComponent()
public int getRowCount()
getRowCount in interface TableModelpublic int getColumnCount()
getColumnCount in interface TableModel
public Object getValueAt(int row,
int column)
getValueAt in interface TableModel
public RowItem getRowItem(int row,
int idColumn)
throws SQLException
SQLException
public RowItem getRowItem(int row,
String idColumn)
throws SQLException
SQLExceptionpublic String getColumnName(int column)
getColumnName in interface TableModelgetColumnName in class AbstractTableModel
public String[] getColumns()
throws SQLException
SQLExceptionpublic 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)
setValueAt in interface TableModelsetValueAt in class AbstractTableModel
protected void finalize()
throws IOException
finalize in class ObjectIOException
public void close()
throws IOException
close in interface CloseableIOException
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||