org.apache.tapestry.contrib.table.model
Interface ITableColumn

All Known Implementing Classes:
AbstractTableColumn, ExpressionTableColumn, SimpleTableColumn, SqlTableColumn, TreeTableColumn

public interface ITableColumn

The interface defining a table column. A column is responsible for presenting a particular part of the data from the objects in the table. This is done via the getValueRender() method. A column may be sortable, in which case it defines the way in which the objects in the table must be sorted by providing a Comparator.

Version:
$Id: ITableColumn.java 243791 2004-02-19 17:38:13Z hlship $
Author:
mindbridge

Method Summary
 String getColumnName()
          Method getColumnName provides the name of the column.
 IRender getColumnRenderer(IRequestCycle objCycle, ITableModelSource objSource)
          Method getColumnRenderer provides a renderer that takes care of rendering the column in the table header.
 Comparator getComparator()
          Method getComparator returns the Comparator to be used to sort the data in the table according to this column.
 boolean getSortable()
          Method getSortable declares whether the column allows sorting.
 IRender getValueRenderer(IRequestCycle objCycle, ITableModelSource objSource, Object objRow)
          Method getValueRenderer provides a renderer for presenting the value of a particular row in the current column.
 

Method Detail

getColumnName

String getColumnName()
Method getColumnName provides the name of the column. The column name must be unique and is generally used for the identification of the column. It does not have to be the same as the display name via which the column is identified to the user (see the getColumnRender() method).

Returns:
String the name of the column

getSortable

boolean getSortable()
Method getSortable declares whether the column allows sorting. If the column allows sorting, it must also return a valid Comparator via the getComparator() method.

Returns:
boolean whether the column is sortable or not

getComparator

Comparator getComparator()
Method getComparator returns the Comparator to be used to sort the data in the table according to this column. The Comparator must accept two different rows, compare them according to this column, and return the appropriate value.

Returns:
Comparator the Comparator used to sort the table data

getColumnRenderer

IRender getColumnRenderer(IRequestCycle objCycle,
                          ITableModelSource objSource)
Method getColumnRenderer provides a renderer that takes care of rendering the column in the table header. If the column is sortable, the renderer may provide a mechanism to sort the table in an ascending or descending manner.

Parameters:
objCycle - the current request cycle
objSource - a component that can provide the table model (typically TableView)
Returns:
IRender the renderer to present the column header

getValueRenderer

IRender getValueRenderer(IRequestCycle objCycle,
                         ITableModelSource objSource,
                         Object objRow)
Method getValueRenderer provides a renderer for presenting the value of a particular row in the current column.

Parameters:
objCycle - the current request cycle
objSource - a component that can provide the table model (typically TableView)
objRow - the row data
Returns:
IRender the renderer to present the value of the row in this column