Class PrintReportProcessor
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.layout.output.AbstractReportProcessor
-
- org.pentaho.reporting.engine.classic.core.modules.output.pageable.base.PageableReportProcessor
-
- org.pentaho.reporting.engine.classic.core.modules.output.pageable.graphics.PrintReportProcessor
-
- All Implemented Interfaces:
Pageable
,ReportProcessor
public class PrintReportProcessor extends PageableReportProcessor implements Pageable
Creation-Date: 09.04.2007, 13:28:33- Author:
- Thomas Morgner
-
-
Field Summary
-
Fields inherited from class org.pentaho.reporting.engine.classic.core.layout.output.AbstractReportProcessor
COMMIT_RATE, MAX_EVENTS_PER_RUN, MIN_ROWS_PER_EVENT
-
Fields inherited from interface java.awt.print.Pageable
UNKNOWN_NUMBER_OF_PAGES
-
-
Constructor Summary
Constructors Constructor Description PrintReportProcessor(MasterReport report)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addReportProgressListener(ReportProgressListener l)
Adds a repagination listener.void
fireProcessingFinished()
protected void
fireProcessingFinished(ReportProgressEvent state)
Sends a repagination update to all registered listeners.void
fireProcessingStarted()
protected void
fireProcessingStarted(ReportProgressEvent state)
Sends a repagination update to all registered listeners.protected void
fireStateUpdate(ReportProgressEvent state)
Sends a repagination update to all registered listeners.Throwable
getErrorReason()
Returns the last exception that has been caught.protected GraphicsOutputProcessor
getGraphicsProcessor()
int
getNumberOfPages()
Returns the number of pages in the set.PageDrawable
getPageDrawable(int pageIndex)
Returns thePageDrawable
instance responsible for rendering the page specified bypageIndex
.PageFormat
getPageFormat(int pageIndex)
Returns thePageFormat
of the page specified bypageIndex
.Printable
getPrintable(int pageIndex)
Returns thePrintable
instance responsible for rendering the page specified bypageIndex
.boolean
isError()
Checks whether an error occurred.boolean
paginate()
Manually triggers the pagination.protected PageDrawable
processPage(int page)
An internal method that returns the page-drawable for the given page.void
processReport()
This method throws an UnsupportedOperationException as printing is a passive process and cannot be started here.void
removeReportProgressListener(ReportProgressListener l)
Removes a repagination listener.-
Methods inherited from class org.pentaho.reporting.engine.classic.core.modules.output.pageable.base.PageableReportProcessor
createLayoutManager
-
Methods inherited from class org.pentaho.reporting.engine.classic.core.layout.output.AbstractReportProcessor
calculatePageCount, cancel, checkInterrupted, close, createProcessingContext, getConfiguration, getLogicalPageCount, getLogicalPageState, getOutputProcessor, getOutputProcessorMetaData, getPhysicalPageCount, getPhysicalPageState, getProcessStateHandle, getReport, isFullStreamingProcessor, isHandleInterruptedState, isPaginated, isQueryLimitReached, isStrictErrorHandling, prepareReportProcessing, processPage, processPrepareLevels, setFullStreamingProcessor, setHandleInterruptedState, setQueryLimitReached
-
-
-
-
Constructor Detail
-
PrintReportProcessor
public PrintReportProcessor(MasterReport report) throws ReportProcessingException
- Throws:
ReportProcessingException
-
-
Method Detail
-
getGraphicsProcessor
protected GraphicsOutputProcessor getGraphicsProcessor()
-
getNumberOfPages
public int getNumberOfPages()
Returns the number of pages in the set. To enable advanced printing features, it is recommended thatPageable
implementations return the true number of pages rather than the UNKNOWN_NUMBER_OF_PAGES constant.- Specified by:
getNumberOfPages
in interfacePageable
- Returns:
- the number of pages in this
Pageable
.
-
paginate
public boolean paginate()
Manually triggers the pagination. This method will block until the pagination is finished and will do nothing if an error occurred.- Overrides:
paginate
in classAbstractReportProcessor
- Returns:
- true, if the pagination was successful, false otherwise.
-
getPageFormat
public PageFormat getPageFormat(int pageIndex) throws IndexOutOfBoundsException
Returns thePageFormat
of the page specified bypageIndex
.- Specified by:
getPageFormat
in interfacePageable
- Parameters:
pageIndex
- the zero based index of the page whosePageFormat
is being requested- Returns:
- the
PageFormat
describing the size and orientation. - Throws:
IndexOutOfBoundsException
- if thePageable
does not contain the requested page.
-
getPrintable
public Printable getPrintable(int pageIndex) throws IndexOutOfBoundsException
Returns thePrintable
instance responsible for rendering the page specified bypageIndex
.- Specified by:
getPrintable
in interfacePageable
- Parameters:
pageIndex
- the zero based index of the page whosePrintable
is being requested- Returns:
- the
Printable
that renders the page. - Throws:
IndexOutOfBoundsException
- if thePageable
does not contain the requested page.
-
getPageDrawable
public PageDrawable getPageDrawable(int pageIndex)
Returns thePageDrawable
instance responsible for rendering the page specified bypageIndex
.- Parameters:
pageIndex
- the zero based index of the page whosePrintable
is being requested- Returns:
- the
PageDrawable
that renders the page. - Throws:
IndexOutOfBoundsException
- if thePageable
does not contain the requested page.
-
processPage
protected PageDrawable processPage(int page) throws ReportProcessingException
An internal method that returns the page-drawable for the given page.- Parameters:
page
- the page number.- Returns:
- the pagedrawable for the given page.
- Throws:
ReportProcessingException
- if a report processing error occurred.
-
isError
public boolean isError()
Checks whether an error occurred. The Exception itself can be queried using 'getErrorReason()'.- Returns:
- true, if an error occurred, false otherwise.
-
processReport
public void processReport() throws ReportProcessingException
This method throws an UnsupportedOperationException as printing is a passive process and cannot be started here. To print the whole report, use this Pageable implementation and pass it to one of the JDKs printing sub-systems.- Specified by:
processReport
in interfaceReportProcessor
- Overrides:
processReport
in classAbstractReportProcessor
- Throws:
ReportProcessingException
-
fireProcessingStarted
public void fireProcessingStarted()
-
fireProcessingFinished
public void fireProcessingFinished()
-
fireStateUpdate
protected void fireStateUpdate(ReportProgressEvent state)
Sends a repagination update to all registered listeners.- Overrides:
fireStateUpdate
in classAbstractReportProcessor
- Parameters:
state
- the state.
-
fireProcessingStarted
protected void fireProcessingStarted(ReportProgressEvent state)
Sends a repagination update to all registered listeners.- Overrides:
fireProcessingStarted
in classAbstractReportProcessor
- Parameters:
state
- the state.
-
fireProcessingFinished
protected void fireProcessingFinished(ReportProgressEvent state)
Sends a repagination update to all registered listeners.- Overrides:
fireProcessingFinished
in classAbstractReportProcessor
- Parameters:
state
- the state.
-
addReportProgressListener
public void addReportProgressListener(ReportProgressListener l)
Adds a repagination listener. This listener will be informed of pagination events.- Specified by:
addReportProgressListener
in interfaceReportProcessor
- Overrides:
addReportProgressListener
in classAbstractReportProcessor
- Parameters:
l
- the listener.
-
removeReportProgressListener
public void removeReportProgressListener(ReportProgressListener l)
Removes a repagination listener.- Specified by:
removeReportProgressListener
in interfaceReportProcessor
- Overrides:
removeReportProgressListener
in classAbstractReportProcessor
- Parameters:
l
- the listener.
-
getErrorReason
public Throwable getErrorReason()
Returns the last exception that has been caught.- Returns:
- the error reason.
-
-