From 34f729bbbd026ae3f6feabc038b0ef0a212183dd Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Wed, 7 Sep 2016 11:24:44 +0300 Subject: [PATCH] Make sure DataCommunicator always has a DataSource Change-Id: I8da042e68da1d28bff87965adeee75aa60b6021d --- .../main/java/com/vaadin/server/data/DataCommunicator.java | 2 +- server/src/main/java/com/vaadin/ui/Grid.java | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/server/src/main/java/com/vaadin/server/data/DataCommunicator.java b/server/src/main/java/com/vaadin/server/data/DataCommunicator.java index 5aceb9b305..396add585e 100644 --- a/server/src/main/java/com/vaadin/server/data/DataCommunicator.java +++ b/server/src/main/java/com/vaadin/server/data/DataCommunicator.java @@ -176,7 +176,7 @@ public class DataCommunicator extends AbstractExtension { private Collection> generators = new LinkedHashSet<>(); private ActiveDataHandler handler = new ActiveDataHandler(); - private DataSource dataSource; + private DataSource dataSource = DataSource.create(); private DataKeyMapper keyMapper; private boolean reset = false; diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java index 22b5ef8072..1214f34d49 100644 --- a/server/src/main/java/com/vaadin/ui/Grid.java +++ b/server/src/main/java/com/vaadin/ui/Grid.java @@ -35,7 +35,6 @@ import com.vaadin.data.selection.SingleSelection; import com.vaadin.server.AbstractExtension; import com.vaadin.server.KeyMapper; import com.vaadin.server.data.DataGenerator; -import com.vaadin.server.data.DataSource; import com.vaadin.server.data.SortOrder; import com.vaadin.shared.MouseEventDetails; import com.vaadin.shared.data.DataCommunicatorConstants; @@ -586,7 +585,6 @@ public class Grid extends AbstractListing> */ public Grid() { setSelectionModel(new SingleSelection<>(this)); - setDataSource(DataSource.create()); registerRpc(new GridServerRpcImpl()); detailsManager = new DetailsManager<>(); addExtension(detailsManager); @@ -608,8 +606,8 @@ public class Grid extends AbstractListing> * * @return the new column */ - public Column addColumn(String caption, Function valueProvider, - Renderer renderer) { + public Column addColumn(String caption, + Function valueProvider, Renderer renderer) { Column c = new Column<>(caption, valueProvider, renderer); c.extend(this); -- 2.39.5