Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 317837

Summary: SETTING UP MASTER PAGE THROUGH JAVA HANDLER DOES NOT WORK in THE RUN then RENDER PROCESS
Product: z_Archived Reporter: jeanmarc.hus
Component: BIRTAssignee: Gang Liu <hustlg>
Status: VERIFIED FIXED QA Contact: Xiaoying Gu <bluesoldier>
Severity: normal    
Priority: P3 CC: bluesoldier, jouyang, zqian
Version: 2.5.1   
Target Milestone: 3.7.0   
Hardware: PC   
OS: Linux   
Whiteboard: Obsolete

Description jeanmarc.hus CLA 2010-06-24 10:53:06 EDT
Guys,
I have a report with two very different Master Page depending on the output format so I have ruled out the idea of using the visibility flag.
My report has two master pages MASTER-PDF and MASTER-HTML that need to be used depending on the output format.
I am using birt 2.5.1 and the report viewer installed in tomcat.

I am writing a Java ReportEventHandler and I have successfully managed to set the master page when using the reportview with the run option.
However, when using the same ReportEventHandler with the reportviewer and the frameset option, my attempt are unsuccessful.

What I am doing is the following:
in the beforeRender method, I simply get the report format using reportContext.getOutputFormat();
and set the master page using setProperty("masterPage", "Master-xxx");

If I understand properly, the run option uses the RunandRender process. However, the frameset option uses the two phases approach Run then Render. Am I correct?
As said, the approach I am using seems to be working fine with the RunandRender process. However, when using the frameset option, it looks like I am getting the following:
- in the beforeFactory event, 

the getOuputFormat method returns "html" regardless of the choosen output.
the setProperty("masterPage", "Master-xxx") seems to be working fine (but I can not choose the right one depending on the output)

- in the beforeRender option,
the getOutputFormat seems to be working properly ... however the setProperty("masterPage", "Master-xxx") has not got any effect.

When I use the same report with the designer, I have the following behaviour:
if I choose view report as PDF, the master page is properly selected.
If I choose view in web browser, the MASTER-HTML is properly selected. However, when I try to print or export the report in PDF using the web browser, the MASTER-PDF pages is NOT used..
Thanks,
Jean-Marc
Comment 1 Gang Liu CLA 2010-06-25 04:42:38 EDT
The pagination occurs in run task, so if you want to change the pagination(such as changing masterPage), you should change it at generation time.
Actually the output format is decided at render time, so BIRT can not support changing masterPage by output format.
Comment 2 Gang Liu CLA 2010-08-26 03:06:14 EDT
set to won't fix