aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/customlayout/CustomLayoutPrimaryStyleName.java
blob: f0dc711f48ae8460861cf9b4946b8776623bdbc7 (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
package com.vaadin.tests.components.customlayout;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.CustomLayout;
import com.vaadin.ui.TextField;

public class CustomLayoutPrimaryStyleName extends TestBase {

    @Override
    protected void setup() {
        InputStream is = new ByteArrayInputStream(
                "<div location='loc1'>".getBytes());
        try {
            final CustomLayout cl = new CustomLayout(is);

            cl.addComponent(new TextField("Hello world"), "loc1");

            cl.setPrimaryStyleName("my-customlayout");
            addComponent(cl);

            addComponent(new Button("Set primary stylename",
                    new Button.ClickListener() {
                        @Override
                        public void buttonClick(ClickEvent event) {
                            cl.setPrimaryStyleName("my-second-customlayout");
                        }
                    }));

        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    @Override
    protected String getDescription() {
        return "CustomLayout should support primary stylenames both initially and dynamically";
    }

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

}