org.apache.tapestry.contrib.table.model.simple
Class SimpleTableColumn

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

public class SimpleTableColumn
extends AbstractTableColumn

A simple minimal implementation of the ITableColumn interface that provides all the basic services for displaying a column.

Version:
$Id: SimpleTableColumn.java 243808 2004-02-28 10:26:15Z mindbridge $
Author:
mindbridge
See Also:
Serialized Form

Nested Class Summary
 class SimpleTableColumn.DefaultTableComparator
           
 
Field Summary
static ITableRendererSource DEFAULT_COLUMN_RENDERER_SOURCE
           
static ITableRendererSource DEFAULT_VALUE_RENDERER_SOURCE
           
static ITableRendererSource FORM_COLUMN_RENDERER_SOURCE
           
 
Fields inherited from class org.apache.tapestry.contrib.table.model.common.AbstractTableColumn
COLUMN_RENDERER_BLOCK_SUFFIX, VALUE_RENDERER_BLOCK_SUFFIX
 
Constructor Summary
SimpleTableColumn(String strColumnName)
          Creates a SimpleTableColumn
SimpleTableColumn(String strColumnName, boolean bSortable)
          Creates a SimpleTableColumn
SimpleTableColumn(String strColumnName, ITableColumnEvaluator objEvaluator, boolean bSortable)
          Creates a SimpleTableColumn
SimpleTableColumn(String strColumnName, String strDisplayName)
          Creates a SimpleTableColumn
SimpleTableColumn(String strColumnName, String strDisplayName, boolean bSortable)
          Creates a SimpleTableColumn
SimpleTableColumn(String strColumnName, String strDisplayName, ITableColumnEvaluator objEvaluator, boolean bSortable)
          Creates a SimpleTableColumn
 
Method Summary
 Object getColumnValue(Object objRow)
          Extracts the value of the column from the row object
 String getDisplayName()
          Returns the display name of the column that will be used in the table header.
 ITableColumnEvaluator getEvaluator()
          Returns the evaluator.
 void loadSettings(IComponent objSettingsContainer)
          Use the column name to get the display name, as well as the column and value renderer sources from the provided component.
 void setColumnComparator(Comparator comparator)
          Sets a comparator that compares the values of this column rather than the objects representing the full rows.
 void setDisplayName(String displayName)
          Sets the displayName.
 void setEvaluator(ITableColumnEvaluator evaluator)
          Sets the evaluator.
 
Methods inherited from class org.apache.tapestry.contrib.table.model.common.AbstractTableColumn
getColumnName, getColumnRenderer, getColumnRendererSource, getComparator, getSortable, getValueRenderer, getValueRendererSource, setColumnName, setColumnRendererSource, setComparator, setSortable, setValueRendererSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_COLUMN_RENDERER_SOURCE

public static final ITableRendererSource DEFAULT_COLUMN_RENDERER_SOURCE

FORM_COLUMN_RENDERER_SOURCE

public static final ITableRendererSource FORM_COLUMN_RENDERER_SOURCE

DEFAULT_VALUE_RENDERER_SOURCE

public static final ITableRendererSource DEFAULT_VALUE_RENDERER_SOURCE
Constructor Detail

SimpleTableColumn

public SimpleTableColumn(String strColumnName)
Creates a SimpleTableColumn

Parameters:
strColumnName - the identifying name and display name of the column

SimpleTableColumn

public SimpleTableColumn(String strColumnName,
                         boolean bSortable)
Creates a SimpleTableColumn

Parameters:
strColumnName - the identifying name and display name of the column
bSortable - whether the column is sortable

SimpleTableColumn

public SimpleTableColumn(String strColumnName,
                         ITableColumnEvaluator objEvaluator,
                         boolean bSortable)
Creates a SimpleTableColumn

Parameters:
strColumnName - the identifying name and display name of the column
bSortable - whether the column is sortable
objEvaluator - the evaluator to extract the column value from the row

SimpleTableColumn

public SimpleTableColumn(String strColumnName,
                         String strDisplayName)
Creates a SimpleTableColumn

Parameters:
strColumnName - the identifying name of the column
strDisplayName - the display name of the column

SimpleTableColumn

public SimpleTableColumn(String strColumnName,
                         String strDisplayName,
                         boolean bSortable)
Creates a SimpleTableColumn

Parameters:
strColumnName - the identifying name of the column
strDisplayName - the display name of the column
bSortable - whether the column is sortable

SimpleTableColumn

public SimpleTableColumn(String strColumnName,
                         String strDisplayName,
                         ITableColumnEvaluator objEvaluator,
                         boolean bSortable)
Creates a SimpleTableColumn

Parameters:
strColumnName - the identifying name of the column
strDisplayName - the display name of the column
bSortable - whether the column is sortable
objEvaluator - the evaluator to extract the column value from the row
Method Detail

getDisplayName

public String getDisplayName()
Returns the display name of the column that will be used in the table header. Override for internationalization.

Returns:
String the display name of the column

setDisplayName

public void setDisplayName(String displayName)
Sets the displayName.

Parameters:
displayName - The displayName to set

getEvaluator

public ITableColumnEvaluator getEvaluator()
Returns the evaluator.

Returns:
ITableColumnEvaluator

setEvaluator

public void setEvaluator(ITableColumnEvaluator evaluator)
Sets the evaluator.

Parameters:
evaluator - The evaluator to set

setColumnComparator

public void setColumnComparator(Comparator comparator)
Sets a comparator that compares the values of this column rather than the objects representing the full rows.
This method allows easier use of standard comparators for sorting the column. It simply wraps the provided comparator with a row-to-column convertor and invokes the setComparator() method.

Parameters:
comparator - The column value comparator

getColumnValue

public Object getColumnValue(Object objRow)
Extracts the value of the column from the row object

Parameters:
objRow - the row object
Returns:
Object the column value

loadSettings

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

Overrides:
loadSettings in class AbstractTableColumn
Parameters:
objSettingsContainer - the component from which to get the settings