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