summaryrefslogtreecommitdiffstats
path: root/shared
diff options
context:
space:
mode:
authorHenrik Paul <henrik@vaadin.com>2014-06-10 21:50:51 +0300
committerHenrik Paul <henrik@vaadin.com>2014-06-27 12:39:42 +0300
commitc4a1ee8a4fbc3fafaabea695d8aaf40aecbeba48 (patch)
tree9bbb9bef83f0e70309067e6d69adde7a7ee5a32a /shared
parent51718c646883f6a9ca26a315d04de6d49119d492 (diff)
downloadvaadin-framework-c4a1ee8a4fbc3fafaabea695d8aaf40aecbeba48.tar.gz
vaadin-framework-c4a1ee8a4fbc3fafaabea695d8aaf40aecbeba48.zip
Send selection between server and client (#13334)
Change-Id: I75174af63092fca72d9aa63ccf3c06a77f42c4f6
Diffstat (limited to 'shared')
-rw-r--r--shared/src/com/vaadin/shared/data/DataProviderRpc.java3
-rw-r--r--shared/src/com/vaadin/shared/ui/grid/GridServerRpc.java30
-rw-r--r--shared/src/com/vaadin/shared/ui/grid/GridState.java14
3 files changed, 44 insertions, 3 deletions
diff --git a/shared/src/com/vaadin/shared/data/DataProviderRpc.java b/shared/src/com/vaadin/shared/data/DataProviderRpc.java
index a92ffe0421..43469914e5 100644
--- a/shared/src/com/vaadin/shared/data/DataProviderRpc.java
+++ b/shared/src/com/vaadin/shared/data/DataProviderRpc.java
@@ -34,7 +34,8 @@ public interface DataProviderRpc extends ClientRpc {
*
* <pre>
* [{
- * "d": [COL_1_JSON, COL_2_json, ...]
+ * "d": [COL_1_JSON, COL_2_json, ...],
+ * "k": "1"
* },
* ...
* ]
diff --git a/shared/src/com/vaadin/shared/ui/grid/GridServerRpc.java b/shared/src/com/vaadin/shared/ui/grid/GridServerRpc.java
new file mode 100644
index 0000000000..b763174e53
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/grid/GridServerRpc.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2000-2014 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.ui.grid;
+
+import java.util.List;
+
+import com.vaadin.shared.communication.ServerRpc;
+
+/**
+ * Client-to-server RPC interface for the Grid component
+ *
+ * @since 7.4
+ * @author Vaadin Ltd
+ */
+public interface GridServerRpc extends ServerRpc {
+ void selectionChange(List<String> newSelection);
+}
diff --git a/shared/src/com/vaadin/shared/ui/grid/GridState.java b/shared/src/com/vaadin/shared/ui/grid/GridState.java
index eceaedd1fc..0b23e2c11d 100644
--- a/shared/src/com/vaadin/shared/ui/grid/GridState.java
+++ b/shared/src/com/vaadin/shared/ui/grid/GridState.java
@@ -39,11 +39,18 @@ public class GridState extends AbstractComponentState {
/**
* The key in which a row's data can be found
- * {@link com.vaadin.shared.data.DataProviderRpc#setRowData(int, List)
- * DataProviderRpc.setRowData(int, List)}
+ *
+ * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, String)
*/
public static final String JSONKEY_DATA = "d";
+ /**
+ * The key in which a row's own key can be found
+ *
+ * @see com.vaadin.shared.data.DataProviderRpc#setRowData(int, String)
+ */
+ public static final String JSONKEY_ROWKEY = "k";
+
{
// FIXME Grid currently does not support undefined size
width = "400px";
@@ -97,4 +104,7 @@ public class GridState extends AbstractComponentState {
@DelegateToWidget
public boolean selectionCheckboxes;
+ // instantiated just to avoid NPEs
+ public List<String> selectedKeys = new ArrayList<String>();
+
}