Package com.inet.pdfc.presenter
Class ConsolePresenter
java.lang.Object
com.inet.pdfc.presenter.BasePresenter
com.inet.pdfc.presenter.ConsolePresenter
- All Implemented Interfaces:
com.inet.plugin.NamedExtension
A presenter to print the
Modifications of a comparison run to the log. If used for a batch comparison
the presenter will print a summary for all compared documents at the end of the batch run.-
Nested Class Summary
Nested classes/interfaces inherited from class com.inet.pdfc.presenter.BasePresenter
BasePresenter.ERROR_SOURCE -
Field Summary
Fields inherited from class com.inet.pdfc.presenter.BasePresenter
LOGGER, MAX_FILENAME_LENGTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanReturns whether the presenter is able to handle errors in a way to notify the user.Configures the presenter according to a profile.voidCalled to indicate that a comparison has finished.voidonError(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.voidonFinish()OPTIONAL: Called in case of batch comparison at the end of all comparisons of the batch run.voidonInit()Called at the time the document informations have been set.voidsetLogWriter(PrintWriter writer) Sets a writer to print the result tovoidsetMaxErrors(int maxErrors) Sets the maximum number of errors to be displayed per comparison.spawn(boolean spawnWithParent) Creates another presenter of the the same type as the current one.Methods inherited from class com.inet.pdfc.presenter.BasePresenter
createExportFilename, detachFromModel, executeImmediately, getDefaultExportName, getLastPresenterException, getModel, getParent, getPresenterExceptions, onClear, onDataUpdate, onFilterChange, onProgressUpdate, setModel, setParent
-
Constructor Details
-
ConsolePresenter
public ConsolePresenter()
-
-
Method Details
-
getExtensionName
-
setLogWriter
Sets a writer to print the result to- Parameters:
writer- the writer to print the result to, ifnullthe default logger will be used- Since:
- i-net PDFC 4.0
-
onInit
Called at the time the document informations have been set.- Overrides:
onInitin classBasePresenter- Throws:
Exception- thrown in case the processing of the init step fails
-
configure
Configures the presenter according to a profile. The presenter will read the propertyPDFCProperty.MAX_ERRORS_PER_FILEfrom the profile.- Overrides:
configurein classBasePresenter- Parameters:
profile- the profile to read from, must not benull- Returns:
- this instance for concatenation
- Since:
- i-net PDFC 3.0
-
setMaxErrors
public void setMaxErrors(int maxErrors) Sets the maximum number of errors to be displayed per comparison. Any further error will just be summed up in a comparison.- Parameters:
maxErrors- the maximum number ofModification- Since:
- i-net PDFC 3.0
-
onComparisonDone
Called to indicate that a comparison has finished. This does not imply that any page data or differences are available.- Specified by:
onComparisonDonein classBasePresenter- Throws:
Exception- thrown in case the processing of the finish step 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:
onFinishin classBasePresenter
-
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:
onErrorin classBasePresenter- Parameters:
error- the exceptioninterrupted- indicates whether the comparison was interrupted due to this exception. Iftruethere will be no further calls (e.g. onComparisonDone)source- the source module of the exception.
-
canInformUserOnErrors
protected boolean canInformUserOnErrors()Returns whether the presenter is able to handle errors in a way to notify the user. E.g. write the error to the log file/console or pop up an error dialog.- Overrides:
canInformUserOnErrorsin classBasePresenter- Returns:
trueofBasePresenter.onError(ExceptionData, boolean, ERROR_SOURCE)will directly inform the user.
-
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:
spawnin 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
-