Reviewers: sbrubaker, Description: Making Composite implement RequiresResize and ProvidesResize so that it can pass resize information to its child widget. This is useful when creating a Composite of a LayoutPanel. In general, a widget should only ProvideResize if its child widget cannot affect the dimensions of the parent (ex. the parent is a a scrollable div or a div with a fixed height and width). Since Composite does not add any elements to the DOM hierarchy and Composite#onResize() is only called if the parent widget implements ProvidesResize, it is safe to pass through the resize. That is, we can implement RequiresResize because it is a no-op unless the Composite's child implements RequiresResize. We can implement ProvidesResize because it is a no-op unless the Composite's parent implements ProvidesResize, which means it is safe to resize the Composite's child.
Please review this at http://gwt-code-reviews.appspot.com/1041801/show Affected files: M user/src/com/google/gwt/user/client/ui/Composite.java Index: user/src/com/google/gwt/user/client/ui/Composite.java =================================================================== --- user/src/com/google/gwt/user/client/ui/Composite.java (revision 9129) +++ user/src/com/google/gwt/user/client/ui/Composite.java (working copy) @@ -34,7 +34,8 @@ * {...@example com.google.gwt.examples.CompositeExample} * </p> */ -public abstract class Composite extends Widget { +public abstract class Composite extends Widget implements RequiresResize, + ProvidesResize { private Widget widget; @@ -53,6 +54,12 @@ // Delegate events to the widget. widget.onBrowserEvent(event); + } + + public void onResize() { + if (widget instanceof RequiresResize) { + ((RequiresResize) widget).onResize(); + } } /** -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
