Package com.vaadin.ui

Examples of com.vaadin.ui.Table$FooterClickEvent


        addComponent(table1);

    }

    private Table initTable() {
        Table table = new Table();
        table.setWidth("100%");

        IndexedContainer idx = new IndexedContainer();
        idx.addContainerProperty("firstname", String.class, null);
        idx.addContainerProperty("lastname", String.class, null);
        Item i = idx.addItem(1);
        i.getItemProperty("firstname").setValue("John");
        i.getItemProperty("lastname").setValue("Johnson");
        i = idx.addItem(2);
        i.getItemProperty("firstname").setValue("Jane");
        i.getItemProperty("lastname").setValue("Janeine");

        for (int index = 3; index < ROWS; index++) {
            i = idx.addItem(index);
            i.getItemProperty("firstname").setValue("Jane");
            i.getItemProperty("lastname").setValue("Janeine");
        }

        idx.addContainerProperty("150pxfixedCol", String.class, "foobar");

        table.setContainerDataSource(idx);

        table.setColumnHeader("firstname", "FirstName");
        table.setColumnHeader("lastname", "LastName with long header");

        table.setColumnWidth("150pxfixedCol", 150);

        return table;
    }
View Full Code Here


        COLUMN1, COLUMN2
    }

    @Override
    protected void setup(VaadinRequest request) {
        final Table table = new Table("Ticket #8264 table");
        addComponent(table);

        table.setWidth("200px");
        table.setHeight("170px");
        table.setSelectable(true);
        table.setMultiSelect(true);
        table.setImmediate(true);

        // Create example data
        table.addContainerProperty(ItemProperty.COLUMN1, String.class, null);
        table.addContainerProperty(ItemProperty.COLUMN2, String.class, null);
        for (int i = 1; i < 100; i++) {
            table.addItem(new String[] { "Item " + i, null }, i);
        }

        // Add action button
        addComponent(new Button("Do It", new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                // Set ItemProperty.COLUMN2 for all selected values of table
                Collection selectedIds = (Collection) table.getValue();
                for (final Object itemId : selectedIds) {
                    final Property p = table.getItem(itemId).getItemProperty(
                            ItemProperty.COLUMN2);
                    if (p.getValue() instanceof String) {
                        p.setValue(null);
                    } else {
                        p.setValue("updated");
View Full Code Here

        final int NUMBER_OF_COLS = 50;

        // mainWindow.setSizeFull();
        // setMainWindow(mainWindow);

        Table ptable = new Table();
        for (int colcount = 0; colcount < NUMBER_OF_COLS; colcount++) {
            String col = "COL_" + colcount + "";
            ptable.addContainerProperty(col, String.class, "--");
            ptable.addItem(colcount + "-").getItemProperty(col)
                    .setValue("--" + colcount + "");
        }
        ptable.setSelectable(true);
        ptable.setMultiSelect(true);
        ptable.setColumnReorderingAllowed(false);
        ptable.setImmediate(true);

        ptable.setWidth("100%");
        ptable.setPageLength(5);

        VerticalLayout vl = new VerticalLayout();
        vl.addComponent(ptable);
        addComponent(vl);
    }
View Full Code Here

        beans.setBeanIdProperty("i");
        for (int i = 0; i < 2000; i++) {
            beans.addBean(new Bean(i));
        }

        final Table table = new Table("Beans", beans);
        table.setVisibleColumns(new Object[] { "i" });
        layout.addComponent(table);

        table.setCurrentPageFirstItemIndex(table.size() - 1);
    }
View Full Code Here

        constructTables((Layout) main.getContent());
    }

    private void constructTables(Layout layout) {

        Table t = createTable();
        layout.addComponent(t);
        t = createTable();
        Label l = new Label("A high label to enable scrollbars");
        l.setHeight("2000px");
        layout.addComponent(l);
View Full Code Here

        layout.addComponent(l);

    }

    private Table createTable() {
        Table t = new Table();
        t.addContainerProperty("test1", String.class, "");
        t.addContainerProperty("test2", String.class, "");
        t.addContainerProperty("test3", String.class, "");
        t.addContainerProperty("test4", String.class, "");
        t.setWidth("100%");
        t.setHeight("300px");
        for (int i = 0; i < 100; i++) {
            Item item = t.addItem(i);
            item.getItemProperty("test1").setValue("testing1 " + i);
            item.getItemProperty("test2").setValue("testing2 " + i);
            item.getItemProperty("test3").setValue("testing3 " + i);
            item.getItemProperty("test4").setValue("testing4 " + i);
        }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    @Override
    protected void setup(VaadinRequest request) {
        final Table table = new Table();
        table.setHeight("500px");
        table.setSelectable(true);
        table.setNullSelectionAllowed(true);
        table.addContainerProperty("Column 1", String.class, "");
        table.addContainerProperty("Column 2", Component.class, "");
        table.addContainerProperty("Column 3", Component.class, "");
        table.addContainerProperty("Column 4", Component.class, "");

        Item item = table.addItem("Item 1 (row 1)");
        item.getItemProperty("Column 1").setValue("String A");
        item.getItemProperty("Column 2").setValue(new Label("Label A"));
        item.getItemProperty("Column 3").setValue(
                new Label("<b>Label A</b>", ContentMode.HTML));
        VerticalLayout l = new VerticalLayout();
        l.setId("row-1");
        l.setHeight(100, Unit.PIXELS);
        item.getItemProperty("Column 4").setValue(l);

        item = table.addItem("Item 2 (row 2)");
        item.getItemProperty("Column 1").setValue("String B");
        item.getItemProperty("Column 2").setValue(new Label("Label B"));
        item.getItemProperty("Column 3")
                .setValue(
                        new Label(
                                "<a style=\"color: blue\" href=\"javascript:false\">Label B</a>",
                                ContentMode.HTML));
        l = new VerticalLayout();
        l.setId("row-2");
        l.setSizeFull();
        item.getItemProperty("Column 4").setValue(l);

        Button clear = new Button("Clear");
        clear.setId(CLEAR_BUTTON_ID);
        clear.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                table.setValue(null);
            }
        });
        addComponent(table);
        addComponent(clear);
    }
