Class PageFunction
- 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
-
- All Implemented Interfaces:
Serializable
,Cloneable
,EventListener
,PageEventListener
,ReportListener
,Expression
,Function
- Direct Known Subclasses:
PageOfPagesFunction
,PageTotalFunction
public class PageFunction extends AbstractFunction implements PageEventListener
A report function that counts pages. This method is only useable when a report processor is used, which generated PageEvents. The PageableReportProcessor is one of them. As with all page dependent functions: The function will only be active, when the page events get fired, this usually only happens during the last pagination run and the printing. The function level will be negative when this happens.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PageFunction()
Constructs an unnamed function.PageFunction(String name)
Constructs a named function.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
getDependencyLevel()
Returns the defined dependency level.String
getGroup()
Returns the group name.int
getPage()
Returns the current page.int
getPageIncrement()
Returns the page increment.int
getStartPage()
Returns the page number where the counting starts.Object
getValue()
Returns the page number (function value).void
groupStarted(ReportEvent event)
Receives notification that a group has started.boolean
isDeepTraversing()
Checks whether this expression is a deep-traversing expression.protected boolean
isIgnoreNextGroupStart()
A internal flag that defines wether the next group start should be ignored.protected boolean
isIgnoreNextPageStart()
Returns, whether the next page-start event will be ignored.protected boolean
isIgnorePageCancelEvents()
Deprecated.No longer used.void
pageFinished(ReportEvent event)
Receives notification that a page is completed.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.void
setDependencyLevel(int dependencyLevel)
Defines the defined dependency level.void
setGroup(String group)
Sets the name of the group that the function acts upon.void
setIgnorePageCancelEvents(boolean ignorePageCancelEvents)
Deprecated.No longer used.protected void
setPage(int page)
Sets the current page.void
setPageIncrement(int pageIncrement)
Defines the page increment.void
setStartPage(int startPage)
Defines the page number where the counting starts.-
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractFunction
groupFinished, itemsAdvanced, itemsFinished, itemsStarted, reportDone, reportFinished, reportStarted, summaryRowSelection
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractExpression
clone, getDataRow, getInstance, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isPreserve, setActive, setName, setPreserve, setRuntime
-
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
clone, getDataRow, getInstance, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isPreserve, setName, setRuntime
-
-
-
-
Constructor Detail
-
PageFunction
public PageFunction()
Constructs an unnamed function.This constructor is intended for use by the SAX handler class only.
-
PageFunction
public PageFunction(String name)
Constructs a named function.- Parameters:
name
- the function name.
-
-
Method Detail
-
isDeepTraversing
public boolean isDeepTraversing()
Checks whether this expression is a deep-traversing expression. Deep-traversing expressions receive events from all sub-reports. This returns true, as this function has to receive page-events even if a sub-report is currently being processed.- Specified by:
isDeepTraversing
in interfaceExpression
- Overrides:
isDeepTraversing
in classAbstractExpression
- Returns:
- true.
-
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 classAbstractExpression
- Returns:
- the dependency level.
-
setDependencyLevel
public void setDependencyLevel(int dependencyLevel)
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 classAbstractExpression
- Parameters:
dependencyLevel
- the dependency level.
-
getPageIncrement
public int getPageIncrement()
Returns the page increment.- Returns:
- the page increment.
-
setPageIncrement
public void setPageIncrement(int pageIncrement)
Defines the page increment.- Parameters:
pageIncrement
- the page increment.
-
getGroup
public String getGroup()
Returns the group name.- Returns:
- the group name.
-
setGroup
public void setGroup(String group)
Sets the name of the group that the function acts upon.- Parameters:
group
- the group name.
-
getStartPage
public int getStartPage()
Returns the page number where the counting starts.- Returns:
- the page number of the first page.
-
setStartPage
public void setStartPage(int startPage)
Defines the page number where the counting starts.- Parameters:
startPage
- the page number of the first page.
-
getPage
public int getPage()
Returns the current page.- Returns:
- the current page.
-
setPage
protected void setPage(int page)
Sets the current page.- Parameters:
page
- the page.
-
reportInitialized
public void reportInitialized(ReportEvent event)
Receives notification that the report has started.- Specified by:
reportInitialized
in interfaceReportListener
- Overrides:
reportInitialized
in classAbstractFunction
- Parameters:
event
- the event.
-
groupStarted
public void groupStarted(ReportEvent event)
Receives notification that a group has started.- Specified by:
groupStarted
in interfaceReportListener
- Overrides:
groupStarted
in classAbstractFunction
- 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.- Specified by:
pageStarted
in interfacePageEventListener
- Parameters:
event
- the event.
-
isIgnoreNextPageStart
protected boolean isIgnoreNextPageStart()
Returns, whether the next page-start event will be ignored. This is an internal state flag to keep the computation in sync with the events.- Returns:
- the flag.
-
pageFinished
public void pageFinished(ReportEvent event)
Receives notification that a page is completed.- Specified by:
pageFinished
in interfacePageEventListener
- Parameters:
event
- The event.
-
getValue
public Object getValue()
Returns the page number (function value).- Specified by:
getValue
in interfaceExpression
- Returns:
- the page number.
-
isIgnoreNextGroupStart
protected boolean isIgnoreNextGroupStart()
A internal flag that defines wether the next group start should be ignored. We have to ignore the first group start of each report so that the report-header becomes part of the first group's page sequence.- Returns:
- the internal flag.
-
isIgnorePageCancelEvents
protected boolean isIgnorePageCancelEvents()
Deprecated.No longer used.A obsolete getter. Ignore it please, it has no effect.- Returns:
- true, if you care to know.
-
setIgnorePageCancelEvents
public void setIgnorePageCancelEvents(boolean ignorePageCancelEvents)
Deprecated.No longer used.A obsolete setter. Ignore it please, it has no effect.- Parameters:
ignorePageCancelEvents
- ignored.
-
-