Package com.vaadin.ui

Examples of com.vaadin.ui.Table$ColumnGenerator


        text.addStyleName(Bootstrap.Typography.TEXT_INFO.styleName());
        container.addComponent(text);
    }

    private void tables(CssLayout container) {
        Table table = getSampleTable("");
        container.addComponent(table);

        table = getSampleTable("Striped");
        table.addStyleName(Bootstrap.Tables.STRIPED.styleName());
        container.addComponent(table);

        table = getSampleTable("Bordered");
        table.addStyleName(Bootstrap.Tables.BORDERED.styleName());
        container.addComponent(table);

        table = getSampleTable("Hover rows");
        table.addStyleName(Bootstrap.Tables.HOVER.styleName());
        container.addComponent(table);

        table = getSampleTable("Condensed");
        table.addStyleName(Bootstrap.Tables.CONDENSED.styleName());
        container.addComponent(table);
    }
View Full Code Here


        table.addStyleName(Bootstrap.Tables.CONDENSED.styleName());
        container.addComponent(table);
    }

    private Table getSampleTable(String caption) {
        Table table = new Table(caption);
        table.setWidth("100%");
        table.setHeight(null);
        table.setPageLength(0);
        table.setRowHeaderMode(RowHeaderMode.INDEX);

        table.addContainerProperty("First Name", String.class, null);
        table.addContainerProperty("Last Name", String.class, null);
        table.addContainerProperty("Username", String.class, null);

        table.addItem(new Object[] { "Mark", "Otto", "@mdo" }, "mark");
        table.addItem(new Object[] { "Jacob", "Thornton", "@fat" }, "jacob");
        table.addItem(new Object[] { "Larry", "the Bird", "@twitter" }, "larry");
        return table;
    }
