use of com.vaadin.v7.event.FieldEvents.TextChangeListener 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);
}
Aggregations