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.

NewItemsESCPress.java 1.0KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package com.vaadin.tests.components.combobox;
  2. import com.vaadin.tests.components.TestBase;
  3. import com.vaadin.v7.ui.ComboBox;
  4. import com.vaadin.v7.ui.TextArea;
  5. @SuppressWarnings("serial")
  6. public class NewItemsESCPress extends TestBase {
  7. @Override
  8. protected void setup() {
  9. final TextArea addedItems = new TextArea("Last added items:");
  10. addedItems.setRows(10);
  11. addComponent(addedItems);
  12. final ComboBox box = new ComboBox("New items are allowed");
  13. box.setNewItemsAllowed(true);
  14. box.setNewItemHandler(newItemCaption -> {
  15. String value = addedItems.getValue();
  16. addedItems.setValue(value + newItemCaption + "\n");
  17. box.addItem(newItemCaption);
  18. });
  19. box.setImmediate(true);
  20. addComponent(box);
  21. }
  22. @Override
  23. protected String getDescription() {
  24. return "Firefox flashes the previously entered value when holding the ESC-key.";
  25. }
  26. @Override
  27. protected Integer getTicketNumber() {
  28. return 5694;
  29. }
  30. }