Revision: 10153
Author:   [email protected]
Date:     Thu May  5 12:43:07 2011
Log: AttachableHTMLPanel.logicalAdd() should receive an Attachable instead of a Widget.

Review at http://gwt-code-reviews.appspot.com/1434802

Review by: [email protected]
http://code.google.com/p/google-web-toolkit/source/detail?r=10153

Modified:
 /trunk/user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java

=======================================
--- /trunk/user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java Wed May 4 12:02:05 2011 +++ /trunk/user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java Thu May 5 12:43:07 2011
@@ -158,8 +158,15 @@
    * Adopts the given, but doesn't change anything about its DOM element.
* Should only be used for widgets with elements that are children of this
    * panel's element.
+   * No-op if called with an Attachable that isn't also IsWidget,
+   * but safe to call with such as a convenience.
    */
-  public void logicalAdd(Widget widget) {
+  public void logicalAdd(Attachable attachable) {
+    if (!(attachable instanceof IsWidget)) {
+      // Nothing to do if not a Widget.
+      return;
+    }
+    Widget widget = ((IsWidget) attachable).asWidget();
     getChildren().add(widget);
     adopt(widget);
   }

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

Reply via email to