|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jrefinery.report.function.AbstractFunction
com.jrefinery.report.function.TotalGroupSumFunction
A report function that calculates the sum of one field (column) from the TableModel. This function produces a global total. The total sum of the group is known when the group processing starts and the report is not performing a prepare-run. The sum is calculated in the prepare run and recalled in the printing run.
The function can be used in two ways:
The function undestands two parameters, the field parameter is required and
denotes the name of an ItemBand-field which gets summed up.
The parameter group denotes the name of a group. When this group is started,
the counter gets reseted to null. This parameter is optional.
| Field Summary | |
static java.lang.String |
FIELD_PROPERTY
Literal text for the 'field' property. |
static java.lang.String |
GROUP_PROPERTY
Literal text for the 'group' property. |
| Fields inherited from interface com.jrefinery.report.function.Expression |
AUTOACTIVATE_PROPERTY |
| Constructor Summary | |
TotalGroupSumFunction()
Constructs a new function. |
|
| Method Summary | |
java.lang.String |
getField()
Returns the field used by the function. |
java.lang.String |
getGroup()
Returns the name of the group to be totalled. |
Expression |
getInstance()
Return a completly separated copy of this function. |
java.lang.Object |
getValue()
Return the current function value. |
void |
groupStarted(ReportEvent event)
Receives notification that a group has started. |
void |
initialize()
Checks that the function has been correctly initialized. |
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 |
setField(java.lang.String field)
Sets the field name for the function. |
void |
setGroup(java.lang.String group)
Defines the name of the group to be totalled. |
| Methods inherited from class com.jrefinery.report.function.AbstractFunction |
clone, getDataRow, getDependencyLevel, getName, getProperties, getProperty, getProperty, groupFinished, isActive, itemsFinished, itemsStarted, pageFinished, pageStarted, reportDone, reportFinished, reportStarted, setDataRow, setDependencyLevel, setName, setProperties, setProperty |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String GROUP_PROPERTY
public static final java.lang.String FIELD_PROPERTY
| Constructor Detail |
public TotalGroupSumFunction()
Initially the function has no name...be sure to assign one before using the function.
| Method Detail |
public void reportInitialized(ReportEvent event)
reportInitialized in interface ReportListenerreportInitialized in class AbstractFunctionevent - the event.public void groupStarted(ReportEvent event)
groupStarted in interface ReportListenergroupStarted in class AbstractFunctionevent - the event.public void itemsAdvanced(ReportEvent event)
itemsAdvanced in interface ReportListeneritemsAdvanced in class AbstractFunctionevent - the event.public java.lang.String getGroup()
public void setGroup(java.lang.String group)
group - the group name.public java.lang.Object getValue()
The value depends (obviously) on the function implementation. For example, a page counting function will return the current page number.
getValue in interface Expressionpublic java.lang.String getField()
The field name corresponds to a column name in the report's TableModel.
public void setField(java.lang.String field)
The field name corresponds to a column name in the report's TableModel.
field - the field name (null not permitted).
public void initialize()
throws FunctionInitializeException
The default implementation checks that the function name is not null, and calls the isInitialized() method (now deprecated).
initialize in interface Expressioninitialize in class AbstractFunctionFunctionInitializeException - if the function name is not set or the call to
isInitialized returns false.public Expression getInstance()
getInstance in interface ExpressiongetInstance in class AbstractFunction
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||