aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/data
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2015-07-06 10:01:17 +0300
committerTeemu Suo-Anttila <teemusa@vaadin.com>2015-09-01 11:58:57 +0000
commit53a4b2c77a6af86c157884c62e6193911242a7f9 (patch)
tree033b8b64744abb3a8b63df52a748261b656247cd /server/src/com/vaadin/data
parent9899aa2009d32e375ccd21e2edf50cb6d2d557bb (diff)
downloadvaadin-framework-53a4b2c77a6af86c157884c62e6193911242a7f9.tar.gz
vaadin-framework-53a4b2c77a6af86c157884c62e6193911242a7f9.zip
Refactor Grid SelectionModels as extensions (#18624)
This patch removes all selection related variables and API from several core parts of Grid. Change-Id: Idb7aa48fda69ded1ef58a69c1f7dbc78b7f52a54
Diffstat (limited to 'server/src/com/vaadin/data')
-rw-r--r--server/src/com/vaadin/data/RpcDataProviderExtension.java25
1 files changed, 15 insertions, 10 deletions
diff --git a/server/src/com/vaadin/data/RpcDataProviderExtension.java b/server/src/com/vaadin/data/RpcDataProviderExtension.java
index f5d712f6b2..c8f3604fd9 100644
--- a/server/src/com/vaadin/data/RpcDataProviderExtension.java
+++ b/server/src/com/vaadin/data/RpcDataProviderExtension.java
@@ -744,15 +744,11 @@ public class RpcDataProviderExtension extends AbstractExtension {
// Send current rows again if needed.
if (refreshCache) {
- for (Object itemId : activeItemHandler.getActiveItemIds()) {
- internalUpdateRowData(itemId);
- }
+ updatedItemIds.addAll(activeItemHandler.getActiveItemIds());
}
}
- for (Object itemId : updatedItemIds) {
- internalUpdateRowData(itemId);
- }
+ internalUpdateRows(updatedItemIds);
// Clear all changes.
rowChanges.clear();
@@ -913,11 +909,20 @@ public class RpcDataProviderExtension extends AbstractExtension {
updatedItemIds.add(itemId);
}
- private void internalUpdateRowData(Object itemId) {
- if (activeItemHandler.getActiveItemIds().contains(itemId)) {
- JsonObject row = getRowData(getGrid().getColumns(), itemId);
- rpc.updateRowData(row);
+ private void internalUpdateRows(Set<Object> itemIds) {
+ if (itemIds.isEmpty()) {
+ return;
+ }
+
+ JsonArray rowData = Json.createArray();
+ int i = 0;
+ for (Object itemId : itemIds) {
+ if (activeItemHandler.getActiveItemIds().contains(itemId)) {
+ JsonObject row = getRowData(getGrid().getColumns(), itemId);
+ rowData.set(i++, row);
+ }
}
+ rpc.updateRowData(rowData);
}
/**