blob: 0336ff423b88d0be7886ef38295b8570cc28fb0e (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
package com.vaadin.tests.components.combobox;
import java.util.Map;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.tests.components.TestBase;
import com.vaadin.tests.util.Log;
import com.vaadin.ui.ComboBox;
public class ComboBoxSlow extends TestBase {
private Log log = new Log(5);
@Override
protected Integer getTicketNumber() {
return 7949;
}
@Override
protected String getDescription() {
return "The ComboBox artificially introduces a server delay to more easily spot problems";
}
public class SlowComboBox extends ComboBox {
@Override
public void changeVariables(Object source, Map<String, Object> variables) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
super.changeVariables(source, variables);
}
}
@Override
protected void setup() {
addComponent(log);
final SlowComboBox cb = new SlowComboBox();
cb.setImmediate(true);
for (int i = 0; i <= 1000; i++) {
cb.addItem("Item " + i);
}
cb.addListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
log.log("Value changed to " + cb.getValue());
}
});
addComponent(cb);
}
}
|