aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/main/java/com/vaadin/tests/themes/valo/LayoutComponentGroup.java
blob: de9d05407cfcbc4a4e3dfe44458a00b8a2ae0f49 (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.themes.valo;

import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Upload;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.themes.ValoTheme;

public class LayoutComponentGroup extends AbstractTestUI {

    private VerticalLayout container;

    @Override
    protected void setup(VaadinRequest request) {

        addComponent(new Label(
                "Test contains alternating rows with Button and Upload"));
        container = new VerticalLayout();
        container.setSizeUndefined();
        container.setSpacing(false);
        container.setId("container");

        createLayout("button", new Button("Upload"));
        createLayout("upload", new Upload());
        createLayout("button", new Button("Before"), new Button("Upload"));
        createLayout("upload", new Button("Before"), new Upload());
        createLayout("button", new Button("Before"), new Button("Upload"),
                new Button("After"));
        createLayout("upload", new Button("Before"), new Upload(),
                new Button("After"));

        addComponent(container);

    }

    private void createLayout(String info, Component... components) {
        CssLayout mainMenuLayout = new CssLayout();
        mainMenuLayout.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);

        for (Component c : components) {
            mainMenuLayout.addComponent(c);
        }
        container.addComponent(mainMenuLayout);

    }

}