public class AsynchronousFillHandle
extends java.lang.Object
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 |
AsynchronousFillHandle.ReportFiller |
Modifier and Type | Field and Description |
---|---|
protected boolean |
cancelled |
protected java.sql.Connection |
conn |
protected JRDataSource |
dataSource |
protected JRBaseFiller |
filler |
protected java.lang.Thread |
fillThread |
protected JasperReport |
jasperReport |
protected java.util.List |
listeners |
protected java.lang.Object |
lock |
protected java.util.Map |
parameters |
protected java.lang.Integer |
priority |
protected boolean |
running |
protected boolean |
started |
protected java.lang.String |
threadName |
Modifier | Constructor and Description |
---|---|
protected |
AsynchronousFillHandle(JasperReport jasperReport,
java.util.Map parameters) |
protected |
AsynchronousFillHandle(JasperReport jasperReport,
java.util.Map parameters,
java.sql.Connection conn) |
protected |
AsynchronousFillHandle(JasperReport jasperReport,
java.util.Map parameters,
JRDataSource dataSource) |
protected |
AsynchronousFillHandle(JasperReport jasperReport,
java.util.Map parameters,
JRDataSource dataSource,
java.sql.Connection conn) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(AsynchronousFilllListener listener)
Adds a listener to the filling process.
|
void |
cancellFill()
Cancels the fill started by the handle.
|
static AsynchronousFillHandle |
createHandle(JasperReport jasperReport,
java.util.Map parameters)
Creates an asychronous filling handle.
|
static AsynchronousFillHandle |
createHandle(JasperReport jasperReport,
java.util.Map parameters,
java.sql.Connection conn)
Creates an asychronous filling handle.
|
static AsynchronousFillHandle |
createHandle(JasperReport jasperReport,
java.util.Map parameters,
JRDataSource dataSource)
Creates an asychronous filling handle.
|
protected void |
notifyCancel() |
protected void |
notifyError(java.lang.Throwable e) |
protected void |
notifyFinish(JasperPrint print) |
boolean |
removeListener(AsynchronousFilllListener listener)
Removes a listener from the filling process.
|
void |
setPriority(int priority)
Sets the priority of the filler thread.
|
void |
setThreadName(java.lang.String name)
Sets the name of the filler thread.
|
void |
startFill()
Starts the filling process asychronously.
|
protected final JasperReport jasperReport
protected final java.util.Map parameters
protected final JRDataSource dataSource
protected final java.sql.Connection conn
protected final JRBaseFiller filler
protected final java.util.List listeners
protected java.lang.Thread fillThread
protected boolean started
protected boolean running
protected boolean cancelled
protected final java.lang.Object lock
protected java.lang.Integer priority
protected java.lang.String threadName
protected AsynchronousFillHandle(JasperReport jasperReport, java.util.Map parameters, JRDataSource dataSource) throws JRException
JRException
protected AsynchronousFillHandle(JasperReport jasperReport, java.util.Map parameters, java.sql.Connection conn) throws JRException
JRException
protected AsynchronousFillHandle(JasperReport jasperReport, java.util.Map parameters) throws JRException
JRException
protected AsynchronousFillHandle(JasperReport jasperReport, java.util.Map parameters, JRDataSource dataSource, java.sql.Connection conn) throws JRException
JRException
public void addListener(AsynchronousFilllListener listener)
listener
- the listener to be addedpublic boolean removeListener(AsynchronousFilllListener listener)
listener
- the listener to be removedpublic void startFill()
The filling is launched on a new thread and the method exits after the thread is started.
When the filling finishes either in success or failure, the listeners are notified.
public void cancellFill() throws JRException
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.
JRException
protected void notifyFinish(JasperPrint print)
protected void notifyCancel()
protected void notifyError(java.lang.Throwable e)
public static AsynchronousFillHandle createHandle(JasperReport jasperReport, java.util.Map parameters, JRDataSource dataSource) throws JRException
jasperReport
- the reportparameters
- the parameter mapdataSource
- the data sourceJRException
public static AsynchronousFillHandle createHandle(JasperReport jasperReport, java.util.Map parameters, java.sql.Connection conn) throws JRException
jasperReport
- the reportparameters
- the parameter mapconn
- the connectionJRException
public static AsynchronousFillHandle createHandle(JasperReport jasperReport, java.util.Map parameters) throws JRException
jasperReport
- the reportparameters
- the parameter mapJRException
public void setPriority(int priority)
priority
- the filler thread priority.Thread.setPriority(int)
public void setThreadName(java.lang.String name)
name
- the filler thread name.Thread.setName(java.lang.String)
© 2001-2010 Jaspersoft Corporation www.jaspersoft.com