com.jidesoft.database
Class CrudDatabaseTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
com.jidesoft.database.DatabaseTableModel
com.jidesoft.database.CrudDatabaseTableModel
- All Implemented Interfaces:
- CrudRowOperations, CrudTableModel, AutoFilterTableHeaderAdapter, AutoFilterTableModel, ContextSensitiveTableModel, IFilterableTableModel, ISortableTableModel, Serializable, TableModel
public class CrudDatabaseTableModel
- extends DatabaseTableModel
- implements CrudTableModel
- See Also:
- Serialized Form
Methods inherited from class com.jidesoft.database.DatabaseTableModel |
addFilter, addFilter, addFilter, addFilterableTableModelListener, addSortListener, adjustStatement, clearFilters, close, commit, configureConverterContexts, convertElementToString, createCountStatement, createOrderStatement, createPossibleValuesStatement, createReadonlyStatement, createSqlStatement, createStatement, createWhereStatement, fireFilterAdded, fireFilterChanged, fireFilterRemoved, fireSortEvent, fireSortingEvent, getActualRowAt, getCellClassAt, getColumnClass, getColumnCount, getColumnMapping, getColumnName, getColumnSortRank, getConverterContextAt, getDynamicTableFilters, getEditorContextAt, getFilterableTableModelListeners, getFilterIcon, getFilterItems, getFilters, getFilterTitleFormatter, getListCellRenderer, getMasterSortColumns, getMaximumSortColumns, getPossibleValues, getPossibleValuesAndConverters, getSortedRowAt, getSortingColumns, getSortListeners, getSortPriority, getTitleConverter, hasFilter, hasFilter, initDatabase, invalidateCache, invalidateCache, isAdjusting, isAllowCustomFilter, isAllowMultipleValues, isAndMode, isCellEditable, isColumnAscending, isColumnAutoFilterable, isColumnFilterable, isColumnSortable, isColumnSorted, isColumnVisible, isConsiderCurrencyField, isFilteringPaused, isFiltersApplied, isMultiColumnSortable, isSameConverterAt, isSortable, isUpdatable, isUseTableCellRenderer, isValuePredetermined, prepareWhereStatement, refresh, refreshData, removeAllFilters, removeAllFilters, removeFilter, removeFilter, removeFilter, removeFilterableTableModelListener, removeSortListener, reset, resort, reverseColumnSortOrder, setAdjusting, setAndMode, setColumnMapping, setColumnSortable, setConsiderCurrencyField, setFilteringPaused, setFiltersApplied, setMasterSortColumns, setMaximumSortColumns, setMultiColumnSortable, setSortable, setSortingColumns, setSortPriority, setUpdatable, sort, sortColumn, sortColumn, sortColumn, toggleSortOrder, unsortColumn, validate, validateNullable, validatePrecision, validateSigned |
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 |
_crudSupport
protected ResultSetTableModelCrudSupport _crudSupport
insertRow
protected Record insertRow
isInInsertRow
protected volatile boolean isInInsertRow
CrudDatabaseTableModel
public CrudDatabaseTableModel(Connection connection,
String fromStatement)
throws SQLException
- Creates a CrudDatabaseTableModel.
- Parameters:
connection
- a database connection.fromStatement
- a SQL from statement. It could be - FROM first_table
- FROM first_table,
second_table
- FROM first_table LEFT JOIN second_table
- FROM first_table INNER JOIN
second_table
- Throws:
SQLException
- if a database related error happens. It could be because the connection is closed.
CrudDatabaseTableModel
public CrudDatabaseTableModel(Connection connection,
String selectStatement,
String fromStatement)
throws SQLException
- Creates a CrudDatabaseTableModel.
- Parameters:
connection
- a database connection.selectStatement
- a SQL select statement. If null, we default it to "*".fromStatement
- a SQL from statement. It could be - FROM first_table
- FROM first_table,
second_table
- FROM first_table LEFT JOIN second_table
- FROM first_table INNER JOIN
second_table
- Throws:
SQLException
- if a database related error happens. It could be because the connection is closed.
CrudDatabaseTableModel
public CrudDatabaseTableModel(Connection connection,
String selectStatement,
String fromStatement,
boolean updatable)
throws SQLException
- Creates a CrudDatabaseTableModel.
- Parameters:
connection
- a database connection.selectStatement
- a SQL select statement. If null, we default it to "*".fromStatement
- a SQL from statement. It could be - FROM first_table
- FROM first_table,
second_table
- FROM first_table LEFT JOIN second_table
- FROM first_table INNER JOIN
second_table
updatable
- if the table model is updatable (or editable)
- Throws:
SQLException
- if a database related error happens. It could be because the connection is closed.
getRowCount
public int getRowCount()
- Specified by:
getRowCount
in interface TableModel
- Overrides:
getRowCount
in class DatabaseTableModel
getValueAt
public Object getValueAt(int rowIndex,
int columnIndex)
- Specified by:
getValueAt
in interface TableModel
- Overrides:
getValueAt
in class DatabaseTableModel
setValueAt
public void setValueAt(Object aValue,
int rowIndex,
int columnIndex)
- Specified by:
setValueAt
in interface TableModel
- Overrides:
setValueAt
in class DatabaseTableModel
insertRow
public void insertRow(Record record)
throws Exception
- Implementation of the CrudTableModel interface
(Create, Read, Update and Delete operations over rows on table models)
- Specified by:
insertRow
in interface CrudRowOperations
- Parameters:
record
- the data structure
- Throws:
Exception
- if encouting any database update error
createRowRecord
protected Record createRowRecord()
readRow
public Record readRow(int rowIndex)
throws Exception
- Description copied from interface:
CrudRowOperations
- Read data of a designated row.
- Specified by:
readRow
in interface CrudRowOperations
- Parameters:
rowIndex
- the row index
- Returns:
- the data structure
- Throws:
Exception
- if encouting any database read error
updateRow
public void updateRow(int rowIndex,
Record record)
throws Exception
- Description copied from interface:
CrudRowOperations
- Update data of a designated row with data.
- Specified by:
updateRow
in interface CrudRowOperations
- Parameters:
rowIndex
- the row indexrecord
- the data array
- Throws:
Exception
- if encouting any database update error
deleteRow
public void deleteRow(int rowIndex)
throws Exception
- Description copied from interface:
CrudRowOperations
- Delete data of a designated row.
- Specified by:
deleteRow
in interface CrudRowOperations
- Parameters:
rowIndex
- the row index
- Throws:
Exception
- if encouting any database update error.
createResultSetTableModel
protected ResultSetTableModel createResultSetTableModel(ResultSet resultSet,
int rowCount)
throws SQLException
- Overrides:
createResultSetTableModel
in class DatabaseTableModel
- Throws:
SQLException