]> source.dussan.org Git - vaadin-framework.git/commitdiff
Make sure DataCommunicator always has a DataSource
authorTeemu Suo-Anttila <teemusa@vaadin.com>
Wed, 7 Sep 2016 08:24:44 +0000 (11:24 +0300)
committerVaadin Code Review <review@vaadin.com>
Wed, 7 Sep 2016 09:33:34 +0000 (09:33 +0000)
Change-Id: I8da042e68da1d28bff87965adeee75aa60b6021d

server/src/main/java/com/vaadin/server/data/DataCommunicator.java
server/src/main/java/com/vaadin/ui/Grid.java

index 5aceb9b305145828876319475f08b492cd6f2c85..396add585e7b6b1ee49ab718efaf1966fdcd8b65 100644 (file)
@@ -176,7 +176,7 @@ public class DataCommunicator<T> extends AbstractExtension {
     private Collection<DataGenerator<T>> generators = new LinkedHashSet<>();
     private ActiveDataHandler handler = new ActiveDataHandler();
 
-    private DataSource<T> dataSource;
+    private DataSource<T> dataSource = DataSource.create();
     private DataKeyMapper<T> keyMapper;
 
     private boolean reset = false;
index 22b5ef8072f3571365440178b4e04487e7ada89a..1214f34d499d2d5c8dcefdf189f0f90c4a17af2d 100644 (file)
@@ -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<T> extends AbstractListing<T, SelectionModel<T>>
      */
     public Grid() {
         setSelectionModel(new SingleSelection<>(this));
-        setDataSource(DataSource.create());
         registerRpc(new GridServerRpcImpl());
         detailsManager = new DetailsManager<>();
         addExtension(detailsManager);
@@ -608,8 +606,8 @@ public class Grid<T> extends AbstractListing<T, SelectionModel<T>>
      *
      * @return the new column
      */
-    public <V> Column<T, V> addColumn(String caption, Function<T, ? extends V> valueProvider,
-            Renderer<V> renderer) {
+    public <V> Column<T, V> addColumn(String caption,
+            Function<T, ? extends V> valueProvider, Renderer<V> renderer) {
         Column<T, V> c = new Column<>(caption, valueProvider, renderer);
 
         c.extend(this);