Class PageOfPagesFunction
- 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.PageFunction
-
- 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 combinesPageFunction
andPageTotalFunction
. Restrictions for both classes apply to this one also.- Author:
- Jörg Schaible
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PageOfPagesFunction()
Default Constructor.PageOfPagesFunction(String name)
Constructs a named function.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 thisFunction
.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, isIgnoreNextGroupStart, isIgnoreNextPageStart, isIgnorePageCancelEvents, setIgnorePageCancelEvents, setPage, setPageIncrement
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractFunction
itemsAdvanced, itemsFinished, itemsStarted, reportFinished, reportStarted, summaryRowSelection
-
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, finalize, 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 ofMessageFormat
. 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 interfaceReportListener
- Overrides:
reportInitialized
in classPageFunction
- 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 interfacePageEventListener
- Overrides:
pageStarted
in classPageFunction
- 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 interfacePageEventListener
- Overrides:
pageFinished
in classPageFunction
- 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 interfaceReportListener
- Overrides:
groupStarted
in classPageFunction
- 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 interfaceReportListener
- Overrides:
groupFinished
in classAbstractFunction
- 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 interfaceReportListener
- Overrides:
reportDone
in classAbstractFunction
- Parameters:
event
- The event.
-
getValue
public Object getValue()
Return the value of thisFunction
. 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 interfaceExpression
- Overrides:
getValue
in classPageFunction
- 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 classPageFunction
- Parameters:
group
- the group name.
-
setStartPage
public void setStartPage(int startPage)
Defines the page number where the counting starts.- Overrides:
setStartPage
in classPageFunction
- 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 interfaceExpression
- Overrides:
setDependencyLevel
in classPageFunction
- 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 interfaceExpression
- Overrides:
getDependencyLevel
in classPageFunction
- 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 interfaceExpression
- Overrides:
getInstance
in classAbstractExpression
- 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 interfaceExpression
- Overrides:
setRuntime
in classAbstractExpression
- Parameters:
runtime
- the runtime information for the expression
-
clone
public Object clone() throws CloneNotSupportedException
Creates a copy of the function.- Specified by:
clone
in interfaceExpression
- Overrides:
clone
in classAbstractExpression
- Returns:
- the clone.
- Throws:
CloneNotSupportedException
- if an error occurs.
-
-