]> source.dussan.org Git - vaadin-framework.git/commitdiff
Remove unnecessary size parameter from data reset in simple mode
authorTeemu Suo-Anttila <teemusa@vaadin.com>
Fri, 5 Feb 2016 15:43:24 +0000 (17:43 +0200)
committerTeemu Suo-Anttila <teemusa@vaadin.com>
Fri, 5 Feb 2016 16:38:05 +0000 (18:38 +0200)
Change-Id: I861cf9ed99637cd74ecb2f65705a2c7717afbd08

client/src/com/vaadin/client/connectors/data/typed/DataSourceConnector.java
server/src/com/vaadin/server/communication/data/typed/CollectionDataSource.java
server/src/com/vaadin/server/communication/data/typed/DataSource.java
server/src/com/vaadin/server/communication/data/typed/SimpleDataProvider.java
shared/src/com/vaadin/shared/data/DataProviderClientRpc.java

index b63bf6e281bfed1e49e6aab51252a8cfadb33de2..49adfdb89b66fa3042d2903852ab34b0343effa5 100644 (file)
@@ -56,7 +56,7 @@ public class DataSourceConnector extends AbstractExtensionConnector {
         registerRpc(DataProviderClientRpc.class, new DataProviderClientRpc() {
 
             @Override
-            public void resetSize(long size) {
+            public void reset() {
                 ds.asList().clear();
                 // Inform the server-side that all keys are now dropped.
                 Set<String> keySet = new HashSet<String>(keyToJson.keySet());
index 3a29befccfaa06f9873c0c3440076775b7939dbb..4a8d14f29e9b9ecddc7120b69a7e2e9c056b9e0e 100644 (file)
@@ -61,9 +61,4 @@ public class CollectionDataSource<T> extends AbstractDataSource<T> {
     public Iterator<T> iterator() {
         return backend.iterator();
     }
-
-    @Override
-    public long size() {
-        return backend.size();
-    }
 }
index d39286a02892848a9cb78dfd27e52f6564bab230..69eccb8686b78488824674161159be6a814de6ff 100644 (file)
@@ -27,13 +27,6 @@ import java.io.Serializable;
  */
 public interface DataSource<T> extends Iterable<T>, Serializable {
 
-    /**
-     * Gets the data object count from the back end.
-     * 
-     * @return back end size
-     */
-    long size();
-
     /**
      * Saves a data object to the back end. If it's a new object, it should be
      * created in the back end. Existing objects with changes should be stored.
index a6a0e193db9812cca48d226c6847079cd92db848..c82ed119e509b34ee9d40c499ddc840cdddfbf67 100644 (file)
@@ -86,9 +86,11 @@ public class SimpleDataProvider<T> extends DataProvider<T> {
     public void beforeClientResponse(boolean initial) {
         super.beforeClientResponse(initial);
 
+        if (reset) {
+            getRpcProxy(DataProviderClientRpc.class).reset();
+        }
+
         if (initial || reset) {
-            getRpcProxy(DataProviderClientRpc.class).resetSize(
-                    dataSource.size());
             pushData(0, dataSource);
         } else if (!updatedData.isEmpty()) {
             JsonArray dataArray = Json.createArray();
index 315df89c9b868cff0f6dc749c5ffa66c3f5b6fde..0c0fd77308fd4248779c110bd769bfcdae3fd335 100644 (file)
@@ -28,12 +28,9 @@ import elemental.json.JsonObject;
 public interface DataProviderClientRpc extends ClientRpc {
 
     /**
-     * Sets the size of the client-side DataSource.
-     * 
-     * @param size
-     *            the new data set size
+     * Informs the client-side DataSource that all data has been invalidated.
      */
-    void resetSize(long size);
+    void reset();
 
     /**
      * Sets the data of the client-side DataSource to match the given data