use of com.vaadin.data.provider.DataProviderListener in project SORMAS-Project by hzi-braunschweig.
the class EventSelectionGrid method setLazyDataProvider.
public void setLazyDataProvider() {
DataProvider<EventIndexDto, EventCriteria> dataProvider = DataProvider.fromFilteringCallbacks(query -> FacadeProvider.getEventFacade().getIndexList(query.getFilter().orElse(null), query.getOffset(), query.getLimit(), query.getSortOrders().stream().map(sortOrder -> new SortProperty(sortOrder.getSorted(), sortOrder.getDirection() == SortDirection.ASCENDING)).collect(Collectors.toList())).stream(), query -> (int) FacadeProvider.getEventFacade().count(query.getFilter().orElse(null)));
setDataProvider(dataProvider);
setSelectionMode(com.vaadin.ui.Grid.SelectionMode.NONE);
EventSelectionGrid tempGrid = this;
dataProvider.addDataProviderListener((DataProviderListener<EventIndexDto>) dataChangeEvent -> {
if (tempGrid.getItemCount() > 0) {
tempGrid.setHeightByRows(Math.min(tempGrid.getItemCount(), 5));
} else {
tempGrid.setHeightByRows(1);
}
});
}
use of com.vaadin.data.provider.DataProviderListener in project SORMAS-Project by hzi-braunschweig.
the class EventGroupSelectionGrid method setLazyDataProvider.
public void setLazyDataProvider() {
DataProvider<EventGroupIndexDto, EventGroupCriteria> dataProvider = DataProvider.fromFilteringCallbacks(query -> FacadeProvider.getEventGroupFacade().getIndexList(query.getFilter().orElse(null), query.getOffset(), query.getLimit(), query.getSortOrders().stream().map(sortOrder -> new SortProperty(sortOrder.getSorted(), sortOrder.getDirection() == SortDirection.ASCENDING)).collect(Collectors.toList())).stream(), query -> (int) FacadeProvider.getEventGroupFacade().count(query.getFilter().orElse(null)));
setDataProvider(dataProvider);
setSelectionMode(SelectionMode.NONE);
EventGroupSelectionGrid tempGrid = this;
dataProvider.addDataProviderListener((DataProviderListener<EventGroupIndexDto>) dataChangeEvent -> {
if (tempGrid.getItemCount() > 0) {
tempGrid.setHeightByRows(Math.min(tempGrid.getItemCount(), 5));
} else {
tempGrid.setHeightByRows(1);
}
});
}
Aggregations