|
|||||||||
| Home >> All >> novaworx >> [ gui overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
novaworx.gui
Class ProgramAction

java.lang.Objectjavax.swing.AbstractAction
novaworx.swing.XAction
novaworx.gui.ProgramAction
- All Implemented Interfaces:
- javax.swing.Action, java.awt.event.ActionListener, java.lang.Cloneable, java.util.EventListener, java.io.Serializable
- public class ProgramAction
- extends novaworx.swing.XAction
This class is used to handle the visual aspects of actions. Since components may treat an action specifically this class allows a component specific action to be set as the acting action. The idea being that when a component gains focus it will register the actions that it handles with the appropriate instance of this class. When the component looses focus then the component will unregister the actions that it handles. This works fine in theory but is a little problematic in reality. The most noticable issue is when a menu item gains the focus it will cause the component that was focused to loose focus and therefore disable the acctions it can handle by the time the user selects the menu item.
| Nested Class Summary | |
private class |
ProgramAction.SetEnabled
The class to set the enabled flag from the event dispatch thread. |
| Field Summary | |
private java.util.Stack |
moListenerStack
The stack of listeners. |
private java.lang.String |
msCommand
The command to be sent. |
static int |
NONE
|
| Fields inherited from class novaworx.swing.XAction |
SHORTCUT_KEY_SEQUENCE |
| 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 | |
ProgramAction(java.lang.String sCommand,
java.lang.String sName)
Construct a program action. |
|
ProgramAction(java.lang.String sCommand,
java.lang.String sName,
javax.swing.Icon cIcon)
Construct a program action. |
|
ProgramAction(java.lang.String sCommand,
java.lang.String sName,
javax.swing.Icon cIcon,
int nMnemonic)
Construct a program action. |
|
ProgramAction(java.lang.String sCommand,
java.lang.String sName,
javax.swing.Icon cIcon,
int nMnemonic,
int nKey)
Construct a program action. |
|
ProgramAction(java.lang.String sCommand,
java.lang.String sName,
javax.swing.Icon cIcon,
int nMnemonic,
int nKey,
int nMask)
Construct a program action. |
|
ProgramAction(java.lang.String sCommand,
java.lang.String sName,
javax.swing.Icon cIcon,
int nMnemonic,
java.lang.String asKeySequence)
Construct a program action. |
|
| Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent aoEvent)
Do whatever this action is going to do. |
java.lang.String |
getCommand()
Get the command associated with this action. |
java.awt.event.ActionListener |
getListener()
Get the current action listener. |
java.awt.event.ActionListener |
peekListener()
Get the current ActionListener. |
boolean |
performAction(java.awt.event.ActionEvent aoEvent)
Called by the KeyEventGrabber. |
java.awt.event.ActionListener |
pullListener(java.awt.event.ActionListener aoListener)
Remove an ActionListener. |
java.awt.event.ActionListener |
pullListener(java.awt.event.ActionListener aoListener,
boolean abEnabled)
Remove an ActionListener. |
void |
pushListener(java.awt.event.ActionListener aoListener)
Add an ActionListener. |
void |
pushListener(java.awt.event.ActionListener aoListener,
boolean abEnabled)
Add an ActionListener. |
void |
setEnabled(boolean abEnabled)
Set the enabled flag. |
| Methods inherited from class novaworx.swing.XAction |
encodeKeyEvent, getShortcutDisplayText |
| Methods inherited from class javax.swing.AbstractAction |
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
NONE
public static final int NONE
- See Also:
- Constant Field Values
msCommand
private java.lang.String msCommand
- The command to be sent.
moListenerStack
private java.util.Stack moListenerStack
- The stack of listeners.
| Constructor Detail |
ProgramAction
public ProgramAction(java.lang.String sCommand, java.lang.String sName)
- Construct a program action.
ProgramAction
public ProgramAction(java.lang.String sCommand, java.lang.String sName, javax.swing.Icon cIcon)
- Construct a program action.
ProgramAction
public ProgramAction(java.lang.String sCommand, java.lang.String sName, javax.swing.Icon cIcon, int nMnemonic)
- Construct a program action.
ProgramAction
public ProgramAction(java.lang.String sCommand, java.lang.String sName, javax.swing.Icon cIcon, int nMnemonic, int nKey)
- Construct a program action.
ProgramAction
public ProgramAction(java.lang.String sCommand, java.lang.String sName, javax.swing.Icon cIcon, int nMnemonic, int nKey, int nMask)
- Construct a program action.
ProgramAction
public ProgramAction(java.lang.String sCommand, java.lang.String sName, javax.swing.Icon cIcon, int nMnemonic, java.lang.String asKeySequence)
- Construct a program action.
| Method Detail |
getCommand
public java.lang.String getCommand()
- Get the command associated with this action.
performAction
public boolean performAction(java.awt.event.ActionEvent aoEvent)
- Called by the
KeyEventGrabber.
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent aoEvent)
- Do whatever this action is going to do.
setEnabled
public void setEnabled(boolean abEnabled)
- Set the enabled flag.
This is now save to call from any thread.
pushListener
public void pushListener(java.awt.event.ActionListener aoListener)
- Add an
ActionListener.
pushListener
public void pushListener(java.awt.event.ActionListener aoListener, boolean abEnabled)
- Add an
ActionListener.
peekListener
public java.awt.event.ActionListener peekListener()
- Get the current
ActionListener.
pullListener
public java.awt.event.ActionListener pullListener(java.awt.event.ActionListener aoListener)
- Remove an
ActionListener.
pullListener
public java.awt.event.ActionListener pullListener(java.awt.event.ActionListener aoListener, boolean abEnabled)
- Remove an
ActionListener.
getListener
public java.awt.event.ActionListener getListener()
- Get the current action listener.
|
|||||||||
| Home >> All >> novaworx >> [ gui overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC