Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package com.vaadin.tests.components.combobox;
  2. import com.vaadin.event.ShortcutAction.KeyCode;
  3. import com.vaadin.tests.components.TestBase;
  4. import com.vaadin.ui.Button;
  5. import com.vaadin.ui.ComboBox;
  6. import com.vaadin.ui.Component;
  7. import com.vaadin.ui.VerticalLayout;
  8. import com.vaadin.ui.Window;
  9. public class ComboBoxInPopup extends TestBase {
  10. @Override
  11. protected void setup() {
  12. VerticalLayout layout = new VerticalLayout();
  13. layout.setMargin(true);
  14. layout.setSizeUndefined();
  15. final Window w = new Window();
  16. w.setContent(layout);
  17. layout.addComponent(createComboBox());
  18. Button close = new Button("Close window", event -> w.close());
  19. close.setClickShortcut(KeyCode.ESCAPE, null);
  20. layout.addComponent(close);
  21. getLayout().getUI().addWindow(w);
  22. }
  23. private Component createComboBox() {
  24. ComboBox<String> comboBox = new ComboBox<String>("A combo box");
  25. comboBox.setItems("Yes", "No", "Maybe");
  26. return comboBox;
  27. }
  28. @Override
  29. protected String getDescription() {
  30. return "Escape is a shortcut for the close button. Pressing escape when the popup is open should cause only the popup to close, not the window.";
  31. }
  32. @Override
  33. protected Integer getTicketNumber() {
  34. return 6978;
  35. }
  36. }