Yes, this is what I was relying on.

But then, does it mean I have to hand code all different events for
all my entities? There must be a shorter way to do this. If all my
entities have a "List<T> l = selectEntities()" service method,
triggered by event "SelectEntitiesEvent<T>" .... any ideas ?

On Feb 22, 1:44 am, Ben Imp <benlee...@gmail.com> wrote:
> After re-reading your post, I think I see the issue.  While you didn't
> post code for the three derived entities, I assume you are using
> different type parameters for your SelectEntitiesEvent, and relying on
> that to keep the events distinct.  I do not believe that works either
> in Java or in the translated JavaScript.  As you mention, generics in
> Java work on erasure, which means they don't really exist at runtime.
> You would have to make them separate classes in order for the event
> bus to treat them as distinct.
>
> http://en.wikipedia.org/wiki/Generics_in_Java#Type_erasure
>
> -Ben
>
> On Feb 21, 2:29 pm, Ben Imp <benlee...@gmail.com> wrote:
>
>
>
>
>
>
>
> > It seems like you are using a singleton event bus.  I would assume all
> > three entities are registered with that bus to handle the
> > SelectEntitiesEvent.  If thats the case, then I don't see why all
> > three wouldn't have their listeners triggered.  The event they
> > registered for did get fired.
>
> > -Ben
>
> > On Feb 21, 12:52 pm, Riyaz Mansoor <riyaz.mans...@gmail.com> wrote:
>
> > > Use case:
>
> > > Register an event (2nd snippet) using extending classes AEntity,
> > > BEntity, CEntity
> > > Refresh a specific table -> create one event and fire it (1st snippet)
> > > ===> the three handlers of AEntity, BEntity, CEntity are fired. Why ?
> > > Expected Case: If BEntity is refreshed -> only BEntity handler should
> > > fire.
>
> > > CellTable refresh code:
>
> > >         @UiHandler("fRefresh")
> > >         protected void refresh(ClickEvent clickEvent) {
> > >                 MsgPopup.getInstance().msgSending();
> > >                 SelectEntitiesEvent<T> event = new 
> > > SelectEntitiesEvent<T>(new
> > > GenericCallback<List<T>>() {
> > >                         public void onSuccess(List<T> result) {
> > >                                 System.out.println(result);
> > >                                 MsgPopup.getInstance().msgLoading();
> > >                                 fDataProvider.setList(result);
> > >                                 MsgPopup.getInstance().clearMessage();
>
> > >                         };
> > >                 });
> > >                 EventBusInstance.getInstance().fireEvent(event);
> > >         }
>
> > > Event registering - Specific classes extend this class:
>
> > >                 SelectEntitiesEvent.register(new 
> > > SelectEntitiesEvent.Handler<T>() {
> > >                         @Override
> > >                         public void 
> > > onSelectEntities(SelectEntitiesEvent<T> event) {
> > >                                 
> > > service.selectEntities(event.getCallback());
> > >                         }
> > >                 });

-- 
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