Oh yeah, forgot to answer that.
HasHandlers.isEventHandled() exists to allow optimization of event object
instantiation, as in:

class SomeEvent {
  static void fireSomeEvent(HasHandlers source) {
    if (source.isEventHandled(SomeEvent.TYPE) {
      source.fireEvent(new SomeEvent());
    }
  }
}

I suppose this is pretty obvious, but I just wanted to reiterate it to be
clear. If you like, we could have a discussion about whether it's worth
complicating HasHandlers to optimize for a use case that we haven't really
shown matters in practice (We would need to show the existence of an event
object that is very expensive to create, that couldn't be resolved in
another way).

The reason this needs to exist on HasHandlers specifically is that methods
of the form "static EventObject.fire()" need a parameter that represents the
collection of objects that are to receive the events.

If no one objects, I'd like to go ahead and check this into the 1.6 branch,
and deal with this question separately. As long as there's not any
contention over the existence of HasHandlers, we should be in pretty good
shape.

On Tue, Jan 20, 2009 at 11:52 AM, Ray Ryan <rj...@google.com> wrote:

> LGTM
> ...but I'd still like to hear why isEventHandled is necessary.
>
> rjrjr
>
> On Tue, Jan 20, 2009 at 8:32 AM, Joel Webber <j...@google.com> wrote:
>
>> I just put a final (?) version of the patch up for review. Other than the
>> changes already discussed in this thread, it includes Emily's suggestion on
>> gwt.xml module structure. Specifically, it now looks like this:
>> gwt.event.Event.gwt.xml
>> gwt.event.EventBase.gwt.xml
>> gwt.event.dom.DomEvent.gwt.xml
>> gwt.event.logical.LogicalEvent.gwt.xml
>>
>> Event.gwt.xml gives you everything. This is the default inherit from
>> User.gwt.xml.
>> EventBase.gwt.xml gives you only the code in event.client.
>> DomEvent.gw.xml and LogicalEvent.gwt.xml both inherit EventBase.gwt.xml.
>>
>> So if you want only logical events, you can just inherit
>> LogicalEvent.gwt.xml. If you really only want the core event infrastructure,
>> you can simply inherit EventBase.gwt.xml. This cleanly handles all the
>> use-cases we could come up with, and follows a pattern already used in the
>> incubator, and that we believe will serve us well in the future.
>>
>> If no one objects to this one, I'm checking it in!
>>
>> On Fri, Jan 16, 2009 at 3:34 PM, <rj...@google.com> wrote:
>>
>>> LGTM, especially if you talk yourself into removing
>>> HasHandlers#isEventHandled
>>>
>>>
>>>
>>> http://gwt-code-reviews.appspot.com/2205
>>>
>>
>>
>

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

Reply via email to