views:

91

answers:

2

Hi, I am working on a gwt project and we are using eventbus for communicating events between widgets. I have 2 modules and when i raise an event in one module, the other module is unable to receive it. How can i solve this.Any help??

+1  A: 

Are you sure you've passed the same EventBus to both modules, and that both modules have subscribed to the event that you're publishing?

What EventBus class are you using, anyway? One you wrote yourself, or one that's included in a GWT library?

Jason Hall
hey, Thanks for the follow up :) I have totally 3 modules. Admin, Technician and a module called common which is inherited by both admin and Technician.EventBus is my custom singleton class extended from handler manager and is defined in the common module.I did not have any requirement for passing data between the modules till now
prabha
A: 

You are most likely using two different instances of EventBus in each of the modules.

Two possible reasons:

  • You have created two different instances (check the code for the occurrences of something like new HandlerManager(null) if you are using the supplied one, or similar).

  • You have a problem with passing the eventBus reference between modules; how are you passing data across these two modules?

igorbel
I have totally 3 modules. Admin, Technician and a module called common which is inherited by both admin and Technician.EventBus is my custom singleton class extended from handler manager and is defined in the common module.I did not have any requirement for passing data between the modules till now :(
prabha
So, where do you create the EventBus? In the common module?How do you obtain its instance in the Admin and Technician classes?Keep in mind that when you inherit a module, its onModuleLoad() method of the EntryPoint class is called.
igorbel