Package io.jmix.flowui.kit.action
Class BaseAction
java.lang.Object
io.jmix.flowui.kit.action.AbstractAction
io.jmix.flowui.kit.action.BaseAction
- All Implemented Interfaces:
Action
,HasShortcutCombination
- Direct Known Subclasses:
LogoutAction
,PropertyFilter.OperationChangeAction
,SecuredBaseAction
,SubstituteUserAction
Base implementation of
Action
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected boolean
Fields inherited from class io.jmix.flowui.kit.action.AbstractAction
description, enabled, eventBus, icon, id, shortcutCombination, text, variant, visible
Fields inherited from interface io.jmix.flowui.kit.action.Action
PROP_DESCRIPTION, PROP_ENABLED, PROP_ICON, PROP_SHORTCUT_COMBINATION, PROP_TEXT, PROP_VARIANT, PROP_VISIBLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
actionPerform
(com.vaadin.flow.component.Component component) Executes action logic.com.vaadin.flow.shared.Registration
Adds a listener to be notified when action is performed.protected boolean
void
Refreshes internal state of the action to initialize enabled, visible, text, icon, etc.void
setEnabled
(boolean enabled) Sets the enabled property value of an action.protected void
setEnabledInternal
(boolean enabled) void
setVisible
(boolean visible) Sets the visible property value of an action.protected void
setVisibleInternal
(boolean visible) withDescription
(String description) Sets the description property value of an action.withEnabled
(boolean enabled) Sets the enabled property value of an action.withHandler
(Consumer<ActionPerformedEvent> handler) Adds a listener to be notified when action is performed.withIcon
(com.vaadin.flow.component.icon.Icon icon) Sets the icon property value of an action.withIcon
(com.vaadin.flow.component.icon.VaadinIcon icon) Deprecated, for removal: This API element is subject to removal in a future version.withShortcutCombination
(KeyCombination shortcutCombination) Sets object that stores information about keys, modifiers and additional settings that describe shortcut combinations.Sets the text property value of an action.Deprecated, for removal: This API element is subject to removal in a future version.usewithDescription(String)
orAbstractAction.setDescription(String)
insteadwithVariant
(ActionVariant variant) Sets the variant property value of an action.withVisible
(boolean visible) Sets the visible property value of an action.Methods inherited from class io.jmix.flowui.kit.action.AbstractAction
addPropertyChangeListener, firePropertyChange, getDescription, getEventBus, getIcon, getId, getShortcutCombination, getText, getVariant, hasListener, isEnabled, isVisible, setDescription, setIcon, setShortcutCombination, setText, setVariant
-
Field Details
-
enabledExplicitly
protected boolean enabledExplicitly -
visibleExplicitly
protected boolean visibleExplicitly
-
-
Constructor Details
-
BaseAction
-
-
Method Details
-
setVisible
public void setVisible(boolean visible) Description copied from interface:Action
Sets the visible property value of an action. May be used by components to initialize their appearance.- Specified by:
setVisible
in interfaceAction
- Overrides:
setVisible
in classAbstractAction
- Parameters:
visible
- whether the action is currently visible
-
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:Action
Sets the enabled property value of an action. May be used by components to initialize their appearance.- Specified by:
setEnabled
in interfaceAction
- Overrides:
setEnabled
in classAbstractAction
- Parameters:
enabled
- whether the action is currently enabled
-
refreshState
public void refreshState()Description copied from interface:Action
Refreshes internal state of the action to initialize enabled, visible, text, icon, etc. properties depending on programmatically set values and user permissions set at runtime.For example, this method is called by visual components holding actions when they are bound to data. At this moment the action can find out what entity it is connected to and change its state according to the user permissions.
-
actionPerform
public void actionPerform(com.vaadin.flow.component.Component component) Description copied from interface:Action
Executes action logic.- Parameters:
component
-Component
that triggered this action
-
addActionPerformedListener
public com.vaadin.flow.shared.Registration addActionPerformedListener(Consumer<ActionPerformedEvent> listener) Adds a listener to be notified when action is performed.- Parameters:
listener
- listener to add- Returns:
- a registration object for removing an event listener
-
withText
Sets the text property value of an action. May be used by components to initialize their appearance.- Parameters:
text
- text to set ornull
to remove- Returns:
- this object
-
withEnabled
Sets the enabled property value of an action. May be used by components to initialize their appearance.- Parameters:
enabled
- whether the action is currently enabled- Returns:
- this object
-
withVisible
Sets the visible property value of an action. May be used by components to initialize their appearance.- Parameters:
visible
- whether the action is currently visible- Returns:
- this object
-
withIcon
Sets the icon property value of an action. May be used by components to initialize their appearance.- Parameters:
icon
- icon to set ornull
to remove- Returns:
- this object
-
withIcon
@Deprecated(since="2.4", forRemoval=true) public BaseAction withIcon(@Nullable com.vaadin.flow.component.icon.VaadinIcon icon) Deprecated, for removal: This API element is subject to removal in a future version.usewithIcon(Icon)
orAbstractAction.setIcon(Icon)
insteadSets the icon property value of an action. May be used by components to initialize their appearance.- Parameters:
icon
- icon to set ornull
to remove- Returns:
- this object
-
withDescription
Sets the description property value of an action. May be used by components to initialize their appearance.- Parameters:
description
- description to set ornull
to remove- Returns:
- this object
-
withTitle
Deprecated, for removal: This API element is subject to removal in a future version.usewithDescription(String)
orAbstractAction.setDescription(String)
insteadSets the description property value of an action. May be used by components to initialize their appearance.- Parameters:
title
- description to set ornull
to remove- Returns:
- this object
-
withVariant
Sets the variant property value of an action. May be used by components to initialize their appearance.- Parameters:
variant
- variant to set- Returns:
- this object
-
withShortcutCombination
Sets object that stores information about keys, modifiers and additional settings that describe shortcut combinations.- Parameters:
shortcutCombination
- key combination to set ornull
to remove- Returns:
- this object
-
withHandler
Adds a listener to be notified when action is performed.- Parameters:
handler
- listener to add ornull
to remove all- Returns:
- this object
-
setVisibleInternal
protected void setVisibleInternal(boolean visible) -
setEnabledInternal
protected void setEnabledInternal(boolean enabled) -
isApplicable
protected boolean isApplicable()
-
withIcon(Icon)
orAbstractAction.setIcon(Icon)
instead