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

import com.vaadin.tests.components.TestBase;
import com.vaadin.tests.util.LoremIpsum;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.CustomLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.NativeButton;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;

public class CustomLayoutUsingTheme extends TestBase implements ClickListener {

    private CustomLayout layout;

    @Override
    protected void setup() {
        setTheme("tests-tickets");
        layout = new CustomLayout("Ticket1775");
        addComponent(layout);
        layout.addComponent(new TextField("Username"), "loginUser");
        layout.addComponent(new TextField("Password"), "loginPassword");
        layout.addComponent(new Button("Login"), "loginButton");
        layout.setWidth(null);

        VerticalLayout menu = new VerticalLayout();
        menu.addComponent(new Button("Set body to label", new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                layout.addComponent(new Label(LoremIpsum.get(200)), "body");
            }
        }));
        menu.addComponent(new Button("Set body to huge NativeButton",
                new ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {
                        layout.addComponent(new NativeButton(
                                "This is it, the body!"), "body");
                    }
                }));
        layout.addComponent(menu, "menu");
    }

    @Override
    protected String getDescription() {
        return "Test for using a CustomLayout with a template read from an input stream and passed through the state";
    }

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

    @Override
    public void buttonClick(ClickEvent event) {
        layout.addComponent(new TextField("A text field!"), "location2");
    }

}