|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.AbstractAction | +--com.borland.primetime.actions.UpdateAction | +--com.borland.primetime.actions.StateAction
A StateAction is a type of UpdateAction that encapsulates a single state property.
A StateAction functions as a regular UpdateAction (or Swing Action object) - it stores the shortText, longText, icon, and enabled state for a single boolean state. The difference is that a StateAction represents a boolean state - as opposed to the UpdateAction (or Action) that represents an arbitrary action.
Subclasses of StateAction need only override the two abstract methods:
public void setState(Object source, boolean state)
and
public boolean getState(Object source)
. They can optionally
override the public method: public void update(Object source)
to initialize the StateAction object immediately before it is
represented as UI somewhere in the environment.
The Grouped property is added to allow a StateAction to appear as grouped in UI - like the use of a radio button or toggle button instead of a checkbox.
Action
, Serialized FormField Summary | |
static java.lang.String |
GROUPED
The storage attribute key for the GROUPED (Boolean) property. |
Fields inherited from class com.borland.primetime.actions.UpdateAction |
ACCELERATOR, ALT_SHORT_DESCRIPTION, disabledReason, EMPTY_ARRAY, ENTERPRISE, FOUNDATION, HELP_TOPIC, LARGE_ICON, MNEMONIC, PROFESSIONAL |
Fields inherited from class javax.swing.AbstractAction |
changeSupport, enabled |
Fields inherited from interface javax.swing.Action |
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON |
Constructor Summary | |
StateAction()
Constructs a StateAction with all default properties. |
|
StateAction(java.lang.String shortText)
Constructs a StateAction with the specified shortText. |
|
StateAction(java.lang.String shortText,
char mnemonic)
Constructs a StateAction with the specified shortText and mnemonic. |
|
StateAction(java.lang.String shortText,
char mnemonic,
java.lang.String longText)
Constructs a StateAction with the specified shortText, mnemonic, and longText. |
|
StateAction(java.lang.String shortText,
char mnemonic,
java.lang.String longText,
javax.swing.Icon smallIcon)
Constructs a StateAction with the specified shortText, mnemonic, longText, and smallIcon. |
|
StateAction(java.lang.String shortText,
char mnemonic,
java.lang.String longText,
javax.swing.Icon smallIcon,
boolean grouped)
Constructs a StateAction with the specified shortText, mnemonic, longText, smallIcon, and grouped setting. |
|
StateAction(java.lang.String shortText,
char mnemonic,
java.lang.String longText,
javax.swing.Icon smallIcon,
javax.swing.Icon largeIcon)
Constructs a StateAction with the specified shortText, mnemonic, longText, and smallIcon. |
Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
The StateAction class implements the actionPerformed(ActionEvent e)
method as a toggle. |
abstract boolean |
getState(java.lang.Object source)
Subclasses should implement this method by returning the appropriate boolean based on the passed source context. |
boolean |
isGrouped()
Returns the grouped property setting. |
void |
setGrouped(boolean grouped)
Sets the grouped property. |
abstract void |
setState(java.lang.Object source,
boolean state)
Subclasses should implement this method by setting the appropriate boolean state using the passed source context. |
Methods inherited from class com.borland.primetime.actions.UpdateAction |
getAltShortText, getDisabledReason, getHelpTopic, getLargeIcon, getLongText, getMnemonic, getShortText, getSmallIcon, getVersion, setAltShortText, setConfigured, setDisabledReason, setHelpTopic, setLargeIcon, setLongText, setMnemonic, setShortText, setSmallIcon, update |
Methods inherited from class javax.swing.AbstractAction |
addPropertyChangeListener, clone, firePropertyChange, getKeys, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.swing.Action |
addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled |
Field Detail |
public static final java.lang.String GROUPED
Constructor Detail |
public StateAction()
public StateAction(java.lang.String shortText)
shortText
- The short text for the StateActionpublic StateAction(java.lang.String shortText, char mnemonic)
shortText
- The short text for the StateActionmnemonic
- The mnemonic for the StateActionpublic StateAction(java.lang.String shortText, char mnemonic, java.lang.String longText)
shortText
- The short text for the StateActionmnemonic
- The mnemonic for the StateActionlongText
- The long text for the StateActionpublic StateAction(java.lang.String shortText, char mnemonic, java.lang.String longText, javax.swing.Icon smallIcon)
shortText
- The short text for the StateActionmnemonic
- The mnemonic for the StateActionlongText
- The long text for the StateActionsmallIcon
- The small icon for the StateActionpublic StateAction(java.lang.String shortText, char mnemonic, java.lang.String longText, javax.swing.Icon smallIcon, javax.swing.Icon largeIcon)
shortText
- The short text for the StateActionmnemonic
- The mnemonic for the StateActionlongText
- The long text for the StateActionsmallIcon
- The small icon for the StateActionlargeIcon
- The large icon for the StateActionpublic StateAction(java.lang.String shortText, char mnemonic, java.lang.String longText, javax.swing.Icon smallIcon, boolean grouped)
shortText
- The short text for the StateActionmnemonic
- The mnemonic for the StateActionlongText
- The long text for the StateActionsmallIcon
- The small icon for the StateActiongrouped
- The grouped or not setting for the StateActionMethod Detail |
public void setGrouped(boolean grouped)
grouped
- The grouped statepublic boolean isGrouped()
public final void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed(ActionEvent e)
method as a toggle. This behavior cannot be overriden.actionPerformed
in class javax.swing.AbstractAction
public abstract void setState(java.lang.Object source, boolean state)
source
- The source context for this action.state
- The enabled/disabled state of this action.public abstract boolean getState(java.lang.Object source)
source
- The source context for this action.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |