11.02.2013 Views

iReport Ultimate Guide

iReport Ultimate Guide

iReport Ultimate Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>iReport</strong> <strong>Ultimate</strong> <strong>Guide</strong><br />

During compilation of the JRXML file (using some JasperReports classes), the XML is parsed and loaded in a JasperDesign<br />

object, which is a rich data structure that allows you to represent the exact XML contents in memory. Without going into<br />

details, regardless of which language is used for expressions inside the JRXML, JasperReports creates a special Java class that<br />

represents the whole report. The report is then compiled, instanced and serialized in a JASPER file, ready for loading at any<br />

time.<br />

JasperReports’s speedy operation is due to all of a report’s formulas being compiled into Java-native bytecode and the report<br />

structure being verified during compilation instead of run time. The JASPER file does not contain extraneous resources, such<br />

as images used in the report, resource bundles to run the report in different languages, or extra scriptlets and external style<br />

definitions. All these resources must be provided by the host application and located at run time .<br />

3.3 Data Sources and Print Formats<br />

Without a means of supplying content from a dynamic data source, even the most sophisticated and appealing report would be<br />

useless. JasperReports allows you to specify fill data for the output report in two ways: parameters and data sources. Either<br />

kinds of data are presented by means of a generic interface named JRDataSource, as shown in Figure 3-1.<br />

36<br />

Code Example 3-1 A simple JRMXL file example, continued<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!