Hi, Luciano. I did read only this ( Hi all,
>
> > > >>>>> I'm fighting withJSNIfor a time without success trying to call a
> > > >>>>> java method from my javascript stuff.
>) from your post and i think i can help you if this is what you want to
achieve.

Let me paste some working example how to call java method from javascript
with gwt:

In my gwt code i have native method, that is called onModuleLoad() and sends
the method reference (public void onMessage(String message) ) to external
js.

public native void initCallBacks() /*-{
        var self = this;

$wnd.setupOnMessageCallback(function(a){se...@claire.admin.client.datasources.manualbetdatasource
::onMessage(Ljava/lang/String;)(a);});
    }-*/;

In my external js file i have this:

externalJS.js :

function MessageHandler() {
    this.onMessage = null;
}

var _mh = new MessageHandler();
..............................................

function setupOnMessageCallback(myJavaMethoRef) {
    if (_mh.onMessage == null) {
        _mh.onMessage = myJavaMethoRef;
    }
}

function anotherTestFunction() {
     _mh.onMessage("test");
}

//END
So when your module is loading int will call the native initCallBacks method
which will call setupOnMessageCallback fron the external js file and will
pass the java method ref to the MessageHandler.
And you are ready to call the java method from js by calling
anotherTestFunction any where you want in your external js :). It works for
me.
Hope this was the problem.

Regards.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to