use of com.vaadin.flow.data.selection.MultiSelect 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();
}
};
}
Aggregations