public interface Action
Action
interface abstracts away a function from a visual component.
The action is executed by invoking its actionPerform(Component)
method.
Modifier and Type | Interface and Description |
---|---|
static class |
Action.ActionPerformedEvent
Event sent when the action is performed.
|
static interface |
Action.AdjustWhenScreenReadOnly
Interface to be implemented by actions which may adjust
their 'enabled' state according to the screen read-only mode.
|
static interface |
Action.BeforeActionPerformedHandler
Callback interface which is invoked by the action before execution.
|
static interface |
Action.DisabledWhenScreenReadOnly
Marker interface that indicates that the implementing action will
change its 'enabled' state according to the screen read-only mode.
|
static interface |
Action.ExecutableAction
Indicates that the action is executable.
|
static interface |
Action.HasBeforeActionPerformedHandler
Interface defining methods for adding and removing
Action.BeforeActionPerformedHandler s |
static interface |
Action.HasOpenType
Deprecated.
|
static interface |
Action.HasPrimaryState
Interface to be implemented by actions that have primary state.
|
static interface |
Action.HasSecurityConstraint
Interface defining constraintOperationType and constraintCode options.
|
static interface |
Action.HasTarget |
static interface |
Action.SecuredAction
Indicates that the action can be affected by UI permissions.
|
static class |
Action.Status
Used in dialogs to assign a special visual style for a button representing the action.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROP_CAPTION |
static java.lang.String |
PROP_DESCRIPTION |
static java.lang.String |
PROP_ENABLED |
static java.lang.String |
PROP_ICON |
static java.lang.String |
PROP_SHORTCUT |
static java.lang.String |
PROP_VISIBLE |
Modifier and Type | Method and Description |
---|---|
void |
actionPerform(Component component)
Invoked by owning component to execute the action.
|
void |
addOwner(ActionOwner actionOwner)
Add an owner component.
|
void |
addPropertyChangeListener(java.util.function.Consumer<java.beans.PropertyChangeEvent> listener)
Adds a listener to be notified about Enabled, Caption or Icon property changes.
|
java.lang.String |
getCaption() |
java.lang.String |
getDescription() |
java.lang.String |
getIcon() |
java.lang.String |
getId() |
ActionOwner |
getOwner() |
java.util.Collection<ActionOwner> |
getOwners() |
KeyCombination |
getShortcutCombination() |
boolean |
isEnabled() |
boolean |
isVisible() |
void |
refreshState()
Refresh internal state of the action to initialize enabled, visible, caption, icon, etc.
|
void |
removeOwner(ActionOwner actionOwner)
Remove the owner component.
|
void |
removePropertyChangeListener(java.util.function.Consumer<java.beans.PropertyChangeEvent> listener)
Removes the listener.
|
void |
setCaption(java.lang.String caption) |
void |
setDescription(java.lang.String description) |
void |
setEnabled(boolean enabled) |
void |
setIcon(java.lang.String icon) |
void |
setIconFromSet(Icons.Icon icon)
Set an icon from an icon set.
|
void |
setShortcut(java.lang.String shortcut)
Set shortcut from string representation.
|
void |
setShortcutCombination(KeyCombination shortcut) |
void |
setVisible(boolean visible) |
static final java.lang.String PROP_CAPTION
static final java.lang.String PROP_DESCRIPTION
static final java.lang.String PROP_SHORTCUT
static final java.lang.String PROP_ICON
static final java.lang.String PROP_ENABLED
static final java.lang.String PROP_VISIBLE
@Nullable java.lang.String getId()
@Nullable java.lang.String getCaption()
@StudioProperty void setCaption(@Nullable java.lang.String caption)
@Nullable java.lang.String getDescription()
@StudioProperty void setDescription(@Nullable java.lang.String description)
@Nullable KeyCombination getShortcutCombination()
void setShortcutCombination(@Nullable KeyCombination shortcut)
@StudioProperty(type=SHORTCUT) void setShortcut(@Nullable java.lang.String shortcut)
shortcut
- string of type "Modifiers-Key", e.g. "Alt-N". Case-insensitive.@Nullable java.lang.String getIcon()
@StudioProperty void setIcon(@Nullable java.lang.String icon)
void setIconFromSet(Icons.Icon icon)
boolean isEnabled()
@StudioProperty(name="enable") void setEnabled(boolean enabled)
boolean isVisible()
@StudioProperty void setVisible(boolean visible)
void refreshState()
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.
@Nullable ActionOwner getOwner()
java.util.Collection<ActionOwner> getOwners()
void addOwner(ActionOwner actionOwner)
actionOwner
- owner componentvoid removeOwner(ActionOwner actionOwner)
actionOwner
- owner componentvoid actionPerform(Component component)
component
- invoking componentvoid addPropertyChangeListener(java.util.function.Consumer<java.beans.PropertyChangeEvent> listener)
listener
- a listener objectvoid removePropertyChangeListener(java.util.function.Consumer<java.beans.PropertyChangeEvent> listener)
listener
- a listener objectaddPropertyChangeListener(java.util.function.Consumer<java.beans.PropertyChangeEvent>)