You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ComboBoxSuggestionOnDetach.java 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package com.vaadin.tests.components.combobox;
  2. import java.util.Arrays;
  3. import com.vaadin.tests.components.TestBase;
  4. import com.vaadin.ui.ComboBox;
  5. import com.vaadin.ui.VerticalLayout;
  6. import com.vaadin.ui.Window;
  7. public class ComboBoxSuggestionOnDetach extends TestBase {
  8. @Override
  9. protected void setup() {
  10. final Window popup = new Window();
  11. VerticalLayout layout = new VerticalLayout();
  12. layout.setMargin(true);
  13. layout.setSizeUndefined();
  14. popup.setContent(layout);
  15. ComboBox<String> comboBox = new ComboBox<>("Combo box",
  16. Arrays.asList("Option 1", "Option 2", "Option 3"));
  17. comboBox.addFocusListener(event -> popup.close());
  18. layout.addComponent(comboBox);
  19. popup.setSizeUndefined();
  20. popup.center();
  21. getMainWindow().addWindow(popup);
  22. }
  23. @Override
  24. protected String getDescription() {
  25. return "Click the arrow to open the combo box suggestion list. When the box is focused, the window is closed and the suggestion popup of the combo box should also be closed";
  26. }
  27. @Override
  28. protected Integer getTicketNumber() {
  29. return Integer.valueOf(7536);
  30. }
  31. }