Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Problem when integrating WebViewer into RCP application
Problem when integrating WebViewer into RCP application [message #792988] Tue, 07 February 2012 16:38 Go to next message
jo moreau is currently offline jo moreauFriend
Messages: 9
Registered: February 2012
Junior Member
Hi everyone,

Here's my problem. I'm using BIRT 3.7.0 to generate a PDF report with a select query dataset. In my dataset script, I'm editing my where clause of the query with "this.textquery" statement. The report is generated and is saved to a temporary file. But when i send it to the viewer, there's no data only the embedded pictures but the PDF file has all the data in it.

I'm using this to pass the where clause from a custom java class to the script:

HashMap hm = config.getAppContext;
hm.put("string name", string);
config.setAppContext(hm);


I'm calling the WebViewer with this:

WebViewer.display(rptname,WebViewer.PDF, Browser);


Thank you
Re: Problem when integrating WebViewer into RCP application [message #793075 is a reply to message #792988] Tue, 07 February 2012 18:51 Go to previous messageGo to next message
jo moreau is currently offline jo moreauFriend
Messages: 9
Registered: February 2012
Junior Member
I actually found the way to make it work. You just have to extend the AppContextExtension of org.eclipse.birt.report.viewer.api.AppContextExtension.

You have to create a class similar to this:

package org.eclipse.birt.examples.rcpviewer;

import java.util.Map;
import org.eclipse.birt.report.viewer.api.AppContextExtension;

public class MyAppContext extends AppContextExtension{

   public Map getAppContext(Map appContext) {
      Map hm = super.getAppContext(appContext);
      hm.put(String ObjectName, Object);      
      return hm;			
   }

   public String getName() {
             return "MyAppContext";
   }
}


After modify the plugin.xml with this

<extension
      point="org.eclipse.birt.report.viewer.appcontext">
      <appcontext
            class="org.eclipse.birt.examples.rcpviewer.MyAppContext">
      </appcontext>
</extension>


And finally add this line to your RCP view using the WebViewer

ViewerPlugin.getDefault( ).getPluginPreferences( ).setValue("APPCONTEXT_EXTENSION_KEY", "MyAppContext");


You should have import the org.eclipse.birt.report.viewer package in your project for this to work.

If this can help anybody.
Re: Problem when integrating WebViewer into RCP application [message #793160 is a reply to message #793075] Tue, 07 February 2012 20:57 Go to previous messageGo to next message
jo moreau is currently offline jo moreauFriend
Messages: 9
Registered: February 2012
Junior Member
I still have a problem. When i try to change the data, the viewer still shows the last report but my where clause string has been changed. I'm suspecting caching problems but I cannot find the way to set the forceOverwriteReport parameter to true.

I'm using BIRT 3.7.0.
Re: Problem when integrating WebViewer into RCP application [message #793186 is a reply to message #793160] Tue, 07 February 2012 21:28 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

I am not sure this is the issue but you could try:

HashMap myparms = new HashMap();
HashMap emitmap = new HashMap();

myparms.put("SERVLET_NAME_KEY", "frameset");
myparms.put("FORMAT_KEY", "html");
//myparms.put("RESOURCE_FOLDER_KEY", "c:/myresources");
myparms.put("ALLOW_PAGE", "false");
myparms.put("SHOW_PARAMETER_PAGE", "false");
emitmap.put("__overwrite", true);
myparms.put("EMITTER_OPTIONS_KEY", emitmap);
WebViewer.display(rpt, browser, myparms);

Jason

On 2/7/2012 3:57 PM, jo moreau wrote:
> I still have a problem. When i try to change the data, the viewer still
> shows the last report but my where clause string has been changed. I'm
> suspecting caching problems but I cannot find the way to set the
> forceOverwriteReport parameter to true.
> I'm using BIRT 3.7.0.
Re: Problem when integrating WebViewer into RCP application [message #793720 is a reply to message #793186] Wed, 08 February 2012 13:30 Go to previous messageGo to next message
jo moreau is currently offline jo moreauFriend
Messages: 9
Registered: February 2012
Junior Member
It's still not working! You were right, that was not the problem. Confused

Does BIRT uses the getAppContext method every time he's generating a report?
Is there another way to pass a string to birt without report parameter?

[Updated on: Wed, 08 February 2012 13:31]

Report message to a moderator

Re: Problem when integrating WebViewer into RCP application [message #793915 is a reply to message #793720] Wed, 08 February 2012 18:35 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you try adding a __document=newrptdoc.rptdocument to the emitter map?

Jason

On 2/8/2012 8:30 AM, jo moreau wrote:
> It's still not working! You were right, that was not the problem.
>
> Does BIRT uses the getAppContext method every time he's generating a
> report? Is there another way to pass a string to birt without parameter?
Re: Problem when integrating WebViewer into RCP application [message #793963 is a reply to message #793915] Wed, 08 February 2012 19:37 Go to previous message
jo moreau is currently offline jo moreauFriend
Messages: 9
Registered: February 2012
Junior Member
Thank you very much for your help. It's now working perfectly. The last post wasn't necessary because I did a typing mistake the first time when I wrote the the HashMap code.

Thanks again.

Jonathan
Previous Topic:1000's separator in tooltip
Next Topic:Question about COUNT vs COUNTDISTINCT
Goto Forum:
  


Current Time: Fri Dec 19 02:25:11 GMT 2014

Powered by FUDForum. Page generated in 0.01917 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software