From: Artur Signell Date: Mon, 28 Sep 2009 13:50:40 +0000 (+0000) Subject: Fix for #3418 - VPopupView should implement Iterable X-Git-Tag: 6.7.0.beta1~2461^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9fcc14f91094a4cecfa2785ef8b85a5fe7f32d8f;p=vaadin-framework.git Fix for #3418 - VPopupView should implement Iterable svn changeset:8960/svn branch:6.1 --- diff --git a/src/com/vaadin/terminal/gwt/client/ui/VPopupView.java b/src/com/vaadin/terminal/gwt/client/ui/VPopupView.java index 46e35f2cb8..c0fe8fd8d1 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VPopupView.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VPopupView.java @@ -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 { public static final String CLASSNAME = "v-popupview"; @@ -426,4 +428,30 @@ public class VPopupView extends HTML implements Container { } } + public Iterator iterator() { + return new Iterator() { + + 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