Class AbstractActionExt
- All Implemented Interfaces:
ActionListener, ItemListener, Serializable, Cloneable, EventListener, Action
- Direct Known Subclasses:
AbstractHyperlinkAction, BoundAction, ColumnControlButton.ColumnVisibilityAction, CompositeAction, JXGradientChooser.AddThumbAction, JXGradientChooser.DeleteThumbAction, JXLoginPane.CancelAction, JXLoginPane.LoginAction, TargetableAction
SwingX 1.6.3 updates AbstractActionExt to use new features of Action that were
added in Java 1.6. The selection is now managed with Action.SELECTED_KEY, which
allows the action to correctly configured Swing buttons. The LARGE_ICON has also been
changed to correspond to Action.LARGE_ICON_KEY.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe key for the button groupstatic final StringThe key for the flag which indicates that this is a state type.static final StringThe key for the large iconFields inherited from class AbstractAction
changeSupport, enabledFields inherited from interface 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
ConstructorsConstructorDescriptionDefault constructor, does nothing.AbstractActionExt(String name) AbstractActionExt(String name, String command) Constructs an Action with the label and commandAbstractActionExt(String name, String command, Icon icon) AbstractActionExt(String name, Icon icon) AbstractActionExt(AbstractActionExt action) Copy constructor copies the state. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Will perform cleanup on the object.Returns the key stroke which represents an accelerator for the action.Returns the action command.getGroup()Returns a large icon which represents the action.Returns a long description of the action.intReturn the mnemonic key code for the action.getName()Returns the name of the action.Returns a short description of the action.Returns a small icon which represents the action.booleanbooleanIndicates if this action has states.voidCallback method asItemListener.voidsetAccelerator(KeyStroke key) Sets the key stroke which represents an accelerator for the action.voidsetActionCommand(String key) Sets the action command key.voidSets the group identity of the state action.voidsetLargeIcon(Icon icon) Sets the large icon which represents the action.voidsetLongDescription(String desc) Sets the long description of the action.voidsetMnemonic(int mnemonic) Sets the mnemonic key code for the action.voidsetMnemonic(String mnemonic) voidSets the name of the action.voidsetSelected(boolean newValue) Changes the state of the action.voidsetShortDescription(String desc) Sets the short description of the action.voidsetSmallIcon(Icon icon) Sets the small icon which represents the action.voidSet the state property to true.voidsetStateAction(boolean state) Set the state property.toString()Methods inherited from class AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabledMethods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ActionListener
actionPerformed
-
Field Details
-
LARGE_ICON
The key for the large iconAs of SwingX 1.6.3 is now has the same value as
Action.LARGE_ICON_KEY, which is new to 1.6.- See Also:
-
GROUP
-
IS_STATE
The key for the flag which indicates that this is a state type.- See Also:
-
-
Constructor Details
-
AbstractActionExt
public AbstractActionExt()Default constructor, does nothing. -
AbstractActionExt
Copy constructor copies the state. -
AbstractActionExt
-
AbstractActionExt
-
AbstractActionExt
-
AbstractActionExt
-
-
Method Details
-
getShortDescription
Returns a short description of the action.- Returns:
- the short description or null
-
setShortDescription
Sets the short description of the action. This will also set the long description value is it is null.This is a convenience method for
putValuewith theAction.SHORT_DESCRIPTIONkey.- Parameters:
desc- the short description; can benullw- See Also:
-
getLongDescription
Returns a long description of the action.- Returns:
- the long description or null
-
setLongDescription
Sets the long description of the action. This will also set the value of the short description if that value is null.This is a convenience method for
putValuewith theAction.LONG_DESCRIPTIONkey.- Parameters:
desc- the long description; can benull- See Also:
-
getSmallIcon
Returns a small icon which represents the action.- Returns:
- the small icon or null
-
setSmallIcon
Sets the small icon which represents the action.This is a convenience method for
putValuewith theAction.SMALL_ICONkey.- Parameters:
icon- the small icon; can benull- See Also:
-
getLargeIcon
Returns a large icon which represents the action.- Returns:
- the large icon or null
-
setLargeIcon
Sets the large icon which represents the action.This is a convenience method for
putValuewith theLARGE_ICONkey.- Parameters:
icon- the large icon; can benull- See Also:
-
setName
Sets the name of the action.This is a convenience method for
putValuewith theAction.NAMEkey.- Parameters:
name- the name of the action; can benull- See Also:
-
getName
-
setMnemonic
-
setMnemonic
public void setMnemonic(int mnemonic) Sets the mnemonic key code for the action.This is a convenience method for
putValuewith theAction.MNEMONIC_KEYkey.This method does not validate the value. Please see
AbstractButton.setMnemonic(int)for details concerning the value of the mnemonic.- Parameters:
mnemonic- an int key code mnemonic or 0- See Also:
-
getMnemonic
public int getMnemonic()Return the mnemonic key code for the action.- Returns:
- the mnemonic or 0
-
setActionCommand
Sets the action command key. The action command key is used to identify the action.This is a convenience method for
putValuewith theAction.ACTION_COMMAND_KEYkey.- Parameters:
key- the action command- See Also:
-
getActionCommand
-
getAccelerator
Returns the key stroke which represents an accelerator for the action.- Returns:
- the key stroke or null
-
setAccelerator
Sets the key stroke which represents an accelerator for the action.This is a convenience method for
putValuewith theAction.ACCELERATOR_KEYkey.- Parameters:
key- the key stroke; can benull- See Also:
-
setGroup
Sets the group identity of the state action. This is used to identify the action as part of a button group. -
getGroup
-
dispose
public void dispose()Will perform cleanup on the object. Should be called when finished with the Action. This should be used if a new action is constructed from the properties of an old action. The old action properties should be disposed. -
isStateAction
public boolean isStateAction()Indicates if this action has states. If this method returns true then the this will send ItemEvents to ItemListeners when the control constructed with this action in invoked.- Returns:
- true if this can handle states
-
setStateAction
public void setStateAction()Set the state property to true. -
setStateAction
public void setStateAction(boolean state) Set the state property.- Parameters:
state- if true then this action will fire ItemEvents
-
isSelected
public boolean isSelected()- Returns:
- true if the action is in the selected state
-
setSelected
public void setSelected(boolean newValue) Changes the state of the action. This is a convenience method for updating the Action via the value map.- Parameters:
newValue- true to set the action as selected of the action.- See Also:
-
toString
-
itemStateChanged
Callback method asItemListener. Updates internal state based on the given ItemEvent.Here: synchs selected property if isStateAction(), does nothing otherwise.
- Specified by:
itemStateChangedin interfaceItemListener- Parameters:
e- the ItemEvent fired by a ItemSelectable on changing the selected state.
-