@StudioAction(category="List Actions", description="Removes an entity instance from the list and from the database") @ActionType(value="remove") public class RemoveAction<E extends Entity> extends SecuredListAction implements Action.DisabledWhenScreenReadOnly, Action.ExecutableAction
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.
BaseAction.EnabledRule
Action.ActionPerformedEvent, Action.AdjustWhenScreenReadOnly, Action.BeforeActionPerformedHandler, Action.DisabledWhenScreenReadOnly, Action.ExecutableAction, Action.HasBeforeActionPerformedHandler, Action.HasOpenType, Action.HasPrimaryState, Action.HasSecurityConstraint, Action.HasTarget, Action.SecuredAction, Action.Status
Modifier and Type | Field and Description |
---|---|
protected java.util.function.Consumer<RemoveOperation.ActionCancelledEvent<E>> |
actionCancelledHandler |
protected java.util.function.Consumer<RemoveOperation.AfterActionPerformedEvent<E>> |
afterActionPerformedHandler |
protected java.lang.Boolean |
confirmation |
protected java.lang.String |
confirmationMessage |
protected java.lang.String |
confirmationTitle |
static java.lang.String |
ID |
protected RemoveOperation |
removeOperation |
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() |
RemoveAction(java.lang.String id) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerform(Component component)
Invoked by owning component to execute the action.
|
protected boolean |
checkRemovePermission() |
void |
execute()
Executes the action.
|
java.lang.Boolean |
getConfirmation()
Returns true/false if the confirmation flag was set by
setConfirmation(Boolean) or in the screen XML. |
java.lang.String |
getConfirmationMessage()
Returns confirmation dialog message if it was set by
setConfirmationMessage(String) or in the screen XML. |
java.lang.String |
getConfirmationTitle()
Returns confirmation dialog title if it was set by
setConfirmationTitle(String) or in the screen XML. |
protected boolean |
isPermitted()
Callback method which is invoked by the action to determine its enabled state.
|
void |
setActionCancelledHandler(java.util.function.Consumer<RemoveOperation.ActionCancelledEvent<E>> actionCancelledHandler)
Sets the handler to be invoked if the action was cancelled by the user.
|
void |
setAfterActionPerformedHandler(java.util.function.Consumer<RemoveOperation.AfterActionPerformedEvent<E>> afterActionPerformedHandler)
Sets the handler to be invoked after removing entities.
|
protected void |
setConfiguration(Configuration configuration) |
void |
setConfirmation(java.lang.Boolean confirmation)
Sets whether to ask confirmation from the user.
|
void |
setConfirmationMessage(java.lang.String confirmationMessage)
Sets confirmation dialog message.
|
void |
setConfirmationTitle(java.lang.String confirmationTitle)
Sets confirmation dialog title.
|
protected void |
setIcons(Icons icons) |
protected void |
setMessages(Messages messages) |
getConstraintCode, getConstraintOperationType, isApplicable, setConstraintCode, setConstraintOperationType, setSecurity
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 ID
@Inject protected RemoveOperation removeOperation
protected java.lang.Boolean confirmation
protected java.lang.String confirmationMessage
protected java.lang.String confirmationTitle
protected java.util.function.Consumer<RemoveOperation.AfterActionPerformedEvent<E extends Entity>> afterActionPerformedHandler
protected java.util.function.Consumer<RemoveOperation.ActionCancelledEvent<E extends Entity>> actionCancelledHandler
public RemoveAction()
public RemoveAction(java.lang.String id)
@Nullable public java.lang.Boolean getConfirmation()
setConfirmation(Boolean)
or in the screen XML.
Otherwise returns null.@StudioPropertiesItem(defaultValue="true") public void setConfirmation(java.lang.Boolean confirmation)
@Nullable public java.lang.String getConfirmationMessage()
setConfirmationMessage(String)
or in the screen XML.
Otherwise returns null.@StudioPropertiesItem public void setConfirmationMessage(java.lang.String confirmationMessage)
@Nullable public java.lang.String getConfirmationTitle()
setConfirmationTitle(String)
or in the screen XML.
Otherwise returns null.@StudioPropertiesItem public void setConfirmationTitle(java.lang.String confirmationTitle)
public void setAfterActionPerformedHandler(java.util.function.Consumer<RemoveOperation.AfterActionPerformedEvent<E>> afterActionPerformedHandler)
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()); }
public void setActionCancelledHandler(java.util.function.Consumer<RemoveOperation.ActionCancelledEvent<E>> actionCancelledHandler)
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"); }
@Inject protected void setIcons(Icons icons)
@Inject protected void setMessages(Messages messages)
@Inject protected void setConfiguration(Configuration configuration)
protected boolean isPermitted()
BaseAction
isPermitted
in class SecuredListAction
protected boolean checkRemovePermission()
public void actionPerform(Component component)
Action
actionPerform
in interface Action
actionPerform
in class BaseAction
component
- invoking componentpublic void execute()
execute
in interface Action.ExecutableAction