org.pentaho.reporting.engine.classic.core.modules.output.pageable.graphics
Class PrintReportProcessor

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.layout.output.AbstractReportProcessor
      extended by org.pentaho.reporting.engine.classic.core.modules.output.pageable.base.PageableReportProcessor
          extended by 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 interface java.awt.print.Pageable
UNKNOWN_NUMBER_OF_PAGES
 
Constructor Summary
PrintReportProcessor(MasterReport report)
           
 
Method Summary
 void addReportProgressListener(ReportProgressListener l)
          Adds a repagination listener.
 void fireProcessingFinished()
           
 void fireProcessingStarted()
           
 Throwable getErrorReason()
          Returns the last exception that has been caught.
 int getNumberOfPages()
          Returns the number of pages in the set.
 PageDrawable getPageDrawable(int pageIndex)
          Returns the PageDrawable instance responsible for rendering the page specified by pageIndex.
 PageFormat getPageFormat(int pageIndex)
          Returns the PageFormat of the page specified by pageIndex.
 Printable getPrintable(int pageIndex)
          Returns the Printable instance responsible for rendering the page specified by pageIndex.
 boolean isError()
          Checks whether an error occured.
 boolean paginate()
          Manually triggers the pagination.
 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.layout.output.AbstractReportProcessor
close, getConfiguration, getLogicalPageCount, getOutputProcessor, getPhysicalPageCount, isFullStreamingProcessor, isHandleInterruptedState, isPaginated, processPage, setFullStreamingProcessor, setHandleInterruptedState
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrintReportProcessor

public PrintReportProcessor(MasterReport report)
                     throws ReportProcessingException
Throws:
ReportProcessingException
Method Detail

getNumberOfPages

public int getNumberOfPages()
Returns the number of pages in the set. To enable advanced printing features, it is recommended that Pageable implementations return the true number of pages rather than the UNKNOWN_NUMBER_OF_PAGES constant.

Specified by:
getNumberOfPages in interface Pageable
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 occured.

Overrides:
paginate in class AbstractReportProcessor
Returns:
true, if the pagination was successfull, false otherwise.

getPageFormat

public PageFormat getPageFormat(int pageIndex)
                         throws IndexOutOfBoundsException
Returns the PageFormat of the page specified by pageIndex.

Specified by:
getPageFormat in interface Pageable
Parameters:
pageIndex - the zero based index of the page whose PageFormat is being requested
Returns:
the PageFormat describing the size and orientation.
Throws:
IndexOutOfBoundsException - if the Pageable does not contain the requested page.

getPrintable

public Printable getPrintable(int pageIndex)
                       throws IndexOutOfBoundsException
Returns the Printable instance responsible for rendering the page specified by pageIndex.

Specified by:
getPrintable in interface Pageable
Parameters:
pageIndex - the zero based index of the page whose Printable is being requested
Returns:
the Printable that renders the page.
Throws:
IndexOutOfBoundsException - if the Pageable does not contain the requested page.

getPageDrawable

public PageDrawable getPageDrawable(int pageIndex)
Returns the PageDrawable instance responsible for rendering the page specified by pageIndex.

Parameters:
pageIndex - the zero based index of the page whose Printable is being requested
Returns:
the PageDrawable that renders the page.
Throws:
IndexOutOfBoundsException - if the Pageable does not contain the requested page.

isError

public boolean isError()
Checks whether an error occured. The Exception itself can be queried using 'getErrorReason()'.

Returns:
true, if an error occured, 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 interface ReportProcessor
Overrides:
processReport in class AbstractReportProcessor
Throws:
ReportProcessingException
EmptyReportException

fireProcessingStarted

public void fireProcessingStarted()

fireProcessingFinished

public void fireProcessingFinished()

addReportProgressListener

public void addReportProgressListener(ReportProgressListener l)
Adds a repagination listener. This listener will be informed of pagination events.

Specified by:
addReportProgressListener in interface ReportProcessor
Overrides:
addReportProgressListener in class AbstractReportProcessor
Parameters:
l - the listener.

removeReportProgressListener

public void removeReportProgressListener(ReportProgressListener l)
Removes a repagination listener.

Specified by:
removeReportProgressListener in interface ReportProcessor
Overrides:
removeReportProgressListener in class AbstractReportProcessor
Parameters:
l - the listener.

getErrorReason

public Throwable getErrorReason()
Returns the last exception that has been caught.

Returns:
the error reason.