summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/tickets/Ticket1365.java
diff options
context:
space:
mode:
Diffstat (limited to 'uitest/src/com/vaadin/tests/tickets/Ticket1365.java')
-rw-r--r--uitest/src/com/vaadin/tests/tickets/Ticket1365.java48
1 files changed, 48 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket1365.java b/uitest/src/com/vaadin/tests/tickets/Ticket1365.java
new file mode 100644
index 0000000000..c617b07248
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/tickets/Ticket1365.java
@@ -0,0 +1,48 @@
+package com.vaadin.tests.tickets;
+
+import com.vaadin.event.Action;
+import com.vaadin.event.Action.Handler;
+import com.vaadin.event.ShortcutAction;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.UI.LegacyWindow;
+import com.vaadin.ui.TextField;
+
+public class Ticket1365 extends com.vaadin.Application.LegacyApplication
+ implements Handler {
+
+ TextField f = new TextField();
+
+ Label status = new Label("ENTER and CTRL-S fires shortcut action.");
+
+ @Override
+ public void init() {
+ final LegacyWindow main = new LegacyWindow(getClass().getName()
+ .substring(getClass().getName().lastIndexOf(".") + 1));
+ setMainWindow(main);
+
+ main.addComponent(f);
+ main.addComponent(status);
+ main.addActionHandler(this);
+ f.focus();
+
+ }
+
+ final static private Action[] actions = new Action[] {
+ new ShortcutAction("Enter", ShortcutAction.KeyCode.ENTER,
+ new int[] {}),
+ new ShortcutAction("CTRL-S", ShortcutAction.KeyCode.S,
+ new int[] { ShortcutAction.ModifierKey.CTRL }), };
+
+ @Override
+ public Action[] getActions(Object target, Object sender) {
+ return actions;
+ }
+
+ @Override
+ public void handleAction(Action action, Object sender, Object target) {
+ status.setValue("Pressed " + action.getCaption()
+ + " to fire shortcut. Texfield value: " + f.getValue());
+ f.focus();
+ }
+
+} \ No newline at end of file