]> source.dussan.org Git - vaadin-framework.git/commitdiff
Also find paintables inside HasOneWidget widgets (#8323)
authorLeif Åstrand <leif@vaadin.com>
Fri, 10 Feb 2012 12:14:22 +0000 (14:14 +0200)
committerLeif Åstrand <leif@vaadin.com>
Fri, 10 Feb 2012 12:14:22 +0000 (14:14 +0200)
src/com/vaadin/terminal/gwt/client/ui/VAbstractPaintableWidgetContainer.java

index ebdb05a6c8f402cbfea06851f67100401648b216..42addc66eb36b7ca2e7e85de278f61dc75cdac04 100644 (file)
@@ -6,6 +6,7 @@ package com.vaadin.terminal.gwt.client.ui;
 import java.util.ArrayList;
 import java.util.Collection;
 
+import com.google.gwt.user.client.ui.HasOneWidget;
 import com.google.gwt.user.client.ui.HasWidgets;
 import com.google.gwt.user.client.ui.Widget;
 import com.vaadin.terminal.gwt.client.VPaintableMap;
@@ -36,15 +37,23 @@ public abstract class VAbstractPaintableWidgetContainer extends
 
         if (widget instanceof HasWidgets) {
             for (Widget child : (HasWidgets) widget) {
-                VPaintableWidget paintable = paintableMap.getPaintable(child);
-                if (paintable != null) {
-                    // If child is a paintable, add it to the collection
-                    paintables.add(paintable);
-                } else {
-                    // Else keep looking for paintables inside the child widget
-                    addDescendantPaintables(child, paintables, paintableMap);
-                }
+                addIfPaintable(child, paintables, paintableMap);
             }
+        } else if (widget instanceof HasOneWidget) {
+            Widget child = ((HasOneWidget) widget).getWidget();
+            addIfPaintable(child, paintables, paintableMap);
+        }
+    }
+
+    private static void addIfPaintable(Widget widget,
+            Collection<VPaintableWidget> paintables, VPaintableMap paintableMap) {
+        VPaintableWidget paintable = paintableMap.getPaintable(widget);
+        if (paintable != null) {
+            // If widget is a paintable, add it to the collection
+            paintables.add(paintable);
+        } else {
+            // Else keep looking for paintables inside the widget
+            addDescendantPaintables(widget, paintables, paintableMap);
         }
     }