Package com.inet.pdfc.presenter
Class ReportPresenter
java.lang.Object
com.inet.pdfc.presenter.BasePresenter
com.inet.pdfc.presenter.ReportPresenter
- All Implemented Interfaces:
NamedExtension
- Direct Known Subclasses:
ReportPDFPresenter
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!
An active 'reporting' plugin is required to use this filter!
- Since:
- i-net PDFC 5.0
-
Nested Class Summary
Nested classes/interfaces inherited from class com.inet.pdfc.presenter.BasePresenter
BasePresenter.ERROR_SOURCE
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Export as 'Open Document Spreadsheet'static final String
Export as 'Portable Document Format'static final String
Export as 'Rich Text Format'static final String
Export as 'Excel Spreadsheet'static final String
Export as 'Excel Spreadsheet', for version 2007 and laterFields inherited from class com.inet.pdfc.presenter.BasePresenter
LOGGER, MAX_FILENAME_LENGTH
-
Constructor Summary
ConstructorDescriptionReportPresenter
(boolean detailed, boolean appendSettings, String exportFormat, File target, boolean isFolder) Creates the exporter.ReportPresenter
(boolean detailed, boolean appendSettings, String exportFormat, OutputStream target) Creates the exporter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Detaches this presenter from a model.void
executeImmediately
(ResultModel model) Forces an execution of the presenter no matter the current model state.
Use this method to run a presenter for an already finished model.protected OutputStream
Opens an returns an output stream for the result of the currentgetModel()
.Returns the UNIQUE name of the extension.protected ResultModel
getModel()
Returns the model this presenter is registered tovoid
onClear()
Called upon comparison startup.void
Creates and saves a report for the registered comparison model.void
Called whenever the referred model receives a data chunk.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 theResultModel
.void
Called whenever the filter conditions of the referenced model have changed.void
onFinish()
OPTIONAL: Called in case of batch comparison at the end of all comparisons of the batch run.void
onInit()
Called at the time the document informations have been set.void
onProgressUpdate
(float progress) Called whenever the comparison sends a progress state.void
setExportFormat
(String exportFormat) Sets the export format of the report.void
setModel
(ResultModel newModel) Registers this presenter to a model.void
setPassword
(String password) Set for the export format pdf the passwordspawn
(boolean spawnWithParent) Creates another presenter of the the same type as the current one.Methods inherited from class com.inet.pdfc.presenter.BasePresenter
canInformUserOnErrors, configure, createExportFilename, getDefaultExportName, getLastPresenterException, getParent, getPresenterExceptions, setParent
-
Field Details
-
FORMAT_ODS
Export as 'Open Document Spreadsheet'- See Also:
-
FORMAT_PDF
Export as 'Portable Document Format'- See Also:
-
FORMAT_RTF
Export as 'Rich Text Format'- See Also:
-
FORMAT_XLS
Export as 'Excel Spreadsheet'- See Also:
-
FORMAT_XLSX
Export as 'Excel Spreadsheet', for version 2007 and later- See Also:
-
-
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 renderedappendSettings
- true when settings must be appendedexportFormat
- 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 ifgetExportStream()
is overwrittenisFolder
- 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 renderedappendSettings
- true when settings must be appendedexportFormat
- 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
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
Creates and saves a report for the registered comparison model.- Specified by:
onComparisonDone
in classBasePresenter
- Throws:
Exception
- on report failures or IO failuresIllegalStateException
- if not model is set- Since:
- i-net PDFC 3.0
-
executeImmediately
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 classBasePresenter
- Parameters:
model
- the model to be presented, ifnull
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 yetException
- thrown in case the processing of fails; this exception is published to the caller to allow a feedback to the user
-
getModel
Returns the model this presenter is registered to- Overrides:
getModel
in classBasePresenter
- 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 classBasePresenter
-
onClear
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 classBasePresenter
- Throws:
Exception
- thrown in case the processing of the clear step fails
-
onDataUpdate
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 classBasePresenter
- Throws:
Exception
- thrown in case the processing of the update step fails
-
onError
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 theResultModel
.- Overrides:
onError
in classBasePresenter
- Parameters:
error
- the exceptioninterrupted
- indicates whether the comparison was interrupted due to this exception. Iftrue
there will be no further calls (e.g. onComparisonDone)source
- the source module of the exception.
-
onFilterChange
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 classBasePresenter
- 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 thePDFComparer.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 classBasePresenter
-
onInit
Called at the time the document informations have been set.- Overrides:
onInit
in classBasePresenter
- 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 classBasePresenter
- Parameters:
progress
- the progress in percent, a value between 0 and 100, bounds included.
-
setModel
Registers this presenter to a model. If it already was registered to a model, the old model will be detached first.- Overrides:
setModel
in classBasePresenter
- Parameters:
newModel
- the new
-
spawn
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 classBasePresenter
- 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
Opens an returns an output stream for the result of the currentgetModel()
. 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
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
Set for the export format pdf the password- Parameters:
password
- the password (currently only for pdf)- Since:
- i-net PDFC 21.4
-