/** * Removes selected items from the list component with confirmation dialog. <br> * After confirmation removes items from DB if the bound container is not nested. * * @param target list component * @param <E> entity type */ public <E extends Entity> void removeSelected(ListComponent<E> target) { builder(target) .withConfirmation(true) .remove(); }
/** * Excludes selected items from the list component without confirmation. Works with nested containers only. * * @param target list component * @param <E> entity type */ public <E extends Entity> void excludeSelected(ListComponent<E> target) { builder(target) .withConfirmation(false) .exclude(); }
/** * Creates a remove builder using list component, e.g. {@link Table} or {@link DataGrid}. * * @param listComponent list component * @param <E> type of entity */ public <E extends Entity> RemoveBuilder<E> builder(ListComponent<E> listComponent) { checkNotNullArgument(listComponent); checkNotNullArgument(listComponent.getFrame()); FrameOwner frameOwner = listComponent.getFrame().getFrameOwner(); Class<E> entityClass; DataUnit items = listComponent.getItems(); if (items instanceof ContainerDataUnit) { entityClass = ((ContainerDataUnit) items).getEntityMetaClass().getJavaClass(); } else { throw new IllegalStateException(String.format("Component %s is not bound to data", listComponent)); } return builder(entityClass, frameOwner) .withListComponent(listComponent); }