jeroenvv Posted May 20, 2010 Share Posted May 20, 2010 Hi!I have created a custom jasperreports component that fetches content from a server and displays it on a report. Now, I want to create a custom iReport component for this, so my novice collegues can edit the report that uses my new component using iReport. Is there any documentation on how to do this? I try to use the barcode or list component as an example, but iReport does not seem to recognize my definitions (probably I do not provide everything necessary or put files in the wrong place).What is the proper way to create an additional iReport component?Regards,Jeroen van Veldhuizen, Redora BV Link to comment Share on other sites More sharing options...
pwd Posted June 3, 2010 Share Posted June 3, 2010 I would be interested in this as well. Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted June 3, 2010 Share Posted June 3, 2010 Hi Jeroen,Here are the steps. Suppose our plugin code is:com.acme.*STEP 1. define a file with extension .irpitem i.e. MyPaletteItem.irpitem(it stays for iReport palette item). The content should look pretty much like this:id=MyPaletteItemIdname=MyPaletteItemtooltip=MyPaletteItem_tooltipicon16=com/acme/mypaletteitem-16.pngicon32=com/acme/mypaletteitem-32.pngaction=com.acme.MyPaletteActionMyPaletteItem and MyPaletteItem_tooltip can be translated in a resource Bundle added to the global resource bundle of ireport, in this case a installer class for your module should do something like:I18n.addBundleLocation(ResourceBundle.getBundle("/com/acme/Bundle"));To create an installer class, use the NetBEans wizard to create a module installer.STEP 2: create com.acme.MyPaletteAction which must extends com.jaspersoft.ireport.designer.palette.PaletteItemAction. This class is very generic, and if your aim is to just create a new element you may be choose to implementa more specific implementation of PaletteItemAction, like com.jaspersoft.ireport.designer.palette.actions.CreateReportElementActionSTEP 3: finally you need to "install" the palette item in the iReport palette. This is done using the layer.xml (an important file of your NetBeans plugin).You need to add the following chunk of xml to your layer.xml:<folder name="palette"> <folder name="ReportElements"> <attr name="SystemFileSystem.localizingBundle" stringvalue="com.jaspersoft.ireport.locale.Bundle"/> <file name="MyPaletteItem.irpitem" url="MyPaletteItem.irpitem"/> </folder></folder>This will add your item inside the ReportElements section of the palette. You can even create your own palette section, or use the Tools section.If everything has been done correctly, you should now see the item in the ireport palette.Giulio Link to comment Share on other sites More sharing options...
pwd Posted June 8, 2010 Share Posted June 8, 2010 Thanks very much, I just saw your reply and will hopefully test it out soon. Link to comment Share on other sites More sharing options...
pwd Posted June 8, 2010 Share Posted June 8, 2010 I installed the nbm that NetBeans created and it said installation successful. However, I don't see my new item in the palette, so I take it there is a problem with my layer.xml. Should it look like this?<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd"><filesystem><folder name="palette"> <folder name="ReportElements"> <attr name="SystemFileSystem.localizingBundle" stringvalue="com.jaspersoft.ireport.locale.Bundle"/> <file name="SomeAction.irpitem" url="SomeAction.irpitem"/></folder></filesystem>Post Edited by pwd at 06/08/2010 19:12 Link to comment Share on other sites More sharing options...
pwd Posted June 10, 2010 Share Posted June 10, 2010 One other question... does it matter if I am creating this module in NetBeans 6.9 RC1? Link to comment Share on other sites More sharing options...
markgrubb Posted April 1, 2011 Share Posted April 1, 2011 STEP 3: finally you need to "install" the palette item in the iReport palette. This is done using the layer.xml (an important file of your NetBeans plugin). You need to add the following chunk of xml to your layer.xml: <folder name="palette"> <folder name="ReportElements"> <attr name="SystemFileSystem.localizingBundle" stringvalue="com.jaspersoft.ireport.locale.Bundle"/> <file name="MyPaletteItem.irpitem" url="MyPaletteItem.irpitem"/> </folder> </folder> "ireport" tag is missing from this XML. The XML added to layer.xml follows:<filesystem> <folder name="ireport"> <folder name="palette"> <folder name="ReportElements"> <attr name="SystemFileSystem.localizingBundle" stringvalue="com.jaspersoft.ireport.locale.Bundle"/> <file name="mypaletteitem.irpitem" url="mypaletteitem.irpitem"/> </folder> </folder> </folder></filesystem> Link to comment Share on other sites More sharing options...
markgrubb Posted April 1, 2011 Share Posted April 1, 2011 Here are the steps. Suppose our plugin code is: com.acme.* STEP 1. define a file with extension .irpitem i.e. MyPaletteItem.irpitem(it stays for iReport palette item). The content should look pretty much like this: id=MyPaletteItemId name=MyPaletteItem tooltip=MyPaletteItem_tooltip icon16=com/acme/mypaletteitem-16.png icon32=com/acme/mypaletteitem-32.png action=com.acme.MyPaletteAction MyPaletteItem and MyPaletteItem_tooltip can be translated in a resource Bundle added to the global resource bundle of ireport, in this case a installer class for your module should do something like: I18n.addBundleLocation(ResourceBundle.getBundle("/com/acme/Bundle")); To create an installer class, use the NetBEans wizard to create a module installer. To add your Bundle.properties (localization text) add the following line to your plugin's manifest.mf:OpenIDE-Module-Install: com/acme/Bundle/Installer.classAND create Installer.java in com/acme with the following code (you will need to add 'Internationalization', 'Module System API' as Module Dependencies in your Project Properties in Netbeans) Code: Post Edited by markgrubb at 04/01/2011 14:01 Link to comment Share on other sites More sharing options...
rajesh.sm Posted September 18, 2013 Share Posted September 18, 2013 i tried the QRPlugin. i am getting Missing resource Bundle exception. please ref the following QR http://community.jaspersoft.com/questions/819065/qrcode-custom-component-palette. i have attached log and exception details. please respond back as early. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now