Craig
Craig

Reputation: 863

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?

Upvotes: 8

Views: 5371

Answers (3)

marioosh
marioosh

Reputation: 28556

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

Upvotes: 2

Jarek Przygódzki
Jarek Przygódzki

Reputation: 4412

I'm afraid it's not possible to monitor progress of filling jasper report (as of version 4.0.2)- net.sf.jasperreports.engine.fill.JRFiller doesn't offer any kind of progress notification.

Upvotes: 0

Sean
Sean

Reputation: 981

I'm using this components from PrimeFaces to show that the report is generating:

<p:ajaxStatus onstart="dlg.show();" onsuccess="dlg.hide();" />
        <p:dialog modal="true"  header="Creating Report" widgetVar="dlg" draggable="false" closable="false" >
            <p:graphicImage value="/resources/images/ajaxloadingbar.gif" />
        </p:dialog>

I don't have any real way to determine the total time my reports will take to compile and fill, so I opted not to use an actual progress bar which sometimes fills before the report is complete.

Upvotes: 0

Related Questions