public class ReportPresenter extends BasePresenter
BasePresenter.ERROR_SOURCE
Modifier and Type | Field and 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
|
LOGGER, MAX_FILENAME_LENGTH
Constructor and 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.
|
Modifier and Type | Method and 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.
|
protected java.io.OutputStream |
getExportStream()
Opens an returns an output stream for the result of the current
getModel() . |
java.lang.String |
getExtensionName()
Returns the UNIQUE name of the extension.
|
protected ResultModel |
getModel()
Returns the model this presenter is registered to
|
void |
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.
|
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.
|
BasePresenter |
spawn(boolean spawnWithParent)
Creates another presenter of the the same type as the current one.
|
canInformUserOnErrors, configure, createExportFilename, getDefaultExportName, getLastPresenterException, getParent, getPresenterExceptions, setParent
public static final java.lang.String FORMAT_ODS
public static final java.lang.String FORMAT_PDF
public static final java.lang.String FORMAT_RTF
public static final java.lang.String FORMAT_XLS
public static final java.lang.String FORMAT_XLSX
public ReportPresenter(boolean detailed, boolean appendSettings, java.lang.String exportFormat, java.io.File target, boolean isFolder)
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 if getExportStream()
is overwrittenisFolder
- if the target is a folder or a filejava.lang.IllegalStateException
- in case the presenter is used without the reporting pluginFORMAT_ODS
,
FORMAT_PDF
,
FORMAT_RTF
,
FORMAT_XLS
,
FORMAT_XLSX
public ReportPresenter(boolean detailed, boolean appendSettings, java.lang.String exportFormat, java.io.OutputStream target)
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 resultjava.lang.IllegalStateException
- in case the presenter is used without the reporting pluginFORMAT_ODS
,
FORMAT_PDF
,
FORMAT_RTF
,
FORMAT_XLS
,
FORMAT_XLSX
public java.lang.String getExtensionName()
public void onComparisonDone() throws java.lang.Exception
onComparisonDone
in class BasePresenter
java.lang.Exception
- on report failures or IO failuresjava.lang.IllegalStateException
- if not model is setpublic void executeImmediately(ResultModel model) throws java.lang.Exception
executeImmediately
in class BasePresenter
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 methodjava.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 userprotected ResultModel getModel()
getModel
in class BasePresenter
public void detachFromModel()
detachFromModel
in class BasePresenter
public void onClear() throws java.lang.Exception
onClear
in class BasePresenter
java.lang.Exception
- thrown in case the processing of the clear step failspublic void onDataUpdate() throws java.lang.Exception
onDataUpdate
in class BasePresenter
java.lang.Exception
- thrown in case the processing of the update step failspublic void onError(ExceptionData error, boolean interrupted, BasePresenter.ERROR_SOURCE source)
ResultModel
.onError
in class BasePresenter
error
- the exceptioninterrupted
- 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.public void onFilterChange() throws java.lang.Exception
onFilterChange
in class BasePresenter
java.lang.Exception
- thrown in case the processing of the filter update failspublic void onFinish()
PDFComparer.batchCompare(java.io.File, java.io.File)
method.onFinish
in class BasePresenter
public void onInit() throws java.lang.Exception
onInit
in class BasePresenter
java.lang.Exception
- thrown in case the processing of the init step failspublic void onProgressUpdate(float progress)
onProgressUpdate
in class BasePresenter
progress
- the progress in percent, a value between 0 and 100, bounds included.public void setModel(ResultModel newModel)
setModel
in class BasePresenter
newModel
- the newpublic BasePresenter spawn(boolean spawnWithParent)
spawn
in class BasePresenter
spawnWithParent
- if true, the presenter is allowed to keep a reference to it's parent to create a summary on onFinish()protected java.io.OutputStream getExportStream() throws java.io.IOException
getModel()
. The
caller of this method will close the stream itself!java.io.IOException
- thrown in case the stream could not be createdpublic void setExportFormat(java.lang.String exportFormat)
exportFormat
- the export format to be setCopyright © 2010-2022 by i-net software GmbH