soumoh Posted March 29, 2009 Share Posted March 29, 2009 Hello,just a brief question regarding the iReport NB platform. Is it possible to write a plug-in for iReport NB where the source of the plugin is modified by an external program? Link to comment Share on other sites More sharing options...
soumoh Posted March 31, 2009 Author Share Posted March 31, 2009 Does anyone here know of a good tutorial for writing plug-in for iReport based on the NB platform? Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted April 1, 2009 Share Posted April 1, 2009 I had not the time to write a plugin tutorial yet, but I can summarize here the steps.An ireport plugin is just a plugin for NetBeans, so basically all the NetBeans plugin development tutorials will work just fine.How to start:1. Install the NetBeans 6.0.1 platform somewhere (you can install NetBeans 6.0.1 and configure it in a different version of NB as platform, or you can just downlaod the platform zip file here: http://download.netbeans.org/netbeans/6.0/final/zip/netbeans-6.0.1-200801291616-ml.zip2. Add the platform to your NetBeans IDE (Tools->NetBeans platform)3. Get the iReport source code from SVN (svn checkout --username anonsvn http://jasperforge.org/svn/repos/ireportfornetbeans) or from a src distribution of iReport4. Open the ireport project (it's the ireport directory itself), compile and run iReport5. Start creating your new plugin (it can be part of the iReport suite, then you can export it using create NBM feature of NetBeans). Remember to add as dependency for your plugin the ireport-designer module.Feel you free to contact me directly for any question about plugin development for iReport (giulio@jaspersoft.com)Good Luck!Giulio Link to comment Share on other sites More sharing options...
soumoh Posted April 2, 2009 Author Share Posted April 2, 2009 Thank you Giulio. Link to comment Share on other sites More sharing options...
C-Box Posted April 3, 2009 Share Posted April 3, 2009 Hi Giulio, I just started migrating my DataBasePlugin from Classic to NB Version. (although the missing barcode will prevent me upgrading at all, but I hope sometimes the barcode support will come!?! )I successfully added a window like the JasperServer Plugin does... so far no problem.But now I need an external Jar for connecting to our Application-Server. Where do I have to put it that the IDE knows the needed classes?When I use the ADD LIBRARY manager, it will add a new module (what I doesn't want)I can see, that all your external libs are located under D:iReportiReport-nb-3.5.0-srcireportmodulesextWhen I copy my jar within that directory my new PluginModule can't find the needed classes.So where can I add those external jars needed for my plugin!?!??! hoping for your support + regards from very sunny GermanyC-Box Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted April 3, 2009 Share Posted April 3, 2009 In your module project you find a file called: project.xml (Project Metadata). Inside this xml you declare you extra jars (that you will put in modules/ext directory of your module).I.e.: <class-path-extension> <runtime-relative-path>ext/batik-bridge.jar</runtime-relative-path> <binary-origin>release/modules/ext/batik-bridge.jar</binary-origin> </class-path-extension>If the jar must be used by the ireport-designer module (i.e. it is a datasource or something used during the design process), you have to add your jars to the iReport classpath too (because NetBeans prevents modules to see the classpath of the other ones). This can be done programmatically with an Installer class (see the NetBeans development docs to see how to create an install class, there is a wizard for that), and with the following lines of code:List<String> cp = IReportManager.getInstance().getRelodableClasspath(); if (!cp.contains(""+newFile)) { cp.add(""+newFile); IReportManager.getInstance().setRelodableClasspath(cp); }You can use the iReport classloader whenever you want setting the thread classloader to IReportManager.getInstance().getReportClassloader()Giulio Link to comment Share on other sites More sharing options...
C-Box Posted April 6, 2009 Share Posted April 6, 2009 Thx Giulio so far... now it works without the separate module. Is there no "GUI Wizzard" for adding an external jar (like in eclipse) instead of editing the xml by hand?!?quite tricky the netbeans environment if you primary work with eclipse.regards from sunny GermanyC-Box Link to comment Share on other sites More sharing options...
drallpradeep Posted April 6, 2009 Share Posted April 6, 2009 Sir,How to call ireport in MyEclipse. Please reply.Regards,Pradeep Link to comment Share on other sites More sharing options...
C-Box Posted May 6, 2009 Share Posted May 6, 2009 Hi Guilio,I just found some time again to migrate my plugin for new nb-ireport version further. So I'm now able to load our designs from database and open the JRXML files in iReport - fine so far. :-)code:DataObject obj = DataObject.find(org.openide.filesystems.FileUtil.toFileObject(singleRep.getFile())); OpenCookie ocookie = obj.getCookie(OpenCookie.class); if (ocookie != null) { ocookie.open(); }Now I have a tree holding our designs. (see screenshot attached) When I click at a node I want the corresponding design activated in "MainFrame". As there isn't any FileTree as in classic old version I can't find the way you did in classic version (there I looped through the opened files and found the ReportFrame).So could you please give me a hint, how I can find the DesignFrame towards my ReportObject within the tree (I just have the opened file - I could also link the ocookie to my node-UserObject if needed) quite complex the new structure :-Otiaregards from rainy GermanyC-Box Link to comment Share on other sites More sharing options...
C-Box Posted May 6, 2009 Share Posted May 6, 2009 Ok.. I'm not sure but I think I got the meaning with the Cookie and DataObject.Find method (holding an instance and open makes everything for you -> also switching to the frame no matter if it was already openend, isn't it !??!?!) Now I want when switching the frames manually that the nodes within my tree also get selected (each opened JRXML is one node in my tree)... so is there a way to register a kind of listener that is called when switching the frames in designer that I could change my tree selection???? tiaC-Box Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted May 6, 2009 Share Posted May 6, 2009 well, the simple thing you are asking for is actually really complicated in NetBeans.This is what can help a little bit. IReportManager allows you to add an JrxmlVisualViewActivatedListener:public final void addJrxmlVisualViewActivatedListener(JrxmlVisualViewActivatedListener l)If you are switching to preview or XML view, I assume you don't get any event, so be carreful.My suggestion is to check if there is a visual view available after getting that event:JrxmlVisualView view = IReportManager.getInstance().getActiveVisualView();if (view != null) { .... }If can be a good starting point...Giulio Link to comment Share on other sites More sharing options...
C-Box Posted May 13, 2009 Share Posted May 13, 2009 Hi Giulio,As I load and save my JRXMLs into DataBase via my plugin I got again the message "File was modified externally, reload it?"....Perhaps you could remember, that I had this problem some years ago too, when I started to develop my classic plugin and you introduced an option "Reload externally modified file without asking".Could you please add this option again? regards from sunny GermanyC-BoxPost Edited by CBox at 05/13/2009 11:04 Link to comment Share on other sites More sharing options...
jkratz Posted May 13, 2009 Share Posted May 13, 2009 There are lots of problems with the source distribution building on my install of NetBeans. The jasperreprots-components project is missing. I completely removed it and the build then occurs. There are a *ton* of warnings generated during the build and I'm not sure if they are important since the build completes without any errors and I can run whats there. Are there supposed to be lots of warnings generated during this process? and why the missing module? Link to comment Share on other sites More sharing options...
jkratz Posted May 13, 2009 Share Posted May 13, 2009 Oops. forgot to mention this is on NB 6.7 beta with the 6.01 platform installed (and lastest jdk 1.6) Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted May 13, 2009 Share Posted May 13, 2009 Unfortunately it is no longer so easy. What you should do is check if the file has been modified in iReport (checking the isModified() in JrxmlEditorSupport). If it has not been modified, when the file is reloaded externally, no user prompt is displayed. If it is modified, force a jrxmlEditorSupport.saveDocument() and then make your changes.giulio Link to comment Share on other sites More sharing options...
jkratz Posted May 13, 2009 Share Posted May 13, 2009 Also just checked the 3.5.0 source vs 3.5.1. 3.5.0 doesn't have the jasperreports-components module. 3.5.1 binary distribution has the jar but its not in the source distribution anywhere. there are also two build.xml files in the main root of the 3.5.1 src project. there are several in other areas as well. perhaps this source distribution isnt correct? Link to comment Share on other sites More sharing options...
jkratz Posted May 13, 2009 Share Posted May 13, 2009 I was able to successfully port my stuff to IR 3.5 after jumping thru some hoops: namely going back to release 3.5.0 source distro and setting up part of module in NB 6.01 since 6.7 was complaining that adding an option pane required NB platform 6.5+. The biggest problem right now is that I can't just distribute the module since I had to add a new data connection type to the IReportManager class. But still happy I was able to get this stuff to work... Link to comment Share on other sites More sharing options...
C-Box Posted May 14, 2009 Share Posted May 14, 2009 Hmm okay, but how do I get the corresponding JrxmlEditorSupport when I just have a file??? Now I open the JRXML via the OpenCookie.... so I don't have any reference to the JrxmlEditorSupport .I can't find a method in IReportManager where all open JrxmlEditorSupport instances are hold where I could get one by file.Or is there any way to get a reference to the JrxmlEditorSupport when open a JRXML? Just by the OpenCookie it seems impossible.(sorry for annoying you... but without documentation it's quite complicate to understand the new nb-version/logic) regards again from still sunny GermanyC-Box BTW: do I have to do something else after OpenCookie (see code below) to open a JRXML correct? I got the case, that I opened the file via code below and just change the foregroundcolor of an element --> then click on any place within the editor and I get "Externally modified. Reload it?" ..... so I haven't done anything after the openFileInIreport call within my plugin... just the color changement and yet iReport asks me to reload it? So I guess I'm doing something wrong or I missed something!??!Code:public static void openFileInIreport(File file) throws Exception { if (file == null || !file.exists()) { return; } DataObject obj = DataObject.find(org.openide.filesystems.FileUtil.toFileObject(file)); OpenCookie ocookie = obj.getCookie(OpenCookie.class); if (ocookie != null) { ocookie.open(); } }Post Edited by CBox at 05/14/2009 15:23 Link to comment Share on other sites More sharing options...
C-Box Posted May 22, 2009 Share Posted May 22, 2009 Hi Giulio, I'm still looking for a way to get to know whether a JRXML is already openend or not within iReport and I searched your code how the instances are hold (seems to be the task of some openide classes) -> unfortunately without success . Could you please give me (us) some hints how to access opened files (not just the ActiveVisualView) from a plugin???? would be really nicetiaC-Box Link to comment Share on other sites More sharing options...
C-Box Posted June 10, 2009 Share Posted June 10, 2009 Hi again,seems to become quite silent here....!?!??! /tools/fckeditor/editor/images/smiley/msn/confused_smile.gifBecause I'm still fighting against the new netbeans structure /tools/fckeditor/editor/images/smiley/msn/wink_smile.gif I came to a new question today...I want to close openend files (see posts before with OpenCookie) by my plugin... so I made a closeaction at my tree and tried the code below... but this time it doesn't work... I don't get a CloseCookie... So the new question is: How to close an opened JRXML just by FileName (java.io.File). ??? btw, for the other question concerning opened JRXMLs I still couldn't find any solution?!? /tools/fckeditor/editor/images/smiley/msn/cry_smile.gif tia & hoping for any inputC-Box Code: Link to comment Share on other sites More sharing options...
C-Box Posted July 24, 2009 Share Posted July 24, 2009 Hi again, back from holiday I had the hope that someone could help me out, but unfortunately it seems that I'm the only one who is a) developing an iReport Plugin for new nb-version or b) too stupid to find the right methods to control iReport remotely. So again... is there any way to get the opened JRXML editor frames to close them by a plugin? Also I must know whether a JRXML was opened already or not (to prevent annoying "Reload question")I struggeld with CloseCookie... and just found tutorials how to write own Netbeans IDE based apps... but not plugins that just use the given logic from e.g. iReport 3.5.X. Please Giulio, if you find two minutes to point me into the right direction or if you have a manual, how to develop a plugin... you would make me happy! regards from sunny GermanyC-Box Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted July 24, 2009 Share Posted July 24, 2009 Hi C-Box! How are you?Here is a sample plugin that opens a view with the list of opened reports. You can select an item and close the document.Hope it is what you need. Let me know if you don't understand the code.To compile it, you need to install iReport inside the NetBeans version you are using since it uses the default platform and declares a dependency on the ireport-designer module (and to a bunch of other core modules).Giulio Link to comment Share on other sites More sharing options...
gmasterb Posted July 27, 2009 Share Posted July 27, 2009 Hi there!I developed an iReport plugin which works launching iReport inside the Netbeans Developer Studio.Trying to deploy the nbm in a standalone iReport-Client fails...It`s missing some dependencies which are available within Netbeans but not deployed to iReport... I can't find any solution to get my plugin running.Maybe someone here can give advices to me? regards frank Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted July 27, 2009 Share Posted July 27, 2009 Hi Frank,what dependencies do you have?Giulio Link to comment Share on other sites More sharing options...
C-Box Posted July 27, 2009 Share Posted July 27, 2009 Hi Giulio, I'm fine thx for the question. Hope the same for you!??Thx a lot for the nice code snipped... I didn't get it to work as module, as I still have NetBeans 6.0.1 and you dependecies requires new versions but I understood the code and I'm now able to close the files opened by my plugin. So you saved my summer and I can sleep better ( at least if Junior II is also sleeping between his breastfeedings /tools/fckeditor/editor/images/smiley/msn/confused_smile.gif ). So I'm now just want to switch between openend files without reopening them (what I do now with simply OpenCookie.open() see code snippets in older post).Is there a way to activate such a found JrxmlEditorSupport Component?I already tried the "toFront" Method of the TopComponent. but it seems, it's not overriden in special for that purpose and just brings the whole (parent) window to front. (just as the apidoc tells). public static void activateEditorByFile(File file) throws Exception{ DataObject seachFileObj = getDataObjectByFile(file); Set<TopComponent> components = Collections.synchronizedSet(new HashSet(WindowManager.getDefault().getRegistry().getOpened())); for (TopComponent t : components) { JrxmlEditorSupport jrxmlEditorSupport = t.getLookup().lookup(JrxmlEditorSupport.class); if (jrxmlEditorSupport != null) { DataObject editorFileObj = jrxmlEditorSupport.getDataObject(); if (editorFileObj.equals(seachFileObj)) { t.toFront(); break; } } } }as I said: without success. /tools/fckeditor/editor/images/smiley/msn/cry_smile.gifThe code for STRG+TAB where you can easily change between opened docs seems to be within the core libs... so I can't take a look into the code how this is done.The SHIFT + F4 also.... So... I don't want to reopen the files always if I navigate through my plugin, as iReport always ask if the external modified file should be reloaded. Would by glad, if you could help again. regards from sunny Dresden /Saxony /Germany C-Box 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