Search in sources :

Example 1 with IndexedContainer

use of com.vaadin.v7.data.util.IndexedContainer in project cuba by cuba-platform.

the class WebOptionsGroup method setOptionsToComponent.

protected void setOptionsToComponent(Stream<I> options) {
    List<I> itemIds = options.collect(Collectors.toList());
    component.setContainerDataSource(new IndexedContainer(itemIds));
}
Also used : IndexedContainer(com.vaadin.v7.data.util.IndexedContainer)

Example 2 with IndexedContainer

use of com.vaadin.v7.data.util.IndexedContainer in project cuba by cuba-platform.

the class CubaTreeTable method setContainerDataSource.

@Override
public void setContainerDataSource(Container newDataSource) {
    disableContentRefreshing();
    if (newDataSource == null || newDataSource instanceof IndexedContainer) {
        // if it is just created
        newDataSource = new NullTreeTableContainer(new HierarchicalContainer());
    } else if (!(newDataSource instanceof Container.Hierarchical)) {
        throw new IllegalArgumentException("CubaTreeTable supports only Container.Hierarchical");
    }
    super.setContainerDataSource(newDataSource);
}
Also used : AggregationContainer(com.haulmont.cuba.web.widgets.data.AggregationContainer) TreeTableContainer(com.haulmont.cuba.web.widgets.data.TreeTableContainer) HierarchicalContainer(com.vaadin.v7.data.util.HierarchicalContainer) TableSortableContainer(com.haulmont.cuba.web.widgets.data.TableSortableContainer) Container(com.vaadin.v7.data.Container) NullTreeTableContainer(com.haulmont.cuba.web.widgets.data.util.NullTreeTableContainer) IndexedContainer(com.vaadin.v7.data.util.IndexedContainer) IndexedContainer(com.vaadin.v7.data.util.IndexedContainer) HierarchicalContainer(com.vaadin.v7.data.util.HierarchicalContainer) NullTreeTableContainer(com.haulmont.cuba.web.widgets.data.util.NullTreeTableContainer)

Example 3 with IndexedContainer

use of com.vaadin.v7.data.util.IndexedContainer in project cuba by cuba-platform.

the class WebOptionsList method initComponent.

protected void initComponent(CubaListSelect component) {
    component.setContainerDataSource(new IndexedContainer());
    component.setItemCaptionGenerator(this::generateItemCaption);
    component.setRequiredError(null);
    component.setDoubleClickHandler(this::onDoubleClick);
    attachListener(component);
}
Also used : IndexedContainer(com.vaadin.v7.data.util.IndexedContainer)

Example 4 with IndexedContainer

use of com.vaadin.v7.data.util.IndexedContainer in project charts by vaadin.

the class TListUi method loadTestClasses.

