Class BoundAction
java.lang.Object
javax.swing.AbstractAction
org.jdesktop.swingx.action.AbstractActionExt
org.jdesktop.swingx.action.BoundAction
- All Implemented Interfaces:
ActionListener, ItemListener, Serializable, Cloneable, EventListener, Action
A class that represents the many type of actions that this framework supports.
The command invocation of this action may be delegated to another action or item state listener. If there isn't an explicit binding then the command is forwarded to the TargetManager.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classThe callback for the toggle/state changed action that invokes a method with a boolean argument on a target. -
Field Summary
FieldsFields inherited from class AbstractActionExt
GROUP, IS_STATE, LARGE_ICONFields inherited from class AbstractAction
changeSupport, enabledFields inherited from interface 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
ConstructorsConstructorDescriptionBoundAction(String name) BoundAction(String name, String command) BoundAction(String name, String command, Icon icon) BoundAction(String name, Icon icon) -
Method Summary
Modifier and TypeMethodDescriptionvoidCallback for command actions.voidaddActionListener(ActionListener listener) Add an action listener which will be invoked when this action is invoked.voidaddItemListener(ItemListener listener) Add an item listener which will be invoked for toggle actions.private <T extends EventListener>
voidaddListener(Class<T> clz, T listener) private EventListener[]getListeners(Class<? extends EventListener> clz) voidCallback for toggle actions.private voidvoidregisterCallback(Object handler, String method) Registers a callback method when the Action corresponding to the action id is invoked.voidremoveActionListener(ActionListener listener) voidremoveItemListener(ItemListener listener) private <T extends EventListener>
voidremoveListener(Class<T> clz, T listener) voidsetCallback(String callback) The callback string will be called to register the action callback.private voidMethods inherited from class AbstractActionExt
dispose, getAccelerator, getActionCommand, getGroup, getLargeIcon, getLongDescription, getMnemonic, getName, getShortDescription, getSmallIcon, isSelected, isStateAction, setAccelerator, setActionCommand, setGroup, setLargeIcon, setLongDescription, setMnemonic, setMnemonic, setName, setSelected, setShortDescription, setSmallIcon, setStateAction, setStateAction, toStringMethods inherited from class AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Field Details
-
LOG
-
listeners
-
-
Constructor Details
-
BoundAction
public BoundAction() -
BoundAction
-
BoundAction
-
BoundAction
-
BoundAction
-
-
Method Details
-
setCallback
The callback string will be called to register the action callback. Note the toggle property must be set if this is a state action before this method is called. For example,<exec>com.sun.foo.FubarHandler#handleBar</exec>will registerregisterCallback(com.sun.foo.FubarHandler(), "handleBar"); -
registerCallback
Registers a callback method when the Action corresponding to the action id is invoked. When a Component that was constructed from the Action identified by the action id invokes actionPerformed then the method named will be invoked on the handler Object.If the Action represented by the action id is a StateChangeAction, then the method passed should take an int as an argument. The value of getStateChange() on the ItemEvent object will be passed as the parameter.
- Parameters:
handler- the object which will be perform the actionmethod- the name of the method on the handler which will be called.
-
addListener
-
removeListener
-
getListeners
-
addActionListener
Add an action listener which will be invoked when this action is invoked. -
removeActionListener
-
getActionListeners
-
addItemListener
Add an item listener which will be invoked for toggle actions. -
removeItemListener
-
getItemListeners
-
actionPerformed
Callback for command actions. -
itemStateChanged
Callback for toggle actions.- Specified by:
itemStateChangedin interfaceItemListener- Overrides:
itemStateChangedin classAbstractActionExt- Parameters:
evt- the ItemEvent fired by a ItemSelectable on changing the selected state.
-
writeObject
- Throws:
IOException
-
readObject
- Throws:
ClassNotFoundExceptionIOException
-