public abstract class BaseFillHandle extends Object implements FillHandle
An instance of this type can be used as a handle to an asychronous fill process. The main benefit of this method is that the filling process can be cancelled.
Modifier and Type | Class and Description |
---|---|
protected class |
BaseFillHandle.ReportFill |
Modifier and Type | Field and Description |
---|---|
protected boolean |
cancelled |
protected Connection |
conn |
protected JRDataSource |
dataSource |
protected ReportFiller |
filler |
protected JasperReport |
jasperReport |
protected JasperReportsContext |
jasperReportsContext |
protected List<AsynchronousFilllListener> |
listeners |
protected Object |
lock |
protected Map<String,Object> |
parameters |
protected boolean |
running |
protected boolean |
started |
Modifier | Constructor and Description |
---|---|
protected |
BaseFillHandle(JasperReportsContext jasperReportsContext,
JasperReport jasperReport,
Map<String,Object> parameters,
JRDataSource dataSource,
Connection conn) |
Modifier and Type | Method and Description |
---|---|
void |
addFillListener(FillListener listener)
Adds a fill listener to the filling process.
|
void |
addListener(AsynchronousFilllListener listener)
Adds a listener to the filling process.
|
void |
cancellFill()
Cancels the fill started by the handle.
|
protected abstract Executor |
getReportExecutor() |
boolean |
isPageFinal(int pageIdx)
Determines wheter a page generated by the fill process is final or not.
|
protected void |
notifyCancel() |
protected void |
notifyError(Throwable e) |
protected void |
notifyFinish(JasperPrint print) |
boolean |
removeListener(AsynchronousFilllListener listener)
Removes a listener from the filling process.
|
void |
startFill()
Starts the filling process asychronously.
|
protected final JasperReportsContext jasperReportsContext
protected final JasperReport jasperReport
protected final JRDataSource dataSource
protected final Connection conn
protected final ReportFiller filler
protected final List<AsynchronousFilllListener> listeners
protected boolean started
protected boolean running
protected boolean cancelled
protected final Object lock
protected BaseFillHandle(JasperReportsContext jasperReportsContext, JasperReport jasperReport, Map<String,Object> parameters, JRDataSource dataSource, Connection conn) throws JRException
JRException
public void addListener(AsynchronousFilllListener listener)
FillHandle
addListener
in interface FillHandle
listener
- the listener to be addedpublic void addFillListener(FillListener listener)
FillHandle
addFillListener
in interface FillHandle
listener
- the listener to addpublic boolean removeListener(AsynchronousFilllListener listener)
FillHandle
removeListener
in interface FillHandle
listener
- the listener to be removedpublic void startFill()
FillHandle
The filling can be launched on a new thread and the method exits after the execution is started.
When the filling finishes either in success or failure, the listeners are notified.
startFill
in interface FillHandle
protected abstract Executor getReportExecutor()
public void cancellFill() throws JRException
FillHandle
The method sends a cancel signal to the filling process. When the filling process will end, the listeners will be notified that the filling has been cancelled.
cancellFill
in interface FillHandle
JRException
protected void notifyFinish(JasperPrint print)
protected void notifyCancel()
protected void notifyError(Throwable e)
public boolean isPageFinal(int pageIdx)
FillHandle
isPageFinal
in interface FillHandle
pageIdx
- the page indexFillListener.pageUpdated(JasperPrint, int)
Copyright © 2017. All rights reserved.