Home
Analytics
BIRT report in Eclipse RCP View
BJSJC
I don't care how this is accomplished, but I want my BIRT Report (Table + Graph) to be visible inside my Eclipse RCP View. The BIRT Report gets its data from a Java Object. The Data Set uses "Scripting", and in the javascript, I called my Java Object. It seems to work fine, and when I view the report as pdf, html, etc, the table and chart look like I expected. Anyway, when I try to put the BIRT report into my view, it does not work - I get an Exception that basically says "cannot call a Java Object, can only call functions".
In the createPartControl method of the View class, I have the following code:
Browser browser = new Browser(parent, SWT.NONE);
WebViewer.display("c:tempstocks_report.rptdesign", WebViewer.HTML,
browser, "frameset");
where the file path is obviously the path where I put my report.
Find more posts tagged with
Comments
BJSJC
Oh, for more information, I'm doing step 10 in this tutorial:<br />
<br />
<a class='bbc_url' href='
http://www.vogella.de/articles/EclipseBIRT/article.html'>Reporting
with Eclipse BIRT and Java Objects (POJO's) - Tutorial</a><br />
<br />
The author acknowledges that it doesn't work - I've searched all over the internet and also tried my own methods to make it work. I'm not a javascript expert or anything, but the javascript I used definitely works, but BIRT throws an Exception in response to the Javascript code I used. I basically used something like this in the javascript. <br />
<br />
<br />
myvariableObj = new Packages.myPackageName.myClassName();<br />
myvariableObj.callMethod();
BJSJC
I figured out one way to get my table to show up inside an RCP view, although this is probably not a very good way of doing it. But I'll post it up and hopefully if any of you find it useful and/or make improvements to it, or even have other solutions, you will post yours too.
After following Lars' tutorial (as I posted the link to in the prior post) change the Fetch code to this:
if(count < yourList.size() - 1){
count++;
row["Your row name"] = yourList.get(count).methodCall1();
row["Your other name"] = yourList.get(count).methodCall2();
row["third name"] = yourList.get(count).methodCall3();
return true;
}
return false;
And change the open code to this:
count = 0;
importPackage(Packages.org.eclipse.core.runtime);
myBundle = Platform.getBundle("POJO_Project");
readerClass = myBundle.loadClass("packageName.YourClassName");
readerInstance = readerClass.newInstance();
yourArray = (readerInstance.callListMethod("meh"));
johnw
Someone just posted a good tutorial on creating a SWT emitter. It will output BIRT reports directly to a SWT Table widget. You might want to give that a look.
BJSJC
<a class='bbc_url' href='
http://blog.zenika.com/index.php?post/2009/05/19/Eclipse-BIRT-:-Create-your-own-SWT-Emitter'>Eclipse
BIRT : Create your own SWT Emitter - Zenika</a><br />
<br />
For anyone else looking for it. ^<br />
<br />
I just completed his tutorial and it does the same thing as my code above does, except his tutorial has a lot more code. It still isn't showing my chart, although I'm trying to get it to. I guess I have to add more code to get the chart to show up?
BJSJC
Yeah, I just checked it out. . the tutorial only shows how to display tables in SWT, which I already figured out how to do (see code I posted above). The tutorial does not show how to put an entire BIRT report into SWT, because the report might contain tables, charts, etc.... which I can't figure out because I don't know how to write the 'fetch' script so that it displays my chart and stuff.
johnw
Not sure off the top of my head how ExtendedItemHandles (chich is what charts and crosstabs are) are handled in an emitter. But Charts are nothing more than images created by the Chart Engine API, which is wrapped in an extended item handle (only ever had to modify it one time, so my memory is a little fuzzy). In the emitter level, I "believe" the image is already generated, you don't need to call the chart engine api separately to render it (since the CEAPI is not coupled to the Report Engine API), just get the final rendered image location, and add it as a SWT Image widget. The problem is you will need to do some sort of custom action handler (I believe they are type Triggers in charts) to handle any sort of click through, mouse over, etc. Only thing I can suggest is implement the StartImage, or check if there is a StartExtendedItemHandle event in the emitter.
BJSJC
I got it working. Anyone who is interested, look at Lars Vogel's tutorial, he has the full example of how it works.