JavaBeat Certifications Certifications Kits Articles Interview Questions OCAJP 7 OCPJP 5 OCPJP 6 OCEJWCD 6 SCBCD 5.0 SCEA SCJA

The BIRT Environment and Your First Report

Author : PacktPub
Topic : eclipse books 
Pages :
Submit Your Blog Feedback Request Article Print Email

Title : The BIRT Environment and Your First Report
Publisher : PacktPub
Topic : eclipse
Related : Hibernate, Spring, Struts, ejb
Javabeat : Tips, Java / J2EE Tutorials, Certifications

Report Designer

In any visual IDE on the market, there is a part of the user interface that allows a developer to manipulate the look and feel of what they are developing. In programming environments such as Visual Basic, this would be the Form designer. In web development environments such as Adobe Dreamweaver, this is the Designer tab. In BIRT, we use the Report Designer. The Report designer is the section of the BIRT workspace that takes up the most real estate, by default. It is denoted by the title of the report design that is currently open, and has multiple tabs on the bottom part.

Reports need to have an interface to the user, and this is where you design that. This is where you drag the visual components from the Palette in order to work with, and get that exact look and feel necessary to display your information. Working with the Report Designer can be a little tricky if you do not know what to expect; so let me set your expectations now. BIRT is not a pixel-perfect "What You See Is What You Get" (WYSIWYG) development environment. So if you are expecting things to design perfect visual layouts for reports for use in printing, or a pixel perfect design interface like Visual Basic, BIRT does not provide this out of the box. BIRT is designed as a primarily online report technology, and as such it is heavily HTML-driven. So it uses a design interface similar to Dreamweaver or NVU. BIRT, out of the box, does not provide layers. In the Report Designer, components will be resized, shaped, and adjusted to give an approximation on how an HTML engine will render them. For such design principles in their strictest sense, this is a much better method as it does most of the alignment and proximity rendering for you.

The designer also has several other tabs associated with it. The Master Page tab will open a designer that allows users to design a constant header and footer layout that will remain persistent on multi-page reports. These would be separate from the table headers and rows used in the Layout Editor.

The Script tab is for more advanced report developers, and allows for overloading report events associated with report elements. BIRT uses an event-based model for report rendering; so overloading particular events allows the user to control and manipulate at a much fi ner level the way a particular report will be displayed to the user. This also allows report developers to add in advanced business logic to report designs. BIRT utilizes the Mozilla Rhino JavaScript engine to accomplish this. In addition to internal report script, BIRT also allows developers to provide event handlers in external Java objects.

The next screens hot shows the BIRT Script Editor overriding an event for a Table object. You will notice the drop-down box displays the event method onPrepare that is being overridden. Next to it is a button labeled Reset Method, which will delete all code in the Editor and bring the event handler back to a default state. And next to it is a label Table, which indicates the name of the element that we are setting an event handler for.

It is important to note from experience that again, the Outline provides an invaluable tool for script editing in that it allows a developer to ensure that they are developing an event handler for the correct component. Too often with report development in BIRT, a developer will select the wrong component using the Layout Editor. Also, because the Layout Editor is not visible when the Script Editor is open, the Outline provides a convenient mechanism to switch between elements.

For those who are gluttons for punishment, you can view the actual XML Source for a report page. Personally I rarely ever use the XML Source viewer, except to copy report source code when helping individuals in the BIRT newsgroup.

Finally, there is the report Preview tab. This is a convenient way to preview how a report will look, without having to have the application launch a separate window with the report viewer. This is different than actually running the report using either the Outline or the Run options under the File menu. For one, it does not provide pagination, so report previews will come out as one giant HTML page. There are no navigation options under the report preview either.

Submit Your Blog Feedback Request Article Print Email

Related Articles


javabeat | advertise | about us | contact | useful resources
Copyright (2004 - 2013), JavaBeat