View Full Code Here

            AssetOwnedDailyId id = ((Property<AssetOwnedDailyId>) screen.getControl(AnyParticipantSelector.class)).getValue();

            if (marketDay != null && id != null) {
                try {
                    List<DSRUpdateDTO> dsrUpdateHourlies = dsrService.getDSRHourly(SSTimeUtil.dateToDateTime(marketDay), id.getAssetOwner());
                    new Table();
                    // should only ever have one
                    if (CollectionUtils.isNotEmpty(dsrUpdateHourlies)) {
                        getView().populateGrid(dsrUpdateHourlies.get(0).getRecords());
                    } else {
                        getView().populateGrid(null);
View Full Code Here

    /**
     * Populates this grid with data
     * @param data any list of transfer objects
     */
    public void populateGrid(List<DTO> data) {
        populateGrid(data, (T) new Table());
    }
View Full Code Here

        final BeanContainer<String, Task> beans = new BeanContainer<String, Task>(Task.class);
        beans.setBeanIdProperty("id");

        final Form form = new Form();
        form.setLocale(Locale.GERMAN);
        final Table table = new Table(this.title, beans);
        MenuBar menu = createMenuBar(beans, table);
        layout.addComponent(menu);
       
        table.setSelectable(true);
        table.setImmediate(true);
        table.setVisibleColumns(VISIBLE_COLUMNS);
        table.addListener(new Property.ValueChangeListener() {
            public void valueChange(ValueChangeEvent event) {
                Object selectedId = table.getValue();
                @SuppressWarnings("unchecked")
                BeanItem<Task> item = (BeanItem<Task>) table.getItem(selectedId);
                form.setItemDataSource(item);
                form.setVisibleItemProperties(VISIBLE_COLUMNS);
           }
        });
        update(beans);
        layout.addComponent(table);

        Object first = table.getItemIds().iterator().next();
        Item item = table.getItem(first);
        form.setItemDataSource(item);

        form.setCaption("Edit Task");
        form.setVisibleItemProperties(VISIBLE_COLUMNS);
        form.setImmediate(true);
View Full Code Here

        VerticalLayout hl = new VerticalLayout();
        hl.setWidth("400px");
        main.setContent(hl);

        Table t = new Table();
        t.setWidth("100%");

        t.addContainerProperty("Prop 1", VerticalLayout.class, "");
        t.addContainerProperty("Prop 2", String.class, "");
        t.addContainerProperty("Prop 3", String.class, "");
        t.addContainerProperty("Prop 4", String.class, "");
        t.addContainerProperty("Prop 5", Button.class, "");

        t.setPageLength(3);

        for (int i = 0; i < 10; i++) {

            VerticalLayout vl = new VerticalLayout();
            // vl.setWidth(null);
            Button b = new Button("String 1 2 3");
            b.setStyleName(BaseTheme.BUTTON_LINK);
            vl.addComponent(b);
            t.addItem(new Object[] { vl, "String 2", "String 3", "String 4",

            new Button("String 5") }, new Integer(new Random().nextInt()));

        }
View Full Code Here

    }

    private static class TestView extends HorizontalLayout {

        TestView() {
            Table table = new Table();
            List<Person> data = createData();
            BeanItemContainer<Person> container = new BeanItemContainer<Person>(
                    Person.class, data) {

                @Override
                public Person getIdByIndex(int index) {
                    try {
                        // Simulate some loading delay with some exaggeration
                        // to make easier to reproduce
                        Thread.sleep(50);
                    } catch (InterruptedException e) {
                        Thread.currentThread().interrupt();
                        throw new RuntimeException(e);
                    }
                    return super.getIdByIndex(index);
                }
            };
            table.setContainerDataSource(container);
            addComponent(table);
        }
View Full Code Here

    }

    @Override
    protected void setup(VaadinRequest request) {
        Table t = new Table("Table with 1000 item");
        t.addGeneratedColumn("Actions", new Table.ColumnGenerator() {
            @Override
            public Component generateCell(final Table source,
                    final Object itemId, final Object columnId) {
                Button tripFolderLink = new Button("Button" + itemId);
                tripFolderLink.addClickListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(final ClickEvent event) {
                        log.log("Button " + event.getButton().getCaption()
                                + " clicked");
                    }
                });
                tripFolderLink.setStyleName(Reindeer.BUTTON_SMALL);
                return tripFolderLink;
            }
        });

        for (int i = 0; i < 1000; i++) {
            MyEntity myEntity = new MyEntity(i + "st");
            myEntity.setCreated(new Date(new Date().getTime() - 24 * 60 * 60
                    * 1000L));
            myEntity.setId(i);
            container.addBean(myEntity);
        }

        t.setContainerDataSource(container);
        t.setVisibleColumns(new Object[] { "id", "created", "name", "Actions" });

        addComponent(t);
        addComponent(log);

        t.sort(new Object[] { "id" }, new boolean[] { false });

    }
View Full Code Here

        ValueHolder<String> v2 = new ValueHolder<String>("test2");
        ValueHolder<String> v3 = new ValueHolder<String>("test3");
        @SuppressWarnings("unchecked")
        final BeanItemContainer<ValueHolder<String>> bic = new BeanItemContainer<ValueHolder<String>>(
                Arrays.asList(v1, v2, v3));
        final Table t = new Table(null, bic);
        t.setSelectable(true);
        t.setMultiSelect(false);
        t.setWidth(200, Sizeable.UNITS_PIXELS);
        t.setHeight(100, Sizeable.UNITS_PIXELS);
        t.select(v1);
        t.focus();
        t.setMultiSelect(true);

        getLayout().addComponent(t);
        getLayout().addComponent(
                new Button("Change elements and selection",
                        new ClickListener() {

                            @Override
                            public void buttonClick(ClickEvent event) {

                                bic.removeAllItems();
                                ValueHolder<String> v4 = null;
                                for (int i = 4; i < 30; i++) {
                                    v4 = new ValueHolder<String>("test" + i);
                                    bic.addBean(v4);

                                }
                                t.select(t.firstItemId());
                                t.focus();
                            }
                        }));
    }
View Full Code Here

            select = new NativeSelect();
        } else if (fieldType.isAssignableFrom(OptionGroup.class)) {
            select = new OptionGroup();
            select.setMultiSelect(false);
        } else if (fieldType.isAssignableFrom(Table.class)) {
            Table t = new Table();
            t.setSelectable(true);
            select = t;
        } else {
            select = new ComboBox(null);
        }
        select.setImmediate(true);
View Full Code Here

TOP

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

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.