}
} else if (popupComponentWidget2 instanceof HasWidgets) {
HasWidgets hw = (HasWidgets) popupComponentWidget2;
- Iterator<Widget> iterator = hw.iterator();
- while (iterator.hasNext()) {
- checkForRTE(iterator.next());
+ try {
+ Iterator<Widget> iterator = hw.iterator();
+ while (iterator.hasNext()) {
+ checkForRTE(iterator.next());
+ }
+ } catch (UnsupportedOperationException e) {
+ // At least Grid refuses to provide child widgets through
+ // iterator()
}
}
}
--- /dev/null
+package com.vaadin.tests.layouts.layouttester.GridLayout;
+
+import com.vaadin.event.SelectionEvent;
+import com.vaadin.event.SelectionEvent.SelectionListener;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.tests.util.Person;
+import com.vaadin.tests.util.PersonContainer;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.PopupView;
+import com.vaadin.ui.PopupView.Content;
+import com.vaadin.ui.VerticalLayout;
+
+public class GridInPopupView extends AbstractTestUIWithLog {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ final Grid grid = new Grid(PersonContainer.createWithTestData(100));
+ grid.addSelectionListener(new SelectionListener() {
+ @Override
+ public void select(SelectionEvent event) {
+ String sel = "";
+ for (Object o : event.getSelected()) {
+ sel += ((Person) o).getFirstName();
+ }
+ log("Selection: " + sel);
+ }
+ });
+ PopupView pv = new PopupView(new Content() {
+ @Override
+ public Component getPopupComponent() {
+ return new VerticalLayout(grid);
+ }
+
+ @Override
+ public String getMinimizedValueAsHTML() {
+ return "foo";
+ }
+ });
+ pv.setHideOnMouseOut(false);
+ addComponent(pv);
+ }
+
+}
--- /dev/null
+package com.vaadin.tests.layouts.layouttester.GridLayout;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.GridElement;
+import com.vaadin.testbench.elements.PopupViewElement;
+import com.vaadin.tests.tb3.SingleBrowserTest;
+
+public class GridInPopupViewTest extends SingleBrowserTest {
+
+ @Test
+ public void popupViewClosedProperly() {
+ openTestURL();
+ PopupViewElement pv = $(PopupViewElement.class).first();
+ pv.click();
+ GridElement grid = $(GridElement.class).first();
+ grid.getCell(5, 0).click();
+ findElement(By.className("v-ui")).click();
+
+ Assert.assertTrue($(GridElement.class).all().isEmpty());
+ Assert.assertEquals("1. Selection: Alice", getLogRow(0));
+ }
+}