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

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
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
PageFunction()
          Constructs an unnamed function.
PageFunction(String name)
          Constructs a named function.
 
Method Summary
 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.
 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.
 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
 
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, 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 interface Expression
Overrides:
isDeepTraversing in class AbstractExpression
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 interface Expression
Overrides:
getDependencyLevel in class AbstractExpression
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 interface Expression
Overrides:
setDependencyLevel in class AbstractExpression
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.

reportInitialized

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

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

groupStarted

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

Specified by:
groupStarted in interface ReportListener
Overrides:
groupStarted in class AbstractFunction
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 interface PageEventListener
Parameters:
event - the event.

pageFinished

public void pageFinished(ReportEvent event)
Receives notification that a page is completed.

Specified by:
pageFinished in interface PageEventListener
Parameters:
event - The event.

getValue

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

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

setIgnorePageCancelEvents

public void setIgnorePageCancelEvents(boolean ignorePageCancelEvents)
Deprecated. No longer used.

A obsolete setter. Ignore it please, it has no effect.

Parameters:
ignorePageCancelEvents - ignored.