org.apache.tapestry.contrib.table.model.common
Class AbstractTableColumn

java.lang.Object
  extended by org.apache.tapestry.contrib.table.model.common.AbstractTableColumn
All Implemented Interfaces:
Serializable, ITableColumn
Direct Known Subclasses:
SimpleTableColumn

public class AbstractTableColumn
extends Object
implements ITableColumn, Serializable

A base implementation of ITableColumn that allows renderers to be set via aggregation.

Since:
2.3
Version:
$Id: AbstractTableColumn.java 243808 2004-02-28 10:26:15Z mindbridge $
Author:
mindbridge
See Also:
ITableRendererSource, Serialized Form

Field Summary
static String COLUMN_RENDERER_BLOCK_SUFFIX
          The suffix of the name of the Block that will be used as the column renderer for this column
static String VALUE_RENDERER_BLOCK_SUFFIX
          The suffix of the name of the Block that will be used as the value renderer for this column
 
Constructor Summary
AbstractTableColumn()
           
AbstractTableColumn(String strColumnName, boolean bSortable, Comparator objComparator)
           
AbstractTableColumn(String strColumnName, boolean bSortable, Comparator objComparator, ITableRendererSource objColumnRendererSource, ITableRendererSource objValueRendererSource)
           
 
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.
 ITableRendererSource getColumnRendererSource()
          Returns the columnRendererSource.
 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.
 ITableRendererSource getValueRendererSource()
          Returns the valueRendererSource.
 void loadSettings(IComponent objSettingsContainer)
          Use the column name to get the column and value renderer sources from the provided component.
 void setColumnName(String columnName)
          Sets the columnName.
 void setColumnRendererSource(ITableRendererSource columnRendererSource)
          Sets the columnRendererSource.
 void setComparator(Comparator comparator)
          Sets the comparator.
 void setSortable(boolean sortable)
          Sets whether the column is sortable.
 void setValueRendererSource(ITableRendererSource valueRendererSource)
          Sets the valueRendererSource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COLUMN_RENDERER_BLOCK_SUFFIX

public static final String COLUMN_RENDERER_BLOCK_SUFFIX
The suffix of the name of the Block that will be used as the column renderer for this column

See Also:
Constant Field Values

VALUE_RENDERER_BLOCK_SUFFIX

public static final String VALUE_RENDERER_BLOCK_SUFFIX
The suffix of the name of the Block that will be used as the value renderer for this column

See Also:
Constant Field Values
Constructor Detail

AbstractTableColumn

public AbstractTableColumn()

AbstractTableColumn

public AbstractTableColumn(String strColumnName,
                           boolean bSortable,
                           Comparator objComparator)

AbstractTableColumn

public AbstractTableColumn(String strColumnName,
                           boolean bSortable,
                           Comparator objComparator,
                           ITableRendererSource objColumnRendererSource,
                           ITableRendererSource objValueRendererSource)
Method Detail

getColumnName

public String getColumnName()
Description copied from interface: ITableColumn
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).

Specified by:
getColumnName in interface ITableColumn
Returns:
String the name of the column
See Also:
ITableColumn.getColumnName()

setColumnName

public void setColumnName(String columnName)
Sets the columnName.

Parameters:
columnName - The columnName to set

getSortable

public boolean getSortable()
Description copied from interface: ITableColumn
Method getSortable declares whether the column allows sorting. If the column allows sorting, it must also return a valid Comparator via the getComparator() method.

Specified by:
getSortable in interface ITableColumn
Returns:
boolean whether the column is sortable or not
See Also:
ITableColumn.getSortable()

setSortable

public void setSortable(boolean sortable)
Sets whether the column is sortable.

Parameters:
sortable - The sortable flag to set

getComparator

public Comparator getComparator()
Description copied from interface: ITableColumn
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.

Specified by:
getComparator in interface ITableColumn
Returns:
Comparator the Comparator used to sort the table data
See Also:
ITableColumn.getComparator()

setComparator

public void setComparator(Comparator comparator)
Sets the comparator.

Parameters:
comparator - The comparator to set

getColumnRenderer

public IRender getColumnRenderer(IRequestCycle objCycle,
                                 ITableModelSource objSource)
Description copied from interface: ITableColumn
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.

Specified by:
getColumnRenderer in interface ITableColumn
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
See Also:
ITableColumn.getColumnRenderer(IRequestCycle, ITableModelSource)

getValueRenderer

public IRender getValueRenderer(IRequestCycle objCycle,
                                ITableModelSource objSource,
                                Object objRow)
Description copied from interface: ITableColumn
Method getValueRenderer provides a renderer for presenting the value of a particular row in the current column.

Specified by:
getValueRenderer in interface ITableColumn
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
See Also:
ITableColumn.getValueRenderer(IRequestCycle, ITableModelSource, Object)

getColumnRendererSource

public ITableRendererSource getColumnRendererSource()
Returns the columnRendererSource.

Returns:
ITableColumnRendererSource

setColumnRendererSource

public void setColumnRendererSource(ITableRendererSource columnRendererSource)
Sets the columnRendererSource.

Parameters:
columnRendererSource - The columnRendererSource to set

getValueRendererSource

public ITableRendererSource getValueRendererSource()
Returns the valueRendererSource.

Returns:
the valueRendererSource of this column

setValueRendererSource

public void setValueRendererSource(ITableRendererSource valueRendererSource)
Sets the valueRendererSource.

Parameters:
valueRendererSource - The valueRendererSource to set

loadSettings

public void loadSettings(IComponent objSettingsContainer)
Use the column name to get the column and value renderer sources from the provided component.

Parameters:
objSettingsContainer - the component from which to get the settings