After debugging, I think I found the solution to my issue. It had to do with
parameterized types, which would break the event flow.
Simply extending all classes to remove all parameterized elements did the
trick.
-- 
Sébastien Tromp

2011/8/3 Sébastien Tromp <[email protected]>

> Hello,
>
> I am trying to build an implementation of the Set interface that notifies
> registered handlers when a modification occurs on the Set.
> First of all, has this already been done somewhere?
> I couldn't find anything, so I went on to build my own. The issue I have is
> that, when the Change event is fired, the handlers are not notified.
>
> My code is as follows:
>
> public class NotifyingSet<T> extends Composite implements
> HasCollectionChangeHandlers<T>, Set<T> {
>
>     private final Set<T> wrappedSet;
>
>     public NotifyingSet() {
>         this.wrappedSet = new HashSet<T>();
>     }
>
>     @Override
>     public boolean add(final T e) {
>         final boolean ret = this.wrappedSet.add(e);
>         this.fireEvent(new CollectionChangeEvent<T>(Operation.ADD, e));
>         return ret;
>     }
>
>    ...
> }
>
> --------------------
>
> public interface HasCollectionChangeHandlers<T> {
>     HandlerRegistration
> addCollectionChangeHandler(CollectionChangeEventHandler<T> handler);
> }
>
> -------------------
>
> In my presenter, I do this:
>
> // Also tried with GWT.create()
> private final NotifyingSet<FightRequest> fightRequests
> = new NotifyingSet<FightRequest>();
>
> this.registerHandler(this.fightRequests
>                 .addCollectionChangeHandler(new
> CollectionChangeEventHandler<FightRequest>() {
>                     @Override
>                     public void onCollectionChange(final FightRequest
> element,
>                             final
> com.fiveorbs.client.events.CollectionChangeEventHandler.Operation operation)
> {
>                         logger.info("on collection change")
>                     }
>
>                 }));
>
> ...
>
> fightRequests.add(someobject);
> ----------------
>
> After the add, I would expect my handler to be called, but to no avail.
>
> Would you have any idea as to what I'm doing wrong?
>
> Thanks,
> --
> Sébastien Tromp
>

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

Reply via email to