org.springframework.richclient.table.support
Class GlazedTableModel.DefaultAdvancedTableFormat

java.lang.Object
  extended by org.springframework.richclient.table.support.GlazedTableModel.DefaultAdvancedTableFormat
All Implemented Interfaces:
ca.odell.glazedlists.gui.AdvancedTableFormat, ca.odell.glazedlists.gui.TableFormat
Enclosing class:
GlazedTableModel

protected class GlazedTableModel.DefaultAdvancedTableFormat
extends Object
implements ca.odell.glazedlists.gui.AdvancedTableFormat

This inner class can be used by derived implementations to use an AdvancedTableFormat instead of the default WritableTableFormat created by GlazedTableModel.createTableFormat().

If a prototype value is provided (see setPrototypeValue(Object), then the default implementation of getColumnClass will inspect the prototype object to determine the Class of the object in that column (by looking at the type of the property in that column). If no prototype is provided, then getColumnClass will inspect the current table data in order to determine the class of object in that column. If there are no non-null values in the column, then getColumnClass will return Object.class, which is not very usable. In that case, you should probably override getColumnClass(int).

You can specify individual comparators for columns using setComparator(int, Comparator). For any column that doesn't have a comparator installed, a default comparable comparator will be handed out by getColumnComparator(int).


Constructor Summary
GlazedTableModel.DefaultAdvancedTableFormat()
           
 
Method Summary
 Class getColumnClass(int column)
          Returns the class for all the cell values in the column.
 Comparator getColumnComparator(int column)
          Get the comparator to use on values in the given column.
 int getColumnCount()
           
 String getColumnName(int column)
           
 Object getColumnValue(Object row, int column)
           
 void setComparator(int column, Comparator comparator)
          Set the comparator to use for a given column.
 void setPrototypeValue(Object prototype)
          Set the prototype value from which to determine column classes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlazedTableModel.DefaultAdvancedTableFormat

public GlazedTableModel.DefaultAdvancedTableFormat()
Method Detail

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface ca.odell.glazedlists.gui.TableFormat

getColumnName

public String getColumnName(int column)
Specified by:
getColumnName in interface ca.odell.glazedlists.gui.TableFormat

getColumnValue

public Object getColumnValue(Object row,
                             int column)
Specified by:
getColumnValue in interface ca.odell.glazedlists.gui.TableFormat

getColumnClass

public Class getColumnClass(int column)
Returns the class for all the cell values in the column. This is used by the table to set up a default renderer and editor for the column. If a prototype object has been specified, then the class will be obtained using introspection using the property name associated with the specified column. If no prorotype has been specified, then the current objects in the table will be inspected to determine the class of values in that column. If no non-null column value is available, then Object.class is returned.

Specified by:
getColumnClass in interface ca.odell.glazedlists.gui.AdvancedTableFormat
Parameters:
column - The index of the column being edited.
Returns:
Class of the values in the column

getColumnComparator

public Comparator getColumnComparator(int column)
Get the comparator to use on values in the given column. If a comparator for this column has been installed by calling setComparator(int, Comparator), then it is returned. If not, then a default comparator (assuming the objects implement Comparable) is returned.

Specified by:
getColumnComparator in interface ca.odell.glazedlists.gui.AdvancedTableFormat
Parameters:
column - the column
Returns:
the Comparator to use or null for an unsortable column.

setComparator

public void setComparator(int column,
                          Comparator comparator)
Set the comparator to use for a given column.

Parameters:
column - The column for which the compartor is to be used
comparator - The comparator to install

setPrototypeValue

public void setPrototypeValue(Object prototype)
Set the prototype value from which to determine column classes. If a prototype value is not provided, then the default implementation of getColumnClass will return Object.class, which is not very usable. If you don't provide a prototype, you should probably override getColumnClass(int).



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