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;
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);
}
}