]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix some broken hierarchies (#6690)
authorLeif Åstrand <leif@vaadin.com>
Tue, 29 May 2012 11:23:39 +0000 (14:23 +0300)
committerLeif Åstrand <leif@vaadin.com>
Wed, 6 Jun 2012 06:33:10 +0000 (09:33 +0300)
src/com/vaadin/ui/Panel.java
src/com/vaadin/ui/Root.java

index 37e03ffb379d49849d2a516b6d92cb43d872ff03..c339100cda70ab031ed504a612ad1ce554a7cfa6 100644 (file)
@@ -4,6 +4,7 @@
 
 package com.vaadin.ui;
 
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.Map;
 
@@ -229,7 +230,7 @@ public class Panel extends AbstractComponentContainer implements Scrollable,
      * @see com.vaadin.ui.ComponentContainer#getComponentIterator()
      */
     public Iterator<Component> getComponentIterator() {
-        return content.getComponentIterator();
+        return Collections.singleton((Component) content).iterator();
     }
 
     /**
index 0ba8ef27fb1a1555bf6ad850c544d96e99150fe6..8792bf1912b4de40c9e65f96011482426c763e02 100644 (file)
@@ -643,11 +643,17 @@ public abstract class Root extends AbstractComponentContainer implements
      * @see com.vaadin.ui.ComponentContainer#getComponentIterator()
      */
     public Iterator<Component> getComponentIterator() {
-        if (getContent() == null) {
-            return Collections.EMPTY_LIST.iterator();
+        // TODO could directly create some kind of combined iterator instead of
+        // creating a new ArrayList
+        ArrayList<Component> components = new ArrayList<Component>();
+
+        if (getContent() != null) {
+            components.add(getContent());
         }
 
-        return Collections.singleton((Component) getContent()).iterator();
+        components.addAll(windows);
+
+        return components.iterator();
     }
 
     /*
@@ -656,7 +662,7 @@ public abstract class Root extends AbstractComponentContainer implements
      * @see com.vaadin.ui.ComponentContainer#getComponentCount()
      */
     public int getComponentCount() {
-        return getContent() == null ? 0 : 1;
+        return windows.size() + (getContent() == null ? 0 : 1);
     }
 
     /**