Thomas Broyer has posted comments on this change.

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


Patch Set 5: Code-Review-1

(1 comment)

I tend to agree with Jens here (now that we see that in isolation, without the FocusComposite and PanelComposite)

When you call initWidget(Widget,T), you already have a variable holding the delegate (because you have to put it as a child of the "root widget"), and changing that variable to a field to make it accessible elsewhere in the class is a no-brainer (and if you use UiBinder to construct your Composite's internals, you already have that field as a @UiField, so the concept of delegate at the Composite level only comes as a duplicate).

The only use case for getDelegate is when you have someone extending your Composite, so they can gain direct access to that "central widget"; but a) extending a Composite is probably an anti-pattern and b) exposing your widget to subclasses is a no-brainer too.

I really think what we want is to have getWidget() return some 'T extends Widget'.

....................................................
File user/src/com/google/gwt/user/client/ui/ResizeComposite.java
Line 25: public abstract class ResizeComposite<T extends Widget & RequiresResize> The problem here is that actually you'll want getWidget to implement RequiresResize, not necessarily getDelegate (the goal of ResizeComposite is to be able to use a RequiresResize widget as the "root widget").

What we want here is more:

public abstract class ResizeComposite<T extends Widget & RequiresResize, D extends Widget> extends Composite<D> implements RequiresResize

and that actually doesn't simplify the implementation of ResizeComposite (it would if Composite had 2 type parameters, for the "root widget" and the delegate).


--
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: 5
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: Jens Nehlmeier <jens.nehlme...@gmail.com>
Gerrit-Reviewer: Leeroy Jenkins <jenk...@gwtproject.org>
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 "GWT 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