|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.as400.vaccess.VActionAdapter
public class VActionAdapter extends Object implements Action, Serializable
The VActionAdapter class represents an object that listens for action events and subsequently performs a VAction.
A VActionAdapter object is useful when an action listener is needed to perform a VAction. For example, this can be used to as an action listener for button clicks or menu item selections.
This class essentially adapts the VAction class hierarchy to the javax.swing.Action class hierarchy.
The following example creates an action adapter which is used to put up a properties pane for a directory in the integrated file system. The action adapter is then attached to a menu item, so that the action is performed when the menu item is selected.
// Set up the directory object. AS400 system = new AS400 ("MySystem", "Userid", "Password"); VIFSDirectory directory = new VIFSDirectory (system, "/myDirectory");
// Set up a pane and add it to a frame. AS400ExplorerPane pane = new AS400ExplorerPane (directory); JFrame frame = new JFrame ("My Window"); frame.getContentPane().add(new JScrollPane(pane));
// Set up the properties action adapter. VActionAdapter adapter = new VActionAdapter (directory, new VPropertiesAction (), pane.getActionContext ());
// Set up the menu item. JMenuItem menuItem = new JMenuItem ("Properties"); menuItem.setEnabled (true); menuItem.addActionListener (adapter);
VAction
,
Serialized FormModifier and Type | Field and Description |
---|
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 and Description |
---|
VActionAdapter()
Deprecated. Constructs a VActionAdapter object. |
VActionAdapter(VAction action,
VActionContext actionContext)
Deprecated. Constructs a VActionAdapter object. |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent event)
Deprecated. Invoked when an action is performed. |
void |
addPropertyChangeListener(PropertyChangeListener listener)
Deprecated. Adds a listener to be notified when the value of any bound property changes. |
VAction |
getAction()
Deprecated. Returns the action with which the action adapter is associated. |
VActionContext |
getActionContext()
Deprecated. Returns the context in which the associated action will be performed. |
Object |
getValue(String key)
Deprecated. Returns the value of the property associated with the given key. |
boolean |
isEnabled()
Deprecated. Indicates if the action is enabled. |
void |
putValue(String key,
Object value)
Deprecated. Sets the value of the property associated with the given key. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Deprecated. Removes a property change listener. |
void |
setAction(VAction action)
Deprecated. Sets the action with which the action adapter is associated. |
void |
setActionContext(VActionContext actionContext)
Deprecated. Sets the context in which the associated action will be performed. |
void |
setEnabled(boolean enabled)
Deprecated. Sets the enabled state of the action. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VActionAdapter()
public VActionAdapter(VAction action, VActionContext actionContext)
action
- The action.actionContext
- The action context.Method Detail |
---|
public void actionPerformed(ActionEvent event)
actionPerformed
in interface ActionListener
event
- The event.public void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in interface Action
listener
- The listener.public VAction getAction()
public VActionContext getActionContext()
public Object getValue(String key)
getValue
in interface Action
key
- The key.public boolean isEnabled()
isEnabled
in interface Action
public void putValue(String key, Object value)
putValue
in interface Action
key
- The key.value
- The value of the property.public void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in interface Action
listener
- The listener.public void setAction(VAction action)
action
- The action.public void setActionContext(VActionContext actionContext)
actionContext
- The action context.public void setEnabled(boolean enabled)
setEnabled
in interface Action
enabled
- true if the action is enabled; false otherwise.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |