blob: a3a13bf93cf8e6714be653e3dbb190f72028b761 (
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
|
package com.itmill.toolkit.tests.tickets;
import com.itmill.toolkit.Application;
import com.itmill.toolkit.data.Container;
import com.itmill.toolkit.tests.TestForTablesInitialColumnWidthLogicRendering;
import com.itmill.toolkit.ui.Button;
import com.itmill.toolkit.ui.Table;
import com.itmill.toolkit.ui.Window;
import com.itmill.toolkit.ui.Button.ClickEvent;
/**
*/
public class Ticket161 extends Application {
private Table t;
public void init() {
final Window mainWin = new Window("Test app to #1368");
setMainWindow(mainWin);
t = TestForTablesInitialColumnWidthLogicRendering.getTestTable(3, 100);
t.setCurrentPageFirstItemIndex(50);
mainWin.addComponent(t);
Button b = new Button("Truncate to 20 rows");
b.addListener(new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
Container containerDataSource = t.getContainerDataSource();
Object[] itemIds = containerDataSource.getItemIds().toArray();
@SuppressWarnings("unused")
int c = 0;
for (int i = 0; i < itemIds.length; i++) {
if (i > 19) {
containerDataSource.removeItem(itemIds[i]);
}
}
}
});
mainWin.addComponent(b);
}
}
|