Holger's
Java API

com.antelmann.mgmt
Class EntityTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by com.antelmann.mgmt.EntityTableModel
All Implemented Interfaces:
Serializable, TableModel

public class EntityTableModel
extends AbstractTableModel

a TableModel that first uses the value of method names and then tries to retrieve properties based on the name as key. The functionality is derived from MethodTableName, but is extended to refer to property values, if no appropriate method is found.

Author:
Holger Antelmann
See Also:
MethodTableModel, Serialized Form

Field Summary
protected  List<Entity> list
           
protected  String[] methodOrPropertyNames
           
protected  Method[] methods
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
EntityTableModel(List<? extends Entity> list, String... methodOrPropertyNames)
           
 
Method Summary
 int getColumnCount()
           
 String getColumnName(int column)
          returns the column name which - in the case of a method name - may be altered according to Beans specifications (i.e.
 List<Entity> getList()
          returns an unmodifiable view of the embedded list.
 Entity getRow(int row)
           
 int getRowCount()
           
 Object getValueAt(int row, int column)
           
 void refresh(List<? extends Entity> list, String... methodOrPropertyNames)
           
 
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<Entity> list

methodOrPropertyNames

protected String[] methodOrPropertyNames

methods

protected Method[] methods
Constructor Detail

EntityTableModel

public EntityTableModel(List<? extends Entity> list,
                        String... methodOrPropertyNames)
                 throws IllegalArgumentException
Throws:
IllegalArgumentException
Method Detail

refresh

public void refresh(List<? extends Entity> list,
                    String... methodOrPropertyNames)
             throws IllegalArgumentException
Throws:
IllegalArgumentException

getList

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


getRow

public Entity 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 - in the case of a method name - may be altered according to Beans specifications (i.e. "is" and "get" is removed at the beginning if the following letter is upper-case). If the given column doesn't reflect on a method name, the methodOrPropertyName originally given is returned.

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