Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » applet in Iframe fails with "w.setAddress is not a function"
applet in Iframe fails with "w.setAddress is not a function" [message #521838] Thu, 18 March 2010 21:12 Go to next message
Robbi Dierks is currently offline Robbi DierksFriend
Messages: 3
Registered: March 2010
Junior Member
Hello!
I try to include an applet in a RAP widget through a qx.ui.embed.Iframe. I am using eclipse-jee-galileo-SR2 with RAP 1.3M5.

I started with the functional GMap demo application as described in the custom widget tutorial (org.eclipse.rap.demo.gmaps from CVS). Then I replaced the complete GMap.js with the following code:

---------8<----------------------------
qx.Class.define( "org.eclipse.rap.gmaps.GMap", {
extend: qx.ui.embed.Iframe,
construct: function( id ) {
this.base( arguments );
this.setHtmlAttribute("id", id);
this._id = id;
this.setSource("http:/"+" /java.sun.com/applets/jdk/1.4/demo/applets/TicTacToe/example 1.html ");
}
});
--------->8----------------------------

This example worked for me with RAP 1.2. But with RAP 1.3 I get the following error:

---------8<----------------------------
Could not evaluate javascript response:
TypeError: this[$1[$4]] is not a function

var req = org.eclipse.swt.Request.getInstance();req.setRequestCounter( "0" );qx.theme.manager.Meta.getInstance().setTheme( org.eclipse.swt.theme.Default );org.eclipse.swt.Request.getInstance().setTimeoutPage( "<html><head><title>Session timed out</title></head><body><p>The server session timed out.</p><p>Please click <a {HREF_URL}>here</a> to restart the session.</p></body></html>" );var wm = org.eclipse.swt.WidgetManager.getInstance();var w = wm.newWidget( "w2", "", false, "org.eclipse.swt.widgets.Shell" );w.addToDocument();w.addState( "rwt_TITLE" );w.setShowMinimize( true );w.setAllowMinimize( true );w.setShowMaximize( true );w.setAllowMaximize( true );w.setShowClose( true );w.setAllowClose( true );w.setResizable( true, true, true, true );w.initialize();w.addEventListener( "changeWidth", org.eclipse.swt.EventUtil.widgetResized );w.addEventListener( "changeHeight", org.eclipse.swt.EventUtil.widgetResized );w.addEventListener( "changeLeft", org.eclipse.swt.EventUtil.widgetMoved );w.addEventListener( "changeTop", org.eclipse.swt.EventUtil.widgetMoved );w.setSpace( 0, 300, 0, 300 );w.setTabIndex( -1 );w.setVisibility( true );w.setCaption( "GMaps Demo" );w.open();w.setActive( true );w.setMinWidth( 80 );w.setMinHeight( 23 );var w = wm.newWidget( "w3", "w2", true, "org.eclipse.rap.gmaps.GMap", '"w3"' );w.setAppearance( "composite" );w.setOverflow( "hidden" );w.setSpace( 0, 296, 19, 277 );w.setZIndex( 300 );w.setTabIndex( 1 );w.setAddress( "" );var w = wm.findWidgetById( "w2" );w.setActiveControl( wm.findWidgetById( "w3" ) );org.eclipse.swt.WidgetManager.getInstance().focus( "w3" );
----------->8----------------------------

I found a sort of solution to this problem at https://bugs.eclipse.org/bugs/show_bug.cgi?id=261355#c11, but it does not quite work for me. I added the dummy properties, so that the GMap.js is now:

---------8<----------------------------
qx.Class.define( "org.eclipse.rap.gmaps.GMap", {
extend: qx.ui.embed.Iframe,
properties : {
// Dummy property to make it works with RAP 1.3
backgroundGradient : {
check : "Array",
nullable : true,
init : null,
themeable : true
}
},
construct: function( id ) {
this.base( arguments );
this.setHtmlAttribute("id", id);
this._id = id;
this.setSource("http:/"+" /java.sun.com/applets/jdk/1.4/demo/applets/TicTacToe/example 1.html ");
}
});
--------->8----------------------------

But now I get a different error:

---------8<----------------------------
Could not evaluate javascript response:
TypeError: w.setAddress is not a function

var req = org.eclipse.swt.Request.getInstance();req.setRequestCounter( "0" );qx.theme.manager.Meta.getInstance().setTheme( org.eclipse.swt.theme.Default );org.eclipse.swt.Request.getInstance().setTimeoutPage( "<html><head><title>Session timed out</title></head><body><p>The server session timed out.</p><p>Please click <a {HREF_URL}>here</a> to restart the session.</p></body></html>" );var wm = org.eclipse.swt.WidgetManager.getInstance();var w = wm.newWidget( "w2", "", false, "org.eclipse.swt.widgets.Shell" );w.addToDocument();w.addState( "rwt_TITLE" );w.setShowMinimize( true );w.setAllowMinimize( true );w.setShowMaximize( true );w.setAllowMaximize( true );w.setShowClose( true );w.setAllowClose( true );w.setResizable( true, true, true, true );w.initialize();w.addEventListener( "changeWidth", org.eclipse.swt.EventUtil.widgetResized );w.addEventListener( "changeHeight", org.eclipse.swt.EventUtil.widgetResized );w.addEventListener( "changeLeft", org.eclipse.swt.EventUtil.widgetMoved );w.addEventListener( "changeTop", org.eclipse.swt.EventUtil.widgetMoved );w.setSpace( 0, 300, 0, 300 );w.setTabIndex( -1 );w.setVisibility( true );w.setCaption( "GMaps Demo" );w.open();w.setActive( true );w.setMinWidth( 80 );w.setMinHeight( 23 );var w = wm.newWidget( "w3", "w2", true, "org.eclipse.rap.gmaps.GMap", '"w3"' );w.setAppearance( "composite" );w.setOverflow( "hidden" );w.setSpace( 0, 296, 19, 277 );w.setZIndex( 300 );w.setTabIndex( 1 );w.setAddress( "" );var w = wm.findWidgetById( "w2" );w.setActiveControl( wm.findWidgetById( "w3" ) );org.eclipse.swt.WidgetManager.getInstance().focus( "w3" );
--------->8----------------------------

Where does the call to w.setAddress come from? I have removed the call to 'map.setAddress( "Stephanienstraße 20, Karlsruhe" );' from the GMapDemo class in the custom widget help text.
And how can I correct the example above to display an applet in the Iframe?

Thanks
Robbi
Re: applet in Iframe fails with "w.setAddress is not a function" [message #521841 is a reply to message #521838] Thu, 18 March 2010 21:29 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Robbi,

take a look at GMapLCA#renderChanges method and remove this line:
writer.set( PROP_ADDRESS, JS_PROP_ADDRESS, gmap.getAddress() );

Best,
Ivan

On 03/18/2010 11:12 PM, Robbi Dierks wrote:
> Hello!
> I try to include an applet in a RAP widget through a
> qx.ui.embed.Iframe. I am using eclipse-jee-galileo-SR2 with RAP 1.3M5.
>
> I started with the functional GMap demo application as described in
> the custom widget tutorial (org.eclipse.rap.demo.gmaps from CVS). Then
> I replaced the complete GMap.js with the following code:
>
> ---------8<----------------------------
> qx.Class.define( "org.eclipse.rap.gmaps.GMap", {
> extend: qx.ui.embed.Iframe,
> construct: function( id ) {
> this.base( arguments );
> this.setHtmlAttribute("id", id);
> this._id = id;
> this.setSource("http:/"+"
> /java.sun.com/applets/jdk/1.4/demo/applets/TicTacToe/example 1.html ");
> }
> }); --------->8----------------------------
>
> This example worked for me with RAP 1.2. But with RAP 1.3 I get the
> following error:
>
> ---------8<----------------------------
> Could not evaluate javascript response:
> TypeError: this[$1[$4]] is not a function
>
> var req =
> org.eclipse.swt.Request.getInstance();req.setRequestCounter( "0"
> );qx.theme.manager.Meta.getInstance().setTheme(
> org.eclipse.swt.theme.Default
> );org.eclipse.swt.Request.getInstance().setTimeoutPage(
> "<html><head><title>Session timed out</title></head><body><p>The
> server session timed out.</p><p>Please click <a {HREF_URL}>here</a> to
> restart the session.</p></body></html>" );var wm =
> org.eclipse.swt.WidgetManager.getInstance();var w = wm.newWidget(
> "w2", "", false, "org.eclipse.swt.widgets.Shell"
> );w.addToDocument();w.addState( "rwt_TITLE" );w.setShowMinimize( true
> );w.setAllowMinimize( true );w.setShowMaximize( true
> );w.setAllowMaximize( true );w.setShowClose( true );w.setAllowClose(
> true );w.setResizable( true, true, true, true
> );w.initialize();w.addEventListener( "changeWidth",
> org.eclipse.swt.EventUtil.widgetResized );w.addEventListener(
> "changeHeight", org.eclipse.swt.EventUtil.widgetResized
> );w.addEventListener( "changeLeft",
> org.eclipse.swt.EventUtil.widgetMoved );w.addEventListener(
> "changeTop", org.eclipse.swt.EventUtil.widgetMoved );w.setSpace( 0,
> 300, 0, 300 );w.setTabIndex( -1 );w.setVisibility( true
> );w.setCaption( "GMaps Demo" );w.open();w.setActive( true
> );w.setMinWidth( 80 );w.setMinHeight( 23 );var w = wm.newWidget( "w3",
> "w2", true, "org.eclipse.rap.gmaps.GMap", '"w3"' );w.setAppearance(
> "composite" );w.setOverflow( "hidden" );w.setSpace( 0, 296, 19, 277
> );w.setZIndex( 300 );w.setTabIndex( 1 );w.setAddress( "" );var w =
> wm.findWidgetById( "w2" );w.setActiveControl( wm.findWidgetById( "w3"
> ) );org.eclipse.swt.WidgetManager.getInstance().focus( "w3" );
> ----------->8----------------------------
>
> I found a sort of solution to this problem at
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=261355#c11, but it does
> not quite work for me. I added the dummy properties, so that the
> GMap.js is now:
>
> ---------8<----------------------------
> qx.Class.define( "org.eclipse.rap.gmaps.GMap", {
> extend: qx.ui.embed.Iframe,
> properties : { // Dummy property to make it works with RAP 1.3
> backgroundGradient : {
> check : "Array",
> nullable : true,
> init : null,
> themeable : true
> } },
> construct: function( id ) {
> this.base( arguments );
> this.setHtmlAttribute("id", id);
> this._id = id;
> this.setSource("http:/"+"
> /java.sun.com/applets/jdk/1.4/demo/applets/TicTacToe/example 1.html ");
> }
> }); --------->8----------------------------
>
> But now I get a different error:
>
> ---------8<----------------------------
> Could not evaluate javascript response:
> TypeError: w.setAddress is not a function
>
> var req =
> org.eclipse.swt.Request.getInstance();req.setRequestCounter( "0"
> );qx.theme.manager.Meta.getInstance().setTheme(
> org.eclipse.swt.theme.Default
> );org.eclipse.swt.Request.getInstance().setTimeoutPage(
> "<html><head><title>Session timed out</title></head><body><p>The
> server session timed out.</p><p>Please click <a {HREF_URL}>here</a> to
> restart the session.</p></body></html>" );var wm =
> org.eclipse.swt.WidgetManager.getInstance();var w = wm.newWidget(
> "w2", "", false, "org.eclipse.swt.widgets.Shell"
> );w.addToDocument();w.addState( "rwt_TITLE" );w.setShowMinimize( true
> );w.setAllowMinimize( true );w.setShowMaximize( true
> );w.setAllowMaximize( true );w.setShowClose( true );w.setAllowClose(
> true );w.setResizable( true, true, true, true
> );w.initialize();w.addEventListener( "changeWidth",
> org.eclipse.swt.EventUtil.widgetResized );w.addEventListener(
> "changeHeight", org.eclipse.swt.EventUtil.widgetResized
> );w.addEventListener( "changeLeft",
> org.eclipse.swt.EventUtil.widgetMoved );w.addEventListener(
> "changeTop", org.eclipse.swt.EventUtil.widgetMoved );w.setSpace( 0,
> 300, 0, 300 );w.setTabIndex( -1 );w.setVisibility( true
> );w.setCaption( "GMaps Demo" );w.open();w.setActive( true
> );w.setMinWidth( 80 );w.setMinHeight( 23 );var w = wm.newWidget( "w3",
> "w2", true, "org.eclipse.rap.gmaps.GMap", '"w3"' );w.setAppearance(
> "composite" );w.setOverflow( "hidden" );w.setSpace( 0, 296, 19, 277
> );w.setZIndex( 300 );w.setTabIndex( 1 );w.setAddress( "" );var w =
> wm.findWidgetById( "w2" );w.setActiveControl( wm.findWidgetById( "w3"
> ) );org.eclipse.swt.WidgetManager.getInstance().focus( "w3" );
> --------->8----------------------------
>
> Where does the call to w.setAddress come from? I have removed the call
> to 'map.setAddress( "Stephanienstraße 20, Karlsruhe" );' from the
> GMapDemo class in the custom widget help text.
> And how can I correct the example above to display an applet in the
> Iframe?
>
> Thanks
> Robbi
Re: applet in Iframe fails with "w.setAddress is not a function" [message #521846 is a reply to message #521841] Thu, 18 March 2010 21:46 Go to previous messageGo to next message
Robbi Dierks is currently offline Robbi DierksFriend
Messages: 3
Registered: March 2010
Junior Member
Hrmpf, I removed the getAddress call as you suggested.

This causes a reproducible crash of the whole eclipse IDE. On the terminal, which started eclipse, I see:

java: ../../../../src/plugin/share/plugin2/common/LocalFramePusher .h:25: LocalFramePusher::LocalFramePusher(int): Assertion `env != __null' failed.

Any idea?

Before the crash I see jetty logging its start in the eclipse console as usual without error messages. Then the blue gradient RAP background and the GMap shell appear in the browser, and half a second later all is destroyed.

Thanks for the tip, nevertheless it brings me closer to a solution, I hope.

Robbi
Re: applet in Iframe fails with "w.setAddress is not a function" [message #521851 is a reply to message #521846] Thu, 18 March 2010 22:17 Go to previous messageGo to next message
Robbi Dierks is currently offline Robbi DierksFriend
Messages: 3
Registered: March 2010
Junior Member
Update:

If I run the RAP application in an external browser instead of the eclipse internal browser, the applet works fine. Thanks again!

Because I find it more convenient to use the internal browser for testing, any hint about how to avoid the crash is highly appreciated.

Robbi
Re: applet in Iframe fails with "w.setAddress is not a function" [message #522006 is a reply to message #521851] Fri, 19 March 2010 15:27 Go to previous message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Robbi,

there are a couple of SWT bugs describing problems with applets in the
SWT browser. You might want to search the Eclipse bugzilla if your issue
is already known and if not open a new bug against Platform/SWT.

Regards, Ralf

Robbi Dierks wrote:
> Update:
>
> If I run the RAP application in an external browser instead of the
> eclipse internal browser, the applet works fine. Thanks again!
>
> Because I find it more convenient to use the internal browser for
> testing, any hint about how to avoid the crash is highly appreciated.
>
> Robbi
Previous Topic:Where does RAP store instance-scope preferences?
Next Topic:page.showEditor( Editor.ID) & page.hideEditor(Editor.ID)
Goto Forum:
  


Current Time: Thu Apr 25 15:12:48 GMT 2024

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

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

Back to the top