View Full Code Here

    protected void setup(VaadinRequest request) {
        final BeanItemContainer<TableItem> cont = new BeanItemContainer<TableItem>(
                TableItem.class);
        final List<TableItem> restoringItemList = new ArrayList<TableItem>();

        final Table table = new Table();
        table.setWidth("400px");
        table.setPageLength(-1);
        table.setContainerDataSource(cont);
        table.setSelectable(true);

        Button buttonRestore = new Button("Restore table rows");
        buttonRestore.setId("buttonRestore");
        buttonRestore.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
                cont.removeAllItems();
                cont.addAll(restoringItemList);
            }
        });

        Button buttonReAddAllViaAddAll = new Button("Re-add rows all at once");
        buttonReAddAllViaAddAll.setId("buttonReAddAllViaAddAll");
        buttonReAddAllViaAddAll.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
                List<TableItem> originalItemIds = new ArrayList<TableItem>(cont
                        .getItemIds());
                cont.removeAllItems();
                cont.addAll(originalItemIds);
            }
        });

        Button buttonReplaceByAnotherCollectionViaAddAll = new Button(
                "Replace by another items (via addAll())");
        buttonReplaceByAnotherCollectionViaAddAll
                .setId("buttonReplaceByAnotherCollectionViaAddAll");
        buttonReplaceByAnotherCollectionViaAddAll
                .addClickListener(new ClickListener() {

                    @Override
                    public void buttonClick(
                            com.vaadin.ui.Button.ClickEvent event) {
                        cont.removeAllItems();
                        // create new collection (of different items) with other
                        // size
                        List<TableItem> itemList = new ArrayList<TableItem>();
                        for (int i = 0; i < 79; i++) {
                            TableItem ti = new TableItem();
                            ti.setName("AnotherItem1_" + i);
                            itemList.add(ti);
                        }
                        cont.addAll(itemList);
                    }
                });

        Button buttonReplaceByAnotherCollectionViaAdd = new Button(
                "Replace by another items (via add(), add()..)");
        buttonReplaceByAnotherCollectionViaAdd
                .setId("buttonReplaceByAnotherCollectionViaAdd");
        buttonReplaceByAnotherCollectionViaAdd
                .addClickListener(new ClickListener() {

                    @Override
                    public void buttonClick(
                            com.vaadin.ui.Button.ClickEvent event) {
                        cont.removeAllItems();
                        for (int i = 0; i < 81; i++) {
                            TableItem ti = new TableItem();
                            ti.setName("AnotherItem2_" + i);
                            // add one by one in container
                            cont.addBean(ti);
                        }
                    }
                });

        Button buttonReplaceBySubsetOfSmallerSize = new Button(
                "Replace rows by sub-set of smaller size (size not enought for restoring scroll position)");
        buttonReplaceBySubsetOfSmallerSize
                .setId("buttonReplaceBySubsetOfSmallerSize");
        buttonReplaceBySubsetOfSmallerSize
                .addClickListener(new ClickListener() {

                    @Override
                    public void buttonClick(
                            com.vaadin.ui.Button.ClickEvent event) {
                        cont.removeAllItems();
                        cont.addAll(restoringItemList.subList(0, 20));
                    }
                });

        Button buttonReplaceByWholeSubsetPlusOneNew = new Button(
                "Replace rows by whole subset plus one new item");
        buttonReplaceByWholeSubsetPlusOneNew
                .setId("buttonReplaceByWholeSubsetPlusOneNew");
        buttonReplaceByWholeSubsetPlusOneNew
                .addClickListener(new ClickListener() {

                    @Override
                    public void buttonClick(
                            com.vaadin.ui.Button.ClickEvent event) {
                        cont.removeAllItems();

                        List<TableItem> list = new ArrayList<TableItem>(
                                restoringItemList);
                        TableItem ti = new TableItem();
                        ti.setName("AnotherItem3_" + 80);
                        list.add(ti);
                        cont.addAll(list);
                    }
                });

        Button buttonRemoveAllAddOne = new Button(
                "Remove all items and add only one new item");
        buttonRemoveAllAddOne.setId("buttonRemoveAllAddOne");
        buttonRemoveAllAddOne.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
                cont.removeAllItems();
                TableItem ti = new TableItem();
                ti.setName("Item_" + 20);
                cont.addBean(ti);
            }
        });

        // This should be the last test as it changes the table datasource
        Button buttonReplaceByNewDatasource = new Button(
                "Remove all items and add new datasource");
        buttonReplaceByNewDatasource.setId("buttonReplaceByNewDatasource");
        buttonReplaceByNewDatasource.addClickListener(new ClickListener() {

            @Override
            public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
                cont.removeAllItems();
                BeanItemContainer<TableItem> newContainer = new BeanItemContainer<TableItem>(
                        TableItem.class);
                for (int i = 0; i < 50; i++) {
                    TableItem ti = new TableItem();
                    ti.setName("Item_" + i);
                    newContainer.addBean(ti);
                }
                table.setContainerDataSource(newContainer);
            }
        });

        for (int i = 0; i < 80; i++) {
            TableItem ti = new TableItem();
View Full Code Here

    @Override
    public void init() {
        LegacyWindow mainw = new LegacyWindow();
        setMainWindow(mainw);
        mainLo = (VerticalLayout) mainw.getContent();
        table = new Table();
        for (int i = 0; i < 10000; i++) {
            table.addItem(i);
        }
        TestColumnGenerator cgen = new TestColumnGenerator();
        table.addGeneratedColumn("col1", cgen);
View Full Code Here

        HorizontalLayout hl = new HorizontalLayout();
        hl.setSizeFull();
        hl.setId(which + "Layout");

        Table t = new Table();
        t.addContainerProperty("name", String.class, null);
        for (int i = 0; i < 10; i++) {
            String id = which + " " + i;
            t.addItem(new String[] { id }, id);
        }
        t.setId(which + "Table");
        t.setItemCaptionPropertyId("name");
        t.setSizeFull();

        hl.addComponent(t);

        return hl;
    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Table$FooterClickEvent

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.