use of com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent in project aire-components by aire-ux.
the class ModuleGrid method valueChanged.
@Override
public void valueChanged(ComponentValueChangeEvent<TextField, String> event) {
val text = textField.getValue();
val matches = getZephyr().getPlugins().stream().filter(module -> module.getCoordinate().getName().contains(text) || module.getCoordinate().getGroup().contains(text) || module.getCoordinate().getVersion().toString().contains(text)).collect(Collectors.toList());
grid.setItems(new ListDataProvider<>(matches));
}
use of com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent in project flow-components by vaadin.
the class AbstractGridMultiSelectionModel method asMultiSelect.
@Override
public MultiSelect<Grid<T>, T> asMultiSelect() {
return new MultiSelect<Grid<T>, T>() {
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Registration addValueChangeListener(ValueChangeListener<? super ComponentValueChangeEvent<Grid<T>, Set<T>>> listener) {
Objects.requireNonNull(listener, "listener cannot be null");
ComponentEventListener componentEventListener = event -> listener.valueChanged((ComponentValueChangeEvent<Grid<T>, Set<T>>) event);
return ComponentUtil.addListener(getGrid(), MultiSelectionEvent.class, componentEventListener);
}
@Override
public Registration addSelectionListener(MultiSelectionListener<Grid<T>, T> listener) {
return addMultiSelectionListener(listener);
}
@Override
public void deselectAll() {
AbstractGridMultiSelectionModel.this.deselectAll();
}
@Override
public void updateSelection(Set<T> addedItems, Set<T> removedItems) {
AbstractGridMultiSelectionModel.this.updateSelection(addedItems, removedItems);
}
@Override
public Element getElement() {
return getGrid().getElement();
}
@Override
public Set<T> getSelectedItems() {
return AbstractGridMultiSelectionModel.this.getSelectedItems();
}
};
}
use of com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent in project flow-components by vaadin.
the class AbstractGridSingleSelectionModel method asSingleSelect.
@Override
public SingleSelect<Grid<T>, T> asSingleSelect() {
return new SingleSelect<Grid<T>, T>() {
@Override
public void setValue(T value) {
setSelectedItem(value);
}
@Override
public T getValue() {
return getSelectedItem().orElse(getEmptyValue());
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Registration addValueChangeListener(ValueChangeListener<? super ComponentValueChangeEvent<Grid<T>, T>> listener) {
Objects.requireNonNull(listener, "listener cannot be null");
ComponentEventListener componentEventListener = event -> listener.valueChanged((ComponentValueChangeEvent<Grid<T>, T>) event);
return ComponentUtil.addListener(getGrid(), SingleSelectionEvent.class, componentEventListener);
}
@Override
public Element getElement() {
return getGrid().getElement();
}
};
}
Aggregations