From 60db37dfaaa7d04bb393a27b888110dc73299404 Mon Sep 17 00:00:00 2001 From: Aleksi Hietanen Date: Tue, 2 May 2017 10:58:29 +0300 Subject: Improve expand and collapse of items in TreeGrid (#9159) Fixes a race condition when expanding multiple items. Only one expand or collapse request should be sent from the client before waiting for a response, otherwise the indexing in subsequent requests will be incorrect. Adds API to collapse and expand multiple items from the server, reducing the amount of round trips with multiple item expands and collapses. HierarchyMapper now correctly keeps expanded nodes expanded if their parent is collapsed. --- .../shared/ui/treegrid/TreeGridClientRpc.java | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'shared/src') diff --git a/shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridClientRpc.java b/shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridClientRpc.java index 16d2179741..d6d7d95def 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridClientRpc.java +++ b/shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridClientRpc.java @@ -15,6 +15,8 @@ */ package com.vaadin.shared.ui.treegrid; +import java.util.List; + import com.vaadin.shared.communication.ClientRpc; /** @@ -26,22 +28,22 @@ import com.vaadin.shared.communication.ClientRpc; public interface TreeGridClientRpc extends ClientRpc { /** - * Inform the client that an item with the given key has been expanded by - * the server. + * Inform the client that a list of items with the given keys have been + * expanded by the server. * - * @param key - * the communication key of the expanded item + * @param keys + * the communication keys of the expanded items */ - public void setExpanded(String key); + public void setExpanded(List keys); /** - * Inform the client that an item with the given key has been collapsed by - * the server. + * Inform the client that a list of items with the given keys have been + * collapsed by the server. * - * @param key - * the communication key of the collapsed item + * @param keys + * the communication keys of the collapsed items */ - public void setCollapsed(String key); + public void setCollapsed(List keys); /** * Clear all pending expands from the client. -- cgit v1.2.3