Holger's
Java API

com.antelmann.util.table
Class MethodTableModel<T>

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.antelmann.util.table.MethodTableModel<T>
All Implemented Interfaces:
Serializable, TableModel

public class MethodTableModel<T>
extends AbstractTableModel

a table model that displays a list of objects based on the return value of given method names using reflection.

Author:
Holger Antelmann
See Also:
Serialized Form

Field Summary
protected  List<T> list
           
protected  Method[] methods
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
MethodTableModel(List<T> list, String... methodNames)
           
 
Method Summary
 int getColumnCount()
           
 String getColumnName(int column)
          returns the column name which may be altered according to Beans specifications (i.e.
 List<T> getList()
          returns an unmodifiable view of the embedded list.
 T getRow(int row)
           
 int getRowCount()
           
 Object getValueAt(int row, int column)
           
 void refresh(List<T> list, String... methodNames)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

protected final List<T> list

methods

protected Method[] methods
Constructor Detail

MethodTableModel

public MethodTableModel(List<T> list,
                        String... methodNames)
                 throws IllegalArgumentException
Throws:
IllegalArgumentException
Method Detail

refresh

public void refresh(List<T> list,
                    String... methodNames)
             throws IllegalArgumentException
Throws:
IllegalArgumentException

getList

public List<T> getList()
returns an unmodifiable view of the embedded list.


getRow

public T getRow(int row)

getRowCount

public int getRowCount()

getColumnCount

public int getColumnCount()

getValueAt

public Object getValueAt(int row,
                         int column)

getColumnName

public String getColumnName(int column)
returns the column name which may be altered according to Beans specifications (i.e. "is" and "get" is removed at the beginning if the following letter is upper-case).

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel


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