|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.AbstractAction
com.ehsbe.commons.action.AbstractActionExt
com.ehsbe.commons.action.ManagedAction
com.ehsbe.commons.action.TriggerAction
public class TriggerAction
Action, that supports different settings for tootltip, text and icons depending on its selection state.
Field Summary | |
---|---|
static String |
SELECTED_LARGE_ICON
The key for the large icon, when the button is selected. |
static String |
SELECTED_LONG_DESCRIPTION
The key used for storing a longer String description for
the action, when it is selected. |
static String |
SELECTED_MNEMONIC_KEY
The key used for storing a the mnemonic for the action, when it is selected. |
static String |
SELECTED_NAME
The key used for storing the String name for the action,
used for a menu or button, when it is selected. |
static String |
SELECTED_SHORT_DESCRIPTION
The key used for storing a short String description for
the action, used for tooltip text, when it is selected. |
static String |
SELECTED_SMALL_ICON
The key used for storing a small Icon , such as
ImageIcon , for the action, when it is selected. |
static String |
TOGGLE_BUTTON
UI hint to use a JToggleButton instead of a normal JButton. |
Fields inherited from class com.ehsbe.commons.action.ManagedAction |
---|
actionListeners, itemListeners |
Fields inherited from class com.ehsbe.commons.action.AbstractActionExt |
---|
GROUP, IS_STATE, LARGE_ICON_P_KEY, SELECT_PROPERTY_NAME, SMALL_ICON_P_KEY |
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 | |
---|---|
TriggerAction()
Default Action constructor. |
|
TriggerAction(String name)
Defines an Action object with the specified name and a
default icon. |
|
TriggerAction(String name,
Icon icon)
Defines an Action object with the specified name and the
specified icon. |
|
TriggerAction(String name,
String command)
Defines an Action object with the specified name, and the
specified command key. |
|
TriggerAction(String name,
String command,
Icon icon)
Defines an Action object with the specified name, the
specified command key and the specified icon. |
|
TriggerAction(String name,
String command,
Icon icon,
String selectedName,
Icon selectedIcon)
Defines an Action object with the specified name, the
specified command key and the specified icon. |
Method Summary | |
---|---|
Icon |
getLargeIcon()
Get a large icon which represents the action wrt. its current selection state. |
Icon |
getLargeIcon(boolean selected)
Get a large icon which represents the action wrt. the given selection state. |
String |
getLongDescription()
Get a long desciption of the action wrt. its current selection state. |
String |
getLongDescription(boolean selected)
Get a long desciption of the action wrt. the given selection state. |
int |
getMnemonic()
Get the mnemonic key code for the action wrt. to the current selection state. |
int |
getMnemonic(boolean selected)
Get the mnemonic key code for the action wrt. to the given selection state. |
String |
getName()
Get the name of the action wrt. its current selection state. |
String |
getName(boolean selected)
Get the name of the action wrt. the given selection state. |
String |
getShortDescription()
Get a short description of the action wrt. its current selection state. |
String |
getShortDescription(boolean selected)
Get a short description of the action wrt. the given selection state. |
Icon |
getSmallIcon()
Get a small icon which represents the action wrt. to the current selection state. |
Icon |
getSmallIcon(boolean selected)
Get a small icon which represents the action wrt. to the given selection state. |
Object |
getValue(String key)
|
void |
setLargeIcon(Icon icon,
boolean selected)
Sets the large icon which represents the action depending on its selection state. |
void |
setLongDescription(String desc,
boolean selected)
Sets the long description of the action depending on its selection state. |
void |
setMnemonic(int mnemonic,
boolean selected)
Sets the mnemonic key code for the action wrt. to the given selection state. |
void |
setMnemonic(String mnemonic,
boolean selected)
Sets the mnemonic key code for the action wrt. to the given selection state. |
void |
setName(String name,
boolean selected)
Sets the display name of the action depending on its selection state. |
void |
setShortDescription(String desc,
boolean selected)
Sets the short description of the action. |
void |
setSmallIcon(Icon icon,
boolean selected)
Sets the small icon which represents the action depending on its selection state. |
Methods inherited from class com.ehsbe.commons.action.ManagedAction |
---|
actionPerformed, addActionListener, addItemListener, clone, itemStateChanged, removeActionListener, removeItemListener |
Methods inherited from class com.ehsbe.commons.action.AbstractActionExt |
---|
dispose, getAccelerator, getActionCommand, getGroup, getLargePressedIcon, getSmallPressedIcon, isSelected, isStateAction, setAccelerator, setActionCommand, setGroup, setLargeIcon, setLargePressedIcon, setLongDescription, setMnemonic, setMnemonic, setName, setSelected, setShortDescription, setSmallIcon, setSmallPressedIcon, setStateAction, setStateAction, toString |
Methods inherited from class javax.swing.AbstractAction |
---|
addPropertyChangeListener, firePropertyChange, getKeys, getPropertyChangeListeners, isEnabled, putValue, removePropertyChangeListener, setEnabled |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String SELECTED_LARGE_ICON
public static final String SELECTED_NAME
String
name for the action,
used for a menu or button, when it is selected.
public static final String SELECTED_SHORT_DESCRIPTION
String
description for
the action, used for tooltip text, when it is selected.
public static final String SELECTED_LONG_DESCRIPTION
String
description for
the action, when it is selected. Could be used for context-sensitive
help.
public static final String SELECTED_SMALL_ICON
Icon
, such as
ImageIcon
, for the action, when it is selected. Used for
menu items.
public static final String SELECTED_MNEMONIC_KEY
public static final String TOGGLE_BUTTON
Constructor Detail |
---|
public TriggerAction()
public TriggerAction(String name)
Action
object with the specified name and a
default icon.
name
- display name of the actionpublic TriggerAction(String name, Icon icon)
Action
object with the specified name and the
specified icon.
name
- display name of the actionicon
- the action's iconpublic TriggerAction(String name, String command)
Action
object with the specified name, and the
specified command key.
name
- display name of the actioncommand
- the value of the action command keypublic TriggerAction(String name, String command, Icon icon)
Action
object with the specified name, the
specified command key and the specified icon.
name
- display name of the actioncommand
- the value of the action command keyicon
- icon to displaypublic TriggerAction(String name, String command, Icon icon, String selectedName, Icon selectedIcon)
Action
object with the specified name, the
specified command key and the specified icon.
name
- display name of the actioncommand
- the value of the action command keyicon
- icon to displayselectedName
- display name of the action, when selectedselectedIcon
- icon to display, when selectedMethod Detail |
---|
public void setName(String name, boolean selected)
This is a convenience method for putValue
with the
Action.NAME
and SELECTED_NAME
key.
name
- the name of the action; can be null
selected
- if true
, the icon will be used, when selected,
otherwise when unselected.Action.NAME
,
SELECTED_NAME
,
Action.putValue(java.lang.String, java.lang.Object)
public String getName()
getName
in class AbstractActionExt
null
if not set.public String getName(boolean selected)
selected
- selection state
null
if not set.public void setSmallIcon(Icon icon, boolean selected)
This is a convenience method for putValue
with the
Action.SMALL_ICON
and SELECTED_SMALL_ICON
key.
Also sets its counter part's icon to the given icon, if it has no
icon set (i.e. null
).
icon
- the small icon; can be null
selected
- if true
, the icon will be used, when selected,
otherwise when unselected.Action.SMALL_ICON
,
SELECTED_SMALL_ICON
,
Action.putValue(java.lang.String, java.lang.Object)
public Icon getSmallIcon()
getSmallIcon
in class AbstractActionExt
null
if not set.public Icon getSmallIcon(boolean selected)
selected
- selection state
null
if not set.setSmallIcon(Icon, boolean)
public void setLargeIcon(Icon icon, boolean selected)
This is a convenience method for putValue
with the
LARGE_ICON
and SELECTED_LARGE_ICON
key.
Also sets its counter part's icon to the given icon, if it has no
icon set (i.e. null
).
icon
- the large icon; can be null
selected
- if true
, the icon will be used, when selected,
otherwise when unselected.Action.LARGE_ICON_KEY
,
SELECTED_LARGE_ICON
,
Action.putValue(java.lang.String, java.lang.Object)
public Icon getLargeIcon()
getLargeIcon
in class AbstractActionExt
null
if not set.public Icon getLargeIcon(boolean selected)
selected
- selection state
null
if not set.public void setShortDescription(String desc, boolean selected)
This is a convenience method for putValue
with the
Action.SHORT_DESCRIPTION
and
SELECTED_SHORT_DESCRIPTION
key.
desc
- the short description; can be null
wselected
- if true
, the description will be used, when
selected, otherwise when unselected.Action.SHORT_DESCRIPTION
,
SELECTED_SHORT_DESCRIPTION
,
Action.putValue(java.lang.String, java.lang.Object)
public String getShortDescription()
getShortDescription
in class AbstractActionExt
null
if not set.public String getShortDescription(boolean selected)
selected
- selection state
null
if not set.public void setLongDescription(String desc, boolean selected)
This is a convenience method for putValue
with the
Action.LONG_DESCRIPTION
||SELECTED_LONG_DESCRIPTION
key.
desc
- the long description; can be null
selected
- if true
, the icon will be used, when selected,
otherwise when unselected.Action.LONG_DESCRIPTION
,
SELECTED_LONG_DESCRIPTION
,
Action.putValue(java.lang.String, java.lang.Object)
public String getLongDescription()
getLongDescription
in class AbstractActionExt
null
if not set.public String getLongDescription(boolean selected)
selected
- selection state
null
if not set.public void setMnemonic(int mnemonic, boolean selected)
mnemonic
- an int key code mnemonic or 0selected
- selection stateAbstractActionExt.setMnemonic(int)
public void setMnemonic(String mnemonic, boolean selected)
mnemonic
- the first character of this parameter will be used
to get the mnemonic value. Ignored if null
or empty.selected
- selection statesetMnemonic(int, boolean)
public int getMnemonic()
getMnemonic
in class AbstractActionExt
public int getMnemonic(boolean selected)
selected
- selection state
public Object getValue(String key)
getValue
in interface Action
getValue
in class AbstractAction
|
ehsbe CommonsTM Version 1.1.0rc3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |