blob: 8214966139a1a2b2a5c357752456fa09fac15840 (
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
75
76
77
|
package com.vaadin.tests.components.table;
import java.util.Arrays;
import com.vaadin.server.Sizeable;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.v7.data.util.BeanItemContainer;
import com.vaadin.v7.ui.Table;
@SuppressWarnings("serial")
public class KeyboardNavigationWithChangingContent extends TestBase {
@Override
protected void setup() {
ValueHolder<String> v1 = new ValueHolder<>("test1");
ValueHolder<String> v2 = new ValueHolder<>("test2");
ValueHolder<String> v3 = new ValueHolder<>("test3");
@SuppressWarnings("unchecked")
final BeanItemContainer<ValueHolder<String>> bic = new BeanItemContainer<>(
Arrays.asList(v1, v2, v3));
final Table t = new Table(null, bic);
t.setSelectable(true);
t.setMultiSelect(false);
t.setWidth(200, Sizeable.UNITS_PIXELS);
t.setHeight(100, Sizeable.UNITS_PIXELS);
t.select(v1);
t.focus();
t.setMultiSelect(true);
getLayout().addComponent(t);
getLayout().addComponent(
new Button("Change elements and selection", event -> {
bic.removeAllItems();
ValueHolder<String> v4 = null;
for (int i = 4; i < 30; i++) {
v4 = new ValueHolder<>("test" + i);
bic.addBean(v4);
}
t.select(t.firstItemId());
t.focus();
}));
}
@Override
protected String getDescription() {
// TODO Auto-generated method stub
return "Table keyboard navigation does not work after the contents in table is changed";
}
@Override
protected Integer getTicketNumber() {
// TODO Auto-generated method stub
return 5347;
}
public class ValueHolder<E> {
private E value;
public ValueHolder() {
}
public ValueHolder(E value) {
this.value = value;
}
public void setValue(E value) {
this.value = value;
}
public E getValue() {
return value;
}
}
}
|