Package com.vaadin.ui

Examples of com.vaadin.ui.VerticalLayout


    private Form createForm(GridLayout parentLayout, String w, String h) {
        FormLayout formLayout = new FormLayout();
        Form form = new Form(formLayout);

        VerticalLayout vl = new VerticalLayout();
        vl.setMargin(true);
        vl.setSizeFull();
        Panel p = new Panel("Form " + w + "x" + h, vl);

        p.setWidth(w);
        p.setHeight(h);

        parentLayout.addComponent(p);
        vl.addComponent(form);
        formLayout.setSizeFull();

        return form;
    }
View Full Code Here


public class ButtonsInHorizontalLayout extends AbstractTestCase {

    @Override
    public void init() {
        VerticalLayout content = new VerticalLayout();
        content.setMargin(true);
        content.setSpacing(true);

        content.addComponent(createButtonLayout(null));
        content.addComponent(createButtonLayout(BaseTheme.BUTTON_LINK));

        setMainWindow(new LegacyWindow("", content));
    }
View Full Code Here

    }

    private Panel createPanel() {
        Panel p = new Panel();

        VerticalLayout content = new VerticalLayout();
        p.setContent(content);
        content.setHeight("500px");

        List<String> items = new ArrayList<String>();
        items.add("1");
        items.add("2");
        items.add("3");

        Button button = new Button("Press me");
        content.addComponent(button);
        content.setComponentAlignment(button, Alignment.BOTTOM_CENTER);
        return p;
    }
View Full Code Here

    @Override
    protected void setup(VaadinRequest request) {
        final Window window = new Window("Test window");
        addWindow(window);

        final Layout layout1 = new VerticalLayout();
        Button button1 = new Button("Button 1");
        layout1.addComponent(button1);

        final Layout layout2 = new VerticalLayout();
        Button button2 = new Button("Button 2");
        layout2.addComponent(button2);

        window.setContent(layout1);

        button1.addListener(new ClickListener() {
View Full Code Here

        setMainWindow(main);

        HorizontalLayout base = new HorizontalLayout();
        main.setContent(base);

        VerticalLayout content = new VerticalLayout();

        content.addComponent(new Label("Content."));
        content.setWidth("500px");

        Table table = new Table();

        table.setPageLength(10);

        table.setWidth("100%");

        table.addContainerProperty("Lähettäjä", String.class, "");
        table.addContainerProperty("Viestin tyyppi", String.class, "");

        for (int i = 0; i < 15; i++) {

            table.addItem(new Object[] { i + " Joku Ihminen", "Testiviesti" },

            new Object());

        }

        content.addComponent(table);

        Panel right = new Panel("Panel");

        right.setContent(new Label("Some basic text might show up here."));
View Full Code Here

    public void init() {
        LegacyWindow w = new LegacyWindow(getClass().getSimpleName());
        w.setContent(new GridLayout(2, 2));
        setMainWindow(w);

        VerticalLayout layout = new VerticalLayout();
        Panel p = new Panel(layout);
        p.setCaption("ExpandLayout");
        p.setWidth("500px");
        p.setHeight("500px");
        layout.setSizeFull();

        w.addComponent(p);

        tf1 = new TextArea();
        tf1.setRows(5);
        tf1.setSizeFull();
        tf1.setValue(contents);
        tf1.setCaption("TextField caption");
        layout.addComponent(tf1);

        /*
         *
         * OrderedLayout
         */

        VerticalLayout layout2 = new VerticalLayout();
        Panel p2 = new Panel(layout2);
        p2.setCaption("OrderedLayout");
        p2.setWidth("500px");
        p2.setHeight("500px");
        layout2.setSizeFull();

        w.addComponent(p2);

        tf2 = new TextArea();
        tf2.setRows(5);
        tf2.setSizeFull();
        tf2.setValue(contents);
        tf2.setCaption("TextField caption");
        layout2.addComponent(tf2);

        /*
         *
         * GridLayout
         */

        VerticalLayout p3l = new VerticalLayout();
        p3l.setMargin(true);
        Panel p3 = new Panel(p3l);
        p3.setCaption("GridLayout");
        p3.setWidth("500px");
        p3.setHeight("500px");
        // p3.setContent(new GridLayout());
        p3l.setSizeFull();
        p3l.setMargin(false);

        GridLayout gl = new GridLayout();
        gl.setSizeFull();
        gl.setMargin(false);
        p3l.addComponent(gl);
        w.addComponent(p3);

        tf3 = new TextArea();
        tf3.setRows(5);
        tf3.setSizeFull();
View Full Code Here

    private static final String desc = "non-first tree in non-sized orderedlayout seems to be the problem";

    Tree tree;

    public TreeExample() {
        final VerticalLayout main = new VerticalLayout();
        setCompositionRoot(main);

        // Panel w/ Tree
        main.setStyleName(Reindeer.PANEL_LIGHT);
        main.setWidth("200px");
        // // Description, this is needed. Works in first slot
        main.addComponent(new Label(desc));

        // setting either width or height fixes the issue
        // p.setWidth(500);
        // p.setHeight(800);

        // Tree with a few items
        tree = new Tree();
        tree.setImmediate(true);
        // we'll use a property for caption instead of the item id ("value"),
        // so that multiple items can have the same caption
        tree.addContainerProperty(CAPTION_PROPERTY, String.class, "");
        tree.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
        tree.setItemCaptionPropertyId(CAPTION_PROPERTY);
        for (int i = 1; i <= 3; i++) {
            final Object id = addCaptionedItem("Section " + i, null);
            tree.expandItem(id);
            addCaptionedItem("Team A", id);
            addCaptionedItem("Team B", id);
        }
        main.addComponent(tree);
    }
View Full Code Here

    @Override
    public void init() {
        mainWindow = new LegacyWindow("Resize test");
        setMainWindow(mainWindow);
        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        subWindow = new Window("Sub window", layout);
        subWindow.setHeight("50%");
        subWindow.setWidth("50%");
        subWindow.center();
        layout.addComponent(new Label(LoremIpsum.get(1000)));
        getMainWindow().addWindow(subWindow);

        lazyMode = new CheckBox("Lazy resize");
        lazyMode.setImmediate(true);
        lazyMode.addListener(new ValueChangeListener() {
View Full Code Here

        addComponent(tf);

        Button b = new Button("new", new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                VerticalLayout layout = new VerticalLayout();
                layout.setMargin(true);
                final Window win = new Window("Subwin", layout);
                layout.setWidth(null);
                win.center();
                win.setClosable(false);
                getMainWindow().addWindow(win);
                layout.addComponent(new Label("SPACE notifies, ESC closes."));

                win.addActionHandler(new Action.Handler() {

                    ShortcutAction esc = new ShortcutAction("Close",
                            ShortcutAction.KeyCode.ESCAPE, null);
                    ShortcutAction spc = new ShortcutAction("Space",
                            ShortcutAction.KeyCode.SPACEBAR, null);

                    @Override
                    public Action[] getActions(Object target, Object sender) {
                        return new Action[] { esc, spc };
                    }

                    @Override
                    public void handleAction(Action action, Object sender,
                            Object target) {
                        if (action == esc) {
                            getMainWindow().removeWindow(win);
                        } else {
                            getMainWindow().showNotification(
                                    action.getCaption());
                        }

                    }

                });

                layout.addComponent(new TextField());
            }

        });
        addComponent(b);
View Full Code Here

        TextArea performanceReportArea = new TextArea();
        performanceReportArea.setWidth("200px");
        TestUtils.installPerformanceReporting(performanceReportArea);

        VerticalLayout leftBar = new VerticalLayout();
        leftBar.setSizeUndefined();
        leftBar.addComponent(new Label("This is the left bar"));
        leftBar.addComponent(performanceReportArea);
        leftBar.addComponent(reportPerformanceButton);

        leftBar.addComponent(new Button("Set 20 panels as content",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        popupateContent(contentLayout, 20, true);
                        updatePerformanceReporting("20 panels", 100, 100);
                    }
                }));
        leftBar.addComponent(new Button("Set 40 panels as content",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        popupateContent(contentLayout, 40, true);
                        updatePerformanceReporting("40 panels", 100, 100);
                    }
                }));
        leftBar.addComponent(new Button("Set 40 layouts as content",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        popupateContent(contentLayout, 40, false);
                        updatePerformanceReporting("40 layouts", 100, 100);
                    }
                }));

        leftBar.addComponent(new Button("Update all labels",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        Iterator<Component> componentIterator = contentLayout
                                .getComponentIterator();
                        while (componentIterator.hasNext()) {

                            Iterator<Component> columHolderIterator;
                            Component child = componentIterator.next();
                            if (child instanceof Panel) {
                                columHolderIterator = ((ComponentContainer) ((Panel) child)
                                        .getContent()).getComponentIterator();
                            } else {
                                columHolderIterator = ((ComponentContainer) child)
                                        .getComponentIterator();
                            }
                            while (columHolderIterator.hasNext()) {
                                VerticalLayout column = (VerticalLayout) columHolderIterator
                                        .next();
                                Iterator<Component> columnIterator = column
                                        .getComponentIterator();
                                while (columnIterator.hasNext()) {
                                    Label label = (Label) columnIterator.next();
                                    label.setValue("New value");
                                }
                            }
                        }
                        updatePerformanceReporting("Update labels", 100, 100);
                    }
                }));

        leftBar.addComponent(new Button("Clear content",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        contentLayout.removeAllComponents();
                        contentLayout.addComponent(new Label("No content"));
                        updatePerformanceReporting("No content", 100, 100);
                    }
                }));

        HorizontalLayout intermediateLayout = new HorizontalLayout();
        intermediateLayout.setSizeFull();
        intermediateLayout.addComponent(leftBar);
        intermediateLayout.addComponent(contentScroller);
        intermediateLayout.setExpandRatio(contentScroller, 1);

        VerticalLayout mainLayout = new VerticalLayout();
        mainLayout.setSizeFull();
        mainLayout.addComponent(new Label("This is a header"));
        mainLayout.addComponent(intermediateLayout);
        mainLayout.setExpandRatio(intermediateLayout, 1);

        return mainLayout;
    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.VerticalLayout

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.