Class DefaultOutputFunction
- 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.layout.output.DefaultOutputFunction
-
- All Implemented Interfaces:
Serializable
,Cloneable
,EventListener
,PageEventListener
,ReportListener
,Expression
,Function
,OutputFunction
public class DefaultOutputFunction extends AbstractFunction implements OutputFunction, PageEventListener
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static InlineSubreportMarker[]
EMPTY_INLINE_SUBREPORT_MARKERS
-
Constructor Summary
Constructors Constructor Description DefaultOutputFunction()
Creates an unnamed function.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSubReportMarkers(InlineSubreportMarker[] markers)
protected void
clearCurrentEvent()
Clears the current event.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
endRenderedCrosstabLayout()
protected ReportEvent
getCurrentEvent()
Returns the current report event.RenderedCrosstabLayout
getCurrentRenderedCrosstabLayout()
InlineSubreportMarker[]
getInlineSubreports()
Expression
getInstance()
Return a completly separated copy of this function.protected OutputProcessorMetaData
getMetaData()
Renderer
getRenderer()
Object
getValue()
Return the current expression value.void
groupBodyFinished(ReportEvent event)
void
groupFinished(ReportEvent event)
Receives notification that a group has finished.void
groupStarted(ReportEvent event)
Receives notification that a group has started.protected boolean
isDesignTime()
static boolean
isGroupSectionPrintable(Band b, boolean testSticky, boolean testRepeat)
protected boolean
isGroupSectionPrintableInternal(Band b, boolean testSticky, boolean testRepeat)
protected boolean
isLastPagebreak()
protected boolean
isNeedPrintRepeatingFooter(ReportEvent event, LayouterLevel[] levels)
protected boolean
isPageFooterPrintable(Band b, boolean testSticky)
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
print(ExpressionRuntime dataRow, Band band)
Prints the given band at the current cursor position.protected void
printDesigntimeFooter(ReportEvent event)
protected void
printDesigntimeHeader(ReportEvent event)
protected void
printEmptyRootLevelBand()
protected void
printPerformanceStats()
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)
protected void
setCurrentEvent(ReportEvent currentEvent)
Sets the current event (also updates the report reference).void
setRenderer(Renderer renderer)
RenderedCrosstabLayout
startRenderedCrosstabLayout()
void
summaryRowSelection(ReportEvent event)
A crosstab specific event notifying crosstab-aware functions to select the result for the summary row cell that will be printed next.protected ExpressionRuntime
updateDetailsHeader(ReportState state, ProcessingContext processingContext, ReportDefinition report, ExpressionRuntime runtime)
void
updateFooterArea(ReportEvent event)
protected void
updateHeaderArea(ReportState givenState)
protected boolean
updatePageFooter(ReportEvent event, LayouterLevel[] levels)
protected ExpressionRuntime
updatePageHeader(ReportState state, ProcessingContext processingContext, ReportDefinition report, LayouterLevel[] levels, ExpressionRuntime runtime)
protected boolean
updateRepeatingFooters(ReportEvent event, LayouterLevel[] levels)
protected ExpressionRuntime
updateRepeatingGroupHeader(ReportState state, ProcessingContext processingContext, ReportDefinition report, LayouterLevel[] levels, ExpressionRuntime runtime)
protected ExpressionRuntime
updateWatermark(ReportState state, ProcessingContext processingContext, ReportDefinition report, LayouterLevel[] levels, ExpressionRuntime runtime)
-
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, finalize, 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
-
-
-
-
Field Detail
-
EMPTY_INLINE_SUBREPORT_MARKERS
public static final InlineSubreportMarker[] EMPTY_INLINE_SUBREPORT_MARKERS
-
-
Constructor Detail
-
DefaultOutputFunction
public DefaultOutputFunction()
Creates an unnamed function. Make sure the name of the function is set usingAbstractExpression.setName(java.lang.String)
before the function is added to the report's function collection.
-
-
Method Detail
-
getMetaData
protected OutputProcessorMetaData getMetaData()
-
getValue
public Object getValue()
Return the current expression value.The value depends (obviously) on the expression implementation.
- Specified by:
getValue
in interfaceExpression
- 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 interfaceReportListener
- Overrides:
reportInitialized
in classAbstractFunction
- 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 interfaceReportListener
- Overrides:
reportStarted
in classAbstractFunction
- Parameters:
event
- the event.
-
printDesigntimeHeader
protected void printDesigntimeHeader(ReportEvent event) throws ReportProcessingException
- Throws:
ReportProcessingException
-
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 interfaceReportListener
- Overrides:
groupStarted
in classAbstractFunction
- 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 interfaceReportListener
- Overrides:
itemsStarted
in classAbstractFunction
- 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 interfaceReportListener
- Overrides:
itemsAdvanced
in classAbstractFunction
- 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 interfaceReportListener
- Overrides:
itemsFinished
in classAbstractFunction
- Parameters:
event
- The event.
-
groupBodyFinished
public void groupBodyFinished(ReportEvent event)
- Specified by:
groupBodyFinished
in interfaceOutputFunction
-
groupFinished
public void groupFinished(ReportEvent event)
Receives notification that a group has finished.Prints the GroupFooter.
- Specified by:
groupFinished
in interfaceReportListener
- Overrides:
groupFinished
in classAbstractFunction
- Parameters:
event
- Information about the event.
-
summaryRowSelection
public void summaryRowSelection(ReportEvent event)
Description copied from class:AbstractFunction
A crosstab specific event notifying crosstab-aware functions to select the result for the summary row cell that will be printed next.- Specified by:
summaryRowSelection
in interfaceReportListener
- Overrides:
summaryRowSelection
in classAbstractFunction
- Parameters:
event
- The report 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 interfaceReportListener
- Overrides:
reportFinished
in classAbstractFunction
- Parameters:
event
- Information about the event.
-
printDesigntimeFooter
protected void printDesigntimeFooter(ReportEvent event) throws ReportProcessingException
- Throws:
ReportProcessingException
-
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.
-
printPerformanceStats
protected void printPerformanceStats()
-
isLastPagebreak
protected boolean isLastPagebreak()
-
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 interfacePageEventListener
- Parameters:
event
- Information about the event.
-
updateHeaderArea
protected void updateHeaderArea(ReportState givenState) throws ReportProcessingException
- Throws:
ReportProcessingException
-
updateWatermark
protected ExpressionRuntime updateWatermark(ReportState state, ProcessingContext processingContext, ReportDefinition report, LayouterLevel[] levels, ExpressionRuntime runtime) throws ReportProcessingException
- Throws:
ReportProcessingException
-
updatePageHeader
protected ExpressionRuntime updatePageHeader(ReportState state, ProcessingContext processingContext, ReportDefinition report, LayouterLevel[] levels, ExpressionRuntime runtime) throws ReportProcessingException
- Throws:
ReportProcessingException
-
updateRepeatingGroupHeader
protected ExpressionRuntime updateRepeatingGroupHeader(ReportState state, ProcessingContext processingContext, ReportDefinition report, LayouterLevel[] levels, ExpressionRuntime runtime) throws ReportProcessingException
- Throws:
ReportProcessingException
-
updateDetailsHeader
protected ExpressionRuntime updateDetailsHeader(ReportState state, ProcessingContext processingContext, ReportDefinition report, ExpressionRuntime runtime) throws ReportProcessingException
- Throws:
ReportProcessingException
-
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 interfacePageEventListener
- Parameters:
event
- the report event.
-
updateFooterArea
public void updateFooterArea(ReportEvent event) throws ReportProcessingException
- Throws:
ReportProcessingException
-
updatePageFooter
protected boolean updatePageFooter(ReportEvent event, LayouterLevel[] levels) throws ReportProcessingException
- Throws:
ReportProcessingException
-
updateRepeatingFooters
protected boolean updateRepeatingFooters(ReportEvent event, LayouterLevel[] levels) throws ReportProcessingException
- Throws:
ReportProcessingException
-
isNeedPrintRepeatingFooter
protected boolean isNeedPrintRepeatingFooter(ReportEvent event, LayouterLevel[] levels)
-
isGroupSectionPrintableInternal
protected boolean isGroupSectionPrintableInternal(Band b, boolean testSticky, boolean testRepeat)
-
isGroupSectionPrintable
public static boolean isGroupSectionPrintable(Band b, boolean testSticky, boolean testRepeat)
-
isPageFooterPrintable
protected boolean isPageFooterPrintable(Band b, boolean testSticky)
-
getCurrentEvent
protected ReportEvent getCurrentEvent()
Returns the current report event.- Returns:
- the event.
-
setCurrentEvent
protected void setCurrentEvent(ReportEvent currentEvent)
Sets the current event (also updates the report reference).- Parameters:
currentEvent
- event.
-
clearCurrentEvent
protected void clearCurrentEvent()
Clears the current event.
-
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 interfaceExpression
- Overrides:
clone
in classAbstractExpression
- 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 interfaceExpression
- Overrides:
getInstance
in classAbstractExpression
- 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 interfaceOutputFunction
- 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 interfaceOutputFunction
- Returns:
- the deep clone.
-
setRenderer
public void setRenderer(Renderer renderer)
-
isDesignTime
protected boolean isDesignTime()
-
getRenderer
public Renderer getRenderer()
-
print
public void print(ExpressionRuntime dataRow, Band band) throws ReportProcessingException
Prints the given band at the current cursor position.- Parameters:
dataRow
- the datarow for evaluating the band's value-expressions.band
- the band to be printed.- Throws:
ReportProcessingException
- if an error occured during the layout computation.
-
printEmptyRootLevelBand
protected void printEmptyRootLevelBand() throws ReportProcessingException
- Throws:
ReportProcessingException
-
getInlineSubreports
public InlineSubreportMarker[] getInlineSubreports()
- Specified by:
getInlineSubreports
in interfaceOutputFunction
-
clearInlineSubreports
public void clearInlineSubreports(SubReportProcessType inlineExecution)
- Specified by:
clearInlineSubreports
in interfaceOutputFunction
-
startRenderedCrosstabLayout
public RenderedCrosstabLayout startRenderedCrosstabLayout()
-
getCurrentRenderedCrosstabLayout
public RenderedCrosstabLayout getCurrentRenderedCrosstabLayout()
-
endRenderedCrosstabLayout
public void endRenderedCrosstabLayout()
-
restart
public void restart(ReportState state) throws ReportProcessingException
- Specified by:
restart
in interfaceOutputFunction
- Throws:
ReportProcessingException
-
createRollbackInformation
public boolean createRollbackInformation()
- Specified by:
createRollbackInformation
in interfaceOutputFunction
-
-