org.pentaho.reporting.engine.classic.core.function
Class PageOfPagesFunction

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.function.AbstractExpression
      extended by org.pentaho.reporting.engine.classic.core.function.AbstractFunction
          extended by org.pentaho.reporting.engine.classic.core.function.PageFunction
              extended by org.pentaho.reporting.engine.classic.core.function.PageOfPagesFunction
All Implemented Interfaces:
Serializable, Cloneable, EventListener, PageEventListener, ReportListener, Expression, Function

public class PageOfPagesFunction
extends PageFunction

A report function that combines PageFunctionand PageTotalFunction. Restrictions for both classes apply to this one also.

Author:
Jörg Schaible
See Also:
Serialized Form

Constructor Summary
PageOfPagesFunction()
          Default Constructor.
PageOfPagesFunction(String name)
          Constructs a named function.
 
Method Summary
 Object clone()
          Creates a copy of the function.
 int getDependencyLevel()
          Returns the defined dependency level.
 String getFormat()
          Returns the format used to print the value.
 Expression getInstance()
          Return a completly separated copy of this function.
 Object getValue()
          Return the value of this Function.
 void groupFinished(ReportEvent event)
          Receives notification that a group has finished.
 void groupStarted(ReportEvent event)
          Forwards the report event to both the base class and the page-total function delegate.
 void pageFinished(ReportEvent event)
          Forwards the report event to both the base class and the page-total function delegate.
 void pageStarted(ReportEvent event)
          Forwards the report event to both the base class and the page-total function delegate.
 void reportDone(ReportEvent event)
          Receives notification that report generation has completed, the report footer was printed, no more output is done.
 void reportInitialized(ReportEvent event)
          Forwards the report event to both the base class and the page-total function delegate.
 void setDependencyLevel(int level)
          Defines the defined dependency level.
 void setFormat(String format)
          Set the format of the value.
 void setGroup(String group)
          Sets the name of the group that the function acts upon.
 void setRuntime(ExpressionRuntime runtime)
          Defines the ExpressionRune used in this expression.
 void setStartPage(int startPage)
          Defines the page number where the counting starts.
 
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.PageFunction
getGroup, getPage, getPageIncrement, getStartPage, isDeepTraversing, setIgnorePageCancelEvents, setPageIncrement
 
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractFunction
itemsAdvanced, itemsFinished, itemsStarted, reportFinished, reportStarted
 
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractExpression
getDataRow, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isPreserve, setActive, setName, setPreserve
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.pentaho.reporting.engine.classic.core.function.Expression
getDataRow, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isPreserve, setName
 

Constructor Detail

PageOfPagesFunction

public PageOfPagesFunction()
Default Constructor.


PageOfPagesFunction

public PageOfPagesFunction(String name)
Constructs a named function.

Parameters:
name - the function name.
Method Detail

getFormat

public String getFormat()
Returns the format used to print the value. The default format is "{0} / {1}".

Returns:
the format string.
See Also:
MessageFormat

setFormat

public void setFormat(String format)
Set the format of the value. The format should follow the rules of MessageFormat. The first parameter is filled with the current page, the second with the total number of pages.

Parameters:
format - the format string.

reportInitialized

public void reportInitialized(ReportEvent event)
Forwards the report event to both the base class and the page-total function delegate.

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

pageStarted

public void pageStarted(ReportEvent event)
Forwards the report event to both the base class and the page-total function delegate.

Specified by:
pageStarted in interface PageEventListener
Overrides:
pageStarted in class PageFunction
Parameters:
event - the received report event.

pageFinished

public void pageFinished(ReportEvent event)
Forwards the report event to both the base class and the page-total function delegate.

Specified by:
pageFinished in interface PageEventListener
Overrides:
pageFinished in class PageFunction
Parameters:
event - the received report event.

groupStarted

public void groupStarted(ReportEvent event)
Forwards the report event to both the base class and the page-total function delegate.

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

groupFinished

public void groupFinished(ReportEvent event)
Description copied from class: AbstractFunction
Receives notification that a group has finished.

Specified by:
groupFinished in interface ReportListener
Overrides:
groupFinished in class AbstractFunction
Parameters:
event - the event.

reportDone

public void reportDone(ReportEvent event)
Receives notification that report generation has completed, the report footer was printed, no more output is done. This is a helper event to shut down the output service.

Specified by:
reportDone in interface ReportListener
Overrides:
reportDone in class AbstractFunction
Parameters:
event - The event.

getValue

public Object getValue()
Return the value of this Function. The method uses the format definition from the properties and adds the current page and the total number of pages as parameter.

Specified by:
getValue in interface Expression
Overrides:
getValue in class PageFunction
Returns:
the formatted value with current page and total number of pages.

setGroup

public void setGroup(String group)
Sets the name of the group that the function acts upon.

Overrides:
setGroup in class PageFunction
Parameters:
group - the group name.

setStartPage

public void setStartPage(int startPage)
Defines the page number where the counting starts.

Overrides:
setStartPage in class PageFunction
Parameters:
startPage - the page number of the first page.

setDependencyLevel

public void setDependencyLevel(int level)
Defines the defined dependency level. For page functions, this level can be as low as the pagination level.

Specified by:
setDependencyLevel in interface Expression
Overrides:
setDependencyLevel in class PageFunction
Parameters:
level - the dependency level.

getDependencyLevel

public int getDependencyLevel()
Returns the defined dependency level. For page functions, this level can be as low as the pagination level.

Specified by:
getDependencyLevel in interface Expression
Overrides:
getDependencyLevel in class PageFunction
Returns:
the dependency level.

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 AbstractExpression
Returns:
a copy of this function.

setRuntime

public void setRuntime(ExpressionRuntime runtime)
Defines the ExpressionRune used in this expression. The ExpressionRuntime is set before the expression receives events or gets evaluated and is unset afterwards. Do not hold references on the runtime or you will create memory-leaks.

Specified by:
setRuntime in interface Expression
Overrides:
setRuntime in class AbstractExpression
Parameters:
runtime - the runtime information for the expression

clone

public Object clone()
             throws CloneNotSupportedException
Creates a copy of the function.

Specified by:
clone in interface Expression
Overrides:
clone in class AbstractExpression
Returns:
the clone.
Throws:
CloneNotSupportedException - if an error occurs.