您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

FocusFromShortcutAction.java 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package com.vaadin.tests.components;
  2. import java.util.Arrays;
  3. import com.vaadin.event.ShortcutAction.KeyCode;
  4. import com.vaadin.event.ShortcutAction.ModifierKey;
  5. import com.vaadin.ui.Button;
  6. import com.vaadin.v7.ui.Select;
  7. import com.vaadin.v7.ui.TextField;
  8. public class FocusFromShortcutAction extends TestBase {
  9. @Override
  10. protected void setup() {
  11. final Select select = new Select("Select",
  12. Arrays.asList("Option 1", "Option 2"));
  13. final TextField text = new TextField("Text");
  14. addComponent(select);
  15. addComponent(text);
  16. Button focusText = new Button("Focus text", event -> text.focus());
  17. focusText.setClickShortcut(KeyCode.T, ModifierKey.ALT);
  18. addComponent(focusText);
  19. Button focusSelect = new Button("Focus select",
  20. event -> select.focus());
  21. focusSelect.setClickShortcut(KeyCode.S, ModifierKey.ALT);
  22. addComponent(focusSelect);
  23. }
  24. @Override
  25. protected String getDescription() {
  26. return "The option drop down of the Focus select should not be opened when the \"Focus select\" button is triggered by clicking it with the mouse or with the associated shortcut key Alt + S";
  27. }
  28. @Override
  29. protected Integer getTicketNumber() {
  30. return Integer.valueOf(7539);
  31. }
  32. }