Package com.vaadin.ui

Examples of com.vaadin.ui.Table


        return 1623;
    }

    @Override
    protected void setup() {
        table = new Table();
        table.setWidth("400px");
        table.setHeight("100px");
        table.setPageLength(100);
        table.addContainerProperty("p1", String.class, null);
        table.addContainerProperty("p2", String.class, null);
View Full Code Here


        result = new Label();
        main.addComponent(result);

        testContainer = new VerticalLayout();

        final Table t = TestForTablesInitialColumnWidthLogicRendering
                .getTestTable(5, 200);

        Table t2 = new Table("Test Table with 199 rows rendered initially") {
            @Override
            public void changeVariables(Object source,
                    Map<String, Object> variables) {
                super.changeVariables(source, variables);
                // end timing on cache row request
                endTest();
            }
        };
        t2.setPageLength(199); // render almost all rows at once
        t2.setContainerDataSource(t.getContainerDataSource());

        testContainer.addComponent(t2);

        for (int i = 0; i < INITIAL_COMPONENTS; i++) {
            ComboBox cb = new ComboBox("Combobox " + i);
View Full Code Here

     * @param testContainer2
     */
    private void populateContainer(VerticalLayout container, int n) {
        for (int i = 0; i < n; i++) {
            // array_type array_element = [i];
            final Table t = TestForTablesInitialColumnWidthLogicRendering
                    .getTestTable(5, 100);
            container.addComponent(t);
        }
    }
View Full Code Here

        main.addComponent(getTestTable(4, 1000));

    }

    public static Table getTestTable(int cols, int rows) {
        final Table t = new Table();
        t.setColumnCollapsingAllowed(true);
        for (int i = 0; i < cols; i++) {
            t.addContainerProperty(testString[i], String.class, "");
        }
        t.addContainerProperty("button", Button.class, null);
        for (int i = 0; i < rows; i++) {
            final Vector<Object> content = new Vector<Object>();
            for (int j = 0; j < cols; j++) {
                content.add(rndString());
            }
            content.add(new Button("b" + i, new Button.ClickListener() {

                @Override
                public void buttonClick(ClickEvent event) {
                    Button b = event.getButton();
                    System.out.println(b.getCaption() + " click: "
                            + (new Date()).toString());
                    System.out.println(b.getUI().getSession());

                }
            }));
            t.addItem(content.toArray(), "" + i);
        }
        t.setRowHeaderMode(Table.ROW_HEADER_MODE_ID);
        return t;
    }
View Full Code Here

        report.addStyleName(Reindeer.PANEL_LIGHT);
        report.setHeight(100, Sizeable.UNITS_PERCENTAGE);

        sp2.setFirstComponent(report);

        final Table table = TestForTablesInitialColumnWidthLogicRendering
                .getTestTable(5, 200);
        table.setPageLength(15);
        table.setSelectable(true);
        table.setRowHeaderMode(Table.ROW_HEADER_MODE_INDEX);
        table.setColumnCollapsingAllowed(true);
        table.setColumnReorderingAllowed(true);
        table.setSortDisabled(false);
        table.setSizeFull();
        table.addStyleName("table-inline");
        sp2.setSecondComponent(table);

        tab.addTab(new Label("Tab1"), "Summary", null);
        tab.addTab(sp2, "Reports", null);
        tab.addTab(new Label("Tab 3"), "Statistics", null);
View Full Code Here

public class TableFocusOnRefreshRowCache extends TestBase {

    @Override
    protected void setup() {
        final Table table = new Table();
        table.setSizeFull();
        table.addContainerProperty("Name", String.class, null);
        for (int i = 0; i < 200; i++) {
            table.addItem(new Object[] { "Item " + i }, i);
        }

        table.setSelectable(true);
        table.addListener(new ItemClickListener() {
            public void itemClick(ItemClickEvent event) {
                table.refreshRowCache();
            }
        });
        addComponent(table);
    }
View Full Code Here

        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) {
View Full Code Here

    static final String COUNT_OF_SELECTED_ROWS_LABEL = "label";

    @Override
    protected void setup(VaadinRequest request) {

        final Table table = new Table();
        table.setId(TABLE);
        table.setImmediate(true);
        table.setMultiSelect(true);
        table.setSelectable(true);
        table.addContainerProperty("row", String.class, null);
        addComponent(table);

        Button button = new Button("Count");
        button.setId(COUNT_SELECTED_BUTTON);
        addComponent(button);

        final Label label = new Label();
        label.setId(COUNT_OF_SELECTED_ROWS_LABEL);
        label.setCaption("Selected count:");
        addComponent(label);

        button.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(Button.ClickEvent event) {
                Set selected = (Set) table.getValue();
                label.setValue(String.valueOf(selected.size()));
            }
        });

        for (int i = 0; i < TOTAL_NUMBER_OF_ROWS; i++) {
            Object itemId = table.addItem();
            table.getContainerProperty(itemId, "row").setValue("row " + i);
        }
    }
View Full Code Here

public class TableSelectPagingOff extends TestBase {

    @Override
    protected void setup() {
        Table table = new Table();
        BeanItemContainer<MyBean> dataSource = new BeanItemContainer<MyBean>(
                getBeans());
        table.setContainerDataSource(dataSource);
        table.setSelectable(true);
        table.setPageLength(0);
        addComponent(table);
    }
View Full Code Here

    private static final int NUM_COLS = 16;

    @Override
    protected void setup() {
        Table table = new Table();
        table.setSizeFull();
        table.setColumnReorderingAllowed(true);

        for (int i = 0; i < NUM_COLS; ++i) {
            table.addContainerProperty("col-" + i, String.class, null);
        }

        addComponent(table);
    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Table

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.