aboutsummaryrefslogtreecommitdiffstats
path: root/shared/src
diff options
context:
space:
mode:
authorAdam Wagner <wbadam@users.noreply.github.com>2017-04-07 09:52:06 +0300
committerHenri Sara <henri.sara@gmail.com>2017-04-12 14:58:11 +0300
commita773c8c7b365e4041db87b5d9ddaad0bdc244a91 (patch)
tree422ce4db5bde123c7dc775d70e49e259c17b2dce /shared/src
parent659313e8c35e68d14fe2599b9bbb4dbba35fb4a3 (diff)
downloadvaadin-framework-a773c8c7b365e4041db87b5d9ddaad0bdc244a91.tar.gz
vaadin-framework-a773c8c7b365e4041db87b5d9ddaad0bdc244a91.zip
Make it possible to drop things between Grid rows (#8979)
Fixes #8401
Diffstat (limited to 'shared/src')
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/grid/DropLocation.java40
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/grid/DropMode.java38
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetExtensionRpc.java5
-rw-r--r--shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetExtensionState.java4
4 files changed, 86 insertions, 1 deletions
diff --git a/shared/src/main/java/com/vaadin/shared/ui/grid/DropLocation.java b/shared/src/main/java/com/vaadin/shared/ui/grid/DropLocation.java
new file mode 100644
index 0000000000..1453c05c71
--- /dev/null
+++ b/shared/src/main/java/com/vaadin/shared/ui/grid/DropLocation.java
@@ -0,0 +1,40 @@
+/*
+ * 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.grid;
+
+/**
+ * Defines drop locations within a Grid row.
+ *
+ * @author Vaadin Ltd.
+ * @since
+ */
+public enum DropLocation {
+
+ /**
+ * Drop on top of the row.
+ */
+ ON_TOP,
+
+ /**
+ * Drop above or before the row.
+ */
+ ABOVE,
+
+ /**
+ * Drop below or after the row.
+ */
+ BELOW
+}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/grid/DropMode.java b/shared/src/main/java/com/vaadin/shared/ui/grid/DropMode.java
new file mode 100644
index 0000000000..2db639be7d
--- /dev/null
+++ b/shared/src/main/java/com/vaadin/shared/ui/grid/DropMode.java
@@ -0,0 +1,38 @@
+/*
+ * 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.grid;
+
+/**
+ * Defines the locations within the Grid row where an element can be dropped.
+ *
+ * @author Vaadin Ltd.
+ * @since
+ */
+public enum DropMode {
+
+ /**
+ * The drop event can happen between Grid rows. The drop is above a row
+ * when the cursor is over the top 50% of a row, otherwise below the
+ * row.
+ */
+ BETWEEN,
+
+ /**
+ * The drop event can happen on top of Grid rows. The target of the drop
+ * is the row under the cursor at the time of the drop event.
+ */
+ ON_TOP,
+}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetExtensionRpc.java b/shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetExtensionRpc.java
index ef0dc405b5..212081d486 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetExtensionRpc.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetExtensionRpc.java
@@ -34,6 +34,9 @@ public interface GridDropTargetExtensionRpc extends ServerRpc {
* object.
* @param rowKey
* Key of the row on which the drop event occured.
+ * @param dropLocation
+ * Location of the drop within the row.
*/
- public void drop(String dataTransferText, String rowKey);
+ public void drop(String dataTransferText, String rowKey,
+ DropLocation dropLocation);
}
diff --git a/shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetExtensionState.java b/shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetExtensionState.java
index c911d529d0..50b50a5d24 100644
--- a/shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetExtensionState.java
+++ b/shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetExtensionState.java
@@ -25,4 +25,8 @@ import com.vaadin.shared.ui.dnd.DropTargetState;
*/
public class GridDropTargetExtensionState extends DropTargetState {
+ /**
+ * Stores the drop mode of the drop target Grid.
+ */
+ public DropMode dropMode;
}