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

Bug 320881

Summary: findStyle does not work for library styles in Webviewer (frameset)
Product: z_Archived Reporter: Jens Heidemann <jens.heidemann>
Component: BIRTAssignee: Birt-Report-inbox <Birt-Report-inbox>
Status: RESOLVED WONTFIX QA Contact: Xiaoying Gu <bluesoldier>
Severity: normal    
Priority: P3 CC: bluesoldier, rlu, ywang
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Jens Heidemann CLA 2010-07-26 06:14:23 EDT
Build Identifier: 2.5.2, 2.6.0

If a style was defined within a library, the function "findStyle()" works differently in HTML- Viewer (run) and Webviewer (frameset).
When starting a report with Webviewer the function "findStyle([StyleName])" returns null, until this style was used in a highlight rule of any report element.

Unlike in the HTML- Viewer in which the function always returns the correct style object.

Reproducible: Always

Steps to Reproduce:
Precondition
1. create a library and a report template which uses this library
2. define two different styles within the library
3. create one report element and define a highlight rule which uses the first style.
4. create an event handler for "onCreate" and call "reportContext.getDesignHandle().findStyle()" with the name of the first and the second style and check both result.

Action
5. start the report on Webviewer (frameset)

Result:
The function returns a correct handle to the first style, but null for the second.

Expected Result:
The function will return a correct handle for both styles.

Additional:
Start the report in HTML- View (run). 
Result:
The function works as excepted and returns a correct handle for both styles.
Comment 1 Yueqian Wang CLA 2010-08-03 02:12:49 EDT
 In the web-view mode, the report design is flattened. Afterwards,  there will be no libraries. During this process, only used styles are created in the flatten design to reduce the design size. 

So, it is correct that the 2nd style cannot be found. If 2nd style is used, it can be found.
Comment 2 Rick Lu CLA 2010-08-03 03:47:44 EDT
Jens, what's your purpose to write such javascript? Only for testing?
Comment 3 Jens Heidemann CLA 2010-08-12 04:47:08 EDT
First of all, sorry for late response.

We want to have section headers within our Reports, such as "2. Details" or "3.1 Environment". 
Depending on their level they should have different styles, defined in a library.
Because I'm too lazy to manually set the styles for each header and to make sure, that every header has still the correct style even after major changes, I looked for an easier solution.
At the end, the complete script reads out an UserProperty, appropriates the name of the desired style and applies the (library-defined) style on the element.


Additionally, it creates a TOC- entry and generates the section number, such as "2." or "3.1", according to its level.

Any idea or advice for a better solution are welcome.


BTW: Please, can you give me a hint why the report design is only "flattened" in web-view mode but not in "html-mode"?

Thanks a lot!