summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/tests/components/combobox/ComboBoxItemIcon.java
blob: 905e9a37c3f20f21beb130a7e32da4420b6f6ddf (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
package com.vaadin.tests.components.combobox;

import com.vaadin.data.Item;
import com.vaadin.terminal.ClassResource;
import com.vaadin.terminal.Resource;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.ComboBox;

public class ComboBoxItemIcon extends TestBase {

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

    @Override
    protected String getDescription() {
        return "The items in the ComboBox should have icons - also when selected.";
    }

    @Override
    protected void setup() {
        ComboBox cb = new ComboBox();
        cb.addContainerProperty("icon", Resource.class, null);
        cb.setItemIconPropertyId("icon");
        getLayout().addComponent(cb);

        Item item = cb.addItem("FI");
        item.getItemProperty("icon").setValue(
                new ClassResource("fi.gif", ComboBoxItemIcon.this));
        item = cb.addItem("SE");
        item.getItemProperty("icon").setValue(
                new ClassResource("se.gif", ComboBoxItemIcon.this));

    }

}