aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/table/LastColumnNegative.java
blob: b7379b4f2c9c9082364b629b9ec050789dfda59e (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
78
79
80
package com.vaadin.tests.components.table;

import com.vaadin.data.util.IndexedContainer;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Table;
import com.vaadin.ui.VerticalLayout;

public class LastColumnNegative extends TestBase {
    Table table = setupTable();
    VerticalLayout wrapper = new VerticalLayout();

    @Override
    public void setup() {
        Button addButton = new Button("Add a table",
                new Button.ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {
                        wrapper.addComponent(table);
                    }

                });
        Button removeButton = new Button("Remove a table",
                new Button.ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {
                        wrapper.removeComponent(table);
                    }
                });
        Button shrinkWrapper = new Button("Shrink wrapper",
                new Button.ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {
                        wrapper.setWidth("400px");
                    }
                });

        addComponent(addButton);
        addComponent(removeButton);
        addComponent(shrinkWrapper);
        addComponent(wrapper);
    }

    private Table setupTable() {
        IndexedContainer container = new IndexedContainer();

        container
                .addContainerProperty(
                        "fileName",
                        String.class,
                        "Long enough string to cause a scrollbar when the window is set to a dencently small size.");
        container.addContainerProperty("size", Long.class, 23958l);
        container.addItem();
        container.addItem();
        container.addItem();

        Table table = new Table();
        table.setContainerDataSource(container);
        table.setWidth("100%");
        table.setColumnCollapsingAllowed(true);
        table.setColumnExpandRatio("size", 1);
        return table;
    }

    @Override
    protected String getDescription() {

        return "Table rendering should not fail when view becomes smaller than the table width.";
    }

    @Override
    protected Integer getTicketNumber() {

        return 8411;
    }
}