@Component(value="cuba_RemoveAction") @Scope(value="prototype") public class RemoveAction extends ItemTrackingAction implements Action.HasBeforeActionPerformedHandler
Action's behaviour can be customized by providing arguments to constructor, setting properties, or overriding
method afterRemove(java.util.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 |
BaseAction.EnabledRule
Action.ActionPerformedEvent, Action.BeforeActionPerformedHandler, Action.HasBeforeActionPerformedHandler, Action.HasOpenType, Action.HasSecurityConstraint, Action.HasTarget, Action.SecuredAction, Action.Status
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ACTION_ID |
protected RemoveAction.AfterRemoveHandler |
afterRemoveHandler |
protected boolean |
autocommit |
protected Action.BeforeActionPerformedHandler |
beforeActionPerformedHandler |
protected boolean |
confirm |
protected java.lang.String |
confirmationMessage |
protected java.lang.String |
confirmationTitle |
constraintCode, constraintOperationType, security
target
caption, description, enabled, eventHub, icon, id, owners, primary, shortcut, visible
PROP_CAPTION, PROP_DESCRIPTION, PROP_ENABLED, PROP_ICON, PROP_SHORTCUT, PROP_VISIBLE
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(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<Entity> selected) |
static RemoveAction |
create(ListComponent target)
Creates an action with default id.
|
static RemoveAction |
create(ListComponent target,
boolean autocommit)
Creates an action with default id.
|
static RemoveAction |
create(ListComponent target,
boolean autocommit,
java.lang.String id)
Creates an action with the given id.
|
protected void |
doRemove(java.util.Set<Entity> selected,
boolean autocommit) |
Action.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<Entity> selected) |
void |
setAfterRemoveHandler(RemoveAction.AfterRemoveHandler afterRemoveHandler) |
void |
setAutocommit(boolean autocommit) |
void |
setBeforeActionPerformedHandler(Action.BeforeActionPerformedHandler handler) |
void |
setConfirm(boolean confirm) |
void |
setConfirmationMessage(java.lang.String confirmationMessage) |
void |
setConfirmationTitle(java.lang.String confirmationTitle) |
getConstraintCode, getConstraintOperationType, isApplicable, setConstraintCode, setConstraintOperationType
getTarget, setTarget, withCaption, withDescription, withHandler, withIcon, withPrimary, withShortcut
addActionPerformedListener, addEnabledRule, isEnabledByRule, isEnabledByUiPermissions, isVisibleByUiPermissions, refreshState, removeEnabledRule, setEnabled, setEnabledByUiPermissions, setEnabledInternal, setVisible, setVisibleByUiPermissions, setVisibleInternal
addOwner, addPropertyChangeListener, firePropertyChange, getCaption, getDefaultCaption, getDescription, getEventHub, getIcon, getId, getOwner, getOwners, getShortcutCombination, hasSubscriptions, isEnabled, isPrimary, isVisible, removeOwner, removePropertyChangeListener, setCaption, setDescription, setIcon, setIconFromSet, setPrimary, setShortcut, setShortcutCombination
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addOwner, addPropertyChangeListener, getCaption, getDescription, getIcon, getId, getOwner, getOwners, getShortcutCombination, isEnabled, isVisible, refreshState, removeOwner, removePropertyChangeListener, setCaption, setDescription, setEnabled, setIcon, setIconFromSet, setShortcut, setShortcutCombination, setVisible
public 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 Action.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(ListComponent target)
target
- component containing this actionpublic static RemoveAction create(ListComponent target, boolean autocommit)
target
- component containing this actionautocommit
- whether to commit datasource immediatelypublic static RemoveAction create(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 ItemTrackingAction
protected boolean checkRemovePermission()
public void actionPerform(Component component)
actionPerform
in interface Action
actionPerform
in class BaseAction
component
- component invoking the actionprotected void confirmAndRemove(java.util.Set<Entity> selected)
protected void remove(java.util.Set<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<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 Action.BeforeActionPerformedHandler getBeforeActionPerformedHandler()
getBeforeActionPerformedHandler
in interface Action.HasBeforeActionPerformedHandler
public void setBeforeActionPerformedHandler(Action.BeforeActionPerformedHandler handler)
setBeforeActionPerformedHandler
in interface Action.HasBeforeActionPerformedHandler