aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/table/TableExtraScrollbars.java
blob: fa10ab344ce8993515bae6f87298159797391645 (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
package com.vaadin.tests.components.table;

import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.tests.components.AbstractTestCase;
import com.vaadin.ui.LegacyWindow;
import com.vaadin.ui.Table;
import com.vaadin.ui.VerticalLayout;

public class TableExtraScrollbars extends AbstractTestCase {

    private static int PROPS = 15;
    private static int ROWS = 1000;

    @Override
    public void init() {
        setTheme("runo");
        LegacyWindow w = new LegacyWindow("Table scrollbars bug example");
        setMainWindow(w);

        VerticalLayout vl = new VerticalLayout();
        vl.setSizeFull();
        vl.addComponent(createTable());
        w.setContent(vl);
    }

    protected Table createTable() {
        Table table = new Table(null, createContainer());
        table.setSizeFull();
        table.setPageLength(50);
        table.setColumnReorderingAllowed(true);
        table.setSelectable(true);
        return table;
    }

    protected Container createContainer() {
        Container container = new IndexedContainer();
        for (int i = 0; i < PROPS; ++i) {
            container.addContainerProperty("prop" + i, String.class, null);
        }
        for (int i = 0; i < ROWS; ++i) {
            Item item = container.addItem(i);
            for (int p = 0; p < PROPS; ++p) {
                item.getItemProperty("prop" + p).setValue(
                        "property value 1234567890");
            }
        }
        return container;
    }

    @Override
    protected String getDescription() {
        return "Scrolling down in the table should not add extra scrollbars";
    }

    @Override
    protected Integer getTicketNumber() {
        return 4489;
    }
}