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
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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.inet.pdfc.presenter.BasePresenter
BasePresenter.ERROR_SOURCE
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FORMAT_ODS
Export as 'Open Document Spreadsheet'static java.lang.String
FORMAT_PDF
Export as 'Portable Document Format'static java.lang.String
FORMAT_RTF
Export as 'Rich Text Format'static java.lang.String
FORMAT_XLS
Export as 'Excel Spreadsheet'static java.lang.String
FORMAT_XLSX
Export as 'Excel Spreadsheet', for version 2007 and later-
Fields inherited from class com.inet.pdfc.presenter.BasePresenter
LOGGER, MAX_FILENAME_LENGTH
-
-
Constructor Summary
Constructors Constructor Description ReportPresenter(boolean detailed, boolean appendSettings, java.lang.String exportFormat, java.io.File target, boolean isFolder)
Creates the exporter.ReportPresenter(boolean detailed, boolean appendSettings, java.lang.String exportFormat, java.io.OutputStream target)
Creates the exporter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
detachFromModel()
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 java.io.OutputStream
getExportStream()
Opens an returns an output stream for the result of the currentgetModel()
.java.lang.String
getExtensionName()
Returns the UNIQUE name of the extension.protected ResultModel
getModel()
Returns the model this presenter is registered tovoid
onClear()
Called upon comparison startup.void
onComparisonDone()
Creates and saves a report for the registered comparison model.void
onDataUpdate()
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
onFilterChange()
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(java.lang.String exportFormat)
Sets the export format of the report.void
setModel(ResultModel newModel)
Registers this presenter to a model.void
setPassword(java.lang.String password)
Set for the export format pdf the passwordBasePresenter
spawn(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 Detail
-
FORMAT_ODS
public static final java.lang.String FORMAT_ODS
Export as 'Open Document Spreadsheet'- See Also:
- Constant Field Values
-
FORMAT_PDF
public static final java.lang.String FORMAT_PDF
Export as 'Portable Document Format'- See Also:
- Constant Field Values
-
FORMAT_RTF
public static final java.lang.String FORMAT_RTF
Export as 'Rich Text Format'- See Also:
- Constant Field Values
-
FORMAT_XLS
public static final java.lang.String FORMAT_XLS
Export as 'Excel Spreadsheet'- See Also:
- Constant Field Values
-
FORMAT_XLSX
public static final java.lang.String FORMAT_XLSX
Export as 'Excel Spreadsheet', for version 2007 and later- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ReportPresenter
public ReportPresenter(boolean detailed, boolean appendSettings, java.lang.String exportFormat, java.io.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:
java.lang.IllegalStateException
- in case the presenter is used without the reporting plugin- Since:
- i-net PDFC 5.0
- See Also:
FORMAT_ODS
,FORMAT_PDF
,FORMAT_RTF
,FORMAT_XLS
,FORMAT_XLSX
-
ReportPresenter
public ReportPresenter(boolean detailed, boolean appendSettings, java.lang.String exportFormat, java.io.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:
java.lang.IllegalStateException
- in case the presenter is used without the reporting plugin- Since:
- i-net PDFC 5.0
- See Also:
FORMAT_ODS
,FORMAT_PDF
,FORMAT_RTF
,FORMAT_XLS
,FORMAT_XLSX
-
-
Method Detail
-
getExtensionName
public java.lang.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 java.lang.Exception
Creates and saves a report for the registered comparison model.- Specified by:
onComparisonDone
in classBasePresenter
- Throws:
java.lang.Exception
- on report failures or IO failuresjava.lang.IllegalStateException
- if not model is set- Since:
- i-net PDFC 3.0
-
executeImmediately
public void executeImmediately(ResultModel model) throws java.lang.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 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:
java.lang.IllegalStateException
- in case the no model has been set yetjava.lang.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 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
public void onClear() throws java.lang.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 classBasePresenter
- Throws:
java.lang.Exception
- thrown in case the processing of the clear step fails
-
onDataUpdate
public void onDataUpdate() throws java.lang.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 classBasePresenter
- Throws:
java.lang.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 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
public void onFilterChange() throws java.lang.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 classBasePresenter
- Throws:
java.lang.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
public void onInit() throws java.lang.Exception
Called at the time the document informations have been set.- Overrides:
onInit
in classBasePresenter
- Throws:
java.lang.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
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 classBasePresenter
- 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 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
protected java.io.OutputStream getExportStream() throws java.io.IOException
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:
java.io.IOException
- thrown in case the stream could not be created- Since:
- i-net PDFC 3.0
-
setExportFormat
public void setExportFormat(java.lang.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(java.lang.String password)
Set for the export format pdf the password- Parameters:
password
- the password (currently only for pdf)- Since:
- i-net PDFC 21.4
-
-