|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jfree.report.function.AbstractFunction
org.jfree.report.function.ItemSumFunction
A report function that calculates the sum of one field (column) from the TableModel. This function produces a running total, no global total. For a global sum, use the TotalGroupSumFunction function. 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.
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 org.jfree.report.function.Expression |
AUTOACTIVATE_PROPERTY |
Constructor Summary | |
ItemSumFunction()
Constructs an unnamed function. |
|
ItemSumFunction(java.lang.String name)
Constructs a named function. |
Method Summary | |
java.lang.String |
getField()
Returns the field used by the function. |
java.lang.String |
getGroup()
Returns the group name. |
Expression |
getInstance()
Return a completly separated copy of this function. |
java.lang.Object |
getValue()
Returns the function value, in this case the running total of a specific column in the report's TableModel. |
void |
groupStarted(ReportEvent event)
Receives notification that a new group is about to start. |
void |
initialize()
Initializes the function and tests that all required properties are set. |
void |
itemsAdvanced(ReportEvent event)
Receives notification that a row of data is being processed. |
void |
reportInitialized(ReportEvent event)
Receives notification that a new report is about to start. |
void |
setField(java.lang.String field)
Sets the field name for the function. |
void |
setGroup(java.lang.String name)
Sets the group name. |
Methods inherited from class org.jfree.report.function.AbstractFunction |
clone, getDataRow, getDependencyLevel, getName, getProperties, getProperty, getProperty, groupFinished, isActive, itemsFinished, itemsStarted, 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 ItemSumFunction()
public ItemSumFunction(java.lang.String name)
The field must be defined before using the function.
name
- The function name.Method Detail |
public void reportInitialized(ReportEvent event)
Does nothing.
reportInitialized
in interface ReportListener
reportInitialized
in class AbstractFunction
event
- Information about the event.public void groupStarted(ReportEvent event)
groupStarted
in interface ReportListener
groupStarted
in class AbstractFunction
event
- Information about the event.public java.lang.String getGroup()
public void setGroup(java.lang.String name)
If a group is defined, the running total is reset to zero at the start of every instance of this group.
name
- the group name (null permitted).public 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 itemsAdvanced(ReportEvent event)
This function assumes that it will find an instance of the Number class in the column of the TableModel specified by the field name.
itemsAdvanced
in interface ReportListener
itemsAdvanced
in class AbstractFunction
event
- Information about the event.public java.lang.Object getValue()
getValue
in interface Expression
public void initialize() throws FunctionInitializeException
initialize
in interface Expression
initialize
in class AbstractFunction
FunctionInitializeException
- when no field is set.public Expression getInstance()
getInstance
in interface Expression
getInstance
in class AbstractFunction
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |