Package com.vaadin.ui

Examples of com.vaadin.ui.Table


                });

        layout.addComponent(b);

        t = new Table("A table");
        prop = new ObjectProperty<String>(valueDataSource);
        t.setPropertyDataSource(prop);
        t.setSelectable(true);
        t.setImmediate(true);
        t.setPageLength(5);
View Full Code Here


                });

    }

    protected Table createTable() {
        return new Table();
    }
View Full Code Here

     * VaadinRequest)
     */
    @Override
    protected void setup(VaadinRequest request) {

        final Table table = new Table();
        table.addContainerProperty("", Integer.class, null);
        table.setSizeFull();
        table.setMultiSelect(true);
        table.setNullSelectionAllowed(true);
        table.setSelectable(true);

        CheckBox selectAllCheckbox = new CheckBox("Select All");
        selectAllCheckbox.addValueChangeListener(new ValueChangeListener() {
            @Override
            public void valueChange(
                    com.vaadin.data.Property.ValueChangeEvent event) {
                Object checked = event.getProperty().getValue();
                if (checked instanceof Boolean) {
                    if (((Boolean) checked).booleanValue()) {
                        table.setValue(table.getItemIds());
                    } else {
                        table.setValue(null);
                    }
                }
            }
        });

        for (int i = 0; i < 200; i++) {
            table.addItem(new Object[] { new Integer(i) }, new Integer(i));
        }

        table.setCurrentPageFirstItemIndex(185);

        final CssLayout layout = new CssLayout();
        layout.addComponent(selectAllCheckbox);
        layout.addComponent(table);
        layout.setSizeFull();
View Full Code Here

                @Override
                public void buttonClick(ClickEvent event) {
                    try {
                        me.removeComponent(testTable);

                        testTable = new Table();
                        createContainers();
                        testTable.setContainerDataSource(containerA);

                        me.addComponent(testTable);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });
            this.addComponent(clearButton);

            testTable = new Table();
            this.addComponent(testTable);

            createContainers();
            testTable.setContainerDataSource(containerA);
        }
View Full Code Here

        HorizontalLayout visibilities = new HorizontalLayout();
        visibilities.setSpacing(true);
        addComponent(visibilities);

        final Table tbl = new Table("", createDataSource());
        tbl.setImmediate(true);
        tbl.setColumnCollapsingAllowed(true);

        log = new Log(5);

        controls.addComponent(new Button("Fixed size (200x200)",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        tbl.setWidth("200px");
                        tbl.setHeight("200px");
                        log.log("Size 200x200 pixels");
                    }
                }));

        controls.addComponent(new Button("Fixed size (600x200)",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        tbl.setWidth("600px");
                        tbl.setHeight("200px");
                        log.log("Size 600x200 pixels");
                    }
                }));

        controls.addComponent(new Button("Undefined size",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        tbl.setSizeUndefined();
                        log.log("Size undefined");
                    }
                }));

        NativeSelect pageLength = new NativeSelect("PageLength", Arrays.asList(
                0, 1, 2, 4, 8, 10));
        pageLength.setImmediate(true);
        pageLength.setNullSelectionAllowed(false);
        pageLength.addListener(new Property.ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                int pageLength = Integer.valueOf(event.getProperty().getValue()
                        .toString());
                tbl.setPageLength(pageLength);
                log.log("Page length: " + pageLength);
            }
        });
        controls.addComponent(pageLength);

        CheckBox cb = new CheckBox("Column 1");
        cb.setValue(true);
        cb.addListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                Boolean value = (Boolean) event.getProperty().getValue();
                tbl.setColumnCollapsed("Column 1", !value);
                if (value) {
                    log.log("Column 1 visible");
                } else {
                    log.log("Column 1 hidden");
                }
            }
        });
        cb.setImmediate(true);
        visibilities.addComponent(cb);

        cb = new CheckBox("Column 2");
        cb.setValue(true);
        cb.addListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                Boolean value = (Boolean) event.getProperty().getValue();
                tbl.setColumnCollapsed("Column 2", !value);

                if (value) {
                    log.log("Column 2 visible");
                } else {
                    log.log("Column 2 hidden");
                }
            }
        });
        cb.setImmediate(true);
        visibilities.addComponent(cb);

        cb = new CheckBox("Column 3");
        cb.setValue(true);
        cb.addListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                Boolean value = (Boolean) event.getProperty().getValue();

                tbl.setColumnCollapsed("Column 3", !value);

                if (value) {
                    log.log("Column 3 visible");
                } else {
                    log.log("Column 3 hidden");
View Full Code Here

        container.addContainerProperty("integer", Integer.class, 5);

        container.addItem();
        container.addItem();

        Table t1 = new Table(
                "Editable table with bells and wistles. See description.");
        t1.setDescription("Opening combobox should never fire table"
                + " refresh (for this table). Update from textfield "
                + "(integer) may be sent to server however. The readonly table"
                + " my refresh, but not this one.");
        t1.setPageLength(0);
        t1.setContainerDataSource(container);
        t1.addGeneratedColumn("integer x 3", multiplier);
        t1.setTableFieldFactory(ff);
        t1.setEditable(true);
        t1.setId("editortable");

        Table t2 = new Table(
                "A clone of table1, but disabled. Properties are in components.");
        t2.setDescription("This table is in editable mode."
                + " Updates to common datasource should not affect redraw for this "
                + "table. Only the components inside table should get updated.");
        t2.setTableFieldFactory(ff);
        t2.setEditable(true);
        t2.setEnabled(false);
        t2.setContainerDataSource(container);
        t2.addGeneratedColumn("integer x 3", multiplier);
        t2.setPageLength(0);
        t2.setId("disabled table");

        Table reader = new Table("Reader table");
        reader.setDescription("This table should be redrawn on container changes as container data is "
                + "displayed directly in cells.");
        reader.setContainerDataSource(container);
        reader.addGeneratedColumn("integer x 3", multiplier);
        reader.setPageLength(0);
        reader.setId("reader table");

        getLayout().addComponent(t1);
        getLayout().addComponent(t2);
        getLayout().addComponent(reader);
        getLayout().addComponent(new Button("Sync!"));
View Full Code Here

        ValueChangeListener update = new ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                if (table == null) {
                    table = new Table();
                    table.setContainerDataSource(normalContainer);
                    addComponent(table);
                }
                if (hierarchical.getValue() && table instanceof Table) {
                    removeComponent(table);
                    table = new TreeTable();
                    table.setContainerDataSource(hierarchicalContainer);
                    addComponent(table);
                } else if (!hierarchical.getValue()
                        && table instanceof TreeTable) {
                    removeComponent(table);
                    table = new Table();
                    table.setContainerDataSource(normalContainer);
                    addComponent(table);
                }

                configure(table, footer.getValue(), sized.getValue(),
View Full Code Here

        });
        form.setItemDataSource(new BeanItem<MyBean>(new MyBean()));
        content.addComponent(form);

        table = new Table("Enabled");
        table.setPageLength(7);
        table.addContainerProperty("Text", String.class, null);
        for (int i = 0; i < 150; i++) {
            Item item = table.addItem("Item" + i);
            Property<String> p = item.getItemProperty("Text");
View Full Code Here

        datasource.addContainerProperty("value", Integer.class, -1);
        for (int i = 0; i < totalRows; i++) {
            addRow(datasource);
        }

        final Table table = new Table();
        table.setContainerDataSource(datasource);
        layout.addComponent(table);
        addComponent(layout);

        final Label label = new Label("");
        layout.addComponent(label);

        NativeButton addRowButton = new NativeButton("Add row",
                new NativeButton.ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {
                        addRow(datasource);
                    }
                });

        NativeButton jumpToLastRowButton = new NativeButton("Jump to last row",
                new NativeButton.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        jumpToLastRow(table);
                    }
                });
        NativeButton jumpTo15thRowButton = new NativeButton("Jump to 15th row",
                new NativeButton.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        jumpToFifteenthRow(table);
                    }
                });
        NativeButton jumpToFirstRowButton = new NativeButton(
                "Jump to first row", new NativeButton.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        jumpToFirstRow(table);
                    }
                });

        NativeButton updateLabelButton = new NativeButton("UpdateLabel",
                new NativeButton.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        label.setValue(Integer.toString(table
                                .getCurrentPageFirstItemIndex()));
                    }
                });
        layout.addComponent(addRowButton);
        layout.addComponent(jumpToLastRowButton);
View Full Code Here

    private static final int ROWS = 100;

    @Override
    public void setup() {
        Table table1 = initTable();
        addComponent(new Label("Plain table"));
        addComponent(table1);

    }
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.