From 6ed5f2a0df068dba713d8e24dc9f78e2a0829a73 Mon Sep 17 00:00:00 2001 From: Adam Wagner Date: Wed, 28 Jun 2017 10:29:57 +0200 Subject: Create drag source and drop target extensions for tree grid (#9463) Resolves #9372 --- .../ui/treegrid/TreeGridDragSourceState.java | 28 ++++++++++ .../shared/ui/treegrid/TreeGridDropTargetRpc.java | 59 ++++++++++++++++++++++ .../ui/treegrid/TreeGridDropTargetState.java | 28 ++++++++++ 3 files changed, 115 insertions(+) create mode 100644 shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridDragSourceState.java create mode 100644 shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridDropTargetRpc.java create mode 100644 shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridDropTargetState.java (limited to 'shared') diff --git a/shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridDragSourceState.java b/shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridDragSourceState.java new file mode 100644 index 0000000000..f3ea4cf900 --- /dev/null +++ b/shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridDragSourceState.java @@ -0,0 +1,28 @@ +/* + * 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.ui.treegrid; + +import com.vaadin.shared.ui.grid.GridDragSourceState; + +/** + * State class containing parameters for TreeGridDragSource. + * + * @author Vaadin Ltd + * @since 8.1 + */ +public class TreeGridDragSourceState extends GridDragSourceState { + +} diff --git a/shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridDropTargetRpc.java b/shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridDropTargetRpc.java new file mode 100644 index 0000000000..0ce81c80dd --- /dev/null +++ b/shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridDropTargetRpc.java @@ -0,0 +1,59 @@ +/* + * 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.ui.treegrid; + +import java.util.List; +import java.util.Map; + +import com.vaadin.shared.MouseEventDetails; +import com.vaadin.shared.communication.ServerRpc; +import com.vaadin.shared.ui.grid.DropLocation; + +/** + * RPC for firing server side drop event when client side drop event happens on + * drop target TreeGrid. + * + * @author Vaadin Ltd. + * @since 8.1 + */ +public interface TreeGridDropTargetRpc extends ServerRpc { + + /** + * Called when drop event happens on client side. + * + * @param types + * list of data types from {@code DataTransfer.types} object + * @param data + * map containing all types and corresponding data from the {@code + * DataTransfer} object + * @param dropEffect + * the desired drop effect + * @param rowKey + * key of the row on which the drop event occurred + * @param depth + * depth of the row in the hierarchy + * @param collapsed + * whether the target row is collapsed + * @param dropLocation + * location of the drop within the row + * @param mouseEventDetails + * Mouse event details object containing information about the drop + * event + */ + public void drop(List types, Map data, + String dropEffect, String rowKey, Integer depth, Boolean collapsed, + DropLocation dropLocation, MouseEventDetails mouseEventDetails); +} diff --git a/shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridDropTargetState.java b/shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridDropTargetState.java new file mode 100644 index 0000000000..29fea79c98 --- /dev/null +++ b/shared/src/main/java/com/vaadin/shared/ui/treegrid/TreeGridDropTargetState.java @@ -0,0 +1,28 @@ +/* + * 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.ui.treegrid; + +import com.vaadin.shared.ui.grid.GridDropTargetState; + +/** + * State class containing parameters for TreeGridDropTarget. + * + * @author Vaadin Ltd + * @since 8.1 + */ +public class TreeGridDropTargetState extends GridDropTargetState { + +} -- cgit v1.2.3