]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix for #3418 - VPopupView should implement Iterable
authorArtur Signell <artur.signell@itmill.com>
Mon, 28 Sep 2009 13:50:40 +0000 (13:50 +0000)
committerArtur Signell <artur.signell@itmill.com>
Mon, 28 Sep 2009 13:50:40 +0000 (13:50 +0000)
svn changeset:8960/svn branch:6.1

src/com/vaadin/terminal/gwt/client/ui/VPopupView.java

index 46e35f2cb8a2395dc9a8800ae61b44d7b2cefdb3..c0fe8fd8d1cab53d2314424122f89fef4b09a62a 100644 (file)
@@ -1,6 +1,8 @@
 package com.vaadin.terminal.gwt.client.ui;
 
 import java.util.HashSet;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
 import java.util.Set;
 
 import com.google.gwt.event.dom.client.ClickEvent;
@@ -27,7 +29,7 @@ import com.vaadin.terminal.gwt.client.VCaptionWrapper;
 import com.vaadin.terminal.gwt.client.VTooltip;
 import com.vaadin.terminal.gwt.client.RenderInformation.Size;
 
-public class VPopupView extends HTML implements Container {
+public class VPopupView extends HTML implements Container, Iterable<Widget> {
 
     public static final String CLASSNAME = "v-popupview";
 
@@ -426,4 +428,30 @@ public class VPopupView extends HTML implements Container {
         }
     }
 
+    public Iterator<Widget> iterator() {
+        return new Iterator<Widget>() {
+
+            int pos = 0;
+
+            public boolean hasNext() {
+                // There is a child widget only if next() has not been called.
+                return (pos == 0);
+            }
+
+            public Widget next() {
+                // Next can be called only once to return the popup.
+                if (pos != 0) {
+                    throw new NoSuchElementException();
+                }
+                pos++;
+                return popup;
+            }
+
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+
+        };
+    }
+
 }// class VPopupView