aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/tests/components/combobox/ComboBoxSlowInFF.java
blob: 159e6a879c3cdd1844b520714ed1610dfd93978a (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
package com.vaadin.tests.components.combobox;

import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.v7.data.Item;
import com.vaadin.v7.ui.ComboBox;
import com.vaadin.v7.ui.Table;

@SuppressWarnings("serial")
public class ComboBoxSlowInFF extends TestBase {

    @Override
    protected void setup() {
        VerticalLayout lo = new VerticalLayout();
        lo.setSizeFull();
        final Table t = new Table();
        t.setSizeFull();
        for (int i = 0; i < 5; i++) {
            t.addContainerProperty("test" + i, Component.class, null);
        }

        Button fill = new Button("fill it");
        fill.addClickListener(event -> {
            t.removeAllItems();
            for (int i = 0; i < 200; i++) {
                Item item = t.addItem(i);
                for (int j = 0; j < 5; j++) {
                    item.getItemProperty("test" + j)
                            .setValue(createComponent(i, j));
                }
            }
        });
        lo.addComponent(fill);
        lo.addComponent(t);
        lo.setExpandRatio(t, 1.0F);
        addComponent(lo);
    }

    private Component createComponent(int x, int y) {
        ComboBox box = new ComboBox();
        // box.setMultiSelect(true);
        box.addContainerProperty("name", String.class, "");
        box.setItemCaptionPropertyId("name");
        for (int ix = 0; ix < 20; ix++) {
            box.addItem(x + 20 * y + ix).getItemProperty("name")
                    .setValue("" + x + ", " + y + " " + ix);
        }
        box.setValue(x + 20 * y);
        return box;
    }

    @Override
    protected String getDescription() {
        return "FF is very slow when rendering many ComboBoxes in a table";
    }

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

}