use of com.vaadin.flow.component.combobox.ComboBox in project flow-components by vaadin.
the class LazyLoadingPage method createComboBoxWithCustomPageSize.
private void createComboBoxWithCustomPageSize() {
addTitle("ListDataProvider with custom page size 180");
ComboBox<String> comboBox = new ComboBox<>(180);
comboBox.setId("pagesize");
comboBox.setDataProvider(DataProvider.ofCollection(generateStrings(1000)));
NativeButton pageSizeButton = new NativeButton("set pagesize 100", e -> comboBox.setPageSize(100));
pageSizeButton.setId("change-pagesize");
add(comboBox, pageSizeButton);
}
use of com.vaadin.flow.component.combobox.ComboBox in project flow-components by vaadin.
the class LazyLoadingPage method createComboBoxWithCustomPageSizeAndLazyLoading.
private void createComboBoxWithCustomPageSizeAndLazyLoading() {
addTitle("Callback data provider with custom page size 42");
ComboBox<String> comboBox = new ComboBox<>(42);
comboBox.setId("lazy-custom-page-size");
comboBox.setDataProvider(DataProvider.fromFilteringCallbacks(query -> {
Stream<String> stream = IntStream.range(0, 500).mapToObj(String::valueOf);
message.setText(String.valueOf(query.getPageSize()));
return stream.skip(query.getOffset()).limit(query.getLimit());
}, query -> 500));
NativeButton changePageSizeButton = new NativeButton("Change page size", event -> comboBox.setPageSize(41));
changePageSizeButton.setId("change-page-size-button");
add(comboBox, changePageSizeButton);
}
use of com.vaadin.flow.component.combobox.ComboBox in project flow-components by vaadin.
the class RefreshDataProviderPage method createRefreshAll.
private void createRefreshAll() {
NativeButton update = new NativeButton("Update");
update.addClickListener(event -> addNames());
update.setId("update");
ComboBox<String> nameSelection = new ComboBox<>("Name");
nameSelection.setRenderer(new TextRenderer<>());
nameSelection.setDataProvider(provider);
add(update, nameSelection);
}
use of com.vaadin.flow.component.combobox.ComboBox in project flow-components by vaadin.
the class RequiredComboboxPage method requiredComboBoxSetItemsAfter.
private void requiredComboBoxSetItemsAfter() {
Binder<TestItem> binder = new Binder<>();
ComboBox<String> comboBox = new ComboBox<>();
binder.forField(comboBox).asRequired().bind(TestItem::getName, TestItem::setName);
binder.setBean(new TestItem(0));
// Set items last:
comboBox.setItems("foo", "bar");
add(comboBox);
}
use of com.vaadin.flow.component.combobox.ComboBox in project flow-components by vaadin.
the class ClientSideFilterPage method createClientFilterComboBox.
private void createClientFilterComboBox() {
ComboBox<String> clientFilterComboBox = new ComboBox<>("Browsers");
clientFilterComboBox.setId(CLIENT_FILTER_COMBO_BOX);
ComboBoxListDataView<String> clientFilterDataView = clientFilterComboBox.setItems("Google Chrome", "Mozilla Firefox", "Opera", "Apple Safari", "Microsoft Edge");
Span itemCountSpan = new Span("0");
itemCountSpan.setId(CLIENT_FILTER_COMBO_BOX_ITEM_COUNT_SPAN_ID);
this.add(itemCountSpan);
addListener(itemCountSpan, clientFilterDataView);
this.add(clientFilterComboBox);
}
Aggregations