Thomas Broyer has posted comments on this change.

Change subject: Introduces generic Composite widgets.
......................................................................


Patch Set 3:

(1 comment)

I'd vote for removing FocusComposite from this change, to get it merged early, and adding it in its own change.

....................................................
File user/src/com/google/gwt/user/client/ui/FocusComposite.java
Line 127:     return getDelegate().addDoubleClickHandler(handler);
Yes, that'd mean tracking, for each event, whether the handler was added to the delegate widget, something like:

   private boolean dblClickHandlerRegistered;
   …
public HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler) {
     if (!dblClickHandlerRegistered) {
       getDelegate().addDoubleClickHandler(new DoubleClickHandler() {
         @Override
         public void onDoubleClick(DoubleClickEvent event) {
           fireEvent(event);
         }
       });
       dbleClickHandlerRegistered = true;
     }
     return addHandler(handler, DoubleClickEvent.getType());
   }

That's a lot of boilerplate and a bit of runtime overhead; and it doesn't remove the anonymous handler from the delegate when all the handlers are removed from the composite; this would require tracking the number of handlers added –unfortunately I don't think we can use getHandlerCount here as it doesn't account for queued adds/removes, when adding/removing handlers from within an event handler–, storing the HandlerRegistration for the anonymous handler, and wrapping the HandlerRegistration returned from addHandler() to remove the anonymous handler when the handler count reaches 0.

Note that instead of an anonymous class, we could have an inner class implementing all the event handlers; similar to SuggestBox. I have no idea what the compiler would optimize best.

Last, but not least, it'll possibly fire the events twice when getWidget()==getDelegate(); see issue 3533.


--
To view, visit https://gwt-review.googlesource.com/2582
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I41e5c07e978d442db7d8402c57605cec1b3ea09e
Gerrit-PatchSet: 3
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Goktug Gokdogan <[email protected]>
Gerrit-Reviewer: Brian Slesinsky <[email protected]>
Gerrit-Reviewer: Goktug Gokdogan <[email protected]>
Gerrit-Reviewer: Jens Nehlmeier <[email protected]>
Gerrit-Reviewer: Leeroy Jenkins <[email protected]>
Gerrit-Reviewer: Matthew Dempsky <[email protected]>
Gerrit-Reviewer: Thomas Broyer <[email protected]>
Gerrit-HasComments: Yes

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to