java.lang.Object
javax.swing.AbstractAction
com.iamsoft.util.ui.swing.activation.AbstractActivateableAction
com.iamsoft.util.ui.swing.SwingAction
- All Implemented Interfaces:
Activatable,ActionListener,Serializable,Cloneable,EventListener,Action
- Direct Known Subclasses:
CascadeWindowAction,CheckForUpdateAction,DataRequestAction,DisplayDisablementExplanationAction,EvalScriptAction,GoToSnapshotAction,HelpContentsAction,HelpIndexAction,HelpSearchAction,HistoryAction,LaunchWindowDialogWindowAction,Log4jPrefsAction,RedoAction,SwingWorkersAction,ThreadPrefsAction,TileHorizontallyWindowAction,TileVerticallyWindowAction,UndoAction
Wraps actions so that enablement and errors can be more easily handled. If the wrapped
ActionListener.actionPerformed(ActionEvent) throws an exception, the
decorator will catch the error and display a friendly dialog. If any other class has
reason to disable the action, the decorator can add it to a list and ensure that the
action remains disabled until the list is empty. This approach should greatly simplify
disablements that occur because of busy threads. In general, the underlying action should
always be enabled.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringString suffix that indicates that an action requires further input from a user prior to completion.Fields inherited from class javax.swing.AbstractAction
changeSupport, enabledFields 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
ConstructorsModifierConstructorDescriptionprotectedprotectedSwingAction(String pText) protectedSwingAction(String pText, Icon pIcon) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidactionPerformed(ActionEvent pEvt) Try to perform wrapped action.protected voidstatic SwingActiondecorateAction(Action pAction) Wrap an ordinary action in a SwingAction.abstract voidexecute()Perform action.protected intMethods inherited from class com.iamsoft.util.ui.swing.activation.AbstractActivateableAction
addActivationCriterion, getActivatableFacade, isDisplayingDisablementReasonsByDefault, isDisplayingDisablementReasonsByOverride, putValue, setDisplayingDisablementReasonsByDefault, setEnabled, stripTooltipMethods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, removePropertyChangeListener
-
Field Details
-
ELIPSIS
String suffix that indicates that an action requires further input from a user prior to completion.- See Also:
-
-
Constructor Details
-
SwingAction
protected SwingAction() -
SwingAction
- See Also:
-
SwingAction
- Parameters:
pText- Action name.pIcon- Action icon.
-
-
Method Details
-
getModifiers
protected int getModifiers() -
decorateAction
Wrap an ordinary action in a SwingAction. The wrapped action's "actionPerformed" method must be able to accept a null parameter.- Parameters:
pAction- Wrapped action.- Returns:
- A SwingAction that wraps an ordinary action.
-
actionPerformed
Try to perform wrapped action. On error, display a dialog. -
addElipsis
protected void addElipsis() -
execute
public abstract void execute()Perform action.
-