See GWT Exporter.  This allows you to inject unobfuscated javascript
functions so you can call them through JSNI from the other module.  If
you don't want to include exporter, all you have to do is inject the
functions through JSNI on module load. DISCLAIMER: this is untested,
you might have to modify to get it to work/compile.

public abstract class ModuleEntryPoint implements EntryPoint {
    protected abstract String getModuleId();

    public abstract void recieveData(String data);

    public void onModuleLoad() {
        injectCallback(this, getModuleId());
    }

    private native void injectCallback(ModuleEntryPoint instance,
String moduleId)/*-{
        if ($wnd.moduleDataInterfaces == undefined)
            $wnd.moduleDataInterfaces = [];
        $wnd.moduleDataInterfaces[moduleId] = function(data) {
            return
instan...@com.google.example.moduleentrypoint::recieveData(Ljava/lang/
String;)(data);
        }
    }-*/;

    public static native void sendData(String moduleId, String data)/*-
{
        if ($wnd.moduleDataInterfaces != undefined)
            $wnd.moduleDataInterfaces[moduleId](data) ;
    }-*/;
}

On May 12, 8:36 am, djd <alex.dobjans...@gmail.com> wrote:
> No easy way to do this,
>
> One way is to use JSNI, write to DOM in one module, read in the 2nd.
> The problem here is serialization of these 2 events (read & write) -
> meaning u should be sure the data was actually written before reading
> them.
> Another way is to set a callback to DOM that listens to data :) (in
> the module that needs reading). And write with the 2nd module (after
> you have set the callback).
>
> Or you could eliminate these indirect methods and use a 3rd module
> that connects those 2 :) - which I actually suggest.
>
> Regards
>
>
>
> > package module1
> > method1 (Data data)
> > {
> >    module2.class2.method2 (data);
>
> > }
>
> > when you consider a more complex case, you need to explain what you
> > are going to do?.
>
> > Stefan Bacherthttp://gwtworld.de
>
> > On 12 Mai, 08:43, Stefan Ludwig <tapir0...@gmail.com> wrote:
>
> > > Hi,
>
> > > how I can exchange datas between two GWT modules? I there a way? Or/
> > > and how can I dispatch an event in another module (like button click)?
>
> > > Thanks
> > > Stefan
>
> > > --
> > > 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-tool...@googlegroups.com.
> > > To unsubscribe from this group, send email to 
> > > google-web-toolkit+unsubscr...@googlegroups.com.
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/google-web-toolkit?hl=en.
>
> > --
> > 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-tool...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > google-web-toolkit+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/google-web-toolkit?hl=en.
>
> --
> 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-tool...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-web-toolkit+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/google-web-toolkit?hl=en.

-- 
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-tool...@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