Class ReportPresenter

java.lang.Object
com.inet.pdfc.presenter.BasePresenter
com.inet.pdfc.presenter.ReportPresenter
All Implemented Interfaces:
NamedExtension
Direct Known Subclasses:
ReportPDFPresenter

public class ReportPresenter extends BasePresenter
Generates a statistical report of the comparison which contains diagrams of the difference types and their distribution along the pages.
An active 'reporting' plugin is required to use this filter!
Since:
i-net PDFC 5.0
  • Field Details

  • Constructor Details

    • ReportPresenter

      public ReportPresenter(boolean detailed, boolean appendSettings, String exportFormat, File target, boolean isFolder)
      Creates the exporter.
      Parameters:
      detailed - set to true when additional the list of errors must be rendered
      appendSettings - true when settings must be appended
      exportFormat - defines the format of the exported report. Valid values are 'pdf', 'xls', 'xlsx', 'ods' and 'rtf'.
      target - the folder or file to write the results to, will be ignored if getExportStream() is overwritten
      isFolder - if the target is a folder or a file
      Throws:
      IllegalStateException - in case the presenter is used without the reporting plugin
      Since:
      i-net PDFC 5.0
      See Also:
    • ReportPresenter

      public ReportPresenter(boolean detailed, boolean appendSettings, String exportFormat, OutputStream target)
      Creates the exporter.
      Parameters:
      detailed - set to true when additional the list of errors must be rendered
      appendSettings - true when settings must be appended
      exportFormat - defines the format of the exported report. Valid values are 'pdf', 'xls', 'xlsx', 'ods' and 'rtf'.
      target - the outputstream for the result
      Throws:
      IllegalStateException - in case the presenter is used without the reporting plugin
      Since:
      i-net PDFC 5.0
      See Also:
  • Method Details

    • getExtensionName

      public String getExtensionName()
      Returns the UNIQUE name of the extension. With UNIQUE referring to 'unique among all implementations of the same interface'
      Returns:
      the UNIQUE name of the extension
    • onComparisonDone

      public void onComparisonDone() throws Exception
      Creates and saves a report for the registered comparison model.
      Specified by:
      onComparisonDone in class BasePresenter
      Throws:
      Exception - on report failures or IO failures
      IllegalStateException - if not model is set
      Since:
      i-net PDFC 3.0
    • executeImmediately

      public void executeImmediately(ResultModel model) throws Exception
      Forces an execution of the presenter no matter the current model state.
      Use this method to run a presenter for an already finished model.
      Overrides:
      executeImmediately in class BasePresenter
      Parameters:
      model - the model to be presented, if null the currently set model will be presented. This model will not be set persistently to the presenter, it will be detached at the end of this method
      Throws:
      IllegalStateException - in case the no model has been set yet
      Exception - thrown in case the processing of fails; this exception is published to the caller to allow a feedback to the user
    • getModel

      protected ResultModel getModel()
      Returns the model this presenter is registered to
      Overrides:
      getModel in class BasePresenter
      Returns:
      the model, is null until a comparison was started where this Presenter was added to.
    • detachFromModel

      public void detachFromModel()
      Detaches this presenter from a model. Call this method if the presenter should no longer generate output for the referenced model.
      Overrides:
      detachFromModel in class BasePresenter
    • onClear

      public void onClear() throws Exception
      Called upon comparison startup. This does not imply which data is available to the model, but most likely the model has been cleared at this point.
      Overrides:
      onClear in class BasePresenter
      Throws:
      Exception - thrown in case the processing of the clear step fails
    • onDataUpdate

      public void onDataUpdate() throws Exception
      Called whenever the referred model receives a data chunk. This does not imply that any differences are available yet as it is called as well for no-difference areas.
      Overrides:
      onDataUpdate in class BasePresenter
      Throws:
      Exception - thrown in case the processing of the update step fails
    • onError

      public void onError(ExceptionData error, boolean interrupted, BasePresenter.ERROR_SOURCE source)
      Called in case of an error that occurred either in one of the parser threads or in the compare thread.
      NOTE: This method is only called for exceptions which are notified to the ResultModel.
      Overrides:
      onError in class BasePresenter
      Parameters:
      error - the exception
      interrupted - indicates whether the comparison was interrupted due to this exception. If true there will be no further calls (e.g. onComparisonDone)
      source - the source module of the exception.
    • onFilterChange

      public void onFilterChange() throws Exception
      Called whenever the filter conditions of the referenced model have changed. This method is not called automatically during a comparison but rather a reaction to a configuration change that can be applied to the model.
      Overrides:
      onFilterChange in class BasePresenter
      Throws:
      Exception - thrown in case the processing of the filter update fails
    • onFinish

      public void onFinish()
      OPTIONAL: Called in case of batch comparison at the end of all comparisons of the batch run. This method cannot be triggered by an event of any referenced result model. It's sole purpose is to serve as a callback for the PDFComparer.batchCompare(java.io.File, java.io.File) method.
      NOTE: This method only called once per batch compare and only for the root presenter, never for spawned ones.
      Overrides:
      onFinish in class BasePresenter
    • onInit

      public void onInit() throws Exception
      Called at the time the document informations have been set.
      Overrides:
      onInit in class BasePresenter
      Throws:
      Exception - thrown in case the processing of the init step fails
    • onProgressUpdate

      public void onProgressUpdate(float progress)
      Called whenever the comparison sends a progress state. In some rare cases the same progress value may be sent multiple times.
      Overrides:
      onProgressUpdate in class BasePresenter
      Parameters:
      progress - the progress in percent, a value between 0 and 100, bounds included.
    • setModel

      public void setModel(ResultModel newModel)
      Registers this presenter to a model. If it already was registered to a model, the old model will be detached first.
      Overrides:
      setModel in class BasePresenter
      Parameters:
      newModel - the new
    • spawn

      public BasePresenter spawn(boolean spawnWithParent)
      Creates another presenter of the the same type as the current one. The spawned presenter may either have the same settings as the current one or it may be a child of the current one.
      Overrides:
      spawn in class BasePresenter
      Parameters:
      spawnWithParent - if true, the presenter is allowed to keep a reference to it's parent to create a summary on onFinish()
      Returns:
      a new presenter for the same batch comparison run as the current one
    • getExportStream

      protected OutputStream getExportStream() throws IOException
      Opens an returns an output stream for the result of the current getModel(). The caller of this method will close the stream itself!
      Returns:
      the stream to write the current result to
      Throws:
      IOException - thrown in case the stream could not be created
      Since:
      i-net PDFC 3.0
    • setExportFormat

      public void setExportFormat(String exportFormat)
      Sets the export format of the report. Valid values are 'pdf', 'xls', 'xlsx', 'ods' and 'rtf'
      Parameters:
      exportFormat - the export format to be set
      Since:
      i-net PDFC 4.3
    • setPassword

      public void setPassword(String password)
      Set for the export format pdf the password
      Parameters:
      password - the password (currently only for pdf)
      Since:
      i-net PDFC 21.4