From 663fe67e988b90c1b802f421250b6c923e5f7787 Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Fri, 5 Feb 2016 17:43:24 +0200 Subject: [PATCH] Remove unnecessary size parameter from data reset in simple mode Change-Id: I861cf9ed99637cd74ecb2f65705a2c7717afbd08 --- .../client/connectors/data/typed/DataSourceConnector.java | 2 +- .../communication/data/typed/CollectionDataSource.java | 5 ----- .../vaadin/server/communication/data/typed/DataSource.java | 7 ------- .../communication/data/typed/SimpleDataProvider.java | 6 ++++-- .../src/com/vaadin/shared/data/DataProviderClientRpc.java | 7 ++----- 5 files changed, 7 insertions(+), 20 deletions(-) diff --git a/client/src/com/vaadin/client/connectors/data/typed/DataSourceConnector.java b/client/src/com/vaadin/client/connectors/data/typed/DataSourceConnector.java index b63bf6e281..49adfdb89b 100644 --- a/client/src/com/vaadin/client/connectors/data/typed/DataSourceConnector.java +++ b/client/src/com/vaadin/client/connectors/data/typed/DataSourceConnector.java @@ -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 keySet = new HashSet(keyToJson.keySet()); diff --git a/server/src/com/vaadin/server/communication/data/typed/CollectionDataSource.java b/server/src/com/vaadin/server/communication/data/typed/CollectionDataSource.java index 3a29befccf..4a8d14f29e 100644 --- a/server/src/com/vaadin/server/communication/data/typed/CollectionDataSource.java +++ b/server/src/com/vaadin/server/communication/data/typed/CollectionDataSource.java @@ -61,9 +61,4 @@ public class CollectionDataSource extends AbstractDataSource { public Iterator iterator() { return backend.iterator(); } - - @Override - public long size() { - return backend.size(); - } } diff --git a/server/src/com/vaadin/server/communication/data/typed/DataSource.java b/server/src/com/vaadin/server/communication/data/typed/DataSource.java index d39286a028..69eccb8686 100644 --- a/server/src/com/vaadin/server/communication/data/typed/DataSource.java +++ b/server/src/com/vaadin/server/communication/data/typed/DataSource.java @@ -27,13 +27,6 @@ import java.io.Serializable; */ public interface DataSource extends Iterable, 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. diff --git a/server/src/com/vaadin/server/communication/data/typed/SimpleDataProvider.java b/server/src/com/vaadin/server/communication/data/typed/SimpleDataProvider.java index a6a0e193db..c82ed119e5 100644 --- a/server/src/com/vaadin/server/communication/data/typed/SimpleDataProvider.java +++ b/server/src/com/vaadin/server/communication/data/typed/SimpleDataProvider.java @@ -86,9 +86,11 @@ public class SimpleDataProvider extends DataProvider { 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(); diff --git a/shared/src/com/vaadin/shared/data/DataProviderClientRpc.java b/shared/src/com/vaadin/shared/data/DataProviderClientRpc.java index 315df89c9b..0c0fd77308 100644 --- a/shared/src/com/vaadin/shared/data/DataProviderClientRpc.java +++ b/shared/src/com/vaadin/shared/data/DataProviderClientRpc.java @@ -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 -- 2.39.5