On Mon, Aug 10, 2009 at 10:26 AM, John LaBanca <[email protected]> wrote:

> I believe the problem is that if you extend ValueChangeEvent and
> ValueChangeHandler, you can then call
> Widget#addHandler(mySubValueChangeHandler, ValueChangeEvent.getType()),
> creating a mismatch because you are associating a SubValueChangeHandler with
> the ValueChangeEvent type.  While I don't think this will cause technically
> any problems, it can lead to a little confusion because if you fire a
> SubValueChangeEvent, your handler will not fire.
>
> Still, I think we can just javadoc that and take off the final modifier.
>

This could be useful in that you could register a change handler that takes
a superclass event, and register it for some number of specific subclasses
that you want to handle.

Ideally, there would be a way to register a handler for all subclasses as
well, ie:

  addHandler(ValueChangeHandler<FooSuper> handler, FooSuper.getType());

and it would get triggered on FooSub1, FooSub2, etc as well.

-- 
John A. Tamplin
Software Engineer (GWT), Google

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to