org.displaytag.decorator
Class TotalTableDecorator

java.lang.Object
  extended by org.displaytag.decorator.TableDecorator
      extended by org.displaytag.decorator.TotalTableDecorator

public class TotalTableDecorator
extends TableDecorator

A table decorator which adds rows with totals (for column with the "total" attribute set) and subtotals (grouping by the column with a group="1" attribute).

Version:
$Id$
Author:
Fabrizio Giustina

Field Summary
protected  TableModel tableModel
          The table model.
 
Constructor Summary
TotalTableDecorator()
           
 
Method Summary
protected  java.lang.String createTotalRow(boolean grandTotal)
           
 java.lang.String finishRow()
          After every row completes we evaluate to see if we should be drawing a new total line and summing the results from the previous group.
 java.lang.Object getDecoratedObject()
          returns the decorated object.
 javax.servlet.jsp.PageContext getPageContext()
          returns the page context.
 boolean hasGetterFor(java.lang.String propertyName)
          Check if a getter exists for a given property.
 void init(javax.servlet.jsp.PageContext pageContext, java.lang.Object decorated)
          Deprecated. use #init(PageContext, Object, TableModel)
 void init(javax.servlet.jsp.PageContext context, java.lang.Object decorated, TableModel tableModel)
          Initialize the TableTecorator instance.
 boolean searchGetterFor(java.lang.String propertyName)
          Looks for a getter for the given property using introspection.
 void setSubtotalLabel(java.lang.String subtotalLabel)
          Setter for subtotalLabel.
 void setTotalLabel(java.lang.String totalLabel)
          Setter for totalLabel.
 java.lang.String startRow()
          Called at the beginning of a row.
 
Methods inherited from class org.displaytag.decorator.TableDecorator
addRowClass, addRowId, displayGroupedValue, endOfGroup, evaluate, finish, getCurrentRowObject, getListIndex, getViewIndex, initRow, isLastRow, startOfGroup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tableModel

protected TableModel tableModel
The table model.

Since:
1.1
Constructor Detail

TotalTableDecorator

public TotalTableDecorator()
Method Detail

setSubtotalLabel

public void setSubtotalLabel(java.lang.String subtotalLabel)
Setter for subtotalLabel.

Parameters:
subtotalLabel - The subtotalLabel to set.

setTotalLabel

public void setTotalLabel(java.lang.String totalLabel)
Setter for totalLabel.

Parameters:
totalLabel - The totalLabel to set.

init

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

Parameters:
context - PageContext
decorated - decorated object (usually a list)
tableModel - table model
See Also:
Decorator.init(PageContext, Object, TableModel)

startRow

public java.lang.String startRow()
Description copied from class: TableDecorator
Called at the beginning of a row. Can be subclassed to provide specific data at the beginning of a row

Overrides:
startRow in class TableDecorator
Returns:
null in the default implementation

finishRow

public final java.lang.String finishRow()
After every row completes we evaluate to see if we should be drawing a new total line and summing the results from the previous group.

Overrides:
finishRow in class TableDecorator
Returns:
String

createTotalRow

protected java.lang.String createTotalRow(boolean grandTotal)

init

public void init(javax.servlet.jsp.PageContext pageContext,
                 java.lang.Object decorated)
Deprecated. use #init(PageContext, Object, TableModel)

Initialize the TableTecorator instance.

Parameters:
pageContext - PageContext
decorated - decorated object (usually a list)
See Also:
init(PageContext, Object, TableModel)

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-2007 the Displaytag team. All Rights Reserved.