summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/tickets/Ticket1904.java
blob: f35463f6a8464988c0ed560f1833b2440c13bad1 (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
package com.vaadin.tests.tickets;

import com.vaadin.Application;
import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.Button;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI.LegacyWindow;
import com.vaadin.ui.VerticalLayout;

public class Ticket1904 extends Application.LegacyApplication {

    @Override
    public void init() {
        setMainWindow(new LegacyWindow("#1904"));
        setTheme("tests-tickets");

        addOL("defaults", null, false);
        addOL("l5,r10,t20,b40,vs20,hs40", "ticket1904", false);
        addOL("l5,r10,t20,b40,vs20,hs40", "ticket1904", true);
    }

    private void addOL(String descr, String style, boolean horizontal) {
        AbstractOrderedLayout ol;
        if (horizontal) {
            ol = new HorizontalLayout();
        } else {
            ol = new VerticalLayout();
        }
        ol.setMargin(true);
        ol.setSpacing(true);
        if (style != null) {
            ol.setStyleName(style);
        }
        ol.addComponent(new Label(descr));
        for (int i = 0; i < 3; i++) {
            Button b = new Button("Row " + (i + 1));
            if (!horizontal) {
                b.setWidth("500px");
            }
            ol.addComponent(b);
        }
        getMainWindow().addComponent(ol);
    }

}