jasperreports ireport
Download
Skip this Video
Download Presentation
JasperReports & iReport

Loading in 2 Seconds...

play fullscreen
1 / 153

JasperReports & iReport - PowerPoint PPT Presentation


  • 182 Views
  • Uploaded on

JasperReports & iReport. Part I General Information about iReport. What is JasperReports?. JasperReports is a powerful open source Java reporting tool that has the ability to deliver rich content onto the screen, to the printer or into PDF, HTML, XLS, CSV and XML files .

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' JasperReports & iReport' - gwenifer-allen


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
what is jasperreports
What is JasperReports?
  • JasperReports is a powerful open source Java reporting tool that has the ability to deliver rich content onto the screen, to the printer or into PDF, HTML, XLS, CSV and XML files.
  • It is entirely written in Java and can be used in a variety of Java enabled applications, including J2EE or Web applications, to generate dynamic content.
  • Its main purpose is to help creating page oriented, ready to print documents in a simple and flexible manner.
jasperreports requirements
JasperReports Requirements
  • JRE
    • JRE 1.3 or higher
  • Commons
    • Jakarta Commons BeanUtils Component (version 1.7 or later)
    • Jakarta Commons Collections Component (version 2.1 or later)
    • Jakarta Commons Javaflow (Sandbox version)
    • Jakarta Commons Logging Component (version 1.0 or later)

http://jasperforge.org/sf/wiki/do/viewPage/projects.jasperreports/wiki/Requirements

jasperreports requirements1
JasperReports Requirements
  • XML
    • JAXP 1.1 XML Parser
    • Jakarta Commons Digester Component (version 1.7 or later)
  • JDBC
    • JDBC 2.0 Driver
  • PDF
    • iText - Free Java-PDF library by Bruno Lowagie and Paulo Soares (version 1.01 or later)
jasperreports requirements2
JasperReports Requirements
  • XLS
    • Jakarta POI (version 2.0 or later)
    • JExcelApi (version 2.5.7 or later)
  • Charts
    • JFreeChart (1.0.0 or later)
    • JCommon - required by JFreeChart
what is ireport
What is iReport ?
  • iReport is a powerful, intuitive and easy to use visual report builder/designer for JasperReports written in 100% pure java. This tool allows users to visually edit complex reports with charts, images, and subreports. iReport is integrated with leading open source chart libraries for java.
  • The data to print can be retrieved through several ways including multiple JDBC connections, TableModels, JavaBeans, XML, MDX, EJBQL, Hibernate, etc.
the main features of ireport
The main features of iReport
  • 98% of JasperReports tags supported
  • Visual designer wysiwyg with tools for draw rectangles, lines, ellipses, textfields fields, charts, subreports...
  • Built-in editor with syntax highlighting for write expression
  • Support for Unicode and non Latin language (russian, chinese, korean,...)
  • Document structure browser
  • Integrated compiler and exporter
the main features of ireport1
The main features of iReport
  • Support of all JDBC compliant databases
  • Support of all kind of JRDataSource
  • Wizard to create automagically reports
  • Support for subreports
  • Save backup
  • Support for templates
  • Facilities for fonts
useful jasperreports and ireport related links
Useful JasperReports and iReport related links
  • JasperReports home page
  • iReport home page
  • iText home page The pdf library used by JasperReports
installing ireport
Installing iReport
  • iReport comes as a zip archive. It contains the main distribution files (classes and source), some templates for wizard, all additional required jars.
ireport system requirements
iReport - System Requirements
  • Sun JDK 1.4 or greater
  • Ant (required if you want recompile sources, but strongly recommended to lunch iReport too)
  • JasperReports 0.4.6 (*)
  • SAX 2.0 XML Parser (Apache Xerces 1.3 or later recommended) (*)
  • Jakarta Commons Digester Component (version 1.1 or later) (*)
  • Jakarta Commons BeanUtils Component (version 1.1 or later) (*)
  • Jakarta Commons Collections Component (version 1.0 or later) (*)
  • Jakarta Commons Logging Component (version 1.0 or later) (*)
  • JDBC 2.0 Driver (A MySql driver is already included) (*)
  • iText - Free Java-PDF library by Bruno Lowagie and Paulo Soares (*)
ireport system requirements1
iReport - System Requirements
  • Jakarta POI (version 1.5.1 or later) (*)
  • JFreeChart (version 0.9.8 or later) (*)
  • Acrobat Reader 5.0 is not required, but strongly recommended.
  • If you think to use Chinese Simplified, Chinese traditional, Japanese and Korean characters, you must download the Asian font pack from Adobe at: http://www.adobe.com/products/acrobat/acrrasianfontpack.html or use a localized Windows.
  • If you want connect to a database, you must provide a JDBC driver (not shipped with iReport).

(*)a jar of this software is already included in the lib directory of iReport distribution, so you have not to download it.

  • Note that for now JFreeChart is used to generate charts. This can be change. I'm evaluating JCharts, another OpenSource charting library. It's possible that in future iReport will support both this libraries trought an abstract layer.
installation and configuration
Installation and configuration
  • If you have already installed on your machine a JDK (not simply a Java Runtime Environment, but a Java Development Kit) we are ready to start...
installation and configuration1
Installation and configuration
  • 1. Unzip iReport-x.x.x.zip and copy the extracted directory where you want.
  • 2. Look for a file called tools.jar in your JDK and copy it in the lib directory of iReport.If you have Ant installed on your machine, modify the file iReport.bat or iReport.sh to adjust the ant installation path (default is c:\ant under Win32 and /ant under Linux).
  • 3.Start iReport.bat or iReport.sh.If you don't have Ant installed (only for win32 users), go to the directory noAnt and type:startup.bat
installation and configuration2
Installation and configuration
  • At the first execution, iReport will create a directory (.ireport) in your home directory. Here will be stored all configuration files. iReport use XML files for configuration.***This files are not compatible with old 0.1.0 properties files***.
  • At startup all jars in the iReport lib directory are added to the classpath.
  • If you want use TTF Font files installed on your system, add to the classpath your fonts directory. iReport comes with an own fonts directory automatically added to the classpath.Started iReport...
installation and configuration3
Installation and configuration
  • 1. go to menu->Tools->Options
  • 2. go to tab external programs
  • 3. set external viewers programs
final test
Final test...
  • Ok, try if the configuration is ok....Create a new blank report. Click on the iReport "Run without connection" button After few seconds will appeared our PDF opened with the program that we have set, as signal that all is OK.
ireport and jasperreports basic concepts
iReport and JasperReports basic concepts
  • iReport is not useful without a library called JasperReports. This powerful library is one of the most advanced reporting engine available to the Open Source community.
  • Before starting to play with iReport, it's important understand what iReport do and why. In this chapter I'll explain some basic concepts on how JasperReports works, what iReport do using "jasper" itself and why it simplify the live of the user.
how jasperreports works
How JasperReports works
  • JasperReport works in a way similar to a compiler and an interpreter. The user design a report coding it in XML in agreement to tags and attributes defined in a file called jasperreports.dtd(part of JasperReports). Using XML a user define the entire report, describing where place texts, images, lines, rectangles, how to retrieve data, how to make certain calculations to show subtotals, etc...
how jasperreports works2
How JasperReports works
  • This XML source file must be compiled in order to produce a real report. The compiled version of the source is named "jasper file" (it ends with .jasper). A jasper file is a compiled report source.
  • When we have a jasper file, we need another thing in order to produce a report: we need data. This is not always true. In some cases We could want to generate a report that don't shows dynamic data, but i.e. only static text, but this can be reduced to a report that has only an empty record. To supply this records to the jasper engine we need to present it using a special jasperreports specific interface named JRDataSource.
  • A datasource + a jasper file = a print. A print can then be exported in many formats like PDF, HTML, XML, XLS, CVS, etc... The export will be done using special classes the implement specific exporters.
compilation end export of reports
Compilation end export of reports
  • For a newbie, design and create the jasper file is the hardest work. When you have designed and compiled your jasper file, you can use the JasperReport library to dynamically fill your report in several environments like a web application (using i.e. java Servlet, but I have successfully used JasperReports for generating PDF reports calling it from a PHP script...).
  • Jasper make available a special viewer to display a report preview, designed for swing based traditional java applications.
compilation end export of reports1
Compilation end export of reports
  • JasperReports can easily integrated in a Web application as in a java swing based program.
our first very simple report
Our first very simple report
  • iReport provide to JasperReport users a visual interface to build reports, generate jasper files and test prints.
  • iReport born as development tool, but it can be used as an office tool to retrieve and print data stored in a database, without pass through another application.
our first very simple report1
Our first very simple report
  • iReport can read and modify both jasper XML and jasper files. Trought jasperreports, it's able to compile XML to jasper files and "run reports" to fill it using several types of JRDataSource and export the result to PDF,HTML,XLS,CSV,...
  • To better understand as all works, we'll do a test. Follow this simple steps:
our first very simple report2
Our first very simple report
  • In this session we have created a simple report, saved as XML file, compiled as jasper file, filled with an "EmptyDataSource" end exported in PDF.
summary
Summary

iReport

Preview

Design

Create report layout

.jrmxl

PDF,XLS,RTF

,CSV,TXT,HTML

JasperReport

Runtime

Read

Generate output

.jrmxl

Compile to binary format

.jasper

a typical jrxml file contains the following elements
A typical jrxml file contains the following elements:
  • - the root element.
  • - its contents are printed only once at the beginning of the report </li><li><pageHeader> - its contents are printed at the beginning of every page in the report. </li><li><detail> - contains the body of the report. </li><li><pageFooter> - its contents are printed at the bottom of every page in the report. </li><li><band> - defines a report section, all of the above elements contain a band element as its only child element. </li></ul></div></div><div class="tslide"><div><img alt="a typical jrxml file contains the following elements1" src="https://image3.slideserve.com/6723346/a-typical-jrxml-file-contains-the-following-elements1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/a-typical-jrxml-file-contains-the-following-elements1-n.jpg" title="44.a typical jrxml file contains the following elements1" target="_blank">A typical jrxml file contains the following elements:</a></span><ul><li><jasperReport> - the root element. </li><li><title> - its contents are printed only once at the beginning of the report </li><li><pageHeader> - its contents are printed at the beginning of every page in the report. </li><li><detail> - contains the body of the report. </li><li><pageFooter> - its contents are printed at the bottom of every page in the report. </li><li><band> - defines a report section, all of the above elements contain a band element as its only child element. </li></ul></div></div><div class="tslide"><div><img alt="a typical jrxml file" src="https://image3.slideserve.com/6723346/a-typical-jrxml-file-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/a-typical-jrxml-file-n.jpg" title="45.a typical jrxml file" target="_blank">A typical jrxml file</a></span><ul><li>All of the elements are optional, except for the root jasperReport element. Here is an example jrxml file that will generate a simple report displaying the string "Hello World!" </li></ul></div></div><div class="tslide"><div><img alt="example jrxml file" src="https://image3.slideserve.com/6723346/example-jrxml-file-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/example-jrxml-file-n.jpg" title="46.example jrxml file" target="_blank">Example : jrxml file</a></span></div></div><div class="tslide"><div><img alt="compile jrxml files" src="https://image3.slideserve.com/6723346/compile-jrxml-files-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/compile-jrxml-files-n.jpg" title="47.compile jrxml files" target="_blank">Compilejrxml files </a></span><ul><li>jrxml files need to be "compiled" into a binary format that is specific to JasperReports, this can be achieved by calling the compileReport() method on the net.sf.jasperreports.engine.JasperCompileManagerclass. </li><li>There are several overloaded versions of this method, in our example, we will use the one that takes a single String parameter, consult the JasperReport documentation for details on the other versions of the method.</li></ul></div></div><div class="tslide"><div><img alt="part iv connections and datasources" src="https://image3.slideserve.com/6723346/part-iv-connections-and-datasources-t.jpg"></div><div><h3><a href="https://image3.slideserve.com/6723346/part-iv-connections-and-datasources-n.jpg" title="49.part iv connections and datasources" target="_blank">Part IV Connections and Datasources</a></h3></div></div><div class="tslide"><div><img alt="connections and datasources" src="https://image3.slideserve.com/6723346/connections-and-datasources-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/connections-and-datasources-n.jpg" title="50.connections and datasources" target="_blank">Connections and Datasources</a></span><ul><li>Data to print can be retrieved in several ways from different places like a database or a XML file. </li><li>This data is presented to JasperReports always in form of records using a special interface called JRDataSource. </li><li>JasperReports comes with a good set of implementations of this interface to wrap JDBC ResultSets, TableModels, Collections, Vectors and Arrays of objects, etc... But not always a JRDataSource is needed to supply data to the report in order to fill it. </li><li>In fact JasperReports can execute yourself sql queries using a given opened Connection to a database, and use the result to fill the report. How we'll see, this features will be very useful and easy to use. </li></ul></div></div><div class="tslide"><div><img alt="types of datasource" src="https://image3.slideserve.com/6723346/types-of-datasource-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/types-of-datasource-n.jpg" title="51.types of datasource" target="_blank">Types of datasource</a></span><ul><li>iReport supports JDBC connections and 4 types of datasource (that can be used to wrap any kind of custom datasource). </li><ul><li>1. Empty data source (JREmptyDatasource)</li><li>2. XML DataSource</li><li>3. JavaBeans Set Datasource</li><li>4. Custom Datasource</li></ul></ul></div></div><div class="tslide"><div><img alt="1 empty data source jremptydatasource" src="https://image3.slideserve.com/6723346/1-empty-data-source-jremptydatasource-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/1-empty-data-source-jremptydatasource-n.jpg" title="52.1 empty data source jremptydatasource" target="_blank">1. Empty data source (JREmptyDatasource)</a></span><ul><li>Empty data source (JREmptyDatasource): is a special datasource used to fill report that don't expose any records. This datasource is used when you press the button to "run" a report </li></ul></div></div><div class="tslide"><div><img alt="2 xml datasource" src="https://image3.slideserve.com/6723346/2-xml-datasource-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/2-xml-datasource-n.jpg" title="53.2 xml datasource" target="_blank">2. XML DataSource</a></span><ul><li>XML DataSource (not yet implemented): is a datasource capable to wrap an XML file and normalize its contentThe only information needed to create this type of datasource are a name (for the datasource) and the name of the XML file. </li></ul></div></div><div class="tslide"><div><img alt="2 xml datasource1" src="https://image3.slideserve.com/6723346/2-xml-datasource1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/2-xml-datasource1-n.jpg" title="54.2 xml datasource1" target="_blank">2. XML DataSource</a></span></div></div><div class="tslide"><div><img alt="3 javabeans set datasource" src="https://image3.slideserve.com/6723346/3-javabeans-set-datasource-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/3-javabeans-set-datasource-n.jpg" title="55.3 javabeans set datasource" target="_blank">3. JavaBeans Set Datasource</a></span><ul><li>JavaBeans Set Datasource (not yet implemented): is a datasource capable to wrap a Collection or an Array of JavaBeans..How all the rest of datasources used by iReport and presented here, this datasource need a special factory class that provides a static method to generate a collection or an array of JavaBeans (alias a set of Objects).</li><li>To create this datasource you need a name for the datasource, the name of a class that will provide the static method to call to retrive the Array/Collection of Objects and the name of this method that will have a definition like this: public static Collection createMyCollection()or public static Object[] createMyArray()</li><li>Remember to set the type of result (Collection or Array). </li></ul></div></div><div class="tslide"><div><img alt="3 javabeans set datasource1" src="https://image3.slideserve.com/6723346/3-javabeans-set-datasource1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/3-javabeans-set-datasource1-n.jpg" title="56.3 javabeans set datasource1" target="_blank">3. JavaBeans Set Datasource</a></span></div></div><div class="tslide"><div><img alt="4 custom datasource" src="https://image3.slideserve.com/6723346/4-custom-datasource-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/4-custom-datasource-n.jpg" title="57.4 custom datasource" target="_blank">4. Custom Datasource</a></span><ul><li>Custom Datasource: this type of datasource is generic. iReport don't know how the JRDataSource is implemented by this particular connection but it's not important. This datasource need a special factory class that provides a static method that return a JRDataSource.</li><li>To create this datasource you need a name for the datasource, the name of a class that will provide the static method to call to retrieve the JRDataSource and the name of this method that will have a definition like this:public static JRDataSource createMyJRDataSource()</li><li>An example of implementation of a custom datasource is provided at the end of this chapter. </li></ul></div></div><div class="tslide"><div><img alt="4 custom datasource1" src="https://image3.slideserve.com/6723346/4-custom-datasource1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/4-custom-datasource1-n.jpg" title="58.4 custom datasource1" target="_blank">4. Custom Datasource</a></span></div></div><div class="tslide"><div><img alt="setting up a jdbc connection" src="https://image3.slideserve.com/6723346/setting-up-a-jdbc-connection-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/setting-up-a-jdbc-connection-n.jpg" title="59.setting up a jdbc connection" target="_blank">Setting up a JDBC connection</a></span><ul><li>To set up a JDBC connection we need a running JDBC capable DBMS (I like MySQL), an appropriate JDBC driver to access it, a database and a valid account. Are you ready? Let's go!Select the menu </li></ul><p>Datasources > Connection/Datasources.</p><ul><li>Will appeare the frame with the list of datasources and JDBC connections that you have defined. Please note that you can define how many datasources and connecgtions you want but you can, for now, use only one at time. We'll see how set the "Active connection". </li></ul></div></div><div class="tslide"><div><img alt="setting up a jdbc connection1" src="https://image3.slideserve.com/6723346/setting-up-a-jdbc-connection1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/setting-up-a-jdbc-connection1-n.jpg" title="60.setting up a jdbc connection1" target="_blank">Setting up a JDBC connection</a></span><ul><li>Press the "New" button In the new frame, write a connection name (i.e. "My First JDBC connection"), select the right JDBC driver, you can specify one writing it directly or use one already present in the list. </li><li>Please note that this drivers are not shipped with iReport (except MySQL driver), be sure that the driver that you want use is in the classpath. </li></ul></div></div><div class="tslide"><div><img alt="setting up a jdbc connection2" src="https://image3.slideserve.com/6723346/setting-up-a-jdbc-connection2-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/setting-up-a-jdbc-connection2-n.jpg" title="61.setting up a jdbc connection2" target="_blank">Setting up a JDBC connection</a></span><ul><li>Putting a jar in the lib directory of iReport can be a good idea, but the jars present in this directory are added to the CLASSPATH only when iReport start. For now it's not possible change the classpath of iReport 2 dinamically.</li><li>Before write the URL, write the database name, then press the button "Wizard". In this way, if iReport recognize the driver, it will suggest a URL to use with.</li></ul></div></div><div class="tslide"><div><img alt="setting up a jdbc connection3" src="https://image3.slideserve.com/6723346/setting-up-a-jdbc-connection3-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/setting-up-a-jdbc-connection3-n.jpg" title="62.setting up a jdbc connection3" target="_blank">Setting up a JDBC connection</a></span></div></div><div class="tslide"><div><img alt="setting up a jdbc connection4" src="https://image3.slideserve.com/6723346/setting-up-a-jdbc-connection4-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/setting-up-a-jdbc-connection4-n.jpg" title="63.setting up a jdbc connection4" target="_blank">Setting up a JDBC connection</a></span><ul><li>Set the username and the password, then test the connection pressing the Test button. If all it's OK, a dialog box will inform you of the test success.</li></ul></div></div><div class="tslide"><div><img alt="setting up a jdbc connection5" src="https://image3.slideserve.com/6723346/setting-up-a-jdbc-connection5-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/setting-up-a-jdbc-connection5-n.jpg" title="64.setting up a jdbc connection5" target="_blank">Setting up a JDBC connection</a></span><ul><li>Many software use a very similar way to setting up a JDBC connection. You can refer to the specific JDBC driver documentation to know all options offered by the driver and the exact syntax of the URL.</li></ul></div></div><div class="tslide"><div><img alt="setting up a jdbc connection6" src="https://image3.slideserve.com/6723346/setting-up-a-jdbc-connection6-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/setting-up-a-jdbc-connection6-n.jpg" title="65.setting up a jdbc connection6" target="_blank">Setting up a JDBC connection</a></span><ul><li>All most used DBMS have a JDBC driver. If you need to access a database via ODBC on a Win32 system, you can use the JDBC-ODBC brigde, a special JDBC driver developed by Sun Inc.. But I suggest to verify first the presence of a JDBC driver.</li></ul></div></div><div class="tslide"><div><img alt="setting up a jdbc connection7" src="https://image3.slideserve.com/6723346/setting-up-a-jdbc-connection7-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/setting-up-a-jdbc-connection7-n.jpg" title="66.setting up a jdbc connection7" target="_blank">Setting up a JDBC connection</a></span><ul><li>iReport for default don't store connection passwords. If you want store it, you must first check the "Save password" checkbox. Press the "Save" button to definitely store the connection in the iReport connections pool. </li></ul></div></div><div class="tslide"><div><img alt="setting up a custom datasource" src="https://image3.slideserve.com/6723346/setting-up-a-custom-datasource-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/setting-up-a-custom-datasource-n.jpg" title="67.setting up a custom datasource" target="_blank">Setting up a custom datasource</a></span><ul><li>I will not bore to you with other basic slight notions on which button you must press in order to execute what is written on it...</li><li>If you have not, read the previous paragraph that explains where put hands to create a new datasource/connection. You only should to know that you can choose the type of your datasource selecting it by the combo box in the connection frame.</li></ul></div></div><div class="tslide"><div><img alt="setting up a custom datasource1" src="https://image3.slideserve.com/6723346/setting-up-a-custom-datasource1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/setting-up-a-custom-datasource1-n.jpg" title="68.setting up a custom datasource1" target="_blank">Setting up a custom datasource</a></span><ul><li>When you have filled all fields, test it with the test button. </li><li>In this session we have created a simple report, saved as XML file, compiled as jasper file, filled with an "EmptyDataSource" end exported in PDF. </li></ul></div></div><div class="tslide"><div><img alt="implementing a new custom datasource" src="https://image3.slideserve.com/6723346/implementing-a-new-custom-datasource-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/implementing-a-new-custom-datasource-n.jpg" title="69.implementing a new custom datasource" target="_blank">Implementing a new custom datasource</a></span><ul><li>This topic is more a JasperReports related argument, than an iReport feature explanation. But I think that can be useful know how you can developed your custom data driver (alias JRDataSource).</li><li>We will write a very simple JRDataSource that retrieve fields from a CSV file. A CSV file is a text file that contains a set row. Any row contains a certain number of fields separated by a special character (i.e. the semicolon ';').</li><li>What must do our datasource is retrieve this rows and return the right value to JasperReport when it ask for a fields (or column). What we have to do is implement this very simple interface:</li></ul></div></div><div class="tslide"><div><img alt="implementing a new custom datasource1" src="https://image3.slideserve.com/6723346/implementing-a-new-custom-datasource1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/implementing-a-new-custom-datasource1-n.jpg" title="70.implementing a new custom datasource1" target="_blank">Implementing a new custom datasource</a></span><p>package dori.jasper.engine;public interface JRDataSource{public boolean next() throws JRException;      public Object  getFieldValue(JRField jrField) throws JRException;}</p></div></div><div class="tslide"><div><img alt="implementing a new custom datasource2" src="https://image3.slideserve.com/6723346/implementing-a-new-custom-datasource2-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/implementing-a-new-custom-datasource2-n.jpg" title="71.implementing a new custom datasource2" target="_blank">Implementing a new custom datasource</a></span><ul><li>A JRField is a vary simple class to. It contains the name of the field (a String), and the java Class that represents the type of this field. In our case all fields are of type String, but we can choose to use as field name (alias the column name) the values of the first row of our cvs file or a generic name as COLUMN_1, COLUMN_2, ... </li><li>This is the same way used by JasperReport in implementation of the TableModel wrapper datasource, that can indifferently use as column name the value of the column header (if present) or the special name COLUMN_<n> with n in the set {0,1,2,3,...,k}. We'll use fixed names to refer columns in our datasource (COLUMN_1, COLUMN_2, ...).</li></ul></div></div><div class="tslide"><div><img alt="jrcsvdatasource java" src="https://image3.slideserve.com/6723346/jrcsvdatasource-java-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/jrcsvdatasource-java-n.jpg" title="72.jrcsvdatasource java" target="_blank">JRCSVDataSource.java </a></span></div></div><div class="tslide"><div><img alt="jrcsvdatasource java1" src="https://image3.slideserve.com/6723346/jrcsvdatasource-java1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/jrcsvdatasource-java1-n.jpg" title="73.jrcsvdatasource java1" target="_blank">JRCSVDataSource.java </a></span><ul><li>How you can see, only 38 lines of code... It's time to test it...We'll write a little "JRDataSourcFactory" in order to use it with iReport. This factory will instance a JRCSVDataSource and will return it with the static method: getTheDatasource()</li></ul></div></div><div class="tslide"><div><img alt="csvdatasourcetestfactory java" src="https://image3.slideserve.com/6723346/csvdatasourcetestfactory-java-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/csvdatasourcetestfactory-java-n.jpg" title="74.csvdatasourcetestfactory java" target="_blank">CSVDatasourceTestFactory.java</a></span></div></div><div class="tslide"><div><img alt="implementing a new custom datasource3" src="https://image3.slideserve.com/6723346/implementing-a-new-custom-datasource3-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/implementing-a-new-custom-datasource3-n.jpg" title="75.implementing a new custom datasource3" target="_blank">Implementing a new custom datasource</a></span><ul><li>Open iReport, create a new custom JRDataSource connection and fill all fields as in Figure, test and save the connection. </li></ul></div></div><div class="tslide"><div><img alt="implementing a new custom datasource4" src="https://image3.slideserve.com/6723346/implementing-a-new-custom-datasource4-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/implementing-a-new-custom-datasource4-n.jpg" title="76.implementing a new custom datasource4" target="_blank">Implementing a new custom datasource</a></span><ul><li>Now go to Build > Set active connection and select our new connection ("CSV Datasource (test.csv)")</li></ul></div></div><div class="tslide"><div><img alt="implementing a new custom datasource5" src="https://image3.slideserve.com/6723346/implementing-a-new-custom-datasource5-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/implementing-a-new-custom-datasource5-n.jpg" title="77.implementing a new custom datasource5" target="_blank">Implementing a new custom datasource</a></span><ul><li>This is the result. We'll soon learn how to create the trial report used to test our datasource </li></ul></div></div><div class="tslide"><div><img alt="part v bands and groups" src="https://image3.slideserve.com/6723346/part-v-bands-and-groups-t.jpg"></div><div><h3><a href="https://image3.slideserve.com/6723346/part-v-bands-and-groups-n.jpg" title="78.part v bands and groups" target="_blank">Part V Bands and groups</a></h3><p>In this chapter we'll see how a report is structured and how modify this structure. </p></div></div><div class="tslide"><div><img alt="bands" src="https://image3.slideserve.com/6723346/bands-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/bands-n.jpg" title="79.bands" target="_blank">Bands</a></span><ul><li>A report is composed by a variable set of sections named bands. </li><li>Every band is defined by an height (that should be considered as a minimal height). If the band height is zero, the band will be never visible.</li><li>The band height can grown if elements inside it are stretched. A minimal document has ever:</li></ul></div></div><div class="tslide"><div><img alt="bands1" src="https://image3.slideserve.com/6723346/bands1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/bands1-n.jpg" title="80.bands1" target="_blank">Bands</a></span></div></div><div class="tslide"><div><img alt="bands2" src="https://image3.slideserve.com/6723346/bands2-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/bands2-n.jpg" title="81.bands2" target="_blank">Bands</a></span><ul><li>There is then a special band named background that can be used to define a page background (i.e. using a watermark image).</li><li>The position of a band respect other bands can not be modified. For each band you can modify the minimum height, the value of a flag that allows to split a band during filling process if it's bigger than the portion of page in wich it should be printed, and an boolean expression (alias a java expression that return a Boolean object), with wich is possible control if the band is visible or note. If no expression is defined for a band, the visibility is set to "true".</li></ul></div></div><div class="tslide"><div><img alt="bands3" src="https://image3.slideserve.com/6723346/bands3-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/bands3-n.jpg" title="82.bands3" target="_blank">Bands</a></span><ul><li>Bands button on toolbar. </li></ul></div></div><div class="tslide"><div><img alt="bands4" src="https://image3.slideserve.com/6723346/bands4-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/bands4-n.jpg" title="83.bands4" target="_blank">Bands</a></span><ul><li>Pressing the bands button or selecting the menu item View > Bands , the bands form will be opened.</li></ul></div></div><div class="tslide"><div><img alt="bands5" src="https://image3.slideserve.com/6723346/bands5-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/bands5-n.jpg" title="84.bands5" target="_blank">Bands</a></span><ul><li>From here it's possible modify the band height and set the band expression.The title and summary bands can be printed on a new page. To use this feature, you must go in the report properties form, select the tab "more" and use the proper checkbox. </li></ul></div></div><div class="tslide"><div><img alt="bands6" src="https://image3.slideserve.com/6723346/bands6-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/bands6-n.jpg" title="85.bands6" target="_blank">Bands</a></span><ul><li>Report properties, tab more (menu item View > Report properties). </li></ul></div></div><div class="tslide"><div><img alt="groups" src="https://image3.slideserve.com/6723346/groups-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/groups-n.jpg" title="86.groups" target="_blank">Groups</a></span><ul><li>If you need to group data, you can add one or more groups. When a group is created, two new bands are added to the report: the group header and the group footer. </li></ul></div></div><div class="tslide"><div><img alt="groups1" src="https://image3.slideserve.com/6723346/groups1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/groups1-n.jpg" title="87.groups1" target="_blank">If you need to group data, you can add one or more groups.</a> When a group is created, two new bands are added to the report: the group header and the group footer. </span><span><a href="https://image3.slideserve.com/6723346/groups1-n.jpg" title="87.groups1" target="_blank">Groups</a></span></div></div><div class="tslide"><div><img alt="groups2" src="https://image3.slideserve.com/6723346/groups2-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/groups2-n.jpg" title="88.groups2" target="_blank">Groups</a></span><ul><li>A group is defined by an expression. For each record processed, JasperReports evaluate this expression. If the expression value is changed, the group change. </li><li>Please note that JasperReports don't perform any order on data, so if you use a field as expression and values for this fields are A B A B, four groups are created, against the expected two</li></ul></div></div><div class="tslide"><div><img alt="groups3" src="https://image3.slideserve.com/6723346/groups3-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/groups3-n.jpg" title="89.groups3" target="_blank">Groups</a></span><ul><li>(one for each record with the field value set to A, and one for the records number 2 and 3, with the field value set to B). If you present to JasperReports the ordered data (A A B B), all will works fine.</li></ul></div></div><div class="tslide"><div><img alt="groups4" src="https://image3.slideserve.com/6723346/groups4-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/groups4-n.jpg" title="90.groups4" target="_blank">Groups</a></span><ul><li>Groups button on toolbar. </li><li>Pressing the groups button (or selecting the menu item View > Groups) you can open the groups form from which you can handle groups.</li></ul></div></div><div class="tslide"><div><img alt="groups5" src="https://image3.slideserve.com/6723346/groups5-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/groups5-n.jpg" title="91.groups5" target="_blank">From this form you can set all group properties. </a></span><span><a href="https://image3.slideserve.com/6723346/groups5-n.jpg" title="91.groups5" target="_blank">Groups</a></span></div></div><div class="tslide"><div><img alt="part vi ireport plugins" src="https://image3.slideserve.com/6723346/part-vi-ireport-plugins-t.jpg"></div><div><h3><a href="https://image3.slideserve.com/6723346/part-vi-ireport-plugins-n.jpg" title="92.part vi ireport plugins" target="_blank">Part VI iReport plugins</a></h3><p>From version 0.3.1, iReport supports a plugin system to extend his features. In this chapter we'll learn how to create an iReport plugin and how to deploy it. </p></div></div><div class="tslide"><div><img alt="ireport plugins" src="https://image3.slideserve.com/6723346/ireport-plugins-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/ireport-plugins-n.jpg" title="93.ireport plugins" target="_blank">iReport plugins</a></span><ul><li>An iReport plugin is composed by a descriptor file (an XML document placed in the "plugin" directory) and a set of classes (or a jar) placed in the classpath.</li><li>Normally, when plugin is loaded, iReport creates an item in the plugin menu on main frame. Plugins are loaded only on iReport startup. When the plugin menu item is selected, iReport instance the plugin (if not yet instanced) and call the plagin's call() method.</li></ul></div></div><div class="tslide"><div><img alt="ireport plugins1" src="https://image3.slideserve.com/6723346/ireport-plugins1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/ireport-plugins1-n.jpg" title="94.ireport plugins1" target="_blank">iReport plugins</a></span><ul><li>A plugin is instanced only one time, and in descriptor file it's possible specify to instance it at iReport startup instead to wait for the first user invokation. This is useful when the plugin is marked as "hidden", and it is not visible on the plugin menu.</li></ul></div></div><div class="tslide"><div><img alt="ireport plugins2" src="https://image3.slideserve.com/6723346/ireport-plugins2-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/ireport-plugins2-n.jpg" title="95.ireport plugins2" target="_blank">iReport plugins</a></span><ul><li>The plugin menu on iReport main frame.</li><li>A plugin can be marked as configurable. In this case, the plugin must implement the method configure() that will be executed when the user ask to configure the plugin.</li></ul></div></div><div class="tslide"><div><img alt="the abstract ireport plugin" src="https://image3.slideserve.com/6723346/the-abstract-ireport-plugin-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/the-abstract-ireport-plugin-n.jpg" title="96.the abstract ireport plugin" target="_blank">The abstract iReport plugin</a></span><ul><li>All iReport plugins extends the abstract class it.businesslogic.ireport.plugin.IReportPlugin. This class is really simple:</li></ul></div></div><div class="tslide"><div><img alt="ireportplugin java" src="https://image3.slideserve.com/6723346/ireportplugin-java-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/ireportplugin-java-n.jpg" title="97.ireportplugin java" target="_blank">IReportPlugin.java</a></span></div></div><div class="tslide"><div><img alt="ireportplugin java1" src="https://image3.slideserve.com/6723346/ireportplugin-java1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/ireportplugin-java1-n.jpg" title="98.ireportplugin java1" target="_blank">IReportPlugin.java</a></span></div></div><div class="tslide"><div><img alt="ireportplugin java2" src="https://image3.slideserve.com/6723346/ireportplugin-java2-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/ireportplugin-java2-n.jpg" title="99.ireportplugin java2" target="_blank">IReportPlugin.java</a></span></div></div><div class="tslide"><div><img alt="the abstract ireport plugin1" src="https://image3.slideserve.com/6723346/the-abstract-ireport-plugin1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/the-abstract-ireport-plugin1-n.jpg" title="100.the abstract ireport plugin1" target="_blank">The abstract iReport plugin</a></span><ul><li>Please note that the ONLY abstract method that must be implemented is call() that is called each time the plugin is invoked from the user.</li><li>If you want add a configuration GUI for you plugin, then you must implement the configure() method too. </li></ul></div></div><div class="tslide"><div><img alt="the plugin file descriptor" src="https://image3.slideserve.com/6723346/the-plugin-file-descriptor-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/the-plugin-file-descriptor-n.jpg" title="101.the plugin file descriptor" target="_blank">The plugin file descriptor</a></span><ul><li>The plugin file descriptor is a file with an arbitrary name that describe a plugin. The main information about the plugin are: </li><ul><li>NAME this is the name that will be displayed in the menu item); </li><li>CLASS the plugin class that extendes IReportPlugin; </li><li>ICON FILE an icon used on menu (must be 16x16); </li></ul></ul></div></div><div class="tslide"><div><img alt="the plugin file descriptor1" src="https://image3.slideserve.com/6723346/the-plugin-file-descriptor1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/the-plugin-file-descriptor1-n.jpg" title="102.the plugin file descriptor1" target="_blank">The plugin file descriptor</a></span></div></div><div class="tslide"><div><img alt="the plugin file descriptor2" src="https://image3.slideserve.com/6723346/the-plugin-file-descriptor2-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/the-plugin-file-descriptor2-n.jpg" title="103.the plugin file descriptor2" target="_blank">The plugin file descriptor</a></span></div></div><div class="tslide"><div><img alt="the hello world plugin" src="https://image3.slideserve.com/6723346/the-hello-world-plugin-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/the-hello-world-plugin-n.jpg" title="104.the hello world plugin" target="_blank">The hello world plugin</a></span><ul><li>The following example show a really simple plugin that show a simple message when invoked or configured. </li></ul></div></div><div class="tslide"><div><img alt="helloworld java" src="https://image3.slideserve.com/6723346/helloworld-java-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/helloworld-java-n.jpg" title="105.helloworld java" target="_blank">HelloWorld.java</a></span></div></div><div class="tslide"><div><img alt="helloworld descriptor xml" src="https://image3.slideserve.com/6723346/helloworld-descriptor-xml-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/helloworld-descriptor-xml-n.jpg" title="106.helloworld descriptor xml" target="_blank">Helloworld_descriptor.xml</a></span></div></div><div class="tslide"><div><img alt="part vii using the xml datasource" src="https://image3.slideserve.com/6723346/part-vii-using-the-xml-datasource-t.jpg"></div><div><h3><a href="https://image3.slideserve.com/6723346/part-vii-using-the-xml-datasource-n.jpg" title="107.part vii using the xml datasource" target="_blank">Part VII Using the XML datasource</a></h3><p>Starting from version 0.3.2, iReport provides an XML datasource that permit to fill a report reading data from an XML file.iReport 0.4.0 use JRXmlDatasource shipped with JasperReports (from version 0.6.x) </p></div></div><div class="tslide"><div><img alt="using the xml datasource" src="https://image3.slideserve.com/6723346/using-the-xml-datasource-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/using-the-xml-datasource-n.jpg" title="108.using the xml datasource" target="_blank">Using the XML datasource</a></span><ul><li>This new implementation was developed by Peter Severin (developer of JasperAssistant).</li><li>This new implementation is much powerful supporting real XPath expressions. </li></ul></div></div><div class="tslide"><div><img alt="configuring an xml datasource" src="https://image3.slideserve.com/6723346/configuring-an-xml-datasource-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/configuring-an-xml-datasource-n.jpg" title="109.configuring an xml datasource" target="_blank">Configuring an XML datasource</a></span><ul><li>The first step to use an XML file as a datasource is configure an XML Datasource. Select menu Datasource > Connections / Datasources, press New and select "XML file datasource"as connection type.</li></ul></div></div><div class="tslide"><div><img alt="configuring an xml datasource1" src="https://image3.slideserve.com/6723346/configuring-an-xml-datasource1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/configuring-an-xml-datasource1-n.jpg" title="110.configuring an xml datasource1" target="_blank">Fill the name field with the name of this datasource (i.e.</a> Adressbook), select the XML file and set the record path.</span><span><a href="https://image3.slideserve.com/6723346/configuring-an-xml-datasource1-n.jpg" title="110.configuring an xml datasource1" target="_blank">Configuring an XML datasource</a></span></div></div><div class="tslide"><div><img alt="the record path" src="https://image3.slideserve.com/6723346/the-record-path-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/the-record-path-n.jpg" title="111.the record path" target="_blank">The Record Path</a></span><ul><li>An XML document is structured as a tree. JasperReports need data organized as a record set, so we must present a tree as set of record. The Record Path is a string that define the minimum path required to define a record.</li></ul></div></div><div class="tslide"><div><img alt="the record path1" src="https://image3.slideserve.com/6723346/the-record-path1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/the-record-path1-n.jpg" title="112.the record path1" target="_blank">The Record Path</a></span><ul><li>Example 1:</li><ul><li>It this very simple case, the Record Path is the path from the root (tag palette) to the leaf (tag color): /palette/color</li></ul></ul></div></div><div class="tslide"><div><img alt="the record path2" src="https://image3.slideserve.com/6723346/the-record-path2-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/the-record-path2-n.jpg" title="113.the record path2" target="_blank">Example 2:</a></span><p>Please note that in this case the path don't ends with a leaf tag.In general, the end tag is the first tag that has children of different type or is a leaf.</p><span><a href="https://image3.slideserve.com/6723346/the-record-path2-n.jpg" title="113.the record path2" target="_blank">The Record Path</a></span></div></div><div class="tslide"><div><img alt="the record path3" src="https://image3.slideserve.com/6723346/the-record-path3-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/the-record-path3-n.jpg" title="114.the record path3" target="_blank">When the document become more complex, we can read prodoce</a> a sub-datasource starting from a child. </span><p>In example 3 we can see that any color can have 0 or more aliases... </p><span><a href="https://image3.slideserve.com/6723346/the-record-path3-n.jpg" title="114.the record path3" target="_blank">The Record Path</a></span></div></div><div class="tslide"><div><img alt="the record path4" src="https://image3.slideserve.com/6723346/the-record-path4-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/the-record-path4-n.jpg" title="115.the record path4" target="_blank">In this case we can think to tags alias as a set of records</a> childs of master record /palette/color, the childs record will have as record path the value /color/alias: </span><p>Note as this XML is very similar to </p><p> example 1. </p><span><a href="https://image3.slideserve.com/6723346/the-record-path4-n.jpg" title="115.the record path4" target="_blank">The Record Path</a></span></div></div><div class="tslide"><div><img alt="xml datasource syntax" src="https://image3.slideserve.com/6723346/xml-datasource-syntax-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/xml-datasource-syntax-n.jpg" title="116.xml datasource syntax" target="_blank">XML Datasource Syntax </a></span><ul><li>To bind fields inside the XML, a syntax similar to XPath is used. The field path is stored in the field description (this because the field name don't support a name like "/palette/color").The path syntax is really simple. Is a recursive expression:</li></ul><p><base_path>[<symbol> <base_path>[<symbol><...>] ]</p></div></div><div class="tslide"><div><img alt="xml datasource syntax1" src="https://image3.slideserve.com/6723346/xml-datasource-syntax1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/xml-datasource-syntax1-n.jpg" title="117.xml datasource syntax1" target="_blank">XML Datasource Syntax </a></span><ul><li><base_path>is the path from the root to the tag. If this path is longer than the Record Path, it's cuted to the Record Path. It is required for a field definition. If it's alone, the value of the tag is returned.Example: /palette/color</li></ul></div></div><div class="tslide"><div><img alt="xml datasource syntax2" src="https://image3.slideserve.com/6723346/xml-datasource-syntax2-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/xml-datasource-syntax2-n.jpg" title="118.xml datasource syntax2" target="_blank">XML Datasource Syntax </a></span><ul><li><symbol>is used to add an extra path to the base path and to define what should be returned.+ add the following path to the base_path (this happen when the base_path = record path);@ return the attribute value: it's followed by the attribute name;* return all tags identified by the following path as a JRXMLDatasource</li></ul></div></div><div class="tslide"><div><img alt="xml datasource syntax3" src="https://image3.slideserve.com/6723346/xml-datasource-syntax3-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/xml-datasource-syntax3-n.jpg" title="119.xml datasource syntax3" target="_blank">XML Datasource Syntax </a></span><ul><li>Examples:/palette/color+name/color/alias@type/palette/color*alias/addressbook/catogory/person+other_info+extra_time/hobbies*hobby/addressbook@creation_date </li></ul></div></div><div class="tslide"><div><img alt="addressbook sample" src="https://image3.slideserve.com/6723346/addressbook-sample-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/addressbook-sample-n.jpg" title="120.addressbook sample" target="_blank">Addressbook sample </a></span><ul><li>This sample shows how to use the JRXMLDatasource using subreports.The sample is composed by 4 files:addressbook.xml is the data fileaddressbook.jrxml is the master report filehobby.jrxml is the hobby subreporteamil.jrxml is the email subreport</li></ul></div></div><div class="tslide"><div><img alt="addressbook xml" src="https://image3.slideserve.com/6723346/addressbook-xml-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/addressbook-xml-n.jpg" title="121.addressbook xml" target="_blank">addressbook.xml</a></span></div></div><div class="tslide"><div><img alt="addressbook sample1" src="https://image3.slideserve.com/6723346/addressbook-sample1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/addressbook-sample1-n.jpg" title="122.addressbook sample1" target="_blank">Addressbook sample </a></span><ul><li>We have defined a datasource named Addressbook that use addressbook.xml as data file. The Record path is: /addressbook/category/personFields in the report are defined as follow:</li></ul></div></div><div class="tslide"><div><img alt="addressbook sample2" src="https://image3.slideserve.com/6723346/addressbook-sample2-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/addressbook-sample2-n.jpg" title="123.addressbook sample2" target="_blank">Addressbook sample </a></span><ul><li>To the master report we have added a group named CATEGORY that has as expression the category name. </li><li>The master report.</li></ul></div></div><div class="tslide"><div><img alt="addressbook sample3" src="https://image3.slideserve.com/6723346/addressbook-sample3-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/addressbook-sample3-n.jpg" title="124.addressbook sample3" target="_blank">Addressbook sample </a></span><ul><li>We have two subreport too, one for hobbies of a person and one for email addresses.</li><li>The first subreport element has $F{HOBBIES} as connection expression (of type datasource expression) and as subreport expression "/hobby.jasper"of type String.The second subreport element has $F{EMAIL_ADDRESSES} as connection expression (of type datasource expression) and as subreport expression "/email.jasper" of type String.</li></ul></div></div><div class="tslide"><div><img alt="addressbook sample4" src="https://image3.slideserve.com/6723346/addressbook-sample4-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/addressbook-sample4-n.jpg" title="125.addressbook sample4" target="_blank">In hobby.jasper we have defined only one field: </a></span><p>The same in email.jasper:</p><span><a href="https://image3.slideserve.com/6723346/addressbook-sample4-n.jpg" title="125.addressbook sample4" target="_blank">Addressbook sample </a></span><ul><li>Note as every field in subreport are defined specifing as root element in the path the parent element:HOBBY -> /hobbies/hobbyEMAIL -> /person/email </li></ul></div></div><div class="tslide"><div><img alt="addressbook sample5" src="https://image3.slideserve.com/6723346/addressbook-sample5-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/addressbook-sample5-n.jpg" title="126.addressbook sample5" target="_blank">Addressbook sample </a></span></div></div><div class="tslide"><div><img alt="addressbook sample6" src="https://image3.slideserve.com/6723346/addressbook-sample6-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/addressbook-sample6-n.jpg" title="127.addressbook sample6" target="_blank">Addressbook sample </a></span><ul><li>Finally we show how to use the JRXMLDataDource in a program</li></ul></div></div><div class="tslide"><div><img alt="xmldatasourceexample java" src="https://image3.slideserve.com/6723346/xmldatasourceexample-java-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/xmldatasourceexample-java-n.jpg" title="128.xmldatasourceexample java" target="_blank">XMLDataSourceExample.java</a></span></div></div><div class="tslide"><div><img alt="xmldatasourceexample java1" src="https://image3.slideserve.com/6723346/xmldatasourceexample-java1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/xmldatasourceexample-java1-n.jpg" title="129.xmldatasourceexample java1" target="_blank">XMLDataSourceExample.java</a></span></div></div><div class="tslide"><div><img alt="xml datasource license" src="https://image3.slideserve.com/6723346/xml-datasource-license-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/xml-datasource-license-n.jpg" title="130.xml datasource license" target="_blank">XML Datasource license</a></span><ul><li>JRXMLDatasource is not released under GPL license (as iReport is) but under LGPL as jasperreports: in this way you can use the JRXMLDataSource in your program without problems.</li><li>However, if you use it, please make a symbolic donation to the iReport project.</li></ul></div></div><div class="tslide"><div><img alt="part viii charts" src="https://image3.slideserve.com/6723346/part-viii-charts-t.jpg"></div><div><h3><a href="https://image3.slideserve.com/6723346/part-viii-charts-n.jpg" title="131.part viii charts" target="_blank">Part VIII Charts</a></h3></div></div><div class="tslide"><div><img alt="charts" src="https://image3.slideserve.com/6723346/charts-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/charts-n.jpg" title="132.charts" target="_blank">Charts</a></span><ul><li>JasperReports does not manage directly charts: they must be created independently as images, even using one of numerous open-source java libraries availables to create charts. The produced image will be shown using an image element. The idea is really simple, but the creation of a chart at run time requires a good knowledge of JasperReports programming, and many times it's needed to use write scriptlets capable of collecting data that willl be exposed by the chart.</li></ul></div></div><div class="tslide"><div><img alt="charts1" src="https://image3.slideserve.com/6723346/charts1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/charts1-n.jpg" title="133.charts1" target="_blank">Charts</a></span><ul><li>With version 0.4.0, iReport provides a solution to simplify chart building with a new chart tool. This tool permits to create a chart configuring main properties and data to feed it in a very simple manner for the final user.</li><li>Creation of a chart is delagated to a well know open source library named JFreeCharts (version 0.9.21) developed by David Gilbert from Object Refinery Limited. iReport supportas for now only a little number of chart types exposed from JFreeCharts, and can be modified only few chart properties (in effect JFreeChart permits a really fine control on all chart properties), but it's possible, anyway, create clear chart with a big vision impact.</li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart-n.jpg" title="134.creation of a simple chart" target="_blank">Creation of a simple chart</a></span><ul><li>In this paragraph we'll take confidence with chart tool, building a report with a Pie3D chart step by step; subsequently we'll take a look on all details related to the chart handling.In the sample we'll use as Datasource the NorthWind database on HSQLDB.</li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart1" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart1-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart1-n.jpg" title="135.creation of a simple chart1" target="_blank">Creation of a simple chart</a></span><ul><li>We start opening a blank document. Open the query window using this button: </li></ul><p> and write in the SQL textfield this query:select SHIPCOUNTRY, COUNT(*) AS ORDERS_COUNT</p><p> from ORDERS </p><p> group by SHIPCOUNTRY</p></div></div><div class="tslide"><div><img alt="creation of a simple chart2" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart2-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart2-n.jpg" title="136.creation of a simple chart2" target="_blank">Creation of a simple chart</a></span><ul><li>The report query</li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart3" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart3-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart3-n.jpg" title="137.creation of a simple chart3" target="_blank">Creation of a simple chart</a></span><ul><li>The idea is create a chart to illustrate sales in different states. Executed the quey, seleced fields will appeare on the list. Confirm the field registration pressing the OK button: all field retrived from the query will be registered to the report. We can position fields in the report detail dragging it, i.e. from the objects library </li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart4" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart4-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart4-n.jpg" title="138.creation of a simple chart4" target="_blank">Creation of a simple chart</a></span><ul><li>The report with field SHIPCOUNTRY</li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart5" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart5-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart5-n.jpg" title="139.creation of a simple chart5" target="_blank">Creation of a simple chart</a></span><ul><li>We have to set the height of no useful bands (all exclude summary and details) to zero.</li><li>Select the chart tool and draw a rectangle in the summary band with mouse.</li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart6" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart6-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart6-n.jpg" title="140.creation of a simple chart6" target="_blank">Creation of a simple chart</a></span><ul><li>We put the chart in the summary band. </li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart7" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart7-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart7-n.jpg" title="141.creation of a simple chart7" target="_blank">Creation of a simple chart</a></span><ul><li>iReport will alert about need to activate the internal scriptlet support to handle scriptlet: click YES. From the chart palette select i.e.the Pie3D chart type and press OK. We should be now in the situation showed in figure. </li><li>At this point we must configure the chart. Open element properties window (double click on element), go to chart tab and press "Edit chart properties".</li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart8" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart8-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart8-n.jpg" title="142.creation of a simple chart8" target="_blank">Creation of a simple chart</a></span><ul><li>Chart Tab</li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart9" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart9-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart9-n.jpg" title="143.creation of a simple chart9" target="_blank">Creation of a simple chart</a></span><ul><li>Will appears the chart properties window (the same from wich we are choose the chart type)</li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart10" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart10-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart10-n.jpg" title="144.creation of a simple chart10" target="_blank">Creation of a simple chart</a></span><ul><li>This window is organized with three tabs: </li><ul><li>Chart type</li><li>Data </li><li>Chart details</li></ul></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart11" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart11-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart11-n.jpg" title="145.creation of a simple chart11" target="_blank">Creation of a simple chart</a></span><ul><li>The first tab permits to choose the chart type to show: every chart need data structured in series; all series needed by the selected chart type are listed in the frame labeled "Chart Info" on tab bottom where is exposed the name of the chart type and the library used to generate it (for now all charts are produced using JFreeChart 0.9.21, but iReport can support other libraries).</li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart12" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart12-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart12-n.jpg" title="146.creation of a simple chart12" target="_blank">Creation of a simple chart</a></span><ul><li>In our case we'll need a serie to store labels (exposed in the Y axis), and a single serie of nambers (named Serie 1).</li><li>Move us on Data tab. We'll find a table with two rows ready to get the name the two series that satisfy the chart needs .</li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart13" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart13-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart13-n.jpg" title="147.creation of a simple chart13" target="_blank">Creation of a simple chart</a></span><ul><li>Tab Data</li><li>They are different ways to create a serie. For now we'll use the simplest way: we'll leave iReport handle the serie for us. Select the "Report series" button to open the report series window</li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart14" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart14-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart14-n.jpg" title="148.creation of a simple chart14" target="_blank">Creation of a simple chart</a></span><ul><li>Report series</li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart15" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart15-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart15-n.jpg" title="149.creation of a simple chart15" target="_blank">Creation of a simple chart</a></span><ul><li>Create a brand new serie pressing "New serie". The window will appear. Give a name for the serie (i.e. COUNTRY) and set the "Reset When" to . Now we have to write an expression for the value that we want collect to generate the serie. In our case we'll have a serie of strings for SHIPCOUNTRY and a serie of integer numbers for Serie1.</li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart16" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart16-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart16-n.jpg" title="150.creation of a simple chart16" target="_blank">Creation of a simple chart</a></span><ul><li>Serie definition</li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart17" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart17-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart17-n.jpg" title="151.creation of a simple chart17" target="_blank">Creation of a simple chart</a></span><ul><li>To use the expression editor, press the left mouse button over the text area and select the "Use texteditor" menu item.Add all the two series , go back to window of “Tab Data” and select the two created series from the two combo boxes to assign on Labels the SERIE_COUNTRY and on Serie1 the SERIE_ORDERS_COUNT.Confirm chart properties modifications, save file and run the report using teh active datasource (button on the toolbar). You can show the final result.</li></ul></div></div><div class="tslide"><div><img alt="creation of a simple chart18" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart18-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart18-n.jpg" title="152.creation of a simple chart18" target="_blank">The final report with the chart</a></span><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart18-n.jpg" title="152.creation of a simple chart18" target="_blank">Creation of a simple chart</a></span></div></div><div class="tslide"><div><img alt="creation of a simple chart19" src="https://image3.slideserve.com/6723346/creation-of-a-simple-chart19-t.jpg"></div><div><span><a href="https://image3.slideserve.com/6723346/creation-of-a-simple-chart19-n.jpg" title="153.creation of a simple chart19" target="_blank">Creation of a simple chart</a></span><ul><li>On iReport Guide:Series: Automatic Series, Custom seriesChart Types: Pie Chart, Pie3D Chart, Bar, Bar3D, Line, Area </li></ul></div></div></div> </div> <!-- Presentation Transcript End !--> <input type="hidden" name="video_uid" id="video_uid" value="210683"> <input type="hidden" name="video_vid" id="video_vid" value="6723346"> <input type="hidden" name="video_node" id="video_node" value="3"> <input type="hidden" name="vido_link" id="vido_link" value="jasperreports-ireport"> <input type="hidden" name="vido_uname" id="vido_uname" value="gwenifer-allen"> </div> <!-- Left Side End !--> <!-- Right Side !--> <div class="col-lg-4 col-md-5 col-sm-12 no_padding rightside"> <div align="center" class="adsecmain"> <div class="adsec2"> <a href="https://www.digitalofficepro.com/powerpoint-templates.html?utm_source=slideserve&utm_medium=website&utm_campaign=slideserve+ppt+promotion"><img src="https://www.slideserve.com/images/ss_1366ad.jpg" alt="ad"></a> </div> <div class="adsec1"> <ins class="adsbygoogle" style="display:inline-block;width:300px;height:250px" data-ad-client="ca-pub-3976764401535897" data-ad-slot="6588102353"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <!-- adsense responsive code_end 2nd sec--> </div> </div> <!-- Related Tab Start !--> <ul class="nav nav-tabs ssalignL" id="myTab"> <li class="active"><a href="#related" data-toggle="tab" onclick="$('.pager').show();">Related Presentations</a></li> <li><a href="#more" data-toggle="tab" onclick="moreuser();$('.pager').hide();">More by User</a></li> </ul> <div class="tab-content" id="tab-right"> <ul class="tab-pane list-unstyled active" id="related"> <input type="hidden" name="next_url" id="next_url" value="jane/ireport-vs-traditional-news-media"> <input type="hidden" name="next_img" id="next_img" value="4441693"> <input type="hidden" name="next_title" id="next_title" value="Ireport vs. Traditional News Media"> <li> <div class="col-lg-4 col-md-4 col-sm-3 col-xs-4 item-grid"> <a href="/jane/ireport-vs-traditional-news-media" title="Ireport vs. Traditional News Media - Chris culwell. background. public journalism (or citizen journalism) form of journalism in which general citizens who are not professional journalists gather and report news or"> <div class="list-item-related"> <div class="list-image-related"> <div class="img-item list-centerer"> <img class="centered-img thumbr" src="//thumbs.slideserve.com/1_4441693.jpg" alt="Ireport vs. Traditional News Media" data="xcv "> </div> </div> <div class="list-related-info"><span>Ireport vs. Traditional News Media </span> -Chris culwell. background. public journalism (or citizen journalism) form of journalism in which general citizens who are not professional journalists gather and report news or</div> </div> </a> </div> </li> <li> </li> </ul> <div class="clearfix"></div> </ul> <div class="tab-pane" id="more"></div> </div> <!-- Related Tab End !--> <div class="clearfix"></div> </div> <!-- Right Side End !--> </div> <div id="suggestion"> <div id="suggestion-box" style='display:none;'> <div class="sugg-close" onclick="$('#suggestion').remove()"><i class="fa fa-times" aria-hidden="true"></i></div> <div class="sugg-mini-title">Today's Free</div> <div class="sugg-title">PowerPoint Template</div> <img src="https://www.slideserve.com/download-template/template.jpg" class="img-responsive img-suggestion" alt="Download Template"/> <p class="small sugg-content">For SlideServe users</p> <a href="https://www.slideserve.com/download-template/template.pot" onclick="ga('send', 'event', 'pot download', 'download', 'viewpage template promotion');" class="btn btn-md sugg-down" title="Download"><i class="fa fa-download sugg-animation" aria-hidden="true"></i> Download Now</a> </div> </div> </div> <!-- Mian container End--> <!-- presentation download box_start --> <div class="liststyle-modal modal fade" id="downloadpop" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal-content"> <div class="close-modal" data-dismiss="modal"> <div class="lr"> <div class="rl"></div> </div> </div> <div class="container"> <div class="row"> <div class="col-lg-8 col-lg-offset-2"> <div class="modal-body"> <span class="download_presentation">Download Presentation</span> <hr class="slideshow-hr"> <div class="downloadsec1"> <img class="downloadsecimg" height="92" src="https://thumbs.slideserve.com/1_6723346.jpg" style="width:122px; border:0;" alt="Download Section"> <div align="center" id="fetch"> <span>Connecting to Server..</span> </div> <br><br> </div> </div> </div> </div> </div> </div> </div> <!-- presentation download box_end --> <!-- Footer --> <div class="clearfix"></div> <footer class="text-center"> <div class="footer-above"> <div class="container"> <div class="row"> <div class="col-lg-12" style="margin-bottom:8px;"> <ul class="list-inline"> <li><a href="https://www.slideserve.com" lang="en" hreflang="en" title="JasperReports & iReport - English" >English</a></li> <li><a href="https://fr.slideserve.com" lang="fr" hreflang="fr" title="JasperReports & iReport - Français" >Français</a></li> </ul> </div> <div class="col-lg-12"> <a href="/about" rel="nofollow">About Us</a> | <a href="/advertise" rel="nofollow">Advertise</a> | <a href="/terms" rel="nofollow"> Terms of Use</a> | <a href="/privacy" rel="nofollow" >Privacy Policy</a> | <a href="/contact.php" rel="nofollow" >Contact Us</a> | <a href="https://blog.slideserve.com/" >Blog</a> </div> </div> </div> </div> <div class="footer-below"> <div class="container"> <div class="row"> <div class="col-lg-8 text-left"> © 2017 SlideServe. All rights reserved | Powered By DigitalOfficePro </div> <div class="col-lg-4 text-right"> <ul class="list-inline"> <li><a href="https://www.facebook.com/SlideServe" rel="nofollow"><i class="fa fa-facebook"></i></a></li> <li><a href="https://plus.google.com/+SlideServe" rel="nofollow"><i class="fa fa-google-plus"></i></a></li> <li><a href="https://twitter.com/slideserve" rel="nofollow"><i class="fa fa-twitter"></i></a></li> <li><a href="https://www.youtube.com/user/SlideServe" rel="nofollow"><i class="fa fa-youtube-play"></i></a></li> <li><a href="https://www.pinterest.com/slideserve/" rel="nofollow"><i class="fa fa-pinterest"></i></a></li> </ul> </div> </div> </div> </div> </footer> <script> var subdom = window.location.href.split("/")[2].split(".")[0]; <!------- g analytics[ ------> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-31359012-1', 'auto'); ga('send', 'pageview'); <!------- g analytics ] ------> <!------- fb comment[ ------> (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.6"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); <!------- fb comment] ------> </script> <script async src='//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'></script> <script> //------------------------------------------------------------------------------------------- //on jquery load event function onjqueryload() { //------------------------------------------------------------------------------------------- //Load javascript files loadHandler.load("/new/script/bootstrap.min.js","script",null); loadHandler.load("/js/player.min.js","script",null); loadHandler.load("/js/winHandler.min.js","script",null); loadHandler.load("/js/viewPageHandler.min.js","script",null); //------------------------------------------------------------------------------------------- $(document ).ready(function() { /*$.post( "/track.php", {vid:6723346,uid:210683,vlink:"jasperreports-ireport"}) .done(function( data ) {});*/ }); } //------------------------------------------------------------------------------------------- </script> </body></html>