private void loadTestClasses(TListUi aThis) {
    if (testClassess != null) {
        return;
    }
    testClassess = new IndexedContainer();
    testClassess.addContainerProperty("name", String.class, "");
    testClassess.addContainerProperty("description", String.class, "");
    testClassess.addContainerProperty("package", String.class, "");
    listTestClasses(testClassess, "area");
    listTestClasses(testClassess, "columnandbar");
    listTestClasses(testClassess, "combinations");
    listTestClasses(testClassess, "container");
    listTestClasses(testClassess, "dynamic");
    listTestClasses(testClassess, "lineandscatter");
    listTestClasses(testClassess, "other");
    listTestClasses(testClassess, "pie");
    listTestClasses(testClassess, "themes");
    listTestClasses(testClassess, "librarydata");
    listTestClasses(testClassess, "timeline");
    listTestClasses(testClassess, "threed");
    listTestClasses(testClassess, "declarative");
    listTestClasses(testClassess, "dataprovider");
    Table table = new Table("Test cases", testClassess);
    table.addGeneratedColumn("name", new Table.ColumnGenerator() {

        @Override
        public Object generateCell(Table source, Object itemId, Object columnId) {
            String name = (String) source.getItem(itemId).getItemProperty(columnId).getValue();
            String pack = (String) source.getItem(itemId).getItemProperty("package").getValue();
            Link link = new Link();
            link.setResource(new ExternalResource("/" + (pack != null ? pack + "/" : "") + name));
            link.setCaption(name);
            link.setTargetName("_new");
            return link;
        }
    });
    table.addGeneratedColumn("description", new Table.ColumnGenerator() {

        @Override
        public Object generateCell(Table source, Object itemId, Object columnId) {
            String description = (String) source.getItem(itemId).getItemProperty(columnId).getValue();
            return new Label(description);
        }
    });
    table.setSizeFull();
    table.setColumnExpandRatio("description", 1);
    VerticalLayout verticalLayout = new VerticalLayout();
    TextField filter = new TextField();
    filter.addTextChangeListener(new TextChangeListener() {

        @Override
        public void textChange(TextChangeEvent event) {
            String text = event.getText();
            testClassess.removeAllContainerFilters();
            testClassess.addContainerFilter("name", text, true, false);
        }
    });
    verticalLayout.addComponent(filter);
    filter.focus();
    verticalLayout.addComponent(table);
    setContent(verticalLayout);
}
Also used : Table(com.vaadin.v7.ui.Table) IndexedContainer(com.vaadin.v7.data.util.IndexedContainer) Label(com.vaadin.ui.Label) ExternalResource(com.vaadin.server.ExternalResource) TextChangeEvent(com.vaadin.v7.event.FieldEvents.TextChangeEvent) VerticalLayout(com.vaadin.ui.VerticalLayout) TextField(com.vaadin.v7.ui.TextField) TextChangeListener(com.vaadin.v7.event.FieldEvents.TextChangeListener) Link(com.vaadin.ui.Link)

Example 5 with IndexedContainer

use of com.vaadin.v7.data.util.IndexedContainer in project charts by vaadin.

the class TListUi method addTest.

@SuppressWarnings("unchecked")
private void addTest(Container indexedContainer, String simpleName, Class<?> forName, String subpackage) throws InstantiationException, IllegalAccessException {
    if (AbstractVaadinChartExample.class.isAssignableFrom(forName)) {
        AbstractVaadinChartExample newInstance = (AbstractVaadinChartExample) forName.newInstance();
        Object id = indexedContainer.addItem();
        Item item = indexedContainer.getItem(id);
        item.getItemProperty("name").setValue(simpleName);
        item.getItemProperty("description").setValue(newInstance.getDescription());
        item.getItemProperty("package").setValue(subpackage);
    }
}
Also used : Item(com.vaadin.v7.data.Item) AbstractVaadinChartExample(com.vaadin.addon.charts.examples.AbstractVaadinChartExample)

Aggregations

IndexedContainer (com.vaadin.v7.data.util.IndexedContainer)9 ContainerDataSeries (com.vaadin.v7.addon.charts.model.ContainerDataSeries)3 Item (com.vaadin.v7.data.Item)3 AggregationContainer (com.haulmont.cuba.web.widgets.data.AggregationContainer)1 TableSortableContainer (com.haulmont.cuba.web.widgets.data.TableSortableContainer)1 TreeTableContainer (com.haulmont.cuba.web.widgets.data.TreeTableContainer)1 NullTreeTableContainer (com.haulmont.cuba.web.widgets.data.util.NullTreeTableContainer)1 Chart (com.vaadin.addon.charts.Chart)1 AbstractVaadinChartExample (com.vaadin.addon.charts.examples.AbstractVaadinChartExample)1 Configuration (com.vaadin.addon.charts.model.Configuration)1 DataLabelsRange (com.vaadin.addon.charts.model.DataLabelsRange)1 PlotOptionsArea (com.vaadin.addon.charts.model.PlotOptionsArea)1 PlotOptionsColumnrange (com.vaadin.addon.charts.model.PlotOptionsColumnrange)1 Tooltip (com.vaadin.addon.charts.model.Tooltip)1 XAxis (com.vaadin.addon.charts.model.XAxis)1 YAxis (com.vaadin.addon.charts.model.YAxis)1 ExternalResource (com.vaadin.server.ExternalResource)1 Label (com.vaadin.ui.Label)1 Link (com.vaadin.ui.Link)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1