diff options
author | JenoDK <jenodekeyzer@gmail.com> | 2017-09-26 10:20:33 +0200 |
---|---|---|
committer | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-09-26 11:20:33 +0300 |
commit | 8dbf160f08ec14c9890559e817dcf74a70f011d8 (patch) | |
tree | 240bdd76309fe3f09000433d2d12ddcb93fe2cec | |
parent | 5bd92650415b4df16b7f3708e82a958adda20ad8 (diff) | |
download | vaadin-framework-8dbf160f08ec14c9890559e817dcf74a70f011d8.tar.gz vaadin-framework-8dbf160f08ec14c9890559e817dcf74a70f011d8.zip |
Fix DataCommunicator parameter not used in Grid constructor (#10075)
Fixes #9944
3 files changed, 28 insertions, 1 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java index e20999f0da..d5d5e666bb 100644 --- a/server/src/main/java/com/vaadin/ui/Grid.java +++ b/server/src/main/java/com/vaadin/ui/Grid.java @@ -2277,7 +2277,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, * @since 8.0.7 */ protected Grid(Class<T> beanType, DataCommunicator<T> dataCommunicator) { - this(BeanPropertySet.get(beanType)); + this(BeanPropertySet.get(beanType), dataCommunicator); this.beanType = beanType; } diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java b/server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java index cf43ed8339..5f8327bb8d 100644 --- a/server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java +++ b/server/src/test/java/com/vaadin/tests/server/component/grid/GridTest.java @@ -23,6 +23,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; import java.util.stream.Stream; +import com.vaadin.data.provider.DataCommunicator; import org.easymock.Capture; import org.junit.Assert; import org.junit.Before; @@ -71,6 +72,15 @@ public class GridTest { } @Test + public void testCreateGridWithDataCommunicator() { + DataCommunicator specificDataCommunicator = new DataCommunicator<>(); + + TestGrid<String> grid = new TestGrid(String.class, specificDataCommunicator); + + assertEquals(specificDataCommunicator, grid.getDataCommunicator()); + } + + @Test public void testGridHeightModeChange() { assertEquals("Initial height mode was not CSS", HeightMode.CSS, grid.getHeightMode()); diff --git a/server/src/test/java/com/vaadin/tests/server/component/grid/TestGrid.java b/server/src/test/java/com/vaadin/tests/server/component/grid/TestGrid.java new file mode 100644 index 0000000000..b6a6ab548f --- /dev/null +++ b/server/src/test/java/com/vaadin/tests/server/component/grid/TestGrid.java @@ -0,0 +1,17 @@ +package com.vaadin.tests.server.component.grid; + +import com.vaadin.data.provider.DataCommunicator; +import com.vaadin.ui.Grid; + +/** + * {@link Grid} class for testing purposes + * @param <T> + * the grid bean type + */ +public class TestGrid<T> extends Grid<T> { + + public TestGrid(Class<T> beanType, DataCommunicator<T> dataCommunicator) { + super(beanType, dataCommunicator); + } + +} |