aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/nativeselect/NativeSelects.java
blob: 80b088f03a10f4b312841c9689c2a82a2c829741 (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
package com.vaadin.tests.components.nativeselect;

import java.util.LinkedHashMap;

import com.vaadin.tests.components.select.AbstractSelectTestCase;
import com.vaadin.ui.NativeSelect;

public class NativeSelects extends AbstractSelectTestCase<NativeSelect> {

    @Override
    protected Class<NativeSelect> getTestClass() {
        return NativeSelect.class;
    }

    @Override
    protected void createActions() {
        super.createActions();
        createColumnSelectAction();
    }

    private void createColumnSelectAction() {
        LinkedHashMap<String, Integer> options = new LinkedHashMap<String, Integer>();
        options.put("-", 0);
        for (int i = 1; i <= 10; i++) {
            options.put(String.valueOf(i), i);
        }
        options.put("50", 50);
        options.put("100", 100);
        options.put("1000", 1000);

        super.createSelectAction("Columns", CATEGORY_DATA_SOURCE, options, "-",
                columnsAction);

    }

    private Command<NativeSelect, Integer> columnsAction = new Command<NativeSelect, Integer>() {

        @Override
        public void execute(NativeSelect c, Integer value, Object data) {
            c.setColumns(value);
        }
    };
}