use of com.vaadin.v7.ui.TextField 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.ui.TextField in project charts by vaadin.
the class ChartsDemoUI method init.
@Override
protected void init(VaadinRequest request) {
initGATracker();
tabSheet = new TabSheet();
tabSheet.addSelectedTabChangeListener(new TabSheet.SelectedTabChangeListener() {
@Override
public void selectedTabChange(TabSheet.SelectedTabChangeEvent event) {
com.vaadin.ui.JavaScript.eval("setTimeout(function(){prettyPrint();},300);");
}
});
tabSheet.setSizeFull();
tabSheet.addStyleName(ValoTheme.TABSHEET_PADDED_TABBAR);
Link homepage = new Link("Home page", new ExternalResource("https://vaadin.com/add-ons/charts"));
Link javadoc = new Link("JavaDoc", new ExternalResource("http://demo.vaadin.com/javadoc/com.vaadin/vaadin-charts/" + getVersion() + "/"));
Link manual = new Link("Manual", new ExternalResource("https://vaadin.com/docs/-/part/charts/charts-overview.html"));
Label version = new Label("Version " + getVersion());
version.addStyleName("version");
HorizontalLayout links = new HorizontalLayout(homepage, javadoc, manual);
links.setSpacing(true);
links.addStyleName("links");
final HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
horizontalSplitPanel.setSecondComponent(tabSheet);
horizontalSplitPanel.setSplitPosition(300, Unit.PIXELS);
horizontalSplitPanel.addStyleName("main-layout");
ChartOptions.get().setTheme(new ValoLightTheme());
themeSelector = new ComboBox("Charts Theme:");
themeSelector.addStyleName("theme-selector");
themeSelector.addStyleName(ValoTheme.COMBOBOX_SMALL);
themeSelector.setTextInputAllowed(false);
com.vaadin.addon.charts.model.style.Theme defaultTheme = new ValoLightTheme();
Map<com.vaadin.addon.charts.model.style.Theme, String> mapThemes = new HashMap<>();
com.vaadin.addon.charts.model.style.Theme[] themes = new com.vaadin.addon.charts.model.style.Theme[] { defaultTheme, new ValoDarkTheme(), new VaadinTheme(), new HighChartsDefaultTheme(), new GridTheme(), new GrayTheme(), new SkiesTheme() };
mapThemes.put(themes[0], "Valo Light");
mapThemes.put(themes[1], "Valo Dark");
mapThemes.put(themes[2], "Vaadin");
mapThemes.put(themes[3], "HighCharts");
mapThemes.put(themes[4], "Grid");
mapThemes.put(themes[5], "Gray");
mapThemes.put(themes[6], "Skies");
themeSelector.setEmptySelectionAllowed(false);
themeSelector.setItems(themes);
themeSelector.setSelectedItem(defaultTheme);
themeSelector.setItemCaptionGenerator(mapThemes::get);
themeSelector.addSelectionListener(e -> {
ChartOptions.get().setTheme(e.getValue());
});
final HierarchicalContainer container = getContainer();
VerticalLayout content = new VerticalLayout();
content.setSpacing(true);
content.setMargin(false);
Label logo = new Label("Vaadin Charts");
logo.setWidth("100%");
logo.addStyleName("h3");
logo.addStyleName("logo");
TextField filterField = new TextField();
filterField.setPlaceholder("Filter examples");
filterField.setIcon(FontAwesome.SEARCH);
filterField.addStyleName("filter");
filterField.setWidth("100%");
filterField.addValueChangeListener(e -> {
container.removeAllContainerFilters();
String text = e.getValue();
if (text != null && !text.isEmpty()) {
expandForFiltering();
container.addContainerFilter("searchName", text, true, false);
} else {
restoreExpandedStates();
}
});
tree = new Tree();
tree.setImmediate(true);
tree.setContainerDataSource(container);
tree.setItemCaptionPropertyId("displayName");
tree.setNullSelectionAllowed(false);
tree.setWidth("100%");
tree.addValueChangeListener(new Property.ValueChangeListener() {
@Override
public void valueChange(Property.ValueChangeEvent event) {
Object value = event.getProperty().getValue();
if (value instanceof Class) {
updateTabSheet((Class) value);
} else {
tree.expandItemsRecursively(value);
}
}
});
Button feedback = new Button("Got feedback?", FontAwesome.COMMENTING_O);
feedback.addStyleName("feedback-button");
feedback.addStyleName(ValoTheme.BUTTON_PRIMARY);
feedback.addStyleName(ValoTheme.BUTTON_TINY);
feedback.addClickListener(e -> {
getUI().addWindow(new FeedbackForm());
});
content.addComponents(logo, links, feedback, filterField, tree, version);
content.setComponentAlignment(feedback, Alignment.MIDDLE_CENTER);
horizontalSplitPanel.setFirstComponent(content);
selectItem();
Page.getCurrent().addUriFragmentChangedListener(new Page.UriFragmentChangedListener() {
@Override
public void uriFragmentChanged(Page.UriFragmentChangedEvent event) {
selectItem();
}
});
setContent(new CssLayout() {
{
setSizeFull();
addComponent(horizontalSplitPanel);
addComponent(themeSelector);
}
});
if (tracker != null) {
tracker.trackPageview("/charts");
}
}
Aggregations