blob: f94306d2fa2bb50c2236726e8933d6ebbaa6d710 (
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
package com.vaadin.tests.components.combobox;
import java.util.ArrayList;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.tests.components.ComponentTestCase;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.Notification;
public class ComboBoxScrollingToPageDisabled extends
ComponentTestCase<ComboBox> {
private static final Object CAPTION = "caption";
@Override
protected Class<ComboBox> getTestClass() {
return ComboBox.class;
}
@Override
protected void initializeComponents() {
ComboBox s = createSelect(null);
s.setScrollToSelectedItem(false);
populate(s, 100);
Object selection = new ArrayList<Object>(s.getItemIds()).get(50);
s.setValue(selection);
addTestComponent(s);
}
private void populate(ComboBox s, int nr) {
for (int i = 0; i < nr; i++) {
addItem(s, "Item " + i);
}
}
@SuppressWarnings("unchecked")
private void addItem(ComboBox s, String string) {
Object id = s.addItem();
s.getItem(id).getItemProperty(CAPTION).setValue(string);
}
private ComboBox createSelect(String caption) {
final ComboBox cb = new ComboBox();
cb.setImmediate(true);
cb.addContainerProperty(CAPTION, String.class, "");
cb.setItemCaptionPropertyId(CAPTION);
cb.setCaption(caption);
cb.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChange(ValueChangeEvent event) {
Notification.show("Value now:" + cb.getValue() + " "
+ cb.getItemCaption(cb.getValue()));
}
});
return cb;
}
@Override
protected String getDescription() {
return "Test that selected value appears on the client "
+ "side even though setScrollToSelectedItem(false) "
+ "has been called. Textbox should containe 'Item 50'.";
}
@Override
protected Integer getTicketNumber() {
return 16673;
}
}
|