java.awt.event.ActionListener
, java.awt.event.ItemListener
, java.io.Serializable
, java.lang.Cloneable
, java.util.EventListener
, javax.swing.Action
BoundAction
, ColumnControlButton.ColumnVisibilityAction
, CompositeAction
, LinkAction
, TargetableAction
public abstract class AbstractActionExt
extends javax.swing.AbstractAction
implements java.awt.event.ItemListener
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
GROUP |
The key for the button group
|
static java.lang.String |
IS_STATE |
The key for the flag which indicates that this is a state type.
|
static java.lang.String |
LARGE_ICON |
The key for the large icon
|
Constructor | Description |
---|---|
AbstractActionExt() |
Default constructor, does nothing.
|
AbstractActionExt(java.lang.String name) |
|
AbstractActionExt(java.lang.String name,
java.lang.String command) |
Constructs an Action with the label and command
|
AbstractActionExt(java.lang.String name,
java.lang.String command,
javax.swing.Icon icon) |
|
AbstractActionExt(java.lang.String name,
javax.swing.Icon icon) |
|
AbstractActionExt(AbstractActionExt action) |
Copy constuctor copies the state.
|
Modifier and Type | Method | Description |
---|---|---|
void |
dispose() |
Will perform cleanup on the object.
|
javax.swing.KeyStroke |
getAccelerator() |
Returns the key stroke which represents an accelerator
for the action.
|
java.lang.Object |
getActionCommand() |
Returns the action command.
|
java.lang.Object |
getGroup() |
|
javax.swing.Icon |
getLargeIcon() |
Returns a large icon which represents the action.
|
java.lang.String |
getLongDescription() |
Returns a long desciption of the action.
|
int |
getMnemonic() |
Return the mnemonic key code for the action.
|
java.lang.String |
getName() |
Returns the name of the action.
|
java.lang.String |
getShortDescription() |
Returns a short desciption of the action.
|
javax.swing.Icon |
getSmallIcon() |
Returns a small icon which represents the action.
|
boolean |
isSelected() |
|
boolean |
isStateAction() |
Inicates if this action has states.
|
void |
itemStateChanged(java.awt.event.ItemEvent e) |
Callback method as
ItemListener . |
void |
setAccelerator(javax.swing.KeyStroke key) |
Sets the key stroke which represents an accelerator
for the action.
|
void |
setActionCommand(java.lang.Object key) |
Sets the action command key.
|
void |
setGroup(java.lang.Object group) |
Sets the group identity of the state action.
|
void |
setLargeIcon(javax.swing.Icon icon) |
Sets the large icon which represents the action.
|
void |
setLongDescription(java.lang.String desc) |
Sets the long desciption of the action.
|
void |
setMnemonic(int mnemonic) |
Sets the mnemonic key code for the action.
|
void |
setMnemonic(java.lang.String mnemonic) |
|
void |
setName(java.lang.String name) |
Sets the name of the action.
|
void |
setSelected(boolean newValue) |
Changes the state of the action
|
void |
setShortDescription(java.lang.String desc) |
Sets the short desciption of the action.
|
void |
setSmallIcon(javax.swing.Icon icon) |
Sets the small icon which represents the action.
|
void |
setStateAction() |
Set the state property to true.
|
void |
setStateAction(boolean state) |
Set the state property.
|
java.lang.String |
toString() |
public static final java.lang.String LARGE_ICON
public static final java.lang.String GROUP
public static final java.lang.String IS_STATE
public AbstractActionExt()
public AbstractActionExt(AbstractActionExt action)
public AbstractActionExt(java.lang.String name)
public AbstractActionExt(java.lang.String name, javax.swing.Icon icon)
public AbstractActionExt(java.lang.String name, java.lang.String command)
name
- name of the action usually used as a labelcommand
- command key of the actionpublic AbstractActionExt(java.lang.String name, java.lang.String command, javax.swing.Icon icon)
name
- display name of the actioncommand
- the value of the action command keyicon
- icon to displaypublic java.lang.String getShortDescription()
public void setShortDescription(java.lang.String desc)
This is a convenience method for putValue
with the
Action.SHORT_DESCRIPTION
key.
desc
- the short description; can be null
wAction.SHORT_DESCRIPTION
,
Action.putValue(java.lang.String, java.lang.Object)
public java.lang.String getLongDescription()
public void setLongDescription(java.lang.String desc)
This is a convenience method for putValue
with the
Action.LONG_DESCRIPTION
key.
desc
- the long description; can be null
Action.LONG_DESCRIPTION
,
Action.putValue(java.lang.String, java.lang.Object)
public javax.swing.Icon getSmallIcon()
public void setSmallIcon(javax.swing.Icon icon)
This is a convenience method for putValue
with the
Action.SMALL_ICON
key.
icon
- the small icon; can be null
Action.SMALL_ICON
,
Action.putValue(java.lang.String, java.lang.Object)
public javax.swing.Icon getLargeIcon()
public void setLargeIcon(javax.swing.Icon icon)
This is a convenience method for putValue
with the
LARGE_ICON
key.
icon
- the large icon; can be null
LARGE_ICON
,
Action.putValue(java.lang.String, java.lang.Object)
public void setName(java.lang.String name)
This is a convenience method for putValue
with the
Action.NAME
key.
name
- the name of the action; can be null
Action.NAME
,
Action.putValue(java.lang.String, java.lang.Object)
public java.lang.String getName()
public void setMnemonic(java.lang.String mnemonic)
public void setMnemonic(int mnemonic)
This is a convenience method for putValue
with the
Action.MNEMONIC_KEY
key.
This method does not validate the value. Please see
AbstractButton.setMnemonic(int)
for details
concerning the value of the mnemonic.
mnemonic
- an int key code mnemonic or 0AbstractButton.setMnemonic(int)
,
Action.MNEMONIC_KEY
,
Action.putValue(java.lang.String, java.lang.Object)
public int getMnemonic()
public void setActionCommand(java.lang.Object key)
This is a convenience method for putValue
with the
Action.ACTION_COMMAND_KEY
key.
key
- the action commandAction.ACTION_COMMAND_KEY
,
Action.putValue(java.lang.String, java.lang.Object)
public java.lang.Object getActionCommand()
public javax.swing.KeyStroke getAccelerator()
public void setAccelerator(javax.swing.KeyStroke key)
This is a convenience method for putValue
with the
Action.ACCELERATOR_KEY
key.
key
- the key stroke; can be null
Action.ACCELERATOR_KEY
,
Action.putValue(java.lang.String, java.lang.Object)
public void setGroup(java.lang.Object group)
public java.lang.Object getGroup()
public void dispose()
public boolean isStateAction()
public void setStateAction()
public void setStateAction(boolean state)
state
- if true then this action will fire ItemEventspublic boolean isSelected()
public void setSelected(boolean newValue)
newValue
- true to set the action as selected of the action.public java.lang.String toString()
toString
in class java.lang.Object
public void itemStateChanged(java.awt.event.ItemEvent e)
ItemListener
. Updates internal state based
on the given ItemEvent. Here: synchs selected property if isStateAction(), does nothing otherwise.
itemStateChanged
in interface java.awt.event.ItemListener
e
- the ItemEvent fired by a ItemSelectable on changing the selected
state.