Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
book-of-vaadin.pdf
Скачиваний:
88
Добавлен:
24.03.2015
Размер:
13.43 Mб
Скачать

Advanced Web Application Topics

if (action == action_ok) { okHandler();

}

if (action == action_cancel) { cancelHandler();

}

}

public void okHandler() {

// Do something: report the click formlayout.addComponent(new Label("OK clicked. "

+"User=" + username.getValue() + ", password="

+password.getValue()));

}

public void cancelHandler() {

// Do something: report the click formlayout.addComponent(new Label("Cancel clicked. User="

+username.getValue() + ", password="

+password.getValue()));

}

}

Notice that the keyboard actions can currently be attached only to Panels and Windows. This can cause problems if you have components that require a certain key. For example, multi-line TextField requires the Enter key. There is currently no way to filter the shortcut actions out while the focus is inside some specific component, so you need to avoid such conflicts.

11.5.4. Supported Key Codes and Modifier Keys

The shortcut key definitions require a key code to identify the pressed key and modifier keys, such as Shift, Alt, or Ctrl, to specify a key combination.

The key codes are defined in the ShortcutAction.KeyCode interface and are:

Keys A to Z

Normal letter keys

F1 to F12

Function keys

BACKSPACE, DELETE, ENTER, ESCAPE, INSERT, TAB

Control keys

NUM0 to NUM9

Number pad keys

ARROW_DOWN, ARROW_UP, ARROW_LEFT, ARROW_RIGHT

Arrow keys

HOME, END, PAGE_UP, PAGE_DOWN

Other movement keys

Modifier keys are defined in ShortcutAction.ModifierKey and are:

ModifierKey.ALT

Alt key

ModifierKey.CTRL

Ctrl key

Supported Key Codes and Modifier Keys

293

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]