summaryrefslogtreecommitdiffstats
path: root/shared
diff options
context:
space:
mode:
authorAleksi Hietanen <aleksi@vaadin.com>2017-03-16 08:53:38 +0200
committerPekka Hyvönen <pekka@vaadin.com>2017-03-16 08:53:38 +0200
commit71679dfd1626737081b86127e6c547e37c77923f (patch)
treef0813ec2bde85fbd7f82d80b2b8f7eebaf9d6725 /shared
parente5488dff791afe585bf7ab42e268c3e1f342c142 (diff)
downloadvaadin-framework-71679dfd1626737081b86127e6c547e37c77923f.tar.gz
vaadin-framework-71679dfd1626737081b86127e6c547e37c77923f.zip
Hierarchical data (#8842)
* Initial HierarchicalDataProvider for TreeGrid * Initial in-memory hierarchical data implementation * TreeGrid declarative support Fixes #8611, Fixes #8620
Diffstat (limited to 'shared')
-rw-r--r--shared/src/main/java/com/vaadin/shared/data/DataCommunicatorClientRpc.java21
-rw-r--r--shared/src/main/java/com/vaadin/shared/extension/datacommunicator/HierarchicalDataCommunicatorState.java25
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/treegrid/NodeCollapseRpc.java14
3 files changed, 57 insertions, 3 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
index 501b803cd2..d268c887c4 100644
--- a/shared/src/main/java/com/vaadin/shared/data/DataCommunicatorClientRpc.java
+++ b/shared/src/main/java/com/vaadin/shared/data/DataCommunicatorClientRpc.java
@@ -56,5 +56,24 @@ public interface DataCommunicatorClientRpc extends ClientRpc {
*/
void updateData(JsonArray data);
- // TODO: Notify add / remove
+ /**
+ * Informs that new data has been inserted from the server.
+ *
+ * @param firstRowIndex
+ * the destination index of the new row data
+ * @param count
+ * the number of rows inserted
+ */
+ void insertRows(int firstRowIndex, int count);
+
+ /**
+ * Informs that the server has removed data.
+ *
+ * @param firstRowIndex
+ * the index of the first removed row
+ * @param count
+ * the number of removed rows, starting from
+ * <code>firstRowIndex</code>
+ */
+ void removeRows(int firstRowIndex, int count);
}
diff --git a/shared/src/main/java/com/vaadin/shared/extension/datacommunicator/HierarchicalDataCommunicatorState.java b/shared/src/main/java/com/vaadin/shared/extension/datacommunicator/HierarchicalDataCommunicatorState.java
new file mode 100644
index 0000000000..e56dbfe8a2
--- /dev/null
+++ b/shared/src/main/java/com/vaadin/shared/extension/datacommunicator/HierarchicalDataCommunicatorState.java
@@ -0,0 +1,25 @@
+/*
+ * 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.extension.datacommunicator;
+
+/**
+ * Shared state for HierarchicalDataCommunicator.
+ *
+ * @since
+ */
+public class HierarchicalDataCommunicatorState extends DataCommunicatorState {
+
+}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/treegrid/NodeCollapseRpc.java b/shared/src/main/java/com/vaadin/shared/ui/treegrid/NodeCollapseRpc.java
index 719e5ba183..1b16203648 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/treegrid/NodeCollapseRpc.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/treegrid/NodeCollapseRpc.java
@@ -20,12 +20,22 @@ import com.vaadin.shared.communication.ServerRpc;
/**
* RPC to handle client originated collapse and expand actions on hierarchical
* rows in TreeGrid.
- *
+ *
* @author Vaadin Ltd
* @since 8.1
*/
@FunctionalInterface
public interface NodeCollapseRpc extends ServerRpc {
- void toggleCollapse(String rowKey);
+ /**
+ * Sets the collapse state of a hierarchical row in TreeGrid.
+ *
+ * @param rowKey
+ * the row's key
+ * @param rowIndex
+ * index where the row is in grid (all rows)
+ * @param collapse
+ * {@code true} to collapse, {@code false} to expand
+ */
+ void setNodeCollapsed(String rowKey, int rowIndex, boolean collapse);
}