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));
}
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);
}
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);
}
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);
}
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);
}
}
Aggregations