-/*\r
-@VaadinApache2LicenseForJavaFiles@\r
- */\r
-package com.vaadin.terminal.gwt.client.ui;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-\r
-import com.google.gwt.user.client.ui.HasWidgets;\r
-import com.google.gwt.user.client.ui.Widget;\r
-import com.vaadin.terminal.gwt.client.VPaintableMap;\r
-import com.vaadin.terminal.gwt.client.VPaintableWidget;\r
-import com.vaadin.terminal.gwt.client.VPaintableWidgetContainer;\r
-\r
-public abstract class VAbstractPaintableWidgetContainer extends\r
- VAbstractPaintableWidget implements VPaintableWidgetContainer {\r
-\r
- /**\r
- * Default constructor\r
- */\r
- public VAbstractPaintableWidgetContainer() {\r
- }\r
-\r
- public Collection<VPaintableWidget> getChildren() {\r
- Collection<VPaintableWidget> children = new ArrayList<VPaintableWidget>();\r
-\r
- addDescendantPaintables(getWidgetForPaintable(), children,\r
- VPaintableMap.get(getConnection()));\r
-\r
- return children;\r
- }\r
-\r
- private static void addDescendantPaintables(Widget widget,\r
- Collection<VPaintableWidget> paintables, VPaintableMap paintableMap) {\r
- // FIXME: Store hierarchy instead of doing lookup every time\r
-\r
- if (widget instanceof HasWidgets) {\r
- for (Widget child : (HasWidgets) widget) {\r
- VPaintableWidget paintable = paintableMap.getPaintable(child);\r
- if (paintable != null) {\r
- // If child is a paintable, add it to the collection\r
- paintables.add(paintable);\r
- } else {\r
- // Else keep looking for paintables inside the child widget\r
- addDescendantPaintables(child, paintables, paintableMap);\r
- }\r
- }\r
- }\r
- }\r
-\r
-}\r