Package com.vaadin.tests.components.table

Source Code of com.vaadin.tests.components.table.ColumnGeneratorAddingOrder

package com.vaadin.tests.components.table;

import com.vaadin.data.util.IndexedContainer;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Component;
import com.vaadin.ui.Table;

public class ColumnGeneratorAddingOrder extends TestBase {

    @Override
    protected Integer getTicketNumber() {
        return 2457;
    }

    @Override
    protected String getDescription() {
        return "Column generator must be allowed to be added both before and after data source setting and overriding should work. Bugs in 5.3-rc7 if added after DS.";
    }

    @Override
    protected void setup() {
        Table t = new Table();

        t.addGeneratedColumn("col2", new Table.ColumnGenerator() {
            @Override
            public Component generateCell(Table source, Object itemId,
                    Object columnId) {
                return new Button("generated b c2");
            }
        });

        IndexedContainer c = new IndexedContainer();
        c.addContainerProperty("col1", String.class, "col1 ds data");
        c.addContainerProperty("col2", String.class, "col2 ds data");
        c.addContainerProperty("col3", String.class, "col3 ds data");
        for (int i = 0; i < 100; i++) {
            c.addItem();
        }
        t.setContainerDataSource(c);

        t.addGeneratedColumn("col1", new Table.ColumnGenerator() {
            @Override
            public Component generateCell(Table source, Object itemId,
                    Object columnId) {
                return new Button("generated b c1");
            }
        });

        getLayout().addComponent(t);

    }

}
TOP

Related Classes of com.vaadin.tests.components.table.ColumnGeneratorAddingOrder

TOP
Copyright © 2018 www.massapi.com. 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.