Package com.vaadin.ui

Examples of com.vaadin.ui.Table$HeaderClickEvent


    @Override
    protected void setup(VaadinRequest request) {
        VerticalLayout vl = new VerticalLayout();
        setContent(vl);

        final Table imageTable = new Table();
        vl.addComponent(imageTable);

        imageTable.setColumnHeaderMode(ColumnHeaderMode.HIDDEN);
        imageTable.setPageLength(1);
        imageTable.addGeneratedColumn("image", new ImageGenerator());
        imageTable.setWidth(500, Unit.PIXELS);

        for (int i = 1; i <= 25; i++) {
            imageTable.addItem(new Integer(i));
        }

        imageTable.setCurrentPageFirstItemIndex(index);

        vl.addComponent(new Button("Click", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                }
                if (index != 5) {
                    index = 5;
                    imageTable.setCurrentPageFirstItemIndex(index);
                } else {
                    index = 20;
                    imageTable.setCurrentPageFirstItemIndex(index);
                }
            }
        }));
    }
View Full Code Here


        column3Width.setCaption("Column 3 width");
        widths.addComponent(column3Width);

        addComponent(widths);

        Table table1 = initTable();
        addComponent(table1);

    }
View Full Code Here

    }

    private static final int ROWS = 100;

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

        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);
        column3Width.setValue(table.getColumnWidth("150pxfixedCol") + "px");

        table.addListener(new ColumnResizeListener() {
            @Override
            public void columnResize(com.vaadin.ui.Table.ColumnResizeEvent event) {

                if (event.getPropertyId().equals("firstname")) {
                    column1Width.setValue(event.getCurrentWidth()
View Full Code Here

            }
        });
        verticalLayout.addComponent(button);
        verticalLayout.addComponent(label1);

        Table table = new Table();
        table.addContainerProperty("Field", TextField.class, null);
        Object id = table.addItem();
        TextField tf = new TextField();
        table.getItem(id).getItemProperty("Field").setValue(tf);

        verticalLayout.addComponent(table);

        addComponent(verticalLayout);
View Full Code Here

        });
        return cb;
    }

    protected void recreateTable() {
        Table newTable = createTable(useCustomConverters.getValue(),
                (Locale) localeSelect.getValue());
        newTable.setEditable(editMode.getValue());
        if (table == null) {
            addComponent(newTable);
        } else {
            replaceComponent(table, newTable);
        }
View Full Code Here

        return bic;
    }

    protected Table createTable(boolean useCustomConverters, Locale locale) {
        Table t = new Table("Persons");
        t.setLocale(locale);
        t.setContainerDataSource(personBeanItemContainer);
        t.setSortDisabled(false);
        if (useCustomConverters) {
            addConverters(t);
        }
        t.setSelectable(true);
        t.setImmediate(true);
        t.addListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                log.log("Value is now: " + event.getProperty().getValue());
View Full Code Here

    private static final int ROWS = 20;
    private static final int COLS = 100;

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

        for (int i = 0; i < COLS; i++) {
            t.addContainerProperty("COLUMN_" + i, String.class, "");
        }
        for (int row = 0; row < ROWS; row++) {
            Item i = t.addItem(String.valueOf(row));
            for (int col = 0; col < COLS; col++) {
                Property<String> p = i.getItemProperty("COLUMN_" + col);
                p.setValue("item " + row + "/" + col);
            }
        }
        t.setFooterVisible(true);
        t.setSizeFull();
        addComponent(t);
    }
View Full Code Here

        mainLayout.setExpandRatio(table, 1);
        table.setSizeFull();
    }

    protected void populateAndConfigureTable() {
        table = new Table();

        table.setWidth("100%");
        table.setSelectable(true);
        table.setImmediate(true);
        table.setColumnCollapsingAllowed(true);
View Full Code Here

    public void init() {
        LegacyWindow mainWindow = new LegacyWindow(getClass().getName());
        setMainWindow(mainWindow);
        mainWindow.getContent().setSizeFull();

        t = new Table();
        t.setSizeFull();
        t.setSelectable(true);
        t.setContainerDataSource(buildContainer());
        mainWindow.addComponent(t);
        ((VerticalLayout) mainWindow.getContent()).setExpandRatio(t, 1);
View Full Code Here

        HorizontalLayout hl = new HorizontalLayout();

        container50 = createContainer(50);
        container2 = createContainer(2);

        table = new Table();
        table.setContainerDataSource(container2);
        table.setPageLength(10);

        VerticalLayout buttonLayout = new VerticalLayout();
        buttonLayout.setWidth(null);
View Full Code Here

TOP

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

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.