com.jrefinery.report.function
Class PageTotalFunction

java.lang.Object
  |
  +--com.jrefinery.report.function.AbstractFunction
        |
        +--com.jrefinery.report.function.PageFunction
              |
              +--com.jrefinery.report.function.PageTotalFunction
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, Expression, Function, PageEventListener, ReportListener, java.io.Serializable

public class PageTotalFunction
extends PageFunction

This function will only work as expected in group mode if the named group has pagebreak set to true. This function depends on pageEvents, so use it with PageableProcessor only. FunctionFlow: if autmatic pagebreak: fireGroupFinish -> PageFull, group footer cannot be printed yet firePageFinish -> groupFooter is printed fireGroupStarted firePageFinish // manual pagebreak -> groupHeader is printed if manual pagebreak only fireGroupFinish -> print GroupFooter fireGroupStarted firePageFinish // manual pagebreak -> groupHeader is printed

Author:
Thomas Morgner
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.jrefinery.report.function.Expression
AUTOACTIVATE_PROPERTY
 
Constructor Summary
PageTotalFunction()
          Creates a new page total function.
 
Method Summary
 Expression getInstance()
          Return a completly separated copy of this function.
protected  int getPage()
          Returns the page number.
 java.lang.Object getValue()
          Returns the page number (function value).
 void groupStarted(ReportEvent event)
          Receives notification that a group has started.
 void initialize()
          Checks that the function has been correctly initialized.
 void pageStarted(ReportEvent event)
          Receives notification from the report engine that a new page is starting.
 void reportInitialized(ReportEvent event)
          Receives notification that the report has started.
protected  void setPage(int page)
          Sets the page number.
 
Methods inherited from class com.jrefinery.report.function.PageFunction
getGroup, getStartPage, isIgnorePageCancelEvents, pageCanceled, setGroup
 
Methods inherited from class com.jrefinery.report.function.AbstractFunction
clone, getDataRow, getDependencyLevel, getName, getProperties, getProperty, getProperty, groupFinished, isActive, itemsAdvanced, itemsFinished, itemsStarted, pageFinished, 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
 
Methods inherited from interface com.jrefinery.report.event.PageEventListener
pageFinished
 

Constructor Detail

PageTotalFunction

public PageTotalFunction()
Creates a new page total function.

Method Detail

reportInitialized

public void reportInitialized(ReportEvent event)
Receives notification that the report has started.

Specified by:
reportInitialized in interface ReportListener
Overrides:
reportInitialized in class PageFunction
Parameters:
event - the event.

pageStarted

public void pageStarted(ReportEvent event)
Receives notification from the report engine that a new page is starting. Grabs the page number from the report state and stores it.

Prepared data is bound to the display item, the current displayed row.

Specified by:
pageStarted in interface PageEventListener
Overrides:
pageStarted in class PageFunction
Parameters:
event - Information about the event.

groupStarted

public void groupStarted(ReportEvent event)
Receives notification that a group has started.

If no group is specified for the function, then the event is ignored.

Specified by:
groupStarted in interface ReportListener
Overrides:
groupStarted in class PageFunction
Parameters:
event - the event.

setPage

protected void setPage(int page)
Sets the page number.

Overrides:
setPage in class PageFunction
Parameters:
page - the page number.

getPage

protected int getPage()
Returns the page number.

Overrides:
getPage in class PageFunction
Returns:
the page number.

getValue

public java.lang.Object getValue()
Returns the page number (function value).

Specified by:
getValue in interface Expression
Overrides:
getValue in class PageFunction
Returns:
the page number.

initialize

public void initialize()
                throws FunctionInitializeException
Checks that the function has been correctly initialized. If there is a problem, this method throws a FunctionInitializeException.

Specified by:
initialize in interface Expression
Overrides:
initialize in class PageFunction
Throws:
FunctionInitializeException - if the function name is not set or the call to isInitialized returns false.

getInstance

public Expression getInstance()
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 interface Expression
Overrides:
getInstance in class AbstractFunction
Returns:
a copy of this function.