org.springframework.richclient.table
Class BeanTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.springframework.richclient.table.BaseTableModel
          extended by org.springframework.richclient.table.BeanTableModel
All Implemented Interfaces:
Serializable, TableModel, MutableTableModel
Direct Known Subclasses:
BeanTableListModel

public abstract class BeanTableModel
extends BaseTableModel

Author:
Keith Donald
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
BeanTableModel(Class beanClass)
           
BeanTableModel(Class beanClass, List rows)
           
BeanTableModel(Class beanClass, List rows, MessageSource messages)
           
BeanTableModel(Class beanClass, MessageSource messages)
           
 
Method Summary
protected  void createColumnInfo()
          Creates the required column information based on the value provided by the BaseTableModel.createColumnClasses() and BaseTableModel.createColumnNames() methods.
protected  String[] createColumnNames()
          Subclasses must implement this method to return the array of column headers for the columns to be displayed by this table model.
protected abstract  String[] createColumnPropertyNames()
           
protected  String[] getColumnPropertyNames()
           
protected  Object getValueAtInternal(Object row, int columnIndex)
          Subclasses must implement this method to return the value at the given column index for the given object.
protected  boolean isCellEditableInternal(Object row, int columnIndex)
          Subclasses may override this method to determine if the cell at the specified row and column position can be edited.
 void setBeanClass(Class clazz)
           
 void setMessageSource(MessageSource messages)
           
protected  void setValueAtInternal(Object value, Object bean, int columnIndex)
          Subclasses may implement this method to set the given value on the property at the given column index of the given row object.
 
Methods inherited from class org.springframework.richclient.table.BaseTableModel
addRow, addRows, clear, createColumnClasses, getColumnClass, getColumnClasses, getColumnCount, getColumnData, getColumnHeaders, getColumnName, getColumnNames, getDataColumnCount, getDataColumnHeaders, getRow, getRowCount, getRows, getValueAt, hasRowNumbers, isCellEditable, remove, remove, remove, rowOf, setRowNumbers, setRows, setValueAt
 
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
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, removeTableModelListener
 

Constructor Detail

BeanTableModel

public BeanTableModel(Class beanClass)

BeanTableModel

public BeanTableModel(Class beanClass,
                      List rows)

BeanTableModel

public BeanTableModel(Class beanClass,
                      MessageSource messages)

BeanTableModel

public BeanTableModel(Class beanClass,
                      List rows,
                      MessageSource messages)
Method Detail

setBeanClass

public void setBeanClass(Class clazz)

setMessageSource

public void setMessageSource(MessageSource messages)

createColumnInfo

protected void createColumnInfo()
Description copied from class: BaseTableModel
Creates the required column information based on the value provided by the BaseTableModel.createColumnClasses() and BaseTableModel.createColumnNames() methods.

Overrides:
createColumnInfo in class BaseTableModel

createColumnPropertyNames

protected abstract String[] createColumnPropertyNames()

createColumnNames

protected String[] createColumnNames()
Description copied from class: BaseTableModel
Subclasses must implement this method to return the array of column headers for the columns to be displayed by this table model.

Specified by:
createColumnNames in class BaseTableModel
Returns:
The array of column headers, never null.

getColumnPropertyNames

protected String[] getColumnPropertyNames()

getValueAtInternal

protected Object getValueAtInternal(Object row,
                                    int columnIndex)
Description copied from class: BaseTableModel
Subclasses must implement this method to return the value at the given column index for the given object.

Specified by:
getValueAtInternal in class BaseTableModel
Parameters:
row - The object representing a row of data from the table.
columnIndex - The column index of the value to be returned.
Returns:
The value at the given index for the given object. May be null.

isCellEditableInternal

protected boolean isCellEditableInternal(Object row,
                                         int columnIndex)
Description copied from class: BaseTableModel
Subclasses may override this method to determine if the cell at the specified row and column position can be edited. Default behaviour is to always return false.

Overrides:
isCellEditableInternal in class BaseTableModel
Parameters:
row - The object representing the table row.
columnIndex - The zero-based index of the column to be checked.
Returns:
true if the given cell is editable, false otherwise.

setValueAtInternal

protected void setValueAtInternal(Object value,
                                  Object bean,
                                  int columnIndex)
Description copied from class: BaseTableModel
Subclasses may implement this method to set the given value on the property at the given column index of the given row object. The default implementation is to do nothing.

Overrides:
setValueAtInternal in class BaseTableModel
Parameters:
value - The value to be set.
bean - The object representing the row in the table.
columnIndex - The column position of the property on the given row object.


Copyright © 2004-2008 The Spring Framework. All Rights Reserved.