Holger's
Java API

com.antelmann.db
Class StoreUpdateTableModel<T extends DBEntry>

java.lang.Object
  extended by com.antelmann.db.StoreUpdateTableModel<T>
All Implemented Interfaces:
Refreshable, ObjectTableModel<T>, Wrapped<ObjectTableModel<T>>, TableModel

public class StoreUpdateTableModel<T extends DBEntry>
extends Object
implements ObjectTableModel<T>, Wrapped<ObjectTableModel<T>>

a special TableModel wrapper that supports store updates upon setValueAt(Object, int, int)

Since:
06.10.2009, 16:03:47
Author:
Holger Antelmann

Constructor Summary
StoreUpdateTableModel(ObjectTableModel<T> model, DBClassStore<T> store)
           
 
Method Summary
 void addTableModelListener(TableModelListener l)
           
 Class<?> getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 String getColumnName(int columnIndex)
           
 int getRowCount()
           
 int getRowFor(T entry)
          locates the row where the given entry can be found in this model
 T getRowValue(int row)
          retrieves the value that is represented by the given row in this model.
 Object getValueAt(int rowIndex, int columnIndex)
           
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 void refreshContent()
          refreshes the embedded content
 void removeTableModelListener(TableModelListener l)
           
 void setRowValues(Iterable<? extends T> updatedList)
          allows to change the underlying table data based on the given collection.
 void setValueAt(Object value, int row, int column)
           
 ObjectTableModel<T> unwrap()
          returns the embedded instance that this wrapper encloses
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StoreUpdateTableModel

public StoreUpdateTableModel(ObjectTableModel<T> model,
                             DBClassStore<T> store)
Method Detail

unwrap

public ObjectTableModel<T> unwrap()
Description copied from interface: Wrapped
returns the embedded instance that this wrapper encloses

Specified by:
unwrap in interface Wrapped<ObjectTableModel<T extends DBEntry>>

refreshContent

public void refreshContent()
                    throws IOException
Description copied from interface: Refreshable
refreshes the embedded content

Specified by:
refreshContent in interface Refreshable
Throws:
IOException - if the refresh failed

addTableModelListener

public void addTableModelListener(TableModelListener l)
Specified by:
addTableModelListener in interface TableModel

getColumnClass

public Class<?> getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface TableModel

getColumnCount

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

getColumnName

public String getColumnName(int columnIndex)
Specified by:
getColumnName in interface TableModel

getRowCount

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

getRowFor

public int getRowFor(T entry)
Description copied from interface: ObjectTableModel
locates the row where the given entry can be found in this model

Specified by:
getRowFor in interface ObjectTableModel<T extends DBEntry>
Returns:
the row where the entry is found in the model or -1 if the entry doesn't exist in this model

getRowValue

public T getRowValue(int row)
Description copied from interface: ObjectTableModel
retrieves the value that is represented by the given row in this model. If the given row does not exist in the model, various RuntimeExceptions may occur.

Specified by:
getRowValue in interface ObjectTableModel<T extends DBEntry>
Returns:
the Object value representing the given row

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Specified by:
getValueAt in interface TableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface TableModel

removeTableModelListener

public void removeTableModelListener(TableModelListener l)
Specified by:
removeTableModelListener in interface TableModel

setRowValues

public void setRowValues(Iterable<? extends T> updatedList)
                  throws UnsupportedOperationException
Description copied from interface: ObjectTableModel
allows to change the underlying table data based on the given collection. Unless specified otherwise, the given collection remains untouched and the elements are copied into the internal data structure of the model.

Specified by:
setRowValues in interface ObjectTableModel<T extends DBEntry>
Throws:
UnsupportedOperationException - if this model doesn't allow such changes

setValueAt

public void setValueAt(Object value,
                       int row,
                       int column)
Specified by:
setValueAt in interface TableModel


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