diff options
author | Pekka Hyvönen <pekka@vaadin.com> | 2017-11-15 09:56:27 +0200 |
---|---|---|
committer | Pekka Maanpää <pekkamaa@vaadin.com> | 2017-11-15 09:56:27 +0200 |
commit | 1066d9897be1bdd2d52e46654a5fd7b246d54ab5 (patch) | |
tree | eaff7ad3d6660268ebb63f4953ed2b1683a93144 /shared | |
parent | 2b73e6eb08412e9b37b312421bdda2651095529f (diff) | |
download | vaadin-framework-1066d9897be1bdd2d52e46654a5fd7b246d54ab5.tar.gz vaadin-framework-1066d9897be1bdd2d52e46654a5fd7b246d54ab5.zip |
Add new drop mode ON_GRID for GridDropTarget (#10296)
* Add new drop mode ON_GRID for GridDropTarget
Also adds a way to not accept drops on rows when the user has sorted the grid.
This way the bad UX can be avoided for showing the drop indicator for the wrong place when the grid has been sorted.
This has not been made default behavior to GridDropTarget since it would change behavior compared to 8.1.
Instead if is triggerable via API in GridDropTarget.
* Refactor sorted grid drop logic to server side
* Block setDropMode calls
Blocking setDropMode set values if the grid has been sorted and drop on
sorted rows is not allowed. The value is used once the grid is not sorted
anymore or the drops are allowed on sorted rows.
Diffstat (limited to 'shared')
3 files changed, 16 insertions, 3 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 index 3e031e6c98..aa211875e9 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/grid/DropLocation.java +++ b/shared/src/main/java/com/vaadin/shared/ui/grid/DropLocation.java @@ -39,8 +39,9 @@ public enum DropLocation { BELOW, /** - * Dropping into an empty grid, or to the empty area below the grid rows - * when {@link DropMode#ON_TOP} is used. + * Dropping into an empty grid, to a sorted grid, when + * {@link DropMode#ON_GRID} is used, or to the empty area below the grid + * rows when {@link DropMode#ON_TOP} is used. */ EMPTY; } 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 index c458b9d76c..4294a4fa1a 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/grid/DropMode.java +++ b/shared/src/main/java/com/vaadin/shared/ui/grid/DropMode.java @@ -47,5 +47,16 @@ public enum DropMode { * above conditions.</li> * </ul> */ - ON_TOP_OR_BETWEEN + ON_TOP_OR_BETWEEN, + + /** + * The drop event will not happen on any specific row, it will show the drop + * target outline around the whole grid. For this drop target, the drop + * event will not contain any target row information. This is the drop + * target used when the grid is completely empty. It can also be configured + * to be used automatically when the user has sorted the grid. + * + * @since + */ + ON_GRID; } diff --git a/shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetState.java b/shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetState.java index b0c434305f..f1e2ac6f3f 100644 --- a/shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetState.java +++ b/shared/src/main/java/com/vaadin/shared/ui/grid/GridDropTargetState.java @@ -37,4 +37,5 @@ public class GridDropTargetState extends DropTargetState { * @see DropMode#ON_TOP_OR_BETWEEN */ public int dropThreshold = 5; + } |