org.pentaho.reporting.engine.classic.core.layout.output
Class DefaultOutputFunction

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.layout.output.DefaultOutputFunction
All Implemented Interfaces:
Serializable, Cloneable, EventListener, PageEventListener, ReportListener, Expression, Function, OutputFunction

public class DefaultOutputFunction
extends AbstractFunction
implements OutputFunction, PageEventListener

Creation-Date: 08.04.2007, 16:22:18

Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
DefaultOutputFunction()
          Creates an unnamed function.
 
Method Summary
 void addSubReportMarkers(InlineSubreportMarker[] markers)
           
 void clearInlineSubreports(SubReportProcessType inlineExecution)
           
 Object clone()
          Clones the function.
 boolean createRollbackInformation()
           
 OutputFunction deriveForPagebreak()
          Creates a cheaper version of the deep-copy of the output function.
 OutputFunction deriveForStorage()
          Creates a storage-copy of the output function.
 void endCrosstabLayout()
           
 PreparedCrosstabLayout getCurrentCrosstabLayout()
           
 InlineSubreportMarker[] getInlineSubreports()
           
 Expression getInstance()
          Return a completly separated copy of this function.
 Renderer getRenderer()
           
 Object getValue()
          Return the current expression value.
 void groupFinished(ReportEvent event)
          Receives notification that a group has finished.
 void groupStarted(ReportEvent event)
          Receives notification that a group has started.
 void itemsAdvanced(ReportEvent event)
          Receives notification that a row of data is being processed.
 void itemsFinished(ReportEvent event)
          Receives notification that a group of item bands has been completed.
 void itemsStarted(ReportEvent event)
          Receives notification that a group of item bands is about to be processed.
 void pageFinished(ReportEvent event)
          Receives notification that a page has ended.
 void pageStarted(ReportEvent event)
          Receives notification that a page has started.
 void reportDone(ReportEvent event)
          Receives notification that report generation has completed, the report footer was printed, no more output is done.
 void reportFinished(ReportEvent event)
          Receives notification that the report has finished.
 void reportInitialized(ReportEvent event)
          Receives notification that report generation initializes the current run.
 void reportStarted(ReportEvent event)
          Receives notification that the report has started.
 void restart(ReportState state)
           
 void setRenderer(Renderer renderer)
           
 PreparedCrosstabLayout startCrosstabLayout()
           
 void updateFooterArea(ReportEvent event)
           
 
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractExpression
getDataRow, getDependencyLevel, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setActive, setDependencyLevel, 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
getDataRow, getDependencyLevel, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setDependencyLevel, setName, setRuntime
 

Constructor Detail

DefaultOutputFunction

public DefaultOutputFunction()
Creates an unnamed function. Make sure the name of the function is set using AbstractExpression.setName(java.lang.String) before the function is added to the report's function collection.

Method Detail

getValue

public Object getValue()
Return the current expression value.

The value depends (obviously) on the expression implementation.

Specified by:
getValue in interface Expression
Returns:
the value of the function.

reportInitialized

public void reportInitialized(ReportEvent event)
Description copied from class: AbstractFunction
Receives notification that report generation initializes the current run.

The event carries a ReportState.Started state. Use this to initialize the report.

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

reportStarted

public void reportStarted(ReportEvent event)
Receives notification that the report has started. Also invokes the start of the first page ...

Layout and draw the report header after the PageStartEvent was fired.

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

addSubReportMarkers

public void addSubReportMarkers(InlineSubreportMarker[] markers)

groupStarted

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

Prints the GroupHeader

Specified by:
groupStarted in interface ReportListener
Overrides:
groupStarted in class AbstractFunction
Parameters:
event - Information about the event.

itemsStarted

public void itemsStarted(ReportEvent event)
Receives notification that a group of item bands is about to be processed.

The next events will be itemsAdvanced events until the itemsFinished event is raised.

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

itemsAdvanced

public void itemsAdvanced(ReportEvent event)
Receives notification that a row of data is being processed.

prints the ItemBand.

Specified by:
itemsAdvanced in interface ReportListener
Overrides:
itemsAdvanced in class AbstractFunction
Parameters:
event - Information about the event.

