public abstract class BaseAction extends TextAction
Modifier and Type | Field and Description |
---|---|
static int |
ABBREV_RESET
Deprecated.
Not used anymore.
|
static int |
CLEAR_STATUS_TEXT
Clear status bar text
|
static String |
ICON_RESOURCE_PROPERTY
Resource for the icon
|
static String |
LOCALE_DESC_PREFIX
Prefix for the name of the key for description in locale support
|
static String |
LOCALE_POPUP_PREFIX
Prefix for the name of the key for popup description in locale support
|
static int |
MAGIC_POSITION_RESET
Reset magic caret position
|
static String |
NO_KEYBINDING
The name of Action property.
|
static int |
NO_RECORDING
The action will not be recorded if in macro recording
|
static String |
POPUP_MENU_TEXT
Text of the menu item in popup menu for this action
|
static int |
SAVE_POSITION
Save current position in the jump list
|
static int |
SELECTION_REMOVE
Remove the selected text at the action begining
|
static int |
UNDO_MERGE_RESET
Prevents adding the new undoable edit to the old one when the next
document change occurs.
|
protected int |
updateMask
Bit mask of what should be updated when the action is performed before
the action's real task is invoked.
|
static int |
WORD_MATCH_RESET
Reset word-match table
|
changeSupport, enabled
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 and Description |
---|
BaseAction() |
BaseAction(int updateMask) |
BaseAction(String name) |
BaseAction(String name,
int updateMask) |
Modifier and Type | Method and Description |
---|---|
protected void |
actionNameUpdate(String actionName)
Called by
BaseAction.putValue(String,Object) when Action.NAME property
is set to a non-null String value. |
void |
actionPerformed(ActionEvent evt)
This method is made final here as there's an important
processing that must be done before the real action
functionality is performed.
|
abstract void |
actionPerformed(ActionEvent evt,
JTextComponent target)
The target method that performs the real action functionality.
|
protected boolean |
asynchonous() |
protected Object |
createDefaultValue(String key)
This method is called when there is no value for the particular key.
|
protected Object |
findValue(String key)
Deprecated.
this method is deprecated like the LocaleSupport which it uses by default.
It should be replaced by implementing
BaseAction.getShortDescriptionBundleClass() |
protected Object |
getDefaultShortDescription()
Get the default value for
Action.SHORT_DESCRIPTION property. |
JMenuItem |
getPopupMenuItem(JTextComponent target) |
String |
getPopupMenuText(JTextComponent target) |
protected Class |
getShortDescriptionBundleClass()
Get the class in a package where resource bundle for localization
of the short description of this action resides.
|
Object |
getValue(String key) |
void |
putValue(String key,
Object value) |
void |
updateComponent(JTextComponent target)
Update the component according to the update mask specified
in the constructor of the action.
|
void |
updateComponent(JTextComponent target,
int updateMask)
Update the component according to the given update mask
|
augmentList, getFocusedComponent, getTextComponent
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, isEnabled, removePropertyChangeListener, setEnabled
public static final String POPUP_MENU_TEXT
public static final String LOCALE_DESC_PREFIX
public static final String LOCALE_POPUP_PREFIX
public static final String ICON_RESOURCE_PROPERTY
public static final int SELECTION_REMOVE
public static final int MAGIC_POSITION_RESET
@Deprecated public static final int ABBREV_RESET
public static final int UNDO_MERGE_RESET
public static final int WORD_MATCH_RESET
public static final int CLEAR_STATUS_TEXT
public static final int NO_RECORDING
public static final int SAVE_POSITION
public static final String NO_KEYBINDING
protected int updateMask
public BaseAction()
public BaseAction(int updateMask)
public BaseAction(String name)
public BaseAction(String name, int updateMask)
@Deprecated protected Object findValue(String key)
BaseAction.getShortDescriptionBundleClass()
public Object getValue(String key)
getValue
in interface Action
getValue
in class AbstractAction
public void putValue(String key, Object value)
putValue
in interface Action
putValue
in class AbstractAction
protected void actionNameUpdate(String actionName)
BaseAction.putValue(String,Object)
when Action.NAME
property
is set to a non-null String value. This allows a "polymorphic" action (with
Action.NAME-specific behavior) to update certain properties (e.g. an icon)
according to the name that was set.actionName
- non-null action's name (value of Action.NAME property).protected Object createDefaultValue(String key)
BaseAction.putValue(String, Object)
so in that case this method
is only called once.
Note: When overriding this method super
implementation
should always be called.
key
- key for which the default value should be found.protected Class getShortDescriptionBundleClass()
protected Object getDefaultShortDescription()
Action.SHORT_DESCRIPTION
property.
Action.getValue(Action.SHORT_DESCRIPTION)
.public final void actionPerformed(ActionEvent evt)
public abstract void actionPerformed(ActionEvent evt, JTextComponent target)
evt
- action event describing the action that occuredtarget
- target component where the action occured. It's retrieved
by the TextAction.getTextComponent(evt).protected boolean asynchonous()
public JMenuItem getPopupMenuItem(JTextComponent target)
public String getPopupMenuText(JTextComponent target)
public void updateComponent(JTextComponent target)
target
- target component to be updated.public void updateComponent(JTextComponent target, int updateMask)
target
- target component to be updated.updateMask
- mask that specifies what will be updated