RemoveAction
- action with remove identifier, intended to remove a selected entity instance.
The following specific methods are defined in the RemoveAction
class:
-
setAutocommit()
allows you to control the moment of entity removal from the database. By defaultcommit()
method is invoked after triggering the action and removing the entity from the data source. As result, the entity is removed from the database. You can setautocommit
property into false usingsetAutocommit()
method or corresponding parameter of the constructor. In this case you will need to explicitly invoke the data sourcecommit()
method to confirm the removal after removing the entity from the data source.The value of
autocommit
does not affect datasources in theDatasource.CommitMode.PARENT
mode, i.e. the datasources that provide composite entities editing. -
setConfirmationMessage()
allows you to set message text for the removal confirmation dialog. -
setConfirmationTitle()
allows you to set removal confirmation dialog title. -
afterRemove()
is invoked by the action after the entity has been successfully removed. This method does not have implementation and can be overridden. -
setAfterRemoveHandler()
allows you to provide a handler which will be called after the new entity has been successfully removed. This handler can be used instead of overridingafterRemove()
to avoid creating the action subclass. For example:@Named("customersTable.remove") private RemoveAction customersTableRemove; @Override public void init(Map<String, Object> params) { customersTableRemove.setAfterRemoveHandler(new RemoveAction.AfterRemoveHandler() { @Override public void handle(Set removedItems) { showNotification("Removed", NotificationType.HUMANIZED); } }); }