]> source.dussan.org Git - vaadin-framework.git/commitdiff
Use VPaintableWidgetContainer.getChildren() instead of static helper
authorLeif Åstrand <leif@vaadin.com>
Tue, 7 Feb 2012 11:48:36 +0000 (13:48 +0200)
committerLeif Åstrand <leif@vaadin.com>
Tue, 7 Feb 2012 11:48:36 +0000 (13:48 +0200)
src/com/vaadin/terminal/gwt/client/MeasureManager.java
src/com/vaadin/terminal/gwt/client/ui/VMeasuringOrderedLayoutPaintable.java

index 9bcecfd7862204f5b834a2dc953dde6bbeacfb71..6fbaa3b3f715afcbdb1f74907b7e8ffa62cc3363 100644 (file)
@@ -1,14 +1,11 @@
 package com.vaadin.terminal.gwt.client;
 
-import java.util.ArrayList;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
 
 import com.google.gwt.core.client.JsArrayString;
 import com.google.gwt.dom.client.Element;
-import com.google.gwt.user.client.ui.HasWidgets;
 import com.google.gwt.user.client.ui.RequiresResize;
 import com.google.gwt.user.client.ui.Widget;
 
@@ -82,32 +79,6 @@ public class MeasureManager {
 
     private static MeasureManager instance = new MeasureManager();
 
-    public static Collection<VPaintableWidget> getChildren(
-            VPaintableWidgetContainer paintable, ApplicationConnection client) {
-        Widget widget = paintable.getWidgetForPaintable();
-        Collection<VPaintableWidget> children = new ArrayList<VPaintableWidget>();
-
-        addDescendantPaintables(widget, children, client);
-
-        return children;
-    }
-
-    private static void addDescendantPaintables(Widget widget,
-            Collection<VPaintableWidget> paintables,
-            ApplicationConnection client) {
-        if (widget instanceof HasWidgets) {
-            VPaintableMap paintableMap = client.getPaintableMap();
-            for (Widget child : (HasWidgets) widget) {
-                VPaintableWidget paintable = paintableMap.getPaintable(child);
-                if (paintable != null) {
-                    paintables.add(paintable);
-                } else {
-                    addDescendantPaintables(child, paintables, client);
-                }
-            }
-        }
-    }
-
     public void doLayout(ApplicationConnection client) {
         VPaintableMap paintableMap = client.getPaintableMap();
         VPaintableWidget[] paintableWidgets = paintableMap
index d67574e90fcb4d3667ccb42430c94951bc211437..5e0565f5396d46b5ef7af9f6592e0c2ca2853a6a 100644 (file)
@@ -215,8 +215,7 @@ public abstract class VMeasuringOrderedLayoutPaintable extends
     }
 
     private void layoutPrimaryDirection() {
-        Collection<VPaintableWidget> children = MeasureManager.getChildren(
-                this, getWidgetForPaintable().client);
+        Collection<VPaintableWidget> children = getChildren();
 
         // First pass - get total expand ratio and allocated size
         int totalAllocated = 0;
@@ -335,8 +334,7 @@ public abstract class VMeasuringOrderedLayoutPaintable extends
     }
 
     private void layoutSecondaryDirection() {
-        Collection<VPaintableWidget> children = MeasureManager.getChildren(
-                this, getWidgetForPaintable().client);
+        Collection<VPaintableWidget> children = getChildren();
 
         int maxSize = 0;
         for (VPaintableWidget child : children) {