Package com.vaadin.ui

Examples of com.vaadin.ui.GridLayout


        LegacyWindow w = new LegacyWindow(getClass().getName());
        setMainWindow(w);

        int index = 1;

        GridLayout layout = new GridLayout(2, 2);
        TextField f1 = new TextField("1");
        f1.setTabIndex(index++);
        TextField f2 = new TextField("2");
        f2.setTabIndex(index++);

        DateField f3 = new DateField("3");
        f3.setTabIndex(index++);
        ComboBox cb = new ComboBox("4");
        cb.setTabIndex(index++);

        ListSelect lss = new ListSelect("5");
        lss.addItem("foo");
        lss.addItem("Bar");
        lss.setTabIndex(index++);

        NativeSelect ns = new NativeSelect("6");
        ns.addItem("foo");
        ns.addItem("bar");
        ns.setTabIndex(index++);

        OptionGroup og = new OptionGroup("7");
        og.addItem("foo");
        og.addItem("bar");
        og.setTabIndex(index++);

        OptionGroup ogm = new OptionGroup("7");
        ogm.setMultiSelect(true);
        ogm.addItem("foo");
        ogm.addItem("bar");
        ogm.setTabIndex(index++);

        TwinColSelect ts = new TwinColSelect("8");
        ts.addItem("Foo");
        ts.addItem("Bar");
        ts.setTabIndex(index++);

        Button b = new Button("9");
        b.setTabIndex(index++);

        layout.addComponent(b);
        layout.addComponent(ts);
        layout.addComponent(ogm);
        layout.addComponent(og);
        layout.addComponent(ns);
        layout.addComponent(lss);
        layout.addComponent(cb);
        layout.addComponent(f3);
        layout.addComponent(f2);
        layout.addComponent(f1);

        w.setContent(layout);

    }
View Full Code Here


        Button b = new Button("use gridlayout", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                p.setContent(new GridLayout());
                p2.setContent(new GridLayout());
                p3.setContent(new GridLayout());
            }

        });
        main.addComponent(b);
        b = new Button("use orderedlayout", new Button.ClickListener() {
View Full Code Here

        buttonLayout.addComponents(clearTabIndexes, setTabIndexesToOne,
                setTabIndexesInOrder, setTabIndexesInReverseOrder);

        int fieldId = 1;
        GridLayout gl = new GridLayout(4, 4);
        for (Field f : fields) {
            f.setId("field-" + fieldId++);
            gl.addComponent(f);
        }
        addComponent(gl);

    }
View Full Code Here

    }

    Layout getTestLayout() {
        Layout l = new VerticalLayout();
        if (currentValue == GridLayout.class) {
            l = new GridLayout(1, 1);
        } else {
            try {
                l = (Layout) currentValue.newInstance();
            } catch (InstantiationException e) {
                // TODO Auto-generated catch block
View Full Code Here

*/
public class DDTest1 extends TestBase {

    @Override
    protected void setup() {
        GridLayout gl = new GridLayout(3, 2);
        gl.setSizeFull();
        gl.setSpacing(true);
        Layout main = gl;

        DragDropPane pane1 = new DragDropPane();
        pane1.setSizeFull();
        pane1.setCaption("Pane1");
View Full Code Here

        final VerticalLayout expandLayout = new VerticalLayout();
        test(expandLayout);
        populateLayout(expandLayout);

        final GridLayout gridLayout = new GridLayout();
        test(gridLayout);
        populateLayout(gridLayout);

        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
View Full Code Here

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

        GridLayout mainLayout = new GridLayout(3, 3);
        mainLayout.setSizeFull();

        DateField df;

        df = createDateField();
        mainLayout.addComponent(df, 2, 0);
        mainLayout.setComponentAlignment(df, Alignment.TOP_RIGHT);

        df = createDateField();
        mainLayout.addComponent(df, 2, 1);
        mainLayout.setComponentAlignment(df, Alignment.MIDDLE_RIGHT);

        df = createDateField();
        mainLayout.addComponent(df, 2, 2);
        mainLayout.setComponentAlignment(df, Alignment.BOTTOM_RIGHT);

        df = createDateField();
        mainLayout.addComponent(df, 0, 2);
        mainLayout.setComponentAlignment(df, Alignment.BOTTOM_LEFT);

        df = createDateField();
        mainLayout.addComponent(df, 1, 2);
        mainLayout.setComponentAlignment(df, Alignment.BOTTOM_CENTER);

        mainWindow.setContent(mainLayout);
        setMainWindow(mainWindow);
    }
View Full Code Here

    private GridLayout gridLayout;

    @Before
    public void setup() {
        gridLayout = new GridLayout(2, 2);
    }
View Full Code Here

    Component[] children = new Component[] { new Label("A"), new Label("B"),
            new Label("C"), new Label("D") };

    @Test
    public void testConstructorWithComponents() {
        GridLayout grid = new GridLayout(2, 2, children);
        assertContentPositions(grid);
        assertOrder(grid, new int[] { 0, 1, 2, 3 });

        grid = new GridLayout(1, 1, children);
        assertContentPositions(grid);
        assertOrder(grid, new int[] { 0, 1, 2, 3 });
    }
View Full Code Here

        assertOrder(grid, new int[] { 0, 1, 2, 3 });
    }

    @Test
    public void testAddComponents() {
        GridLayout grid = new GridLayout(2, 2);
        grid.addComponents(children);
        assertContentPositions(grid);
        assertOrder(grid, new int[] { 0, 1, 2, 3 });

        Label extra = new Label("Extra");
        Label extra2 = new Label("Extra2");
        grid.addComponents(extra, extra2);
        assertSame(grid.getComponent(0, 2), extra);
        assertSame(grid.getComponent(1, 2), extra2);

        grid.removeAllComponents();
        grid.addComponents(extra, extra2);
        assertSame(grid.getComponent(0, 0), extra);
        assertSame(grid.getComponent(1, 0), extra2);

        grid.addComponents(children);
        assertOrder(grid, new int[] { -1, -1, 0, 1, 2, 3 });

        grid.removeComponent(extra);
        grid.removeComponent(extra2);
        assertOrder(grid, new int[] { 0, 1, 2, 3 });

        grid.addComponents(extra2, extra);
        assertSame(grid.getComponent(0, 3), extra2);
        assertSame(grid.getComponent(1, 3), extra);
        assertOrder(grid, new int[] { 0, 1, 2, 3, -1, -1 });

        grid.removeComponent(extra2);
        grid.removeComponent(extra);
        grid.setCursorX(0);
        grid.setCursorY(0);
        grid.addComponents(extra, extra2);
        assertSame(grid.getComponent(0, 0), extra);
        assertSame(grid.getComponent(1, 0), extra2);
        assertOrder(grid, new int[] { -1, -1, 0, 1, 2, 3 });

        grid = new GridLayout();
        grid.addComponents(children);
        assertContentPositions(grid);
        assertOrder(grid, new int[] { 0, 1, 2, 3 });
    }
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.