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.

ComboBoxAddWhileFiltering.java 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package com.vaadin.tests.components.select;
  2. import com.vaadin.tests.components.TestBase;
  3. import com.vaadin.ui.Button;
  4. import com.vaadin.ui.Button.ClickEvent;
  5. import com.vaadin.ui.Button.ClickListener;
  6. import com.vaadin.ui.ComboBox;
  7. /**
  8. * TODO can't reproduce the issue with this test case, possibly need some
  9. * enhancements.
  10. *
  11. */
  12. public class ComboBoxAddWhileFiltering extends TestBase {
  13. private int i;
  14. @Override
  15. protected void setup() {
  16. final ComboBox comboBox = new ComboBox();
  17. populate(comboBox);
  18. Button b = new Button("add item (^N)");
  19. b.addListener(new ClickListener() {
  20. @Override
  21. public void buttonClick(ClickEvent event) {
  22. addItem(comboBox);
  23. }
  24. });
  25. addComponent(b);
  26. addComponent(comboBox);
  27. getMainWindow().addAction(new Button.ClickShortcut(b, "^n"));
  28. }
  29. private void populate(ComboBox comboBox) {
  30. for (i = 0; i < 4;) {
  31. addItem(comboBox);
  32. }
  33. }
  34. private void addItem(ComboBox comboBox) {
  35. i++;
  36. comboBox.addItem("Item " + i);
  37. }
  38. @Override
  39. protected String getDescription() {
  40. return "Filtered list should be updated when new item is added.";
  41. }
  42. @Override
  43. protected Integer getTicketNumber() {
  44. return 3643;
  45. }
  46. }