use of com.vaadin.data.Container.Indexed in project VaadinUtils by rlsutton1.
the class GridHeadingV2PropertySet method wrapGridContainer.
@SuppressWarnings("unchecked")
private GeneratedPropertyListContainer<E> wrapGridContainer(final Class<E> entityClass, final Grid grid) {
final Indexed gridContainer = grid.getContainerDataSource();
if (gridContainer instanceof GeneratedPropertyListContainer) {
return (GeneratedPropertyListContainer<E>) gridContainer;
}
final GeneratedPropertyListContainer<E> gplc = new GeneratedPropertyListContainer<>(entityClass);
gplc.setCollection((Collection<E>) gridContainer.getItemIds());
final Collection<?> containerPropertyIds = gridContainer.getContainerPropertyIds();
if (!containerPropertyIds.isEmpty()) {
gplc.setContainerPropertyIds(containerPropertyIds.toArray(new String[containerPropertyIds.size()]));
}
grid.setContainerDataSource(gplc);
return gplc;
}
Aggregations