blob: 0bcd4e60bdfa401c973cffad4259631a88db2262 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
package com.vaadin.tests.tickets;
import com.vaadin.LegacyApplication;
import com.vaadin.event.ShortcutAction.KeyCode;
import com.vaadin.event.ShortcutListener;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
import com.vaadin.ui.UI.LegacyWindow;
import com.vaadin.ui.TextField;
/**
* Key codes were converted to lower case on the server (overlapping special key
* codes for function keys etc.) and then back to upper case on the client.
* Therefore, registering e.g. F8 as a key code resulted in "w" being used as
* the trigger and F8 being ignored.
*/
public class Ticket5157 extends LegacyApplication {
@Override
public void init() {
final LegacyWindow mainWindow = new LegacyWindow(
"Forumtests Application");
setMainWindow(mainWindow);
Panel p = new Panel();
mainWindow.addComponent(p);
Label l = new Label("Panel with F8 bound");
p.addComponent(l);
TextField f = new TextField();
p.addComponent(f);
p.addAction(new ShortcutListener("F8", KeyCode.F8, null) {
@Override
public void handleAction(Object sender, Object target) {
mainWindow.showNotification(getCaption());
}
});
p.addAction(new ShortcutListener("a", KeyCode.A, null) {
@Override
public void handleAction(Object sender, Object target) {
mainWindow.showNotification(getCaption());
}
});
}
}
|