Package com.vaadin.ui

Examples of com.vaadin.ui.GridLayout


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

        GridLayout gl = new GridLayout(2, 2);
        gl.setSizeFull();
        main.setContent(gl);
        gl.setMargin(true);

        TitleBar t1 = new TitleBar("Title 1", gl);
        TitleBar t2 = new TitleBar("Title 2", gl);
        TitleBar t3 = new TitleBar("Title 3", gl);
        TitleBar t4 = new TitleBar("Title 4", gl);
View Full Code Here


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

        gl = new GridLayout(1, 2);
        gl.setStyleName("borders");
        getMainWindow().addComponent(gl);
        setTheme("tests-tickets");
        combo = new ComboBox("Combo caption");
        labelLong = new Label(
View Full Code Here

    @Override
    public void init() {
        LegacyWindow w = new LegacyWindow(getClass().getSimpleName());
        setMainWindow(w);
        // setTheme("tests-tickets");
        GridLayout layout = new GridLayout(10, 10);
        w.setContent(layout);
        createUI(layout);
    }
View Full Code Here

        String[] sizes = { "20", "100", "1", "0", "-1", "", "z" };
        String[] units = { "%", "px", "em", "ex", "in", "cm", "mm", "pt", "pc",
                "", "p", "zyx" };

        GridLayout gl = new GridLayout(units.length, sizes.length);
        main.addComponent(gl);
        for (int i = 0; i < sizes.length; i++) {
            for (int j = 0; j < units.length; j++) {
                String s = sizes[i] + units[j];
                gl.addComponent(new Button(s, this));
            }
        }

        gl.addComponent(new Button("null", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                c.setWidth(null);
                c.setHeight(null);
View Full Code Here

    @Override
    public void init() {
        LegacyWindow w = new LegacyWindow(getClass().getName());
        setMainWindow(w);
        setTheme("tests-tickets");
        GridLayout layout = new GridLayout(1, 10);
        w.setContent(layout);
        createUI(layout);
    }
View Full Code Here

        final int gridSize = (int) java.lang.Math.sqrt(componentCountC);
        VerticalLayout panelGLayout = new VerticalLayout();
        panelGLayout.setMargin(true);
        final Panel panelG = new Panel("Panel containing grid layout ("
                + gridSize + " x " + gridSize + ")", panelGLayout);
        GridLayout layoutG = new GridLayout(gridSize, gridSize);
        // Add 12 random components
        fillLayout(layoutG, componentCountC);
        // Add layout to panel
        panelGLayout.addComponent(layoutG);

        // Create TabSheet
        final TabSheet tabsheet = new TabSheet();
        tabsheet.setCaption("Tabsheet, above layouts are added to this component");
        layoutA = new HorizontalLayout();
        // Add 4 random components
        fillLayout(layoutA, componentCountA);
        tabsheet.addTab(layoutA, "Horizontal ordered layout", null);
        layoutB = new VerticalLayout();
        // Add 4 random components
        fillLayout(layoutB, componentCountB);
        tabsheet.addTab(layoutB, "Vertical ordered layout", null);
        layoutG = new GridLayout(gridSize, gridSize);
        // Add 12 random components
        fillLayout(layoutG, componentCountC);
        tabsheet.addTab(layoutG, "Grid layout (4 x 2)", null);

        // Create custom layout
View Full Code Here

        final VerticalLayout windowLayout = new VerticalLayout();

        final Window testWindow = new Window("WebKitFail", windowLayout);
        testWindow.setWidth(300, Unit.PIXELS);

        GridLayout gl = new GridLayout();
        gl.setHeight(null);
        gl.setWidth(100, Unit.PERCENTAGE);
        windowLayout.addComponent(gl);

        ListSelect listSelect = new ListSelect();
        listSelect.setWidth(100, Unit.PERCENTAGE);
        gl.addComponent(listSelect);
        gl.setMargin(true);

        final Button testButton = new Button("Open Window",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
View Full Code Here

        n.setPosition(Position.BOTTOM_CENTER);
        n.setDelayMsec(300000);
        n.show(Page.getCurrent());

        // grid of compoents
        GridLayout gl = new GridLayout(4, 5);
        gl.setSpacing(true);
        layout.addComponent(gl);

        // Basic components, caption icon only
        Class<?>[] components = { Button.class, CheckBox.class,
                DateField.class, NativeButton.class, Link.class, Label.class,
                Panel.class, Slider.class, TextArea.class, TextField.class,
                Upload.class };
        for (Class<?> clazz : components) {
            Component c;
            try {
                c = (Component) clazz.newInstance();
            } catch (Exception e) {
                e.printStackTrace();
                continue;
            }
            c.setCaption(clazz.getSimpleName());
            c.setIcon(icon);
            gl.addComponent(c);
        }

        // TabSheet, caption + tab icons
        TabSheet tabs = new TabSheet();
        tabs.setCaption("TabSheet");
        tabs.setIcon(icon);
        tabs.addStyleName("myTabs");
        tabs.addTab(new Label("Content 1"), "Tab 1", icon);
        tabs.addTab(new Label("Content 2"), "Tab 2", icon);
        tabs.setWidth("150px");
        gl.addComponent(tabs);

        // Accordion, caption + tab icons
        Accordion acc = new Accordion();
        acc.setCaption("Accordion");
        acc.setIcon(icon);
        acc.addTab(new Label(), "Section 1", icon);
        acc.addTab(new Label(), "Section 2", icon);
        gl.addComponent(acc);

        // Table, caption + column + row + action icons
        Table tbl = new Table("Table");
        tbl.setRowHeaderMode(RowHeaderMode.ICON_ONLY);
        tbl.setIcon(icon);
        tbl.addContainerProperty("Column 1", String.class, "Row", "Column 1",
                icon, Align.LEFT);
        tbl.addContainerProperty("Column 2", String.class, "Row", "Column 2",
                icon, Align.LEFT);
        tbl.setItemIcon(tbl.addItem(), icon);
        tbl.setItemIcon(tbl.addItem(), icon);
        tbl.setItemIcon(tbl.addItem(), icon);
        tbl.setPageLength(3);
        gl.addComponent(tbl);
        tbl.addActionHandler(actionHandler);

        // Selects, caption + item icons
        Class<?>[] selects = { ComboBox.class, NativeSelect.class,
                ListSelect.class, TwinColSelect.class, OptionGroup.class };
        for (Class<?> clazz : selects) {
            AbstractSelect sel;
            try {
                sel = (AbstractSelect) clazz.newInstance();
            } catch (Exception e) {
                e.printStackTrace();
                continue;
            }
            sel.setCaption(clazz.getSimpleName());
            sel.setIcon(icon);
            sel.addItem("One");
            sel.setItemIcon("One", icon);
            sel.addItem("Two");
            sel.setItemIcon("Two", icon);
            gl.addComponent(sel);
        }

        // MenuBar, caption + item + sub-item icons
        MenuBar menu = new MenuBar();
        menu.setIcon(icon);
        menu.setCaption("MenuBar");
        MenuItem mi = menu.addItem("File", icon, null);
        MenuItem smi = mi.addItem("Item", icon, null);
        smi = mi.addItem("Item", icon, null);
        smi = smi.addItem("Item", icon, null);
        gl.addComponent(menu);

        // Tree, caption + item + subitem + action icons
        Tree tree = new Tree("Tree");
        tree.addItem("Root");
        tree.setItemIcon("Root", icon);
        tree.addItem("Leaf");
        tree.setItemIcon("Leaf", icon);
        tree.setParent("Leaf", "Root");
        tree.expandItemsRecursively("Root");
        tree.addActionHandler(actionHandler);
        gl.addComponent(tree);

        // All of FontAwesome
        String allIcons = "";
        for (FontIcon ic : FontAwesome.values()) {
            allIcons += ic.getHtml() + " ";
View Full Code Here

import com.vaadin.ui.Label;

public class TestGridLayoutLastRowRemoval extends TestCase {

    public void testRemovingLastRow() {
        GridLayout grid = new GridLayout(2, 1);
        grid.addComponent(new Label("Col1"));
        grid.addComponent(new Label("Col2"));

        try {
            // Removing the last row in the grid
            grid.removeRow(0);
        } catch (IllegalArgumentException iae) {
            // Removing the last row should not throw an
            // IllegalArgumentException
            fail("removeRow(0) threw an IllegalArgumentExcetion when removing the last row");
        }

        // The column amount should be preserved
        assertEquals(2, grid.getColumns());

        // There should be one row left
        assertEquals(1, grid.getRows());

        // There should be no component left in the grid layout
        assertNull("A component should not be left in the layout",
                grid.getComponent(0, 0));
        assertNull("A component should not be left in the layout",
                grid.getComponent(1, 0));

        // The cursor should be in the first cell
        assertEquals(0, grid.getCursorX());
        assertEquals(0, grid.getCursorY());
    }
View Full Code Here

        olayout = new HorizontalLayout();
        olayout.addComponentAttachListener(new MyAttachListener());
        olayout.addComponentDetachListener(new MyDetachListener());

        gridlayout = new GridLayout();
        gridlayout.addComponentAttachListener(new MyAttachListener());
        gridlayout.addComponentDetachListener(new MyDetachListener());

        absolutelayout = new AbsoluteLayout();
        absolutelayout.addComponentAttachListener(new MyAttachListener());
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.