Package com.vaadin.tests.tickets

Source Code of com.vaadin.tests.tickets.Ticket2232

package com.vaadin.tests.tickets;

import com.vaadin.server.LegacyApplication;
import com.vaadin.ui.Button;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Layout;
import com.vaadin.ui.Layout.SpacingHandler;
import com.vaadin.ui.LegacyWindow;
import com.vaadin.ui.VerticalLayout;

public class Ticket2232 extends LegacyApplication {

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

        getMainWindow()
                .addComponent(
                        new Label(
                                "Defining spacing must be possible also with pure CSS"));

        Layout gl;
        gl = new VerticalLayout();
        gl.setWidth("100%");
        gl.setHeight("200px");
        gl.setStyleName("t2232");
        fillAndAdd(gl);

        gl = new GridLayout();
        gl.setWidth("100%");
        gl.setHeight("200px");
        gl.setStyleName("t2232");
        fillAndAdd(gl);

        gl = new VerticalLayout();
        gl.setWidth("100%");
        gl.setHeight("200px");
        ((SpacingHandler) gl).setSpacing(true);
        fillAndAdd(gl);

        gl = new GridLayout();
        gl.setWidth("100%");
        gl.setHeight("200px");
        ((SpacingHandler) gl).setSpacing(true);
        fillAndAdd(gl);

        gl = new VerticalLayout();
        gl.setWidth("100%");
        gl.setHeight("200px");
        fillAndAdd(gl);

        gl = new GridLayout();
        gl.setWidth("100%");
        gl.setHeight("200px");
        fillAndAdd(gl);

    }

    private void fillAndAdd(Layout gl) {
        for (int i = 0; i < 4; i++) {
            Button b = new Button("B");
            b.setSizeFull();
            gl.addComponent(b);
        }
        String caption = gl.getClass().getSimpleName();
        caption += " style: " + gl.getStyleName() + ", spacingFromServer:"
                + ((SpacingHandler) gl).isSpacing();
        gl.setCaption(caption);
        getMainWindow().addComponent(gl);
    }

}
TOP

Related Classes of com.vaadin.tests.tickets.Ticket2232

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.