@Component(value="cuba_RemoveAction") @Scope(value="prototype") public class RemoveAction extends ItemTrackingAction implements HasBeforeActionPerformedHandler, io.jmix.ui.action.Action.AdjustWhenScreenReadOnly
Action's behaviour can be customized by providing arguments to constructor, setting properties, or overriding
method afterRemove(Set) )}
In order to provide your own implementation globally, create a subclass and register it in web-spring.xml,
for example:
<bean id="cuba_RemoveAction" class="com.company.sample.gui.MyRemoveAction" scope="prototype"/>Also, use
create() static methods instead of constructors when creating the action programmatically.| Modifier and Type | Class and Description |
|---|---|
static interface |
RemoveAction.AfterRemoveHandler |
io.jmix.ui.action.BaseAction.EnabledRuleHasBeforeActionPerformedHandler.BeforeActionPerformedHandlerio.jmix.ui.action.Action.ActionPerformedEvent, io.jmix.ui.action.Action.AdjustWhenScreenReadOnly, io.jmix.ui.action.Action.ExecutableAction, io.jmix.ui.action.Action.HasPrimaryState, io.jmix.ui.action.Action.HasSecurityConstraint, io.jmix.ui.action.Action.HasTarget, io.jmix.ui.action.Action.MainTabSheetAction, io.jmix.ui.action.Action.ScreenOpeningAction, io.jmix.ui.action.Action.SecuredAction, io.jmix.ui.action.Action.Status| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ACTION_ID |
protected RemoveAction.AfterRemoveHandler |
afterRemoveHandler |
protected boolean |
autocommit |
protected HasBeforeActionPerformedHandler.BeforeActionPerformedHandler |
beforeActionPerformedHandler |
protected boolean |
confirm |
protected java.lang.String |
confirmationMessage |
protected java.lang.String |
confirmationTitle |
accessManager, applicationContext, constraintEntityOp, metadata, securitytarget| Constructor and Description |
|---|
RemoveAction(ListComponent target)
The simplest constructor.
|
RemoveAction(ListComponent target,
boolean autocommit)
Constructor that allows to specify autocommit value.
|
RemoveAction(ListComponent target,
boolean autocommit,
java.lang.String id)
Constructor that allows to specify action's identifier and autocommit value.
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerform(io.jmix.ui.component.Component component)
This method is invoked by the action owner component.
|
protected void |
afterRemove(java.util.Set selected)
Hook invoked after remove.
|
protected boolean |
checkRemovePermission() |
protected void |
confirmAndRemove(java.util.Set<io.jmix.core.Entity> selected) |
static RemoveAction |
create(io.jmix.ui.component.ListComponent target)
Creates an action with default id.
|
static RemoveAction |
create(io.jmix.ui.component.ListComponent target,
boolean autocommit)
Creates an action with default id.
|
static RemoveAction |
create(io.jmix.ui.component.ListComponent target,
boolean autocommit,
java.lang.String id)
Creates an action with the given id.
|
protected void |
doRemove(java.util.Set<io.jmix.core.Entity> selected,
boolean autocommit) |
HasBeforeActionPerformedHandler.BeforeActionPerformedHandler |
getBeforeActionPerformedHandler() |
java.lang.String |
getConfirmationMessage()
Provides confirmation dialog message.
|
java.lang.String |
getConfirmationTitle()
Provides confirmation dialog title.
|
boolean |
isAutocommit() |
boolean |
isConfirm() |
protected boolean |
isPermitted()
Check permissions for Action
|
protected void |
remove(java.util.Set<io.jmix.core.Entity> selected) |
void |
setAfterRemoveHandler(RemoveAction.AfterRemoveHandler afterRemoveHandler) |
void |
setAutocommit(boolean autocommit) |
void |
setBeforeActionPerformedHandler(HasBeforeActionPerformedHandler.BeforeActionPerformedHandler handler)
Sets handler that is invoked before the action is executed.
|
void |
setConfirm(boolean confirm) |
void |
setConfirmationMessage(java.lang.String confirmationMessage) |
void |
setConfirmationTitle(java.lang.String confirmationTitle) |
getConstraintEntityOp, getConstraintOperationType, setConstraintEntityOp, setConstraintOperationTypegetTarget, setTargetwithCaption, withDescription, withHandler, withIcon, withPrimary, withShortcutaddActionPerformedListener, addEnabledRule, isApplicable, isEnabledByRule, isEnabledByUiPermissions, isVisibleByUiPermissions, refreshState, removeEnabledRule, setEnabled, setEnabledByUiPermissions, setEnabledInternal, setVisible, setVisibleByUiPermissions, setVisibleInternaladdOwner, addPropertyChangeListener, firePropertyChange, getCaption, getDescription, getEventHub, getIcon, getId, getOwner, getOwners, getShortcutCombination, hasSubscriptions, isEnabled, isPrimary, isVisible, removeOwner, removePropertyChangeListener, setCaption, setDescription, setIcon, setPrimary, setShortcut, setShortcutCombinationclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddOwner, addPropertyChangeListener, getCaption, getDescription, getIcon, getId, getOwner, getOwners, getShortcutCombination, isEnabled, isVisible, refreshState, removeOwner, removePropertyChangeListener, setCaption, setDescription, setEnabled, setIcon, setShortcut, setShortcutCombination, setVisiblepublic static final java.lang.String ACTION_ID
protected boolean autocommit
protected boolean confirm
protected java.lang.String confirmationMessage
protected java.lang.String confirmationTitle
protected RemoveAction.AfterRemoveHandler afterRemoveHandler
protected HasBeforeActionPerformedHandler.BeforeActionPerformedHandler beforeActionPerformedHandler
public RemoveAction(ListComponent target)
target - component containing this actionpublic RemoveAction(ListComponent target, boolean autocommit)
target - component containing this actionautocommit - whether to commit datasource immediatelypublic RemoveAction(ListComponent target, boolean autocommit, java.lang.String id)
target - component containing this actionautocommit - whether to commit datasource immediatelyid - action's identifierpublic static RemoveAction create(io.jmix.ui.component.ListComponent target)
target - component containing this actionpublic static RemoveAction create(io.jmix.ui.component.ListComponent target, boolean autocommit)
target - component containing this actionautocommit - whether to commit datasource immediatelypublic static RemoveAction create(io.jmix.ui.component.ListComponent target, boolean autocommit, java.lang.String id)
target - component containing this actionautocommit - whether to commit datasource immediatelyid - action's identifierprotected boolean isPermitted()
isPermitted in class ItemTrackingActionprotected boolean checkRemovePermission()
public void actionPerform(io.jmix.ui.component.Component component)
actionPerform in interface io.jmix.ui.action.ActionactionPerform in class io.jmix.ui.action.BaseActioncomponent - component invoking the actionprotected void confirmAndRemove(java.util.Set<io.jmix.core.Entity> selected)
protected void remove(java.util.Set<io.jmix.core.Entity> selected)
public boolean isAutocommit()
public void setAutocommit(boolean autocommit)
autocommit - whether to commit datasource immediately after deletionpublic boolean isConfirm()
public void setConfirm(boolean confirm)
confirm - whether to show the confirmation dialog to userpublic java.lang.String getConfirmationMessage()
public void setConfirmationMessage(java.lang.String confirmationMessage)
confirmationMessage - confirmation dialog messagepublic java.lang.String getConfirmationTitle()
public void setConfirmationTitle(java.lang.String confirmationTitle)
confirmationTitle - confirmation dialog title.protected void doRemove(java.util.Set<io.jmix.core.Entity> selected,
boolean autocommit)
protected void afterRemove(java.util.Set selected)
selected - set of removed instancespublic void setAfterRemoveHandler(RemoveAction.AfterRemoveHandler afterRemoveHandler)
afterRemoveHandler - handler that is invoked after removepublic HasBeforeActionPerformedHandler.BeforeActionPerformedHandler getBeforeActionPerformedHandler()
getBeforeActionPerformedHandler in interface HasBeforeActionPerformedHandlerpublic void setBeforeActionPerformedHandler(HasBeforeActionPerformedHandler.BeforeActionPerformedHandler handler)
HasBeforeActionPerformedHandlersetBeforeActionPerformedHandler in interface HasBeforeActionPerformedHandlerhandler - handler to set