Adding an image to monitor progress of report

Hi,

I was going through the IProgressMonitor interface available in BIRT 2.5. I would like to know how we can provide an image while the report is being generated and link the progress of that image using this IProgressMonitor interface.

Thank you.

Comments

  • mwilliamsmwilliams BIRT Guru
    edited December 1969
    Hi Anu.babu,

    Are you using the engine in a servlet or client app?

    Regards,

    Michael Williams

    eSignLive Evangelism & Community Manager | eSignLive by VASCO
     
    Find me on:
    Twitter
    Facebook
    Blog

    LinkedIn

    eSignLive Developer Community
     
    Email me:
    Google: mwilliams.silanis@gmail.com

  • edited December 1969
    Hi,

    I am using the engine in a client application.

    Thank You
  • mwilliamsmwilliams BIRT Guru
    edited December 1969
    If you want to use a page header, you can implement something like:

    package REAPI;
    import org.eclipse.birt.report.engine.api.IPageHandler;
    import org.eclipse.birt.report.engine.api.IReportDocumentInfo;;
    public class MyPageHandler implements IPageHandler
    {
    public void onPage( int pageNumber, boolean checkpoint, IReportDocumentInfo doc){
    //Checkpoint is set true on page 1, 10, 50 and then multiples of 100 and end of report;
    if( checkpoint == true){
    System.out.println("Page " + pageNumber + " is Complete");
    //can use doc to open the report document and render
    //update your gui progress here
    }
    }
    }

    and then in the run task set the page handler like:

    IReportRunnable design = null;
    //Open the report design
    design = engine.openReportDesign("Reports/crosstabscripthighlight.rptdesign");
    IRunTask task = engine.createRunTask(design);
    task.setPageHandler(new MyPageHandler());
    task.run("output/resample/myreport.rptdocument");


    OR

    You could try something like the following if you want to use the IProgressMonitor:

    package REAPI;
    import org.eclipse.birt.report.engine.api.IEngineTask;
    import org.eclipse.birt.report.engine.api.IProgressMonitor;
    public class MyProgressMonitor implements IProgressMonitor {
    public void onProgress(int task, int val) {

    if( task == IProgressMonitor.START_PAGE){
    System.out.println( "Start Page " + val);
    }
    if( task == IProgressMonitor.END_PAGE){
    System.out.println( "End Page " + val);
    }
    if( task == IProgressMonitor.START_QUERY){
    System.out.println( "Start Query for Element Id " + val);
    }
    if( task == IProgressMonitor.END_QUERY){
    System.out.println( "End Query for Element Id " + val);
    }
    if( task == IProgressMonitor.FETCH_ROW){
    System.out.println( "Fetching Row " + val);
    }
    if( task == IProgressMonitor.START_TASK || task == IProgressMonitor.END_TASK){
    String taskStr = " Ending ";
    if( task == IProgressMonitor.START_TASK)taskStr = " Starting ";
    switch( val ){
    case IEngineTask.TASK_RUN:
    System.out.println( taskStr + " Run Task");
    break;
    case IEngineTask.TASK_RENDER:
    System.out.println( taskStr + " Render Task");
    break;
    case IEngineTask.TASK_RUNANDRENDER:
    System.out.println( taskStr + " RunAndRender Task");
    break;
    case IEngineTask.TASK_DATAEXTRACTION:
    System.out.println( taskStr + " Data Extraction Task");
    break;
    case IEngineTask.TASK_DATASETPREVIEW:
    System.out.println( taskStr + " Data Set Preview Task");
    break;
    case IEngineTask.TASK_GETPARAMETERDEFINITION:
    System.out.println( taskStr + " Get Parameter Definition Task");
    break;
    case IEngineTask.TASK_UNKNOWN:
    System.out.println( taskStr + " Unknown Task");
    break;

    }

    }



    }
    }

    Then on the engine task set the progress monitor like:
    task = engine.createRunAndRenderTask(design);
    task.setProgressMonitor(new MyProgressMonitor());

    Regards,

    Michael Williams

    eSignLive Evangelism & Community Manager | eSignLive by VASCO
     
    Find me on:
    Twitter
    Facebook
    Blog

    LinkedIn

    eSignLive Developer Community
     
    Email me:
    Google: mwilliams.silanis@gmail.com

  • edited December 1969
    Hi,

    I have already tried using IProgressMonitor, but it shows the progress by printing on the console. I want something like a progress bar component that the user can see while the report is taking time to render. This component should be tied to IProgressMonitor. Any idea how this can be done.

    Thank You
  • mwilliamsmwilliams BIRT Guru
    edited December 1969
    The problem is that you don't know how many pages there are until the report is executed.

    Regards,

    Michael Williams

    eSignLive Evangelism & Community Manager | eSignLive by VASCO
     
    Find me on:
    Twitter
    Facebook
    Blog

    LinkedIn

    eSignLive Developer Community
     
    Email me:
    Google: mwilliams.silanis@gmail.com

  • edited December 1969
    I can do with an indeterminate mode progress bar which can end once the report if generated.
    Can you tell me how I can add such an image and tie that to the Birt progress bar
    interface implementation.

    Thank You
  • edited December 1969
    I am calling the BIRT engine from a java app. I can show the progress bar in a jsp page. But how do I redirect back to the report that is generated. Please help me in this line.

    Thank You
  • mwilliamsmwilliams BIRT Guru
    edited November 2010
    Sorry for the delay, I was off for Thanksgiving holiday.

    Just a couple questions. What is the reason for using JSP? And what GUI are you using with your java app?

    Regards,

    Michael Williams

    eSignLive Evangelism & Community Manager | eSignLive by VASCO
     
    Find me on:
    Twitter
    Facebook
    Blog

    LinkedIn

    eSignLive Developer Community
     
    Email me:
    Google: mwilliams.silanis@gmail.com

  • @mwilliams said:
    If you want to use a page header, you can implement something like:

    package REAPI;
    import org.eclipse.birt.report.engine.api.IPageHandler;
    import org.eclipse.birt.report.engine.api.IReportDocumentInfo;;
    public class MyPageHandler implements IPageHandler
    {
    public void onPage( int pageNumber, boolean checkpoint, IReportDocumentInfo doc){
    //Checkpoint is set true on page 1, 10, 50 and then multiples of 100 and end of report;
    if( checkpoint == true){
    System.out.println("Page " + pageNumber + " is Complete");
    //can use doc to open the report document and render
    //update your gui progress here
    }
    }
    }

    and then in the run task set the page handler like:

    IReportRunnable design = null;
    //Open the report design
    design = engine.openReportDesign("Reports/crosstabscripthighlight.rptdesign");
    IRunTask task = engine.createRunTask(design);
    task.setPageHandler(new MyPageHandler());
    task.run("output/resample/myreport.rptdocument");


    OR

    You could try something like the following if you want to use the IProgressMonitor:

    package REAPI;
    import org.eclipse.birt.report.engine.api.IEngineTask;
    import org.eclipse.birt.report.engine.api.IProgressMonitor;
    public class MyProgressMonitor implements IProgressMonitor {
    public void onProgress(int task, int val) {

    if( task == IProgressMonitor.START_PAGE){
    System.out.println( "Start Page " + val);
    }
    if( task == IProgressMonitor.END_PAGE){
    System.out.println( "End Page " + val);
    }
    if( task == IProgressMonitor.START_QUERY){
    System.out.println( "Start Query for Element Id " + val);
    }
    if( task == IProgressMonitor.END_QUERY){
    System.out.println( "End Query for Element Id " + val);
    }
    if( task == IProgressMonitor.FETCH_ROW){
    System.out.println( "Fetching Row " + val);
    }
    if( task == IProgressMonitor.START_TASK || task == IProgressMonitor.END_TASK){
    String taskStr = " Ending ";
    if( task == IProgressMonitor.START_TASK)taskStr = " Starting ";
    switch( val ){
    case IEngineTask.TASK_RUN:
    System.out.println( taskStr + " Run Task");
    break;
    case IEngineTask.TASK_RENDER:
    System.out.println( taskStr + " Render Task");
    break;
    case IEngineTask.TASK_RUNANDRENDER:
    System.out.println( taskStr + " RunAndRender Task");
    break;
    case IEngineTask.TASK_DATAEXTRACTION:
    System.out.println( taskStr + " Data Extraction Task");
    break;
    case IEngineTask.TASK_DATASETPREVIEW:
    System.out.println( taskStr + " Data Set Preview Task");
    break;
    case IEngineTask.TASK_GETPARAMETERDEFINITION:
    System.out.println( taskStr + " Get Parameter Definition Task");
    break;
    case IEngineTask.TASK_UNKNOWN:
    System.out.println( taskStr + " Unknown Task");
    break;

    }

    }



    }
    }

    Then on the engine task set the progress monitor like:
    task = engine.createRunAndRenderTask(design);
    task.setProgressMonitor(new MyProgressMonitor());

    @mwilliams ,

    I'm implementing this, but i don't know where exactly:

    1) Where to set my handler in the run task
    2) what should i do in my handler in case i'm not writing my report my hard disk ( i'm sending the request to a servlet /frameset) ?

    Thanks.

Sign In or Register to comment.