Package com.vaadin.ui

Examples of com.vaadin.ui.GridLayout


    protected void setup(VaadinRequest request) {
        final Panel panel = new Panel();
        panel.setWidth("300px");
        addComponent(panel);

        GridLayout gl = new GridLayout();
        gl.setWidth("100%");
        panel.setContent(gl);

        final DateField df = new DateField();
        df.setWidth("100%");
        gl.addComponent(df);

        Button err = new Button("Set error");
        err.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                df.setComponentError(new UserError("foo"));
            }
        });
        gl.addComponent(err);

        err = new Button("Clear error");
        err.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                df.setComponentError(null);
            }
        });
        gl.addComponent(err);
    }
View Full Code Here


        @Override
        public Component generateCell(Table source, Object itemId,
                Object columnId) {
            Item item = source.getItem(itemId);
            GridLayout layout = new GridLayout(1, 2);
            String firstname = (String) item.getItemProperty("firstname")
                    .getValue();
            String lastname = (String) item.getItemProperty("lastname")
                    .getValue();
            layout.addComponent(new Label(firstname), 0, 0);
            layout.addComponent(new Label(lastname), 0, 1);
            return layout;
        }
View Full Code Here

        recreate.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                GridLayout newContainer = createStaticFields();
                replaceComponent(currentStaticContainer, newContainer);
                currentStaticContainer = newContainer;
            }
        });
View Full Code Here

        getLayout().setMargin(new MarginInfo(true, false, false, false));
        getLayout().setSpacing(true);

        initializeControlFields();

        GridLayout gl = new GridLayout(2, 2);
        gl.setSpacing(true);

        gl.addComponent(dynamicDateField);
        gl.addComponent(inlineDynamicDateField);

        HorizontalLayout hl = new HorizontalLayout();
        hl.setSpacing(true);
        hl.addComponent(resoSelect);
        hl.addComponent(fromRange);
View Full Code Here

    private GridLayout createStaticFields() {
        Calendar startCal = createCalendar();
        Calendar endCal = createCalendar();
        endCal.add(Calendar.DATE, 30);
        GridLayout gl = new GridLayout(2, 2);
        gl.setSpacing(true);
        DateField df = createDateField(startCal.getTime(), endCal.getTime(),
                null, Resolution.DAY, false);
        gl.addComponent(df);
        DateField inline = createDateField(startCal.getTime(),
                endCal.getTime(), null, Resolution.DAY, true);
        gl.addComponent(inline);
        inline.setId("staticInline");
        VerticalLayout vl = new VerticalLayout();

        return gl;
    }
View Full Code Here

        addComponent(grid);
    }

    GridLayout getGridLayout() {
        GridLayout grid = new GridLayout(3, 1) {
            @Override
            public void addComponent(Component c) {
                super.addComponent(c);
                setComponentAlignment(c, Alignment.MIDDLE_CENTER);
                if (c.getStyleName() != "") {
                    ((AbstractComponent) c).setDescription(c.getClass()
                            .getSimpleName()
                            + ".addStyleName(\""
                            + c.getStyleName() + "\")");
                } else {
                    ((AbstractComponent) c).setDescription("new "
                            + c.getClass().getSimpleName() + "()");
                }
            }
        };
        grid.setWidth("100%");
        grid.setSpacing(true);
        grid.setMargin(true);
        grid.setStyleName("preview-grid");
        return grid;
    }
View Full Code Here

                    public void buttonClick(ClickEvent event) {
                        dateField1.markAsDirty();
                    }
                });

        GridLayout gl = new GridLayout(3, 1);
        gl.addComponent(dateField1);
        gl.addComponent(button);

        addComponent(gl);
    }
View Full Code Here

        lo.addComponent(oltp);
        orderedLayout.setSpacing(false);
        addFields(orderedLayout);

        // GridLayout
        GridLayout grid = new GridLayout(1, 1);
        Panel g1tp = new LayoutTestingPanel("Gridlayout with 1 column", grid);
        cb = new CheckBox("GridLayout (1col)", new MethodProperty<Boolean>(
                g1tp, "visible"));
        cb.setImmediate(true);
        hidingControls.addComponent(cb);
        g1tp.setVisible(false);
        lo.addComponent(g1tp);
        grid.setSpacing(true);
        addFields(grid);
        GridLayout grid2 = new GridLayout(2, 1);
        Panel g2tp = new LayoutTestingPanel("Gridlayout with 2 columns", grid2);
        cb = new CheckBox("GridLayout (2cols)", new MethodProperty<Boolean>(
                g2tp, "visible"));
        cb.setImmediate(true);
        hidingControls.addComponent(cb);
        g2tp.setVisible(false);
        lo.addComponent(g2tp);
        grid2.setSpacing(true);
        addFields(grid2);

        // ExpandLayout
        VerticalLayout el = new VerticalLayout();
        Panel elp = new LayoutTestingPanel(
View Full Code Here

                horizontalLayout.setStyleName("borders");
            }
            l = horizontalLayout;
        } else if (layoutClass == GridLayout.class) {
            if (gridLayout == null) {
                gridLayout = new GridLayout();
                gridLayout.setStyleName("borders");
            }
            l = gridLayout;
        } else if (layoutClass == CssLayout.class) {
            if (cssLayout == null) {
View Full Code Here

public class Ticket2404 extends LegacyApplication {

    @Override
    public void init() {

        GridLayout gl = new GridLayout(2, 2);
        gl.setSizeFull();

        Button bb = new Button("1st row on 2x2 GridLayout");
        bb.setSizeFull();
        gl.addComponent(bb, 0, 0, 1, 0);
        for (int i = 0; i < 2; i++) {
            Button b = new Button("" + i);
            gl.addComponent(b);
            b.setSizeFull();
        }

        setMainWindow(new LegacyWindow("GridLayout test", gl));
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.