Class RemoveAction<E>

All Implemented Interfaces:
Action, Action.AdjustWhenScreenReadOnly, Action.ExecutableAction, Action.HasPrimaryState, Action.HasSecurityConstraint, Action.HasTarget, Action.SecuredAction

@StudioAction(target="io.jmix.ui.component.ListComponent", description="Removes an entity instance from the list and from the database", availableInScreenWizard=true) @ActionType("remove") public class RemoveAction<E> extends SecuredListAction implements Action.AdjustWhenScreenReadOnly, Action.ExecutableAction
Standard action for removing an entity instance from the list and from the database.

Should be defined for a list component (Table, DataGrid, etc.) in a screen XML descriptor.

The action instance can be parameterized using the nested properties XML element or programmatically in the screen controller.

  • Field Details

  • Constructor Details

    • RemoveAction

      public RemoveAction()
    • RemoveAction

      public RemoveAction(String id)
  • Method Details

    • getConfirmation

      @Nullable public Boolean getConfirmation()
      Returns true/false if the confirmation flag was set by setConfirmation(Boolean) or in the screen XML. Otherwise returns null.
    • setConfirmation

      @StudioPropertiesItem(defaultValue="true") public void setConfirmation(Boolean confirmation)
      Sets whether to ask confirmation from the user.
    • getConfirmationMessage

      @Nullable public String getConfirmationMessage()
      Returns confirmation dialog message if it was set by setConfirmationMessage(String) or in the screen XML. Otherwise returns null.
    • setConfirmationMessage

      @StudioPropertiesItem public void setConfirmationMessage(String confirmationMessage)
      Sets confirmation dialog message.
    • getConfirmationTitle

      @Nullable public String getConfirmationTitle()
      Returns confirmation dialog title if it was set by setConfirmationTitle(String) or in the screen XML. Otherwise returns null.
    • setConfirmationTitle

      @StudioPropertiesItem public void setConfirmationTitle(String confirmationTitle)
      Sets confirmation dialog title.
    • setAfterActionPerformedHandler

      public void setAfterActionPerformedHandler(Consumer<RemoveOperation.AfterActionPerformedEvent<E>> afterActionPerformedHandler)
      Sets the handler to be invoked after removing entities.

      The preferred way to set the handler is using a controller method annotated with Install, e.g.:

       @Install(to = "petsTable.remove", subject = "afterActionPerformedHandler")
       protected void petsTableRemoveAfterActionPerformedHandler(RemoveOperation.AfterActionPerformedEvent event) {
           System.out.println("Removed " + event.getItems());
       }
       
    • setActionCancelledHandler

      public void setActionCancelledHandler(Consumer<RemoveOperation.ActionCancelledEvent<E>> actionCancelledHandler)
      Sets the handler to be invoked if the action was cancelled by the user.

      The preferred way to set the handler is using a controller method annotated with Install, e.g.:

       @Install(to = "petsTable.remove", subject = "actionCancelledHandler")
       protected void petsTableRemoveActionCancelledHandler(RemoveOperation.ActionCancelledEvent event) {
           System.out.println("Cancelled");
       }
       
    • setIcons

      @Autowired protected void setIcons(Icons icons)
    • setMessages

      @Autowired protected void setMessages(Messages messages)
    • setUiComponentProperties

      @Autowired protected void setUiComponentProperties(UiComponentProperties componentProperties)
    • setRemoveOperation

      @Autowired public void setRemoveOperation(RemoveOperation removeOperation)
    • isPermitted

      protected boolean isPermitted()
      Description copied from class: BaseAction
      Callback method which is invoked by the action to determine its enabled state.
      Overrides:
      isPermitted in class SecuredListAction
      Returns:
      true if the action is enabled for the current user
    • checkRemovePermission

      protected boolean checkRemovePermission()
    • actionPerform

      public void actionPerform(Component component)
      Description copied from interface: Action
      Invoked by owning component to execute the action.
      Specified by:
      actionPerform in interface Action
      Overrides:
      actionPerform in class BaseAction
      Parameters:
      component - invoking component
    • execute

      public void execute()
      Executes the action.
      Specified by:
      execute in interface Action.ExecutableAction