Class TotalCalculationFunction
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.function.AbstractExpression
-
- org.pentaho.reporting.engine.classic.core.function.AbstractFunction
-
- org.pentaho.reporting.engine.classic.core.function.TotalCalculationFunction
-
- All Implemented Interfaces:
Serializable
,Cloneable
,EventListener
,ReportListener
,Expression
,Function
public class TotalCalculationFunction extends AbstractFunction
A report function that stores the result of a calculation for a group or the complete report. This function can be used to convert simple running-functions into total-functions by wrapping them up. The wrapped up function will be evaluated as usual and the result at the end of the report and/or end of the group will be stored in the TotalCalculationFunction.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TotalCalculationFunction()
Constructs a new function.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getCrosstabFilterGroup()
String
getField()
Returns the field used by the function.String
getGroup()
Returns the name of the group to be totalled.Expression
getInstance()
Return a completly separated copy of this function.Object
getValue()
Return the current expression value.void
groupStarted(ReportEvent event)
Receives notification that a group has started.void
itemsAdvanced(ReportEvent event)
Receives notification that a row of data is being processed.void
reportInitialized(ReportEvent event)
Receives notification that the report has started.void
setCrosstabFilterGroup(String crosstabFilterGroup)
void
setField(String field)
Sets the field name for the function.void
setGroup(String group)
Defines the name of the group to be totalled.void
summaryRowSelection(ReportEvent event)
A crosstab specific event notifying crosstab-aware functions to select the result for the summary row cell that will be printed next.-
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractFunction
groupFinished, itemsFinished, itemsStarted, reportDone, reportFinished, reportStarted
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractExpression
clone, getDataRow, getDependencyLevel, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setActive, setDependencyLevel, setName, setPreserve, setRuntime
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.pentaho.reporting.engine.classic.core.function.Expression
clone, getDataRow, getDependencyLevel, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setDependencyLevel, setName, setRuntime
-
-
-
-
Method Detail
-
reportInitialized
public void reportInitialized(ReportEvent event)
Receives notification that the report has started.- Specified by:
reportInitialized
in interfaceReportListener
- Overrides:
reportInitialized
in classAbstractFunction
- Parameters:
event
- the event.
-
groupStarted
public void groupStarted(ReportEvent event)
Receives notification that a group has started.- Specified by:
groupStarted
in interfaceReportListener
- Overrides:
groupStarted
in classAbstractFunction
- Parameters:
event
- the event.
-
itemsAdvanced
public void itemsAdvanced(ReportEvent event)
Receives notification that a row of data is being processed.- Specified by:
itemsAdvanced
in interfaceReportListener
- Overrides:
itemsAdvanced
in classAbstractFunction
- Parameters:
event
- the event.
-
summaryRowSelection
public void summaryRowSelection(ReportEvent event)
Description copied from class:AbstractFunction
A crosstab specific event notifying crosstab-aware functions to select the result for the summary row cell that will be printed next.- Specified by:
summaryRowSelection
in interfaceReportListener
- Overrides:
summaryRowSelection
in classAbstractFunction
- Parameters:
event
- The report event.
-
getGroup
public String getGroup()
Returns the name of the group to be totalled.- Returns:
- the group name.
-
setGroup
public void setGroup(String group)
Defines the name of the group to be totalled. If the name is null, all groups are totalled.- Parameters:
group
- the group name.
-
getField
public String getField()
Returns the field used by the function. The field name corresponds to a column name in the report's data-row.- Returns:
- The field name.
-
setField
public void setField(String field)
Sets the field name for the function. The field name corresponds to a column name in the report's data-row.- Parameters:
field
- the field name.
-
getValue
public Object getValue()
Return the current expression value.The value depends (obviously) on the expression implementation.
- Returns:
- the value of the function.
-
getCrosstabFilterGroup
public String getCrosstabFilterGroup()
-
setCrosstabFilterGroup
public void setCrosstabFilterGroup(String crosstabFilterGroup)
-
getInstance
public Expression getInstance()
Description copied from class:AbstractExpression
Return a completly separated copy of this function. The copy does no longer share any changeable objects with the original function.- Specified by:
getInstance
in interfaceExpression
- Overrides:
getInstance
in classAbstractExpression
- Returns:
- a copy of this function.
-
-