Package com.vaadin.ui

Examples of com.vaadin.ui.Layout


    protected void attachField(Object propertyId, Field field) {
        if (propertyId == null || field == null) {
            return;
        }

        Layout layout = parentForm.getLayout();

        Field oldField = fields.get(propertyId);
        if (oldField != null) {
            layout.removeComponent(oldField);
        }

        fields.put(propertyId, field);

        if (layout instanceof CustomLayout) {
            ((CustomLayout) layout).addComponent(field, propertyId.toString());
        } else {
            layout.addComponent(field);
        }
    }
View Full Code Here


    }

    private Layout getLayout(String caption,
            Class<? extends Layout> layoutClass, String width) {
        Layout l;
        if (layoutClass == VerticalLayout.class) {
            if (verticalLayout == null) {
                verticalLayout = new VerticalLayout();
                verticalLayout.setStyleName("borders");
            }
            l = verticalLayout;
        } else if (layoutClass == HorizontalLayout.class) {
            if (horizontalLayout == null) {
                horizontalLayout = new HorizontalLayout();
                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) {
                cssLayout = new CssLayout();
                cssLayout.setStyleName("borders");
            }
            l = cssLayout;
        } else if (layoutClass == FormLayout.class) {
            if (formLayout == null) {
                formLayout = new FormLayout();
                formLayout.setStyleName("borders");
            }
            l = formLayout;
        } else {
            return null;
        }

        l.setCaption(caption);
        if (width.equals("auto")) {
            width = null;
        }

        l.setWidth(width);

        // addComponent(l);

        return l;
    }
View Full Code Here

    protected Integer getTicketNumber() {
        return 11827;
    }

    private Tab addTab() {
        Layout content = new VerticalLayout();
        tabs.add(content);

        TextField field = new TextField("Tab " + index + " label");
        content.addComponent(field);

        Tab tab = ts.addTab(content, "Tab " + index, null);

        if (index == 2) {
            tab.setClosable(true);
View Full Code Here

        return 2915;
    }

    @Override
    protected void setup() {
        Layout main = getLayout();

        final Label l = new Label("A Label");
        final AbsoluteLayout al = new AbsoluteLayout();
        al.setWidth("300px");
        al.setHeight("200px");
        main.addComponent(al);

        final Button b = new Button("Add", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                if (l.getParent() == null) {
                    al.addComponent(l);
                    event.getButton().setCaption("Remove");
                } else {
                    al.removeComponent(l);
                    event.getButton().setCaption("Add");
                }

            }

        });
        main.addComponent(b);

    }
View Full Code Here

        Label description = new Label(
                "Open this application in Chrome, zoom out (cmd + \"-\") and "
                        + "open the ComboBox for weird behaviour.");
        mainWindow.addComponent(description);

        Layout formLayout = new GridLayout(2, 1);
        // formLayout.setWidth("100%");
        formLayout.setWidth("1000px");

        ComboBox countryField = new ComboBox();
        countryField.addItem("Finland");
        countryField.addItem("Sweden");
        countryField.addItem("Canada");
        countryField.addItem("USA");
        countryField.setCaption("Country");
        countryField.setWidth("100%");
        formLayout.addComponent(countryField);

        ComboBox statusField = new ComboBox();
        statusField.addItem("Available");
        statusField.addItem("On vacation");
        statusField.addItem("Busy");
        statusField.addItem("Left the building");
        statusField.setCaption("Status");
        statusField.setWidth("100%");
        formLayout.addComponent(statusField);

        mainWindow.addComponent(formLayout);
    }
View Full Code Here

            setLocked(true);

            final HorizontalSplitPanel leftSide = initLeftSide();
            setFirstComponent(leftSide);

            final Layout rightSide = new VerticalLayout();
            rightSide.setHeight("100%");
            setSecondComponent(rightSide);
        }
View Full Code Here

        b.addListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                int components = Integer.parseInt(n.getValue());
                Layout layout = getCurrentLayout();
                for (int i = 0; i < components; i++) {
                    Component component = newTestComponent();
                    if (cb.getValue()) {
                        component.setCaption("caption " + i);
                    }
                    layout.addComponent(component);
                }

                testarea.removeAllComponents();
                testarea.addComponent(layout);
            }
View Full Code Here

*
*/
public class CustomDDImplementation extends CustomComponent {

    public CustomDDImplementation() {
        Layout l = new CssLayout();
        l.addComponent(new MyDropTarget());
        l.addComponent(new MyDragSource());
    }
View Full Code Here

    }

    private Layout getLayout(String caption,
            Class<? extends Layout> layoutClass, String width) {
        Layout l;
        if (layoutClass == VerticalLayout.class) {
            if (verticalLayout == null) {
                verticalLayout = new VerticalLayout();
                verticalLayout.setStyleName("borders");
            }
            l = verticalLayout;
        } else if (layoutClass == HorizontalLayout.class) {
            if (horizontalLayout == null) {
                horizontalLayout = new HorizontalLayout();
                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) {
                cssLayout = new CssLayout();
                cssLayout.setStyleName("borders");
            }
            l = cssLayout;
        } else if (layoutClass == FormLayout.class) {
            if (formLayout == null) {
                formLayout = new FormLayout();
                formLayout.setStyleName("borders");
            }
            l = formLayout;
        } else {
            return null;
        }

        l.setCaption(caption);
        if (width.equals("auto")) {
            width = null;
        }

        l.setWidth(width);

        // addComponent(l);

        return l;
    }
View Full Code Here

    @Override
    public void init() {
        LegacyWindow w = new LegacyWindow();
        setMainWindow(w);

        Layout layout = null;

        for (int i = 0; i < getLayoutCount(); i++) {
            Layout newlayout = createLayout();
            // newlayout.setHeight("100%");
            if (i == 0) {
                w.setContent(newlayout);
            } else {
                layout.addComponent(newlayout);
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Layout

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.