org.springframework.richclient.table.support
Class GlazedTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by ca.odell.glazedlists.swing.EventTableModel
          extended by org.springframework.richclient.table.support.GlazedTableModel
All Implemented Interfaces:
ca.odell.glazedlists.event.ListEventListener, Serializable, EventListener, TableModel

public class GlazedTableModel
extends ca.odell.glazedlists.swing.EventTableModel

TableModel that accepts a EventList.

By default, a WritableTableFormat will be generated for this model. If you want to change this, you can override the createTableFormat() method to provide your own format. In addition, an implementation of an AdvancedTableFormat is provided for use. It allows for the specification of an object prototype (for determining column classes) and the ability to specify comparators per column for sorting support.

This model can be given an Id, which is used in obtaining the text of the column headers.

Column header text is generated from the column property names in the method createColumnNames. Using the field face source configured, or the default application field face source if none was configured.

Author:
Peter De Bruycker, Larry Streepy, Mathias Broekelmann
See Also:
Serialized Form

Nested Class Summary
protected  class GlazedTableModel.DefaultAdvancedTableFormat
          This inner class can be used by derived implementations to use an AdvancedTableFormat instead of the default WritableTableFormat created by createTableFormat().
protected  class GlazedTableModel.DefaultTableFormat
          This inner class is the default TableFormat constructed.
 
Field Summary
 
Fields inherited from class ca.odell.glazedlists.swing.EventTableModel
swingThreadSource
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
GlazedTableModel(Class beanClass, ca.odell.glazedlists.EventList rows, String[] columnPropertyNames)
          Constructor using the provided row data and column property names.
GlazedTableModel(ca.odell.glazedlists.EventList rows, String[] columnPropertyNames)
          Constructor using the given model data and a null model Id.
GlazedTableModel(ca.odell.glazedlists.EventList rows, String[] columnPropertyNames, String modelId)
          Fully specified Constructor.
GlazedTableModel(String[] columnPropertyNames)
           
 
Method Summary
protected  String[] createColumnNames(String[] propertyColumnNames)
          Create the text for the column headers.
protected  ca.odell.glazedlists.gui.TableFormat createTableFormat()
          Construct the table format to use for this table model.
protected  String[] getColumnLabels()
           
protected  String[] getColumnPropertyNames()
           
protected  Object getColumnValue(Object row, int column)
           
protected  FieldFaceSource getFieldFaceSource()
           
 String getModelId()
          Get the model Id.
protected  boolean isEditable(Object row, int column)
          May be overridden to achieve control over editable columns.
protected  Object setColumnValue(Object row, Object value, int column)
           
 void setFieldFaceSource(FieldFaceSource fieldFaceSource)
           
 
Methods inherited from class ca.odell.glazedlists.swing.EventTableModel
dispose, getColumnClass, getColumnCount, getColumnName, getElementAt, getRowCount, getTableFormat, getValueAt, isCellEditable, listChanged, setTableFormat, 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
 

Constructor Detail

GlazedTableModel

public GlazedTableModel(String[] columnPropertyNames)

GlazedTableModel

public GlazedTableModel(Class beanClass,
                        ca.odell.glazedlists.EventList rows,
                        String[] columnPropertyNames)
Constructor using the provided row data and column property names. The model Id will be set from the class name of the given beanClass.

Parameters:
beanClass -
rows -
columnPropertyNames -

GlazedTableModel

public GlazedTableModel(ca.odell.glazedlists.EventList rows,
                        String[] columnPropertyNames)
Constructor using the given model data and a null model Id.

Parameters:
rows - The data for the model
columnPropertyNames - Names of properties to show in the table columns
modelId - Id for this model, used to create column header message keys

GlazedTableModel

public GlazedTableModel(ca.odell.glazedlists.EventList rows,
                        String[] columnPropertyNames,
                        String modelId)
Fully specified Constructor.

Parameters:
rows - The data for the model
columnPropertyNames - Names of properties to show in the table columns
modelId - Id for this model, used to create column header message keys
Method Detail

setFieldFaceSource

public void setFieldFaceSource(FieldFaceSource fieldFaceSource)

getFieldFaceSource

protected FieldFaceSource getFieldFaceSource()

getColumnValue

protected Object getColumnValue(Object row,
                                int column)

getColumnLabels

protected String[] getColumnLabels()

getColumnPropertyNames

protected String[] getColumnPropertyNames()

getModelId

public String getModelId()
Get the model Id.

Returns:
model Id

isEditable

protected boolean isEditable(Object row,
                             int column)
May be overridden to achieve control over editable columns.

Parameters:
row - the current row
column - the column
Returns:
editable

setColumnValue

protected Object setColumnValue(Object row,
                                Object value,
                                int column)

createColumnNames

protected String[] createColumnNames(String[] propertyColumnNames)
Create the text for the column headers. Use the model Id (if any) and the column property name to generate a series of message keys. Resolve those keys using the configured message source.

Parameters:
propertyColumnNames -
Returns:
array of column header text

createTableFormat

protected ca.odell.glazedlists.gui.TableFormat createTableFormat()
Construct the table format to use for this table model. This base implementation returns an instance of GlazedTableModel.DefaultTableFormat.

Returns:


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