Package com.vaadin.ui

Examples of com.vaadin.ui.Table$ColumnReorderEvent


    VerticalLayout layout;

    @Override
    public void setup() {

        table = new Table();
        table.addContainerProperty("test", String.class, null);
        table.setSizeFull();
        // bug: settings rows to 16 or more => last line is not rendered at all
        // on the client-side.
        final int maxRows = 16;
View Full Code Here


    private CheckBox tableCellItemDescription;
    private CheckBox tableRowItemDescription;

    @Override
    protected void setup(VaadinRequest request) {
        final Table table = createTable();
        table.setId("table");
        componentDescription = new CheckBox("Tooltip on components");
        componentDescription.addValueChangeListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                table.setContainerDataSource(createContainer(componentDescription
                        .getValue()));
            }
        });
        componentDescription.setImmediate(true);
        componentDescription.setValue(true);
        tableCellItemDescription = new CheckBox("Tooltip on table cells");
        tableCellItemDescription
                .addValueChangeListener(new ValueChangeListener() {

                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        table.refreshRowCache();
                    }
                });
        tableCellItemDescription.setImmediate(true);
        tableCellItemDescription.setValue(true);

        tableRowItemDescription = new CheckBox("Tooltip on table Rows");
        tableRowItemDescription
                .addValueChangeListener(new ValueChangeListener() {

                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        table.refreshRowCache();
                    }
                });
        tableRowItemDescription.setImmediate(true);
        tableRowItemDescription.setValue(true);

        addComponent(componentDescription);
        addComponent(tableCellItemDescription);
        addComponent(tableRowItemDescription);
        addComponent(table);

        table.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
            @Override
            public String generateDescription(Component source, Object itemId,
                    Object propertyId) {
                if (propertyId == null && tableRowItemDescription.getValue()) {
                    return "Row description " + itemId;
                } else if (tableCellItemDescription.getValue()) {
                    return "Cell description " + itemId + ", " + propertyId;
                }
                return null;
            }
        });

        table.addGeneratedColumn(GEN_WIDGET_PROPERTY_ID,
                new Table.ColumnGenerator() {

                    @Override
                    public Component generateCell(Table source, Object itemId,
                            Object columnId) {
View Full Code Here

        }
        return wrappedTracker;
    }

    private void blinkTable() {
        final Table table = new Table();
        table.setPageLength(5);
        table.addContainerProperty(new Object(), String.class, null);

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

        System.out.println("adding component");
        addComponent(table);
View Full Code Here

        p2l.setMargin(true);
        Panel p2 = new Panel("Table test (try dbl click also)", p2l);
        p2.setSizeFull();

        final VerticalLayout events2 = new VerticalLayout();
        Table table = TestForTablesInitialColumnWidthLogicRendering
                .getTestTable(5, 100);
        table.setRowHeaderMode(Table.ROW_HEADER_MODE_ID);
        table.addListener(new ItemClickEvent.ItemClickListener() {
            @Override
            public void itemClick(ItemClickEvent event) {
                events2.addComponent(new Label("Click:"
                        + (event.isDoubleClick() ? "double" : "single")
                        + " button:" + event.getButtonName() + " propertyId:"
View Full Code Here

        w.setContent(layout);
        createUI(layout);
    }

    private void createUI(GridLayout layout) {
        Table t = new Table("This is a table");
        t.addContainerProperty(P1, Component.class, null);
        t.addContainerProperty(P2, Component.class, null);
        t.setColumnHeaders(new String[] { "Col1", "Col2" });

        Item i = t.addItem("1");
        i.getItemProperty(P1).setValue(new TextField("abc"));
        i.getItemProperty(P2).setValue(new Label("label"));
        Item i2 = t.addItem("2");
        i2.getItemProperty(P1).setValue(new Button("def"));
        i2.getItemProperty(P2).setValue(new DateField());

        layout.addComponent(t);
    }
View Full Code Here

    private static final String COL1 = "COL1";

    @Override
    protected void setup(VaadinRequest request) {
        final Table table = new Table();
        table.addGeneratedColumn(COL1, new ColumnGenerator() {
            @Override
            public Object generateCell(Table source, Object itemId,
                    Object columnId) {
                TextField textField = new TextField();
                textField.setWidth("100%");
                return textField;
            }
        });

        table.addItem();

        table.setWidth("200px");
        table.setColumnWidth(COL1, 100);

        addComponent(table);
        addComponent(new Button("Increase width", new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                table.setColumnWidth(COL1, table.getColumnWidth(COL1) + 20);
                table.markAsDirty();
            }
        }));
        addComponent(new Button("Decrease width", new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                table.setColumnWidth(COL1, table.getColumnWidth(COL1) - 40);
                table.markAsDirty();
            }
        }));
    }
View Full Code Here

public class UncollapsedCollumnWidth extends TestBase {

    @Override
    protected void setup() {
        final Table table = new Table();
        table.addContainerProperty("Col1", String.class, "");
        table.addContainerProperty("Col2", String.class, "");
        table.setColumnCollapsingAllowed(true);
        table.setColumnCollapsed("Col2", true);

        table.setColumnWidth("Col1", 150);

        table.setWidth("400px");

        table.addItem(new Object[] { "Cell 1", "Cell 2" }, new Object());

        addComponent(table);
        addComponent(new Button("Uncollapse col2", new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                table.setColumnCollapsed("Col2", false);
            }
        }));
    }
View Full Code Here

@SuppressWarnings("serial")
public class MultiClickingItemThatDetachesTable extends TestBase {
    @Override
    public void setup() {
        final Table table = new Table();
        table.setImmediate(true);
        table.addContainerProperty("p1", String.class, "p1");
        table.addContainerProperty("p2", String.class, "p2");
        for (int i = 0; i < 200; ++i) {
            final Item item = table.getItem(table.addItem());
            item.getItemProperty("p2").setValue(i + "");
            item.getItemProperty("p1").setValue(i + "");
        }
        table.addListener(new ItemClickListener() {
            @Override
            public void itemClick(ItemClickEvent event) {
                if (event.isDoubleClick()) {
                    try {
                        // Wait a bit so there's time to click multiple times
View Full Code Here

            public void buttonClick(final ClickEvent event) {
                final Window window = new Window("Simple Window");
                window.setModal(true);
                window.setHeight("200px");
                window.setWidth("200px");
                final Table table = new Table();
                window.setContent(table);
                UI.getCurrent().addWindow(window);
                window.addCloseListener(new CloseListener() {
                    @Override
                    public void windowClose(final CloseEvent e) {
View Full Code Here

        private Filter filter = null;

        private boolean reduceData;

        private TestView() {
            final Table table = new Table();
            List<TestObject> data = createData(1000);
            final BeanItemContainer<TestObject> container = new BeanItemContainer<TestObject>(
                    TestObject.class, data) {

                @Override
                public int size() {
                    if (reduceData) {
                        return 100;
                    } else {
                        return super.size();
                    }
                }
            };
            table.setContainerDataSource(container);
            addComponent(table);
            final Label label = new Label();
            addComponent(label);
            Button button = new Button("Click");
            button.addListener(new Button.ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    try {
                        reduceData = !reduceData;
                        table.refreshRowCache();
                        label.setValue("Index: "
                                + table.getCurrentPageFirstItemIndex());
                    } catch (Exception e) {
                        label.setValue("Exception: "
                                + e.getClass().getSimpleName());
                    }
                }
            });
            addComponent(button);
            Button button2 = new Button("Filter");
            button2.addListener(new Button.ClickListener() {
                @Override
                public void buttonClick(ClickEvent event) {
                    try {
                        if (filter != null) {
                            container.removeAllContainerFilters();
                            filter = null;
                        } else {
                            filter = new DecimateFilter();
                            container.addContainerFilter(filter);
                        }
                        table.refreshRowCache();
                        label.setValue("Index: "
                                + table.getCurrentPageFirstItemIndex());
                    } catch (Exception e) {
                        label.setValue("Exception: "
                                + e.getClass().getSimpleName());
                    }
                }
View Full Code Here

TOP

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

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.