|
|||||||||
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.DelegateAction
A DelegateAction is a type of UpdateAction acts as a delegate for any number of other Actions. When a DelegateAction is invoked, it searches for a Component that implements the DelegateHandler interface starting at the current focused component on the same Window as the passed source (the source must be an instance of java.awt.Component), and works its way up the parent hierarchy until it finds one that handles this DelegateAction. All calls to the DelegateAction are forwarded through a target action via a DelegateHandler in this way.
A an example subclass of DelegateAction would be an Edit-Cut type of Action - one that needs to 're-target' depending on the part of the window that is currently active.
Typically, subclasses of DelegateAction override NONE of the DelegateAction methods - but merely act as a 'marker' for Actions to target to at runtime.
Action
,
DelegateHandler
, Serialized FormField Summary | |
protected javax.swing.Action |
action
The transient storage for the currently associated target action. |
Fields inherited from class com.borland.primetime.actions.UpdateAction |
ACCELERATOR,
EMPTY_ARRAY,
HELP_TOPIC,
LARGE_ICON,
MNEMONIC |
Fields inherited from class javax.swing.AbstractAction |
changeSupport,
enabled |
Constructor Summary | |
DelegateAction()
Constructs an DelegateAction will all default properties. |
|
DelegateAction(java.lang.String shortText)
Constructs an DelegateAction will the specified short text. |
|
DelegateAction(java.lang.String shortText,
char mnemonic)
Constructs an DelegateAction will the specified short text and mnemonic. |
|
DelegateAction(java.lang.String shortText,
char mnemonic,
java.lang.String longText)
Constructs an DelegateAction will the specified short text, mnemonic, and long text. |
|
DelegateAction(java.lang.String shortText,
char mnemonic,
java.lang.String longText,
javax.swing.Icon smallIcon)
Constructs an DelegateAction will the specified short text, mnemonic, long text, and small icon. |
Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
The default implementation of actionPerformed is to first find a target action, then update it (if it is an UpdateableAction), and finally to call its actionPerformed if it is enabled. |
protected void |
findAction(java.lang.Object source)
The findAction method takes the passed source object and calls findFocusOwner(Object source) to find the current focused component in the source's context. |
protected java.awt.Component |
findFocusOwner(java.lang.Object source)
The findFocusOwner method takes the passed source object (assuming it is an instance of java.awt.Component), and walks up its parent hierarchy until it finds a java.awt.Window. |
java.lang.Object |
getValue(java.lang.String key)
The javax.swing.Action.getValue(String key) method is overridden to delegate to the current 'target' action. |
boolean |
isEnabled()
The javax.swing.Action.isEnabled() method is overridden to delegate to the current 'target' action. |
void |
update(java.lang.Object source)
The default implementation of update is to first find a target action, then update it (if it is an UpdateableAction), and finally to reflect the enabled state of the target action. |
Methods inherited from class com.borland.primetime.actions.UpdateAction |
getHelpTopic,
getLargeIcon,
getLongText,
getMnemonic,
getShortText,
getSmallIcon,
setHelpTopic,
setLargeIcon,
setLongText,
setMnemonic,
setShortText,
setSmallIcon |
Methods inherited from class javax.swing.AbstractAction |
addPropertyChangeListener,
clone,
firePropertyChange,
putValue,
removePropertyChangeListener,
setEnabled |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected javax.swing.Action action
Constructor Detail |
public DelegateAction()
public DelegateAction(java.lang.String shortText)
shortText
- The short text for the actionpublic DelegateAction(java.lang.String shortText, char mnemonic)
shortText
- The short text for the actionmnemonic
- The mnemonic character for the actionpublic DelegateAction(java.lang.String shortText, char mnemonic, java.lang.String longText)
shortText
- The short text for the actionmnemonic
- The mnemonic character for the actionlongText
- The long text for the actionpublic DelegateAction(java.lang.String shortText, char mnemonic, java.lang.String longText, javax.swing.Icon smallIcon)
shortText
- The short text for the actionmnemonic
- The mnemonic character for the actionlongText
- The long text for the actionsmallIcon
- The small icon for the action (16x16)Method Detail |
public java.lang.Object getValue(java.lang.String key)
public boolean isEnabled()
public void update(java.lang.Object source)
source
- The source of the action that is about to be displayed as UI.public void actionPerformed(java.awt.event.ActionEvent e)
protected void findAction(java.lang.Object source)
source
- The source context objectprotected java.awt.Component findFocusOwner(java.lang.Object source)
source
- The source context object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |