From 8a66300779e9dcc949d68ab1a66d445921e0d40b Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Tue, 29 Sep 2015 19:13:36 +0300 Subject: Refactor DetailComponentManager to be a static nested class of Grid While refactoring any special cases are removed. This needs Grid extensions to have a way for adding and removing components from Grid. Removing any and all parts of RpcDataProvider work towards having it separate from Grid and maybe usable for other components as well. Change-Id: Ia4e25d5f0acaf2085478346b0ff6e23c8334e1b9 --- .../com/vaadin/tests/components/grid/GridDetailsDetach.java | 2 ++ .../components/grid/basicfeatures/GridBasicFeatures.java | 2 ++ .../grid/basicfeatures/server/GridDetailsServerTest.java | 11 +---------- 3 files changed, 5 insertions(+), 10 deletions(-) (limited to 'uitest') diff --git a/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetach.java b/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetach.java index 3d7f6da587..f18c0f9bdb 100644 --- a/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetach.java +++ b/uitest/src/com/vaadin/tests/components/grid/GridDetailsDetach.java @@ -26,6 +26,7 @@ import com.vaadin.ui.Component; import com.vaadin.ui.Grid; import com.vaadin.ui.Grid.DetailsGenerator; import com.vaadin.ui.Grid.RowReference; +import com.vaadin.ui.Grid.SelectionMode; import com.vaadin.ui.Label; import com.vaadin.ui.VerticalLayout; @@ -79,6 +80,7 @@ public class GridDetailsDetach extends AbstractTestUI { final Grid grid = new Grid(container); grid.setColumnOrder("name", "amount", "count"); grid.setSizeFull(); + grid.setSelectionMode(SelectionMode.NONE); grid.setDetailsGenerator(new DetailsGenerator() { @Override diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java index a3160ba2c6..2e4869cab0 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/GridBasicFeatures.java @@ -231,10 +231,12 @@ public class GridBasicFeatures extends AbstractComponentTest { private Map detailsMap = new HashMap(); private final DetailsGenerator persistingDetailsGenerator = new DetailsGenerator() { + @Override public Component getDetails(RowReference rowReference) { Object itemId = rowReference.getItemId(); if (!detailsMap.containsKey(itemId)) { + Panel panel = new Panel(); panel.setContent(new Label("One")); detailsMap.put(itemId, panel); diff --git a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridDetailsServerTest.java b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridDetailsServerTest.java index f13ea9c073..dda9c03f94 100644 --- a/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridDetailsServerTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/basicfeatures/server/GridDetailsServerTest.java @@ -59,7 +59,7 @@ public class GridDetailsServerTest extends GridBasicFeaturesTest { } @Test(expected = NoSuchElementException.class) - public void openVisibleDetails() { + public void openWithNoGenerator() { try { getGridElement().getDetails(0); fail("Expected NoSuchElementException"); @@ -70,14 +70,6 @@ public class GridDetailsServerTest extends GridBasicFeaturesTest { getGridElement().getDetails(0); } - @Test(expected = NoSuchElementException.class) - public void closeVisibleDetails() { - selectMenuPath(OPEN_FIRST_ITEM_DETAILS); - selectMenuPath(OPEN_FIRST_ITEM_DETAILS); - - getGridElement().getDetails(0); - } - @Test public void openVisiblePopulatedDetails() { selectMenuPath(DETAILS_GENERATOR_WATCHING); @@ -220,7 +212,6 @@ public class GridDetailsServerTest extends GridBasicFeaturesTest { selectMenuPath(OPEN_FIRST_ITEM_DETAILS); assertEquals("Two", getGridElement().getDetails(0).getText()); - } @Test -- cgit v1.2.3