itemsFinished

public void itemsFinished(ReportEvent event)
Receives notification that a group of item bands has been completed.

The itemBand is finished, the report starts to close open groups.

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

groupFinished

public void groupFinished(ReportEvent event)
Receives notification that a group has finished.

Prints the GroupFooter.

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

reportFinished

public void reportFinished(ReportEvent event)
Receives notification that the report has finished.

Prints the ReportFooter and forces the last pagebreak.

Specified by:
reportFinished in interface ReportListener
Overrides:
reportFinished in class AbstractFunction
Parameters:
event - Information about 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.

pageStarted

public void pageStarted(ReportEvent event)
Receives notification that a page has started.

This prints the PageHeader. If this is the first page, the header is not printed if the pageheader style-flag DISPLAY_ON_FIRSTPAGE is set to false. If this event is known to be the last pageStarted event, the DISPLAY_ON_LASTPAGE is evaluated and the header is printed only if this flag is set to TRUE.

If there is an active repeating GroupHeader, print the last one. The GroupHeader is searched for the current group and all parent groups, starting at the current group and ascending to the parents. The first goupheader that has the StyleFlag REPEAT_HEADER set to TRUE is printed.

The PageHeader and the repeating GroupHeader are spooled until the first real content is printed. This way, the LogicalPage remains empty until an other band is printed.

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

pageFinished

public void pageFinished(ReportEvent event)
Receives notification that a page has ended.

This prints the PageFooter. If this is the first page, the footer is not printed if the pagefooter style-flag DISPLAY_ON_FIRSTPAGE is set to false. If this event is known to be the last pageFinished event, the DISPLAY_ON_LASTPAGE is evaluated and the footer is printed only if this flag is set to TRUE.

Specified by:
pageFinished in interface PageEventListener
Parameters:
event - the report event.

updateFooterArea

public void updateFooterArea(ReportEvent event)
                      throws ReportProcessingException
Throws:
ReportProcessingException

clone

public final Object clone()
                   throws CloneNotSupportedException
Clones the function.

Be aware, this does not create a deep copy. If you have complex strucures contained in objects, you have to override this function.

Specified by:
clone in interface Expression
Overrides:
clone in class AbstractExpression
Returns:
a clone of this function.
Throws:
CloneNotSupportedException - this should never happen.

getInstance

public Expression getInstance()
Description copied from class: AbstractExpression
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.

deriveForStorage

public OutputFunction deriveForStorage()
Creates a storage-copy of the output function. A storage copy must create a deep clone of all referenced objects so that it is guaranteed that changes to either the original or the clone do not affect the other instance.

Any failure to implement this method correctly will be a great source of very subtle bugs.

Specified by:
deriveForStorage in interface OutputFunction
Returns:
the deep clone.

deriveForPagebreak

public OutputFunction deriveForPagebreak()
Creates a cheaper version of the deep-copy of the output function. A pagebreak-derivate is created on every possible pagebreak position and must contain all undo/rollback information to restore the state of any shared object when a roll-back is requested.

Any failure to implement this method correctly will be a great source of very subtle bugs.

Specified by:
deriveForPagebreak in interface OutputFunction
Returns:
the deep clone.

setRenderer

public void setRenderer(Renderer renderer)

getRenderer

public Renderer getRenderer()

getInlineSubreports

public InlineSubreportMarker[] getInlineSubreports()
Specified by:
getInlineSubreports in interface OutputFunction

clearInlineSubreports

public void clearInlineSubreports(SubReportProcessType inlineExecution)
Specified by:
clearInlineSubreports in interface OutputFunction

startCrosstabLayout

public PreparedCrosstabLayout startCrosstabLayout()

getCurrentCrosstabLayout

public PreparedCrosstabLayout getCurrentCrosstabLayout()

endCrosstabLayout

public void endCrosstabLayout()

restart

public void restart(ReportState state)
             throws ReportProcessingException
Specified by:
restart in interface OutputFunction
Throws:
ReportProcessingException

createRollbackInformation

public boolean createRollbackInformation()
Specified by:
createRollbackInformation in interface OutputFunction