com.antelmann.sql
Class JDBCTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
com.antelmann.sql.JDBCTableModel
- All Implemented Interfaces:
- Serializable, TableModel
- Direct Known Subclasses:
- JDBCRowModel
public class JDBCTableModel
- extends AbstractTableModel
JDBCTableModel provides a simple way to display/edit a table from a
JDBC connection. An additional feature is that this model is
also editable.
- Since:
- 10/24/2002
- Author:
- Holger Antelmann
- See Also:
ResultSetTableModel,
JDBCRowModel,
JTable,
ConnectionHelper,
Serialized Form
| Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener |
JDBCTableModel
public JDBCTableModel(Connection con,
String tableName)
throws SQLException
- Throws:
SQLException
JDBCTableModel
public JDBCTableModel(Connection con,
String tableName,
boolean updateable)
throws SQLException
- Throws:
SQLException
JDBCTableModel
public JDBCTableModel(Connection con,
String tableName,
String[] columnNames)
throws SQLException
- Throws:
SQLException
JDBCTableModel
public JDBCTableModel(Connection con,
String tableName,
String[] columnNames,
boolean updateable)
throws SQLException
- Throws:
SQLException
getConnection
public Connection getConnection()
getTableName
public String getTableName()
setColumnNames
public 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).
When the array is set to a non-null value, no error is thrown on this method call,
but if the column names are incorrect, various exceptions may be thrown later on
use of this model.
refresh
public void refresh()
throws SQLException
- Throws:
SQLException
getResultSet
public ResultSet getResultSet()
isEditable
public boolean isEditable()
setEditable
public void setEditable(boolean flag)
isInsertMode
public boolean isInsertMode()
setInsertMode
public void setInsertMode(boolean flag)
setParentComponent
public void setParentComponent(Component parent)
getParentComponent
public Component getParentComponent()
getRowCount
public int getRowCount()
getColumnCount
public int getColumnCount()
getValueAt
public Object getValueAt(int row,
int column)
getColumnName
public String getColumnName(int column)
- Specified by:
getColumnName in interface TableModel- Overrides:
getColumnName in class AbstractTableModel
isCellEditable
public boolean isCellEditable(int row,
int column)
- Specified by:
isCellEditable in interface TableModel- Overrides:
isCellEditable in class AbstractTableModel
setValueAt
public void setValueAt(Object value,
int row,
int column)
- Specified by:
setValueAt in interface TableModel- Overrides:
setValueAt in class AbstractTableModel
close
public void close()
throws SQLException
- closes the embedded statement used
- Throws:
SQLException
finalize
protected void finalize()
throws Exception
- Overrides:
finalize in class Object
- Throws:
Exception
(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads