Package com.vaadin.ui

Examples of com.vaadin.ui.GridLayout$OverlapsException


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

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

        TextField f1 = new TextField("Non-immediate/Long text field",
                new MethodProperty<Long>(this, "long1"));
        f1.setImmediate(false);
        f1.setNullSettingAllowed(true);
        TextField f2 = new TextField("Immediate/Long text field",
                new MethodProperty<Long>(this, "long2"));
        f2.setImmediate(true);
        f2.setNullSettingAllowed(true);

        layout.addComponent(f1);
        layout.addComponent(f2);

        w.setContent(layout);
    }
View Full Code Here


        final LegacyWindow main = new LegacyWindow(getClass().getName()
                .substring(getClass().getName().lastIndexOf(".") + 1));
        setMainWindow(main);

        setTheme("tests-tickets");
        GridLayout gl = new GridLayout(5, 5);

        gl.setStyleName("borders");

        gl.addComponent(new Label("0,0"), 0, 0);
        gl.addComponent(new Label("0,1"), 0, 1);
        gl.addComponent(new Label("0,2"), 0, 2);
        gl.addComponent(new Label("0,3"), 0, 3);
        gl.addComponent(new Label("0,4"), 0, 4);
        gl.addComponent(new Label("1,0"), 1, 0);
        gl.addComponent(new Label("2,0"), 2, 0);
        gl.addComponent(new Label("3,0"), 3, 0);
        gl.addComponent(new Label("4,0"), 4, 0);

        gl.addComponent(new Label("1,4"), 1, 4);
        gl.addComponent(new Label("2,4"), 2, 4);
        gl.addComponent(new Label("3,4"), 3, 4);
        gl.addComponent(new Label("4,4"), 4, 4);

        gl.addComponent(new Label("1-1 -> 2-2"), 1, 1, 2, 2);
        gl.addComponent(new Label("3,1"), 3, 1);
        gl.addComponent(new Label("3,2"), 3, 2);
        gl.addComponent(new Label("3,3"), 3, 3);

        main.addComponent(gl);

        // create grid
        GridLayout grid = new GridLayout(7, 7);

        grid.setStyleName("borders");

        // add upper row
        Button up = new Button("UP");

        up.setStyleName(pageButtonStyle);
        grid.addComponent(up, 0, 0);

        Label space = new Label();
        space.setStyleName(spacerStyle);
        grid.addComponent(space, 1, 0);

        Button single = null;
        String headingStyle = "foo";
        for (int i = 1; i < grid.getColumns() - 2; i++) {
            single = new Button(Integer.toString(i));
            single.setStyleName(headingStyle);
            grid.addComponent(single, i + 1, 0);
        }

        space = new Label();
        space.setStyleName(spacerStyle);
        grid.addComponent(space, grid.getColumns() - 1, 0);

        // middle rows
        char rowChar = 'A';
        for (int i = 1; i < grid.getRows() - 1; i++) {
            space = new Label(Character.toString(rowChar++));
            space.setStyleName(colHeadStyle);
            grid.addComponent(space, 0, i);

            space = new Label();
            space.setStyleName(spacerStyle);
            grid.addComponent(space, 1, i);

            space = new Label();
            space.setStyleName(spacerStyle);
            grid.addComponent(space, grid.getColumns() - 1, i);
        }

        // bottom row
        Button dn = new Button("DOWN");
        dn.setStyleName(pageButtonStyle);
        grid.addComponent(dn, 0, grid.getRows() - 1);

        space = new Label();
        space.setStyleName(spacerStyle);
        grid.addComponent(space, 1, grid.getRows() - 1);

        for (int i = 1; i < grid.getColumns() - 2; i++) {
            single = new Button(Integer.toString(i));
            single.setStyleName(headingStyle);
            grid.addComponent(single, i + 1, grid.getRows() - 1);
        }

        space = new Label();
        space.setStyleName(spacerStyle);
        grid.addComponent(space, grid.getColumns() - 1, grid.getRows() - 1);

        main.addComponent(grid);
    }
View Full Code Here

        LegacyWindow w = new LegacyWindow();
        setMainWindow(w);
        w.getContent().setSizeFull();
        ((SpacingHandler) w.getContent()).setSpacing(true);

        Layout layout = new GridLayout(3, 3);
        populateLayout(layout);
        w.addComponent(layout);
        layout = new HorizontalLayout();
        populateLayout(layout);
        w.addComponent(layout);
View Full Code Here

                    t.setImmediate(false);
                    return t;
                }
            });

            layout = new GridLayout(2, 1);
            layout.setWidth(100, Unit.PERCENTAGE);
            layout.setHeight(null);
            layout.setColumnExpandRatio(0, 0.5f);
            layout.setColumnExpandRatio(1, 0.5f);
            layout.setMargin(true);
View Full Code Here

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

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

        gl.addComponent(new Label(
                "Label 1 abc abc abcasdfas dfasd fasdf asdf sadf asdf"));
        gl.addComponent(new Label("Label 2 abc abc abc "));
        Label l = new Label("Colspan2, align right");
        gl.addComponent(l, 0, 1, 1, 1);
        gl.setComponentAlignment(l, Alignment.TOP_RIGHT);
        w.setContent(gl);

    }
View Full Code Here

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

        GridLayout layout = new GridLayout(5, 5);
        w.setContent(layout);

        layout.setSpacing(true);

        {
            selectWithoutNullItem = createSelect();

            layout.addComponent(selectWithoutNullItem);
            Button b = new Button("Select NULL_PROPERTY", new ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    selectWithoutNullItem.select(NULL_ITEM_ID);
                    printState();

                }
            });
            layout.addComponent(b);
            b = new Button("Select 1", new ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    selectWithoutNullItem.select("1");
                    printState();

                }
            });
            layout.addComponent(b);
            b = new Button("Select 2", new ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    selectWithoutNullItem.select("2");
                    printState();

                }
            });
            layout.addComponent(b);

            b = new Button("Select null", new ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    selectWithoutNullItem.select(null);
                    printState();

                }
            });
            layout.addComponent(b);
        }

        {
            selectWithNullItem = createSelect();
            Item nullItem = selectWithNullItem.addItem(NULL_ITEM_ID);
            nullItem.getItemProperty(PROPERTY_ID).setValue("NULL");
            selectWithNullItem.setNullSelectionItemId(NULL_ITEM_ID);

            layout.addComponent(selectWithNullItem);
            selectWithNullItem.setCaption("Select with null item id");
            Button b = new Button("Select NULL_PROPERTY", new ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    selectWithNullItem.select(NULL_ITEM_ID);
                    printState();

                }
            });
            layout.addComponent(b);

            b = new Button("Select 1", new ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    selectWithNullItem.select("1");
                    printState();

                }
            });
            layout.addComponent(b);
            b = new Button("Select 2", new ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    selectWithNullItem.select("2");
                    printState();
                }
            });
            layout.addComponent(b);

            b = new Button("Select null", new ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    selectWithNullItem.select(null);
                    printState();
                }
            });
            layout.addComponent(b);

        }

        w.addComponent(new Button("print select values",
                new Button.ClickListener() {
View Full Code Here

    @Override
    public void init() {
        LegacyWindow w = new LegacyWindow(getClass().getSimpleName());
        setMainWindow(w);
        // setTheme("tests-tickets");
        GridLayout layout = new GridLayout(2, 2);
        layout.setHeight("100%");
        layout.setWidth("700");
        w.getContent().setSizeFull();
        w.getContent().setHeight("2000");
        w.addComponent(layout);

        layout.addComponent(new Label(
                "This should NOT get stuck when scrolling down"));
        layout.addComponent(new TextField("This should not get stuck either..."));

        VerticalLayout ol = new VerticalLayout();
        ol.setHeight("1000");
        ol.setWidth("200");
        w.addComponent(ol);
View Full Code Here

        final Label label = new Label("Short content");
        label.setWidth(null);

        addComponent(new CustomComponent() {
            {
                GridLayout mainLayout = new GridLayout(1, 1);
                mainLayout.addComponent(label);
                mainLayout.setSizeUndefined();
                setSizeUndefined();
                setCompositionRoot(mainLayout);
            }
        });
View Full Code Here

                        + "share all available width with columns "
                        + "relatively to their natural width. And it "
                        + "should still work with margins and spacings");
        main.addComponent(description);

        final GridLayout grid = new GridLayout(4, 1);

        final TextField size = new TextField("Grid width in css unit");
        size.addListener(new ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                String width = size.getValue().toString();
                if (width == null || width.equals("")) {
                    grid.setSizeUndefined();
                } else {
                    grid.setWidth(width);
                }
            }
        });
        main.addComponent(size);
        main.addComponent(new Button("set size"));

        grid.setMargin(true);
        grid.setSpacing(true);

        grid.addComponent(new Label("WIDE"));
        grid.addComponent(new Label("_I_"));
        grid.addComponent(new Label("VEEEEEEEEEEERY_WIDE"));
        Label label = new Label("|");
        grid.addComponent(label);
        grid.setComponentAlignment(label, Alignment.TOP_RIGHT);
        main.addComponent(grid);
    }
View Full Code Here

        //
        // }
        // });
        // layout.addComponent(sw);

        Layout ol = new GridLayout(1, 2);
        p = new Panel("Panel", ol);
        p.setSizeFull();
        Label l = new Label("Spacer");
        l.setHeight("400px");
        ol.addComponent(l);

        embedded = new Embedded(null, new ThemeResource(
                "icons/64/folder-add.png"));
        layout.addComponent(embedded);
        Button b = new Button(
                "Replace image with new embedded component (flashes)",
                new ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {
                        Embedded newEmbedded = new Embedded(null,
                                new ThemeResource("icons/64/folder-add.png"));
                        getMainWindow().replaceComponent(embedded, newEmbedded);
                        embedded = newEmbedded;

                    }

                });
        ol.addComponent(b);

        b = new Button("Change image source (is fine)", new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                String img = "folder-add";
                if (((ThemeResource) embedded.getSource()).getResourceId()
                        .contains("folder-add")) {
                    img = "folder-delete";
                }
                embedded.setSource(new ThemeResource("icons/64/" + img + ".png"));

            }

        });

        ol.addComponent(b);
        layout.addComponent(p);
    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.GridLayout$OverlapsException

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.