Package com.vaadin.ui

Examples of com.vaadin.ui.GridLayout


    @Override
    protected void setup(VaadinRequest request) {
        setContent(topLayout);

        // Create the main layout for our application (4 columns, 5 rows)
        final GridLayout layout = new GridLayout(4, 5);

        topLayout.setMargin(true);
        topLayout.setSpacing(true);
        Label title = new Label("Calculator");
        topLayout.addComponent(title);
        topLayout.addComponent(log);

        HorizontalLayout horizontalLayout = new HorizontalLayout();
        horizontalLayout.setSpacing(true);
        horizontalLayout.addComponent(layout);
        horizontalLayout.addComponent(log);
        topLayout.addComponent(horizontalLayout);

        // Create a result label that over all 4 columns in the first row
        layout.setSpacing(true);
        layout.addComponent(display, 0, 0, 3, 0);
        layout.setComponentAlignment(display, Alignment.MIDDLE_RIGHT);
        display.setSizeFull();
        display.setId("display");
        display.setValue("0.0");

        // The operations for the calculator in the order they appear on the
        // screen (left to right, top to bottom)
        String[] operations = new String[] { "7", "8", "9", "/", "4", "5", "6",
                "*", "1", "2", "3", "-", "0", "=", "C", "+" };

        for (String caption : operations) {

            // Create a button and use this application for event handling
            Button button = new Button(caption);
            button.setWidth("40px");
            button.addClickListener(new ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    // Get the button that was clicked
                    Button button = event.getButton();

                    // Get the requested operation from the button caption
                    char requestedOperation = button.getCaption().charAt(0);

                    // Calculate the new value
                    double newValue = calculate(requestedOperation);

                    // Update the result label with the new value
                    display.setValue("" + newValue);
                }
            });
            button.setId("button_" + caption);

            // Add the button to our main layout
            layout.addComponent(button);
        }

    }
View Full Code Here


                        ".v-app { background: blue !important;}");

            }
        });

        GridLayout gl = new GridLayout(2, 4);
        gl.setCaption("Change theme by clicking a button");
        for (final String theme : new String[] { "reindeer", "runo",
                "chameleon", "base", null }) {
            Button b = new Button(theme);
            b.setId(theme + "");
            b.addClickListener(new ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    getUI().setTheme(theme);
                }
            });
            gl.addComponent(b);
        }

        Table t = new Table();
        PersonContainer pc = PersonContainer.createWithTestData();
        pc.addNestedContainerBean("address");
        t.setContainerDataSource(pc);
        gl.addComponent(t, 0, 3, 1, 3);
        gl.setRowExpandRatio(3, 1);

        gl.setWidth("500px");
        gl.setHeight("800px");

        HorizontalLayout images = new HorizontalLayout();
        images.setSpacing(true);

        Label l = new Label("Chameleon theme image in caption");
View Full Code Here

        Panel panel = new Panel();

        VerticalLayout content = new VerticalLayout();
        panel.setContent(content);

        GridLayout gridLayout = new GridLayout();
        gridLayout.setHeight(null);
        gridLayout.setWidth(100, Unit.PERCENTAGE);
        content.addComponent(gridLayout);

        ListSelect listSelect = new ListSelect();

        listSelect.setWidth(100, Unit.PERCENTAGE);
        listSelect.setHeight(300, Unit.PIXELS);

        gridLayout.addComponent(listSelect);

        gridLayout.setMargin(true);

        setContent(panel);
    }
View Full Code Here

    }

    private Layout createClickableGridLayout() {

        GridLayout gl = new GridLayout(4, 4);
        gl.setHeight("400px");
        gl.setWidth("564px");
        gl.setStyleName("borders");
        gl.setSpacing(true);
        gl.setHideEmptyRowsAndColumns(true);
        addContent(gl, 4);
        TextArea largeTextarea = new TextArea("Large textarea");
        largeTextarea.setWidth("100%");
        largeTextarea.setHeight("99%");
        gl.addComponent(largeTextarea, 0, 3, 3, 3);

        gl.addLayoutClickListener(new LayoutClickListener() {

            @Override
            public void layoutClick(LayoutClickEvent event) {
                logLayoutClick("GridLayout", event);
            }
        });
        gl.setRowExpandRatio(3, 1);
        return wrap(gl, "GridLayout");
    }
View Full Code Here

public class AllComponentTooltipTest extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        GridLayout layout = new GridLayout(5, 5);
        setContent(layout);
        for (Class<? extends Component> cls : VaadinClasses.getComponents()) {
            try {
                AbstractComponent c = (AbstractComponent) cls.newInstance();
                if (c instanceof LegacyWindow) {
                    continue;
                }

                c.setId(cls.getName());
                c.setCaption(cls.getName());
                c.setDescription(cls.getName());
                c.setWidth("100px");
                c.setHeight("100px");
                layout.addComponent(c);
                System.out.println("Added " + cls.getName());
            } catch (Exception e) {
                System.err.println("Could not instatiate " + cls.getName());
            }
        }
View Full Code Here

        VerticalLayout layout = new VerticalLayout();
        layout.setSpacing(true);
        layout.setSizeFull();
        setContent(layout);

        GridLayout grid = new GridLayout();
        grid.setSpacing(true);

        TextField text1 = new TextField();
        text1.setCaption("Text1");
        text1.setRequired(true);

        TextField text2 = new TextField();
        text2.setCaption("Text2");
        text2.setRequired(true);

        ComboBox combo = new ComboBox();
        combo.setCaption("Combo1");

        CheckBox check = new CheckBox();
        check.setCaption("Check");

        grid.setColumns(2);
        grid.setRows(2);

        grid.addComponent(text1);
        grid.addComponent(text2);
        grid.addComponent(combo);
        grid.addComponent(check);

        grid.setSizeUndefined();

        Panel panel = new Panel();
        panel.setContent(grid);

        panel.setSizeUndefined();
View Full Code Here

    private DateField endDateField;

    @SuppressWarnings("serial")
    @Override
    public void init(VaadinRequest request) {
        GridLayout layout = new GridLayout();
        layout.setSizeFull();
        layout.setMargin(true);
        setContent(layout);

        handleURLParams(request.getParameterMap());

        initContent();
View Full Code Here

                Alignment.MIDDLE_LEFT);
        controlPanel.setComponentAlignment(disabledButton,
                Alignment.MIDDLE_LEFT);
        controlPanel.setComponentAlignment(addNewEvent, Alignment.MIDDLE_LEFT);

        GridLayout layout = (GridLayout) getContent();
        layout.addComponent(controlPanel);
        layout.addComponent(hl);
        layout.addComponent(calendarComponent);
        layout.setRowExpandRatio(layout.getRows() - 1, 1.0f);
    }
View Full Code Here

    @Override
    public void init() {
        LegacyWindow w = new LegacyWindow("Main");
        setMainWindow(w);
        layout = (Layout) w.getContent();
        GridLayout gl = new GridLayout(1, 1);
        gl.setSizeUndefined();
        Label l = new Label("This should be visible");
        l.setWidth("100px");
        gl.addComponent(l);

        layout.setSizeUndefined();
        layout.addComponent(gl);
    }
View Full Code Here

        abs.setComponentError(new UserError("A error message..."));
        abs.setId("layout" + debugIdCounter++);

        addComponent(abs);

        GridLayout gl = new GridLayout();
        gl.setMargin(true);
        gl.setSpacing(true);
        gl.setCaption("GridLayout");
        gl.setComponentError(new UserError("A error message..."));
        gl.addComponent(new Label("Some content"));
        gl.setId("layout" + debugIdCounter++);

        addComponent(gl);

        VerticalSplitPanel vert = new VerticalSplitPanel();
        vert.setCaption("VertSplitPan");
View Full Code Here

TOP

Related Classes of com.vaadin.ui.GridLayout

Copyright © 2018 www.massapicom. 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.