To access the JS window or document object of the main page you need
to use the JS variables $wnd and $doc. These variables will
automatically be made available to you inside of JSNI blocks.
So when you say...
> (where remoteClassName above is the name of the JavaScript object
You need to reference that JS object using $wnd[remoteClassName] instead.
I hope that helps a little.
> var me = this;
> ...
> me.@com.eliasbalasis.dwr4gwt.client.DwrAdapter::fireRemoteMethodCallReply(...)
The reference to "this" in "var me = this" isn't what you think it is.
It is *not* a reference to the Java class... which means you can't
use it to call back into the Java class.
The "me" in "me.@..." *must* be a Java object that was passed into the
method, like this...
private native void doStuff (DwrAdapter me) {
me.@com.eliasbalasis.dwr4gwt.client.DwrAdapter::fireRemoteMethodCallReply(...)
}
The Java class is 'called back'. I am using 'me' because 'this' has a
different value where I am using it, so I am using 'me' (original 'this')
instead.
The real problem is the variable name mangling :-(
When translated to JavaScript by the GWT compiler my variables no longer
have the same name and as a result my 'eval' expressions fail :-(
I thought of re-writing the 'eval' expressions and put actual values in
them, but then I wouldn't have a way of expressing the Java method signature
in the 'eval' expression, since whatever passed in 'eval' is not translated
and it wouldn't work in the browser case where everything needs to be
mangled.
Any ideas?
> > > (returnValue.constructor.toString ().indexOf("Array") != -1) {
> ...
>
> read more »