org.displaytag.decorator
Class TableDecorator

java.lang.Object
  extended byorg.displaytag.decorator.Decorator
      extended byorg.displaytag.decorator.TableDecorator
Direct Known Subclasses:
TotalWrapper, Wrapper

public abstract class TableDecorator
extends org.displaytag.decorator.Decorator

Version:
$Revision: 1.11 $ ($Author: fgiust $)
Author:
epesh, Fabrizio Giustina

Constructor Summary
TableDecorator()
           
 
Method Summary
 void finish()
          Called at the end of evaluation.
 java.lang.String finishRow()
          Called at the end of a row.
 java.lang.Object getCurrentRowObject()
          Get the object representing the current row.
 java.lang.Object getDecoratedObject()
          returns the decorated object.
 int getListIndex()
          return the index in the original list.
 javax.servlet.jsp.PageContext getPageContext()
          returns the page context.
 int getViewIndex()
          return the index in the displayed list.
 boolean hasGetterFor(java.lang.String propertyName)
          Check if a getter exists for a given property.
 void init(javax.servlet.jsp.PageContext context, java.lang.Object decorated)
          Initialize the TableTecorator instance.
 void initRow(java.lang.Object rowObject, int currentViewIndex, int currentListIndex)
          Initialize the current row.
 boolean searchGetterFor(java.lang.String propertyName)
          Looks for a getter for the given property using introspection.
 java.lang.String startRow()
          Called at the beginning of a row.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableDecorator

public TableDecorator()
Method Detail

getViewIndex

public final int getViewIndex()
return the index in the displayed list.

Returns:
int index in the displayed list

getListIndex

public final int getListIndex()
return the index in the original list.

Returns:
int index in the original list

getCurrentRowObject

public final java.lang.Object getCurrentRowObject()
Get the object representing the current row.

Returns:
Object

initRow

public final void initRow(java.lang.Object rowObject,
                          int currentViewIndex,
                          int currentListIndex)
Initialize the current row. Note this method is also called when sorting a table using a property supplied by the table decorator, so the method could be called multiple times during rendering. When used to initialize sorting the method is always called with 0, 0 as currentViewIndex and currentListIndex.

Parameters:
rowObject - object representing the current row
currentViewIndex - int index in the displayed list
currentListIndex - int index in the original list

startRow

public java.lang.String startRow()
Called at the beginning of a row. Can be subclassed to provide specific data at the beginning of a row

Returns:
null in the default implementation

finishRow

public java.lang.String finishRow()
Called at the end of a row. Can be subclassed to provide specific data at the end of a row

Returns:
null in the default implementation

finish

public void finish()
Called at the end of evaluation. Can be subclassed to eventully clean up data. Always remember to also call super.finish()!


init

public void init(javax.servlet.jsp.PageContext context,
                 java.lang.Object decorated)
Initialize the TableTecorator instance.

Parameters:
context - PageContext
decorated - decorated object (usually a list)

getPageContext

public javax.servlet.jsp.PageContext getPageContext()
returns the page context.

Returns:
PageContext

getDecoratedObject

public java.lang.Object getDecoratedObject()
returns the decorated object.

Returns:
Object

hasGetterFor

public boolean hasGetterFor(java.lang.String propertyName)
Check if a getter exists for a given property. Uses cached info if property has already been requested. This method only check for a simple property, if pPropertyName contains multiple tokens only the first part is evaluated

Parameters:
propertyName - name of the property to check
Returns:
boolean true if the decorator has a getter for the given property

searchGetterFor

public boolean searchGetterFor(java.lang.String propertyName)
Looks for a getter for the given property using introspection.

Parameters:
propertyName - name of the property to check
Returns:
boolean true if the decorator has a getter for the given property


Copyright © 2002-2005 the Displaytag team. All Rights Reserved.