Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Progress while filling jasper report

I would like to give progress to the user while Jasper reports is filling a compile report. Basically I would like to get progress while this is executing:

JasperFillManager.fillReport(JasperReport rpt, Map params, JRDataSource src)

Is there anyway to achieve this?

like image 453
Craig Avatar asked Oct 26 '10 06:10

Craig


1 Answers

From Jasper Reports version 4.6.0 You can use FillListener:

AsynchronousFillHandle handle = AsynchronousFillHandle.createHandle(jasperReport, params, dataSource);
handle.addFillListener(new FillListener() {

    @Override
    public void pageUpdated(JasperPrint jasperPrint, int pageIndex) {
        log.info("pageUpdated " + pageIndex);
    }

    @Override
    public void pageGenerated(JasperPrint jasperPrint, int pageIndex) {
        log.info("pageGenerated " + pageIndex);
    }
});

NOTE: to build 4.6.0 version get sources from svn and use ant:

svn co http://jasperforge.org/svn/repos/jasperreports (user/pass: anonymous)
cd jasperreports\trunk\jasperreports
ant jar
like image 69
marioosh Avatar answered Oct 10 '22 08:10

marioosh