AttachableHTMLPanel.logicalAdd() should receive an Attachable instead of a Widget.
Review at http://gwt-code-reviews.appspot.com/1434802
Review by: rjrjr@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@10153 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java b/user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java
index 590cf06..4badbf4 100644
--- a/user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java
+++ b/user/src/com/google/gwt/user/client/ui/AttachableHTMLPanel.java
@@ -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);
}