From 14efb0c7dba1d20a2dabd01c4fa0ac952c928be4 Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Mon, 28 Dec 2015 14:15:50 +0200 Subject: Add keyboard shortcut to save grid editor in buffered mode (#16842) Change-Id: I4f542d166e15a63f12f8033aec4ef7b95578df71 --- .../vaadin/client/widget/grid/DefaultEditorEventHandler.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'client/src/com') 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 implements Editor.EventHandler { 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 implements Editor.EventHandler { + (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; -- cgit v1.2.3