diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-12-28 14:15:50 +0200 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-12-28 14:15:50 +0200 |
commit | 14efb0c7dba1d20a2dabd01c4fa0ac952c928be4 (patch) | |
tree | f33d5f62d52901561708d586d5226fa1a023f92d /client | |
parent | 81b05dd2c6fa20e6d1906da40ac323729374f64c (diff) | |
download | vaadin-framework-14efb0c7dba1d20a2dabd01c4fa0ac952c928be4.tar.gz vaadin-framework-14efb0c7dba1d20a2dabd01c4fa0ac952c928be4.zip |
Add keyboard shortcut to save grid editor in buffered mode (#16842)
Change-Id: I4f542d166e15a63f12f8033aec4ef7b95578df71
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java b/client/src/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java index 0fea7c37bd..e4a8783f54 100644 --- a/client/src/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java +++ b/client/src/com/vaadin/client/widget/grid/DefaultEditorEventHandler.java @@ -38,7 +38,8 @@ public class DefaultEditorEventHandler<T> implements Editor.EventHandler<T> { public static final int KEYCODE_OPEN = KeyCodes.KEY_ENTER; public static final int KEYCODE_MOVE_VERTICAL = KeyCodes.KEY_ENTER; public static final int KEYCODE_CLOSE = KeyCodes.KEY_ESCAPE; - private static final int KEYCODE_MOVE_HORIZONTAL = KeyCodes.KEY_TAB; + public static final int KEYCODE_MOVE_HORIZONTAL = KeyCodes.KEY_TAB; + public static final int KEYCODE_BUFFERED_SAVE = KeyCodes.KEY_ENTER; private double lastTouchEventTime = 0; private int lastTouchEventX = -1; @@ -222,6 +223,13 @@ public class DefaultEditorEventHandler<T> implements Editor.EventHandler<T> { + (e.getShiftKey() ? -1 : +1)); return true; + } else if (e.getType().equals(BrowserEvents.KEYDOWN) + && e.getKeyCode() == KEYCODE_BUFFERED_SAVE) { + triggerValueChangeEvent(event); + + // Save and close. + event.getGrid().getEditor().save(); + return true; } return false; |