aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/tests/components/panel/PanelChangeContents.java
blob: d00ae206fe3b46862d0d02354d504c488819895e (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
64
65
66
67
68
69
70
71
72
package com.vaadin.tests.components.panel;

import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
import com.vaadin.ui.VerticalLayout;

public class PanelChangeContents extends AbstractReindeerTestUI
        implements ClickListener {

    VerticalLayout stats = new VerticalLayout();
    VerticalLayout companies = new VerticalLayout();
    VerticalLayout settings = new VerticalLayout();

    Button statsButton = new Button("Stats", this);
    Button companiesButton = new Button("Companies", this);
    Button settingsButton = new Button("Settings", this);

    private Panel panel;

    @Override
    protected void setup(VaadinRequest request) {
        VerticalLayout content = new VerticalLayout();
        setSizeFull();
        HorizontalLayout buttons = new HorizontalLayout();
        stats.addComponent(new Label("stats"));
        companies.addComponent(new Label("companies"));
        settings.addComponent(new Label("settings"));
        buttons.addComponent(statsButton);
        buttons.addComponent(companiesButton);
        buttons.addComponent(settingsButton);
        panel = new Panel();
        panel.setCaption("<div class=\"caption-with-html\">Caption</div>");
        panel.setSizeFull();
        panel.setContent(stats);
        content.addComponent(buttons);
        content.addComponent(panel);
        content.setMargin(true);
        content.setSpacing(true);
        content.setExpandRatio(panel, 1);
        setContent(content);
    }

    @Override
    public void buttonClick(ClickEvent event) {
        if (event.getButton() == statsButton) {
            panel.setContent(stats);
        } else if (event.getButton() == companiesButton) {
            panel.setContent(companies);
        } else if (event.getButton() == settingsButton) {
            panel.setContent(settings);
        }

    }

    @Override
    protected String getTestDescription() {
        // TODO Auto-generated method stub
        return null;
    }

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

}