use of com.vaadin.flow.component.combobox.bean.SimpleBean in project flow-components by vaadin.
the class ComboBoxPage method setLabelGeneratorAfterValue.
private void setLabelGeneratorAfterValue() {
ComboBox<SimpleBean> combo = new ComboBox<>();
SimpleBean foo = new SimpleBean("foo");
combo.setItems(foo);
combo.setId("label-generator-after-value");
combo.setValue(foo);
combo.setItemLabelGenerator(SimpleBean::getName);
add(combo);
}
use of com.vaadin.flow.component.combobox.bean.SimpleBean in project flow-components by vaadin.
the class RefreshDataProviderPage method createRefreshItem.
private void createRefreshItem() {
SimpleBean item1 = new SimpleBean("foo");
SimpleBean item2 = new SimpleBean("bar");
ComboBox<SimpleBean> comboBox = new ComboBox<>();
comboBox.setItemLabelGenerator(SimpleBean::getName);
comboBox.setId("refresh-item-combo-box");
comboBox.setItems(item1, item2);
NativeButton button = new NativeButton("Change both items, refresh only the second one", e -> {
item1.setName("foo updated");
item2.setName("bar updated");
comboBox.getDataProvider().refreshItem(item2);
});
button.setId("refresh-item");
add(comboBox, button);
}
Aggregations