Holger's
Java API

com.antelmann.db
Class DatabaseTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.antelmann.db.DatabaseTableModel
All Implemented Interfaces:
DBStoreListener, Serializable, TableModel

public class DatabaseTableModel
extends AbstractTableModel
implements DBStoreListener

lists all available DBClassStore instances with their size. The table is updated automatically upon data changes.

Since:
5. Juli 2007, 23:24
Author:
Holger Antelmann
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.antelmann.db.DBStoreListener
DBStoreListener.Adapter, DBStoreListener.StoreUpdateAdapter
 
Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
DatabaseTableModel(Database<?> db)
           
 
Method Summary
 void databaseAccessed(DBClassStore<?> dbstore, DBClassStore.DBMethod method, Object parameter, long timeTaken)
          called upon successfully reading from the database (guaranteed to be called from within the transaction).
 void databaseError(DBClassStore<?> dbstore, Throwable t, DBClassStore.DBMethod method, Object parameter)
          called when an error occurred while accessing the database (not guaranteed to be called from within the transaction)
 void databaseUpdated(DBUpdateEvent event, long timeTaken)
          called upon successful insert, delete or update; note that the update becomes permanent ONLY if the current transaction successfully commits.
 void fetchCall(DBClassStore<?> store, DBEnumeration<?> e, String method, long timeTaken)
          called when a method is called on a DBEnumeration that is returned by the store
protected  void finalize()
           
 Class<?> getColumnClass(int column)
           
 int getColumnCount()
           
 String getColumnName(int column)
           
 int getRowCount()
           
 Object getValueAt(int row, int column)
           
 void prepareDatabaseCall(DBClassStore<?> dbstore, DBClassStore.DBMethod method, Object parameter)
          called before the given method is delegated to the embedded store
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseTableModel

public DatabaseTableModel(Database<?> db)
Method Detail

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface TableModel

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface TableModel

getValueAt

public Object getValueAt(int row,
                         int column)
Specified by:
getValueAt in interface TableModel

getColumnName

public String getColumnName(int column)
Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel

getColumnClass

public Class<?> getColumnClass(int column)
Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel

finalize

protected void finalize()
Overrides:
finalize in class Object

databaseUpdated

public void databaseUpdated(DBUpdateEvent event,
                            long timeTaken)
Description copied from interface: DBStoreListener
called upon successful insert, delete or update; note that the update becomes permanent ONLY if the current transaction successfully commits.

Specified by:
databaseUpdated in interface DBStoreListener
See Also:
TransactionListener, DatabaseChangeMonitor, DBVersionedUpdateEvent, Database.setVersioningEnabled(Class, boolean)

prepareDatabaseCall

public void prepareDatabaseCall(DBClassStore<?> dbstore,
                                DBClassStore.DBMethod method,
                                Object parameter)
                         throws DBVetoException
Description copied from interface: DBStoreListener
called before the given method is delegated to the embedded store

Specified by:
prepareDatabaseCall in interface DBStoreListener
Throws:
DBVetoException - if a listener seeks to prevent the call to the embedded store

databaseAccessed

public void databaseAccessed(DBClassStore<?> dbstore,
                             DBClassStore.DBMethod method,
                             Object parameter,
                             long timeTaken)
Description copied from interface: DBStoreListener
called upon successfully reading from the database (guaranteed to be called from within the transaction). This method is not called when an update occurred - in which case only DBStoreListener.databaseUpdated(DBUpdateEvent, long) is called.

Specified by:
databaseAccessed in interface DBStoreListener

databaseError

public void databaseError(DBClassStore<?> dbstore,
                          Throwable t,
                          DBClassStore.DBMethod method,
                          Object parameter)
Description copied from interface: DBStoreListener
called when an error occurred while accessing the database (not guaranteed to be called from within the transaction)

Specified by:
databaseError in interface DBStoreListener

fetchCall

public void fetchCall(DBClassStore<?> store,
                      DBEnumeration<?> e,
                      String method,
                      long timeTaken)
Description copied from interface: DBStoreListener
called when a method is called on a DBEnumeration that is returned by the store

Specified by:
fetchCall in interface DBStoreListener
See Also:
DBClassStore.fetch(com.antelmann.util.Filter), DBClassStore.fetchStubs(com.antelmann.util.Filter), DBEnumeration


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads