X

Geertjan's Blog

  • February 3, 2007

Evaluating the Current State of the JasperReports Visual Designer

Geertjan Wielenga
Product Manager
What better way to evaluate Toni Epple's JasperReports Visual Designer for NetBeans than to walk through it with Integrating and Using JasperReports in NetBeans, a very well received document written by Craig Conover and Maria Sum? (Their tutorial has been transformed and expanded into a tutorial for the Visual Web Pack by Chris Kutler and Craig McCLanahan, here.
It includes info on how to use managed beans instead of servlets to serve up the reports, how to reuse the cached row sets for filling the report, and how to include images in reports.) Taking Craig and Maria's tutorial, we'll see how much Toni has managed to automate. OK, so here we go. I'll take each section from the document, see how it is dealt with by Toni's visual designer, and at the end we should have some indication of what state it is in.

  • Downloading and Installing the Framework. This is all about getting the Japser ZIP file and unzipping it. No need to do this, because the Jasper framework is bundled with the NetBeans module (together with its third party licenses), as shown in the next step. Hurray.

  • Integrating Compilation, Code-Complete, and Documentation Capabilities. In this section, you find out how to get the Jasper JARs and place them in the Library Manager. No need to do that anymore, because the suite that provides the JasperReports Visual Designer also registers the JARs that you'll be using:

  • Defining the Template's File Extension. Because the default IDE does not know about JasperReports, the "jrxml" file extension (for JasperReports template files) is not recognized. Therefore, this section goes through a procedire for creating a file with this extension. However, the suite that provides the JasperReports Visual Designer also includes file templates, one of which is for the JasperReport template file:

    So, hurray, there's no need to create a special file extension manually anymore.

  • Generating Reports. This is the main body of Craig and Maria's tutorial. I've listed the sections in a bulleted list, together with how the JasperReports Visual Designer currently helps the process:

    • Adding JasperReports to a New Project. In this section, you create a new Java application, named JasperReportsDemoApp. Then you add the library containing the Jasper JARs to the application's classpath. This is the same as before, with the exception that you didn't need to create that library yourself, as explained above.

    • Specifying Template and Report Locations. Here, you create the folders "report/templates" and "report/results". You could actually combine the creation of one of these folders in the next step, where you create a Jasper template.

    • Creating a Template. Instead of creating an empty file from the "Other" category, as described in the tutorial, you now use the Jasper template shown in the screenshot above. However, instead of pasting in obscure XML tags, you just drag and drop a 'Static Text' item from the palette:

      The text 'Static Text' is the default. You can change the text in-line, which, if you follow the tutorial, should be "Hello Report World":

      You can drag and drop the item around in the report. Notice also that it is in a clearly marked "Details" area. In fact, the whole Design view shows areas that match those found in the XML tags you'll find in the tutorial, for example "Details" is a clearly marked area, as is "Header". You can also stretch the item, with your mouse. When you right-click on the text item, you see this:

      So, you can delete the item, adjust size and change properties. This is all very detailed. For example, when you click "Properties", you change font, alignment, size, and so on. (Although I haven't found a way to undo changes.)

      When you look in the XML view, you see that this has been generated for the Details section of the report, for the static text item added above:

      <detail>
      <band height="100" isSplitAllowed="true">
      <staticText>
      <reportElement height="30" key="staticText-1" width="60" x="124" y="33"/>
      <box bottomBorder="None" bottomBorderColor="#000000" leftBorder="None"
      leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000"
      topBorder="None" topBorderColor="#000000"/>
      <textElement>
      <font/>
      </textElement>
      <text>Hello Report World</text>
      </staticText>
      </band>
      </detail>

      Next, in the tutorial, you're told to add code to the Main.class generated by the IDE. You're also shown how code completion works, thanks to the Jasper JARs being available on the classpath.

    • Performing a Test Run. In this step, you're told to run the application, to do a test run of the template. However, there's no need to do that, because there's a Preview toggle button, in between "Design" and "XML", which, if you click it, results in this view:

      With the JasperReports Visual Designer, you can very easily switch between views and preview your report as you go along, instead of needing to deploy the application each time.

    • The remaining sections of the tutorial, "Enhancing the Template", "Adding the Java DB Driver Library", and "Generating the Report", I will deal with in a future blog entry, because I don't know exactly how these aspects are dealt with and how far along they are in Toni's development work. I know for sure that data sources will play a big role in this visual designer, because the toolbar already contains buttons such as "Import Datasets" and "New Datasource".

Clearly, this is a very ambitious project, turning into a very mature tool that is going to be incredibly useful within the NetBeans community. Keep it up Toni! You're doing a fantastic job. If you're interested in this work, go to https://jarvis.dev.java.net/, check out the sources from CVS that you find there, and then just run the module suite that you end up with. I've done this successfully in 5.5.

Join the discussion

Comments ( 9 )
  • Insider Scoop From the Tutorial Divas Monday, February 5, 2007
    [Trackback] We just published a new Visual Web Pack tutorial, Generating Reports and PDFs From a Web Application that shows how use JasperReports to generate HTML and PDF reports from a data source. JasperReports is a reporting tool that outputs reports in HTML...
  • Prathamesh Thursday, February 8, 2007
    Thanx's a lot for this article. It helped me a lot.
  • Rahul Kumar Thursday, March 15, 2007
    I have to change dynamically the number of columns in report.The problem is like the following.
    There is a list box in jsp page,that contains the column names.User selects columns in list box that are printed in report.Therefore,i must create report dynamically.How can i organize this report using jasperreport?
  • Joshua Smith Friday, March 23, 2007

    When I tried installing the module using the update center listed on the Java.net page for Jarvis, I got the following error:

    An incompatible Xalan version has been detected on the IDE's classpath. The IDE cannot start. Please see http://wiki.java.net/bin/view/Netbeans/FaqXalanOnCP for more information.

    That link is dead, but it led me to this one:
    http://wiki.netbeans.org/wiki/view/FaqXalanOnCP

    In any case, I removed all Xalan jars that I could find from the classpath and NetBeans still won't launch. I'm running NetBeans 5.5 on Mac OS X 10.4.8 and using Java 1.5.0.07.

    Any ideas?

    Thanks,

    Joshua Smith

  • Toni Epple Friday, March 23, 2007
    Hi Joshua,
    I haven't seen this before, but it's true Jarvis uses xalan, so you should remove the xalan.jar and disable the module. Here is how:
    Everything installed by a module goes to the .netbeans folder in your user home directory. First you should make sure there is no netbeans process running. Then you can go there and make a copy of .netbeans\\5.5 dir ( .netbeans\\5.5_orig ) so you have a backup.
    Now go to .netbeans\\5.5\\modules\\ext and remove xalan.jar.
    In .netbeans\\5.5\\config\\Modules\\de-genomatix-jarvis.xml set enabled to false. This should enable you to restart NetBeans. Please let me know if this works.
    best regards and sorry for the inconvenience,
    Toni
  • Joshua Smith Friday, March 23, 2007

    Toni

    That fixed it! I was looking down in the directories where NetBeans itself is installed and also in the lib directories for my JRE/JDK. I didn't think that there might be jars in ~/.netbeans.

    All I did was move the xalan.jar file into another directory (somewhere completely outside of the .netbeans directory) and everything started up just fine. I didn't even need to disable the plugin.

    Thank you for your quick response. I'm looking forward to kicking the tires on Jarvis.

    Thanks,

    Joshua Smith

  • Kaladji Diomande Thursday, October 11, 2007

    I´m working with Netbeans 6.0 Beta 1. I try to follow this tutorial but at the end i just have in Categories->Jasper Report JRAbstractScriptlet template file and JRDefaultScriptlet template file without JasperReport template file. To have a Categories->JasperReport i must add jrxml in Options/System/Object Types/RepoprtElementDataloader. If i try to make a emplty jrxml file i have this error message:{ java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/JRException

    at de.genomatix.jasperreporteditor.filetypesupport.JasperReportDataLoader.createMultiObject(JasperReportDataLoader.java:56)

    at org.openide.loaders.MultiFileLoader.handleFindDataObject(MultiFileLoader.java:120)

    at org.openide.loaders.DataObjectPool.handleFindDataObject(DataObjectPool.java:136)

    at org.openide.loaders.DataLoader.findDataObject(DataLoader.java:358)

    at org.openide.loaders.DataLoaderPool.findDataObject(DataLoaderPool.java:393)

    at org.openide.loaders.FolderList.createBoth(FolderList.java:718)

    at org.openide.loaders.FolderList.access$700(FolderList.java:52)

    at org.openide.loaders.FolderList$2.run(FolderList.java:344)

    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:539)

    [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:964)}

    Please can sombody help me?


  • Geertjan Thursday, October 11, 2007

    Pretty sure this hasn't been tested for 6.0 at all yet, Kaladji. Probably it would need to be updated for 6.0 still.


  • Kaladji Diomande Thursday, November 1, 2007

    It is runing now with NetBeans 6 Beta 2. It is very nice to use.

    Thinks,

    Kaladji Diomande


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.