From f4a538019bc6c5abeeb453d9f116088d03d7c32f Mon Sep 17 00:00:00 2001 From: Henrik Paul Date: Wed, 18 Jun 2014 16:04:46 +0300 Subject: Change row data type from String[] to String (#13334) Instead of having the data type as one-string-per-column, we now have the entire row encoded as JSON Change-Id: I709b2daa88c516d98203ef463b57257a6647bacd --- .../com/vaadin/shared/data/DataProviderRpc.java | 22 +++++++++++++++++----- .../src/com/vaadin/shared/ui/grid/GridState.java | 7 +++++++ 2 files changed, 24 insertions(+), 5 deletions(-) (limited to 'shared') diff --git a/shared/src/com/vaadin/shared/data/DataProviderRpc.java b/shared/src/com/vaadin/shared/data/DataProviderRpc.java index a2f85159ba..a92ffe0421 100644 --- a/shared/src/com/vaadin/shared/data/DataProviderRpc.java +++ b/shared/src/com/vaadin/shared/data/DataProviderRpc.java @@ -16,8 +16,6 @@ package com.vaadin.shared.data; -import java.util.List; - import com.vaadin.shared.communication.ClientRpc; /** @@ -31,14 +29,28 @@ public interface DataProviderRpc extends ClientRpc { /** * Sends updated row data to a client. *

- * TODO rowData should be List + * rowDataJson represents a JSON array of JSON objects in the following + * format: + * + *

+     * [{
+     *   "d": [COL_1_JSON, COL_2_json, ...]
+     * },
+     * ...
+     * ]
+     * 
+ * + * where COL_INDEX is the index of the column (as a string), and COL_n_JSON + * is valid JSON of the column's data. * * @param firstRowIndex * the index of the first updated row - * @param rowData + * @param rowDataJson * the updated row data + * @see com.vaadin.shared.ui.grid.GridState#JSONKEY_DATA + * @see com.vaadin.ui.components.grid.Renderer#encode(Object) */ - public void setRowData(int firstRowIndex, List rowData); + public void setRowData(int firstRowIndex, String rowDataJson); /** * Informs the client to remove row data. diff --git a/shared/src/com/vaadin/shared/ui/grid/GridState.java b/shared/src/com/vaadin/shared/ui/grid/GridState.java index acb2a48e3c..eceaedd1fc 100644 --- a/shared/src/com/vaadin/shared/ui/grid/GridState.java +++ b/shared/src/com/vaadin/shared/ui/grid/GridState.java @@ -37,6 +37,13 @@ public class GridState extends AbstractComponentState { */ public static final double DEFAULT_HEIGHT_BY_ROWS = 10.0d; + /** + * The key in which a row's data can be found + * {@link com.vaadin.shared.data.DataProviderRpc#setRowData(int, List) + * DataProviderRpc.setRowData(int, List)} + */ + public static final String JSONKEY_DATA = "d"; + { // FIXME Grid currently does not support undefined size width = "400px"; -- cgit v1.2.3