Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Passing result list to EventHandler when using WebViewer in an RCP-Application
anbenham
Hi Birt-Experts,
we have the following problem:
1- We want to integrate BIRT in our Eclipse RCP-Application
2- The report result list is determined using our middleware. For that we need to use parameters given by the user on the GUI (start date, category a.s.o)
3-Because of point 2. we have created a Java-Eventhandler associated to a scripted dataset
4-we want to show the report using the WebViewer because of the practical navigation and export functionalities
so we have two possibilities:
1-Either we generate the result list at the beginning and pass it somehow to the eventhandler . In this case how could we access the report context map, to put the result in it, that would be accessible then in the eventhandler?
2-Or we pass the report parameter somehow and use them in our eventhandler to generate the result using our middleware. In this case how can we set the report parameter and how can we access them in the eventhandler.
Best regards
Find more posts tagged with
Comments
JasonW
For scenario 1 take a look at:<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/forum/eclipse-birt-newsgroup-mirror/13246-webviewer-pass-xml-datasource-inputstream.html'>http://www.birt-exchange.com/forum/eclipse-birt-newsgroup-mirror/13246-webviewer-pass-xml-datasource-inputstream.html</a><br
/>
<br />
For scenario 2<br />
In the beforeOpen event for the datasource get the report parameter value like:<br />
reportContext.getParameterValue("myparameter");<br />
<br />
Jason
anbenham
Thanx,
I think the solution with the context extension cannot help me, because I don´t have access to the created instance of the extension, wich would allow me to give it my result
I have s.th like this:
List<Map> result = broker.findResult(reportParams);
//put my result somehow in the app context
someAccessorOfTheContext.put("listOfMaps",result);
WebViewer.display(reportName , WebViewer.HTML, false);
then I want to access result in my eventhandler:
public void beforeOpen(IDataSetInstance dataSet,
IReportContext reportContext) {
listOfMaps = (List<Map>)reportContext.getAppContext().get("listOfMaps");
..
Is this possible anyhow?
JasonW
This
someAccessorOfTheContext.put("listOfMaps",result);
Is possible if you are using the RE API, but you are using the viewer. Thats why I suggested implementing your own context extension. You could also import the source for the viewer and modify it to put the list of maps in.
Jason
anbenham
Thanx 4 your quick answer<br />
<blockquote class='ipsBlockquote' data-author="JasonW"><p>This <br />
someAccessorOfTheContext.put("listOfMaps",result);<br />
<br />
Is possible if you are using the RE API, but you are using the viewer. Thats why I suggested implementing your own context extension.<br /></p></blockquote>
<br />
OK suppose I write my own extension. this extension is instantiated by birt.<br />
so I can´t give it my result, can I ?<br />
<blockquote class='ipsBlockquote' ><p>
You could also import the source for the viewer and modify it to put the list of maps in.<br />
Jason</p></blockquote>
I have seen the code of the webviewer. It is "just" starting a jetty webserver, and calling the ViewerServlet. so the birt runtime is not started by webviewer, but by the viewerservlet.<br />
<br />
so I think I will try to either pass the parameters by display(.., params) and call my broker in the eventhandler, or just put the result in a static variable.. which is not perfect, but works...:(
JasonW
The application context extension is very easy to implement. You can put anything in it that you want to.
anbenham
<blockquote class='ipsBlockquote' data-author="JasonW"><p>The application context extension is very easy to implement. You can put anything in it that you want to.</p></blockquote>
<br />
I know...but how to pass my result object to an instance that is created by the report engine
JasonW
Either
add a method to
public class MyAppContext extends AppContextExtension
That preloads the object, which you can call prior to calling the WebViewer class or
In the getAppContext method of this class call back to your class that has retrieved the results and load the map then.