blob: 74a5089a84e745a217af85730b06394be99d67d3 (
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
|
package com.vaadin.tests.components.table;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Table;
public class TableModifcationsWhenScrolledRight extends TestBase {
@Override
protected void setup() {
final Table t = new Table();
Button btn = new Button("Add row");
Integer row = 1;
t.setPageLength(5);
t.setWidth("400px");
t.addContainerProperty("name", String.class, "NA");
t.setColumnCollapsingAllowed(true);
for (Integer col = 0; col < 10; col++) {
t.addContainerProperty(col, Integer.class, col);
t.setColumnWidth(col, 50);
}
t.addItem(row).getItemProperty("name").setValue("Row" + row);
btn.addListener(new ClickListener() {
Integer row = 2;
@Override
public void buttonClick(ClickEvent event) {
t.addItem(row).getItemProperty("name").setValue("Row" + row);
row++;
}
});
addComponent(t);
addComponent(btn);
}
@Override
protected String getDescription() {
return "Scroll right and then click \"Add row\". The table will scroll back left and the headers should also.";
}
@Override
protected Integer getTicketNumber() {
return 5382;
}
}
|