java.lang.Object
javax.swing.AbstractAction
org.autogui.swing.GuiSwingTaskRunner.ContextAction
org.autogui.swing.GuiSwingActionDefault.ExecutionAction
- All Implemented Interfaces:
ActionListener
,Serializable
,Cloneable
,EventListener
,Action
,GuiSwingKeyBinding.RecommendedKeyStroke
,PopupCategorized.CategorizedMenuItem
,PopupCategorized.CategorizedMenuItemAction
,PopupCategorized.CategorizedMenuItemComponent
- Direct Known Subclasses:
GuiSwingTableColumnSetDefault.TableSelectionListAction
- Enclosing class:
GuiSwingActionDefault
public static class GuiSwingActionDefault.ExecutionAction
extends GuiSwingTaskRunner.ContextAction
implements PopupCategorized.CategorizedMenuItemAction, GuiSwingKeyBinding.RecommendedKeyStroke
a swing-action executing the action of the context.
the icon will be automatically determined by the name of the context via
GuiSwingIcons
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
the message of the confirmation dialog showen whenneedToConfirm
protected boolean
if true, the action shows a confirmation dialog before executingprotected AtomicBoolean
protected GuiSwingView.SpecifierManager
Fields inherited from class org.autogui.swing.GuiSwingTaskRunner.ContextAction
taskRunner
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
-
Constructor Summary
ConstructorsConstructorDescriptionExecutionAction
(GuiMappingContext context, GuiSwingView.SpecifierManager targetSpecifier) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
executeAction
(GuiReprValue.ObjectSpecifier specifier) executeAction
(GuiReprValue.ObjectSpecifier specifier, ActionEvent e) void
executeWithConfirm
(ActionEvent e, Runnable action, Runnable cancelAction) the void returning version ofexecuteWithConfirmReturn(ActionEvent, Supplier, Supplier)
<RetType> RetType
executeWithConfirmReturn
(ActionEvent e, Supplier<RetType> action, Supplier<RetType> cancelAction) show a confirmation dialog and run the action if the user selects OK of the dialoggetIcon()
protected void
setneedToConfirm
andconfirmDescription
from init-annotation attached to the action methodvoid
setResultTarget
(Consumer<Object> resultTarget) Methods inherited from class org.autogui.swing.GuiSwingTaskRunner.ContextAction
executeContextTask, executeContextTask, getContext
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.swing.Action
accept, addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
Methods inherited from interface org.autogui.swing.util.PopupCategorized.CategorizedMenuItem
getKeyStroke, getSubCategory
Methods inherited from interface org.autogui.swing.util.PopupCategorized.CategorizedMenuItemAction
getMenuItem, getMenuItemWithAction, remap
Methods inherited from interface org.autogui.swing.util.PopupCategorized.CategorizedMenuItemComponent
getCategory, getName
-
Field Details
-
resultTarget
-
running
-
targetSpecifier
-
needToConfirm
protected boolean needToConfirmif true, the action shows a confirmation dialog before executing- Since:
- 1.8
-
confirmDescription
the message of the confirmation dialog showen whenneedToConfirm
- Since:
- 1.8
-
-
Constructor Details
-
ExecutionAction
-
-
Method Details
-
initNeedToConfirmDefault
protected void initNeedToConfirmDefault()setneedToConfirm
andconfirmDescription
from init-annotation attached to the action method- Since:
- 1.8
-
setResultTarget
-
actionPerformed
- Specified by:
actionPerformed
in interfaceActionListener
- Overrides:
actionPerformed
in classGuiSwingTaskRunner.ContextAction
-
actionPerformedWithoutCheckingRunning
-
getIconName
-
executeWithConfirm
the void returning version ofexecuteWithConfirmReturn(ActionEvent, Supplier, Supplier)
- Parameters:
e
- the action-event used for showing the confirmation dialogaction
- the action code body; non-nullcancelAction
- the action executed when the user selects canceling, or null- Since:
- 1.8
-
executeWithConfirmReturn
public <RetType> RetType executeWithConfirmReturn(ActionEvent e, Supplier<RetType> action, Supplier<RetType> cancelAction) show a confirmation dialog and run the action if the user selects OK of the dialog- Type Parameters:
RetType
- the returned type of the action- Parameters:
e
- the action-event used for showing the confirmation dialog; obtaining the root-pane of a source component and used for the dialog parentaction
- the action code body; non-nullcancelAction
- the action when cancelled ; non-null- Returns:
- the returned value of the action (or calcelAction)
- Since:
- 1.8
-
executeAction
-
executeAction
- Parameters:
specifier
- a specifier for the target objecte
- an optional action event- Since:
- 1.8
-
getIcon
- Specified by:
getIcon
in interfacePopupCategorized.CategorizedMenuItem
- Specified by:
getIcon
in interfacePopupCategorized.CategorizedMenuItemComponent
-
getActionPressedIcon
-
getRecommendedKeyStroke
- Specified by:
getRecommendedKeyStroke
in interfaceGuiSwingKeyBinding.RecommendedKeyStroke
-
getRecommendedKeyPrecedence
- Specified by:
getRecommendedKeyPrecedence
in interfaceGuiSwingKeyBinding.RecommendedKeyStroke
-