diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-08-18 10:54:46 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-08-18 11:59:25 +0000 |
commit | 52dc5e4f1c1e11d2181385eb97b78641b8d5b32c (patch) | |
tree | 4fa93427724e70fbb91a5d81e18e2c21a437a6a1 /shared | |
parent | 0081286c8d05c3751803181230092bd4b1e769f7 (diff) | |
download | vaadin-framework-52dc5e4f1c1e11d2181385eb97b78641b8d5b32c.tar.gz vaadin-framework-52dc5e4f1c1e11d2181385eb97b78641b8d5b32c.zip |
Add DataCommunicator for data communication of Listings
Change-Id: I1f50823fdef105c3ba0463011574908a0cec7ad9
Diffstat (limited to 'shared')
-rw-r--r-- | shared/src/main/java/com/vaadin/shared/data/DataCommunicatorClientRpc.java | 60 | ||||
-rw-r--r-- | shared/src/main/java/com/vaadin/shared/data/DataCommunicatorConstants.java | 31 |
2 files changed, 91 insertions, 0 deletions
diff --git a/shared/src/main/java/com/vaadin/shared/data/DataCommunicatorClientRpc.java b/shared/src/main/java/com/vaadin/shared/data/DataCommunicatorClientRpc.java new file mode 100644 index 0000000000..35aa64d195 --- /dev/null +++ b/shared/src/main/java/com/vaadin/shared/data/DataCommunicatorClientRpc.java @@ -0,0 +1,60 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.data; + +import com.vaadin.shared.communication.ClientRpc; + +import elemental.json.JsonArray; + +/** + * RPC interface used by DataProvider to send data to the client-side. + * + * @since + */ +public interface DataCommunicatorClientRpc extends ClientRpc { + + /** + * Informs the client-side DataSource that all data has been invalidated. + * + * @param size + * size of the data source + */ + void reset(int size); + + /** + * Sets the data of the client-side DataSource to match the given data + * starting from given index. + * <p> + * <strong>Note:</strong> This method will override any existing data in the + * range starting from first index with the length of the data array. + * + * @param firstIndex + * first index to update + * @param data + * array of new data + */ + void setData(int firstIndex, JsonArray data); + + /** + * Updates an array of objects based on their identifying key. + * + * @param data + * array of updated data + */ + void updateData(JsonArray data); + + // TODO: Notify add / remove +}
\ No newline at end of file diff --git a/shared/src/main/java/com/vaadin/shared/data/DataCommunicatorConstants.java b/shared/src/main/java/com/vaadin/shared/data/DataCommunicatorConstants.java new file mode 100644 index 0000000000..785d04fc97 --- /dev/null +++ b/shared/src/main/java/com/vaadin/shared/data/DataCommunicatorConstants.java @@ -0,0 +1,31 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.shared.data; + +import java.io.Serializable; + +/** + * Set of contants used by DataCommunicator. These are commonly used JsonObject + * keys which are considered to be reserved for internal use. + * + * @since + */ +public final class DataCommunicatorConstants implements Serializable { + public static final String KEY = "k"; + public static final String SELECTED = "s"; + public static final String NAME = "n"; + public static final String DATA = "d"; +}
\ No newline at end of file |