aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/tabsheet/TabSheetTabStyleNames.java
blob: 54a5ed48572fc992190a1cdf33a52dcf371212d8 (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
package com.vaadin.tests.components.tabsheet;

import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.TabSheet;
import com.vaadin.ui.TabSheet.Tab;

public class TabSheetTabStyleNames extends TestBase {

    private static final String STYLE_NAME = "TabSheetTabStyleNames";

    @Override
    public void setup() {
        setTheme("tests-tickets");

        TabSheet tabsheet = new TabSheet();
        final Tab tab1 = tabsheet.addTab(new Label(), "Tab 1");
        final Tab tab2 = tabsheet.addTab(new Label(), "Tab 2");

        tab1.setStyleName(STYLE_NAME);

        addComponent(new Button("Update style names",
                new Button.ClickListener() {
                    int counter = 0;

                    @Override
                    public void buttonClick(ClickEvent event) {
                        if (tab1.getStyleName() == null) {
                            tab1.setStyleName(STYLE_NAME);
                        } else {
                            tab1.setStyleName(null);
                        }

                        tab2.setStyleName(STYLE_NAME + "_" + (counter++));
                    }
                }));

        addComponent(tabsheet);
    }

    @Override
    protected String getDescription() {
        return "Tests setting style names for individual tabs.";
    }

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