Thomas Broyer has posted comments on this change.

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


Patch Set 1:

(3 comments)

Why couldn't we just make Composite (and ResizeComposite) generic rather than introducing a new class? All current uses of Composite would be seen by the compiler as extending the raw class, so all you get is a warning. Changing ResizeComposite would be a breaking-change API-wise but I doubt anyone uses a ResizeComposite with a non-RequiresResize widget anyway as it breaks at runtime, so it shouldn't break anyone in practice.

....................................................
File user/src/com/google/gwt/user/client/ui/PanelComposite.java
Line 39:     this.add(asWidgetOrNull(w));
How about:

   T widget = getCheckedWidget();
   if (widget instance of HasWidgets.ForIsWidget) {
      widget.add(w);
   } else {
      this.add(getWidgetOrNull(w));
   }

in case the wrapped widget defers the call to asWidget(). If all HasWidgets used in the app are HasWidgets.ForIsWidget (or with a bit of luck, those used within a PanelComposite; I don't know how smart the compiler can be in this case), then the if() will be evaluated statically and simplified in the generated JS.

AFAICT, all "stock" HasWidgets are HasWidgets.ForIsWidget.


....................................................
File user/src/com/google/gwt/user/client/ui/ResizeComposite.java
Line 23:  * If you want initWidget/getWidget to be type safe please use
Should ResizeComposite be deprecated then?


....................................................
File user/src/com/google/gwt/user/client/ui/TypedComposite.java
Line 118:     if (widget == null) {
onAttach will fail already with an NPE.

IMO, render() should check it when renderable==null (if renderable!=null, then widget should be !=null so there's no need to test, though we could add an 'assert')


--
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: 1
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Goktug Gokdogan <gok...@google.com>
Gerrit-Reviewer: Brian Slesinsky <skybr...@google.com>
Gerrit-Reviewer: Goktug Gokdogan <gok...@google.com>
Gerrit-Reviewer: Matthew Dempsky <mdemp...@gwtproject.org>
Gerrit-Reviewer: Thomas Broyer <t.bro...@gmail.com>
Gerrit-HasComments: Yes

--
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- You received this message because you are subscribed to the Google Groups "Google Web Toolkit Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to