use of com.vaadin.flow.data.provider.DataCommunicator in project testbench by vaadin.
the class ComboBoxWrap method getSuggestionItems.
/**
* Get the actual items for the dropdown as a List. any filter that is set
* is taken into account.
*
* @return List of items
*/
public List<Y> getSuggestionItems() {
try {
final Field dataCommunicatorField = getField("dataCommunicator");
final DataCommunicator<T> dataCommunicator = (DataCommunicator) dataCommunicatorField.get(getComponent());
final Method fetchFromProvider = getMethod(DataCommunicator.class, "fetchFromProvider", int.class, int.class);
List<Y> result = ((Stream<Y>) fetchFromProvider.invoke(dataCommunicator, 0, BasicUtilsKt.get_saneFetchLimit())).collect(Collectors.toList());
return result;
} catch (IllegalAccessException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}
Aggregations