@Override public void tableSourceItemSetChanged(TableItems.ItemSetChangeEvent<E> event) { // replacement for collectionChangeSelectionListener // #PL-2035, reload selection from ds Set<Object> selectedItemIds = getSelectedItemIds(); if (selectedItemIds == null) { selectedItemIds = Collections.emptySet(); } Set<Object> newSelection = new HashSet<>(); TableItems<E> tableItems = event.getSource(); for (Object entityId : selectedItemIds) { if (tableItems.getItem(entityId) != null) { newSelection.add(entityId); } } if (tableItems.getState() == BindingState.ACTIVE && tableItems instanceof EntityTableItems) { EntityTableItems entityTableSource = (EntityTableItems) tableItems; if (entityTableSource.getSelectedItem() != null) { newSelection.add(entityTableSource.getSelectedItem().getId()); } } if (newSelection.isEmpty()) { setSelected((E) null); } else { setSelectedIds(newSelection); } refreshActionsState(); }
protected void datasourceCollectionChanged(@SuppressWarnings("unused") CollectionDatasource.CollectionChangeEvent<E, K> e) { events.publish(ItemSetChangeEvent.class, new ItemSetChangeEvent<>(this)); }
protected void containerCollectionChanged(@SuppressWarnings("unused") CollectionContainer.CollectionChangeEvent<E> e) { events.publish(ItemSetChangeEvent.class, new ItemSetChangeEvent<>(this)); }