All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.vaccess.VActionAdapter

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 of an AS/400. 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);

See Also:
VAction

Constructor Index

 o VActionAdapter()
Constructs a VActionAdapter object.
 o VActionAdapter(VAction, VActionContext)
Constructs a VActionAdapter object.

Method Index

 o actionPerformed(ActionEvent)
Invoked when an action is performed.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a listener to be notified when the value of any bound property changes.
 o getAction()
Returns the action with which the action adapter is associated.
 o getActionContext()
Returns the context in which the associated action will be performed.
 o getValue(String)
Returns the value of the property associated with the given key.
 o isEnabled()
Indicates if the action is enabled.
 o putValue(String, Object)
Sets the value of the property associated with the given key.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a property change listener.
 o setAction(VAction)
Sets the action with which the action adapter is associated.
 o setActionContext(VActionContext)
Sets the context in which the associated action will be performed.
 o setEnabled(boolean)
Sets the enabled state of the action.

Constructors

 o VActionAdapter
 public VActionAdapter()
Constructs a VActionAdapter object.

 o VActionAdapter
 public VActionAdapter(VAction action,
                       VActionContext actionContext)
Constructs a VActionAdapter object.

Parameters:
action - The action.
actionContext - The action context.

Methods

 o actionPerformed
 public void actionPerformed(ActionEvent event)
Invoked when an action is performed. This will cause the specified event to also be performed.

Parameters:
event - The event.
 o addPropertyChangeListener
 public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener to be notified when the value of any bound property changes.

Parameters:
listener - The listener.
 o getAction
 public VAction getAction()
Returns the action with which the action adapter is associated.

Returns:
The action, or null if none has been set.
 o getActionContext
 public VActionContext getActionContext()
Returns the context in which the associated action will be performed.

Returns:
The action context, or null if none has been set.
 o getValue
 public Object getValue(String key)
Returns the value of the property associated with the given key.

Parameters:
key - The key.
Returns:
The value.
 o isEnabled
 public boolean isEnabled()
Indicates if the action is enabled.

Returns:
true if the action is enabled; false otherwise.
 o putValue
 public void putValue(String key,
                      Object value)
Sets the value of the property associated with the given key.

Parameters:
key - The key.
value - The value of the property.
 o removePropertyChangeListener
 public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener.

Parameters:
listener - The listener.
 o setAction
 public void setAction(VAction action)
Sets the action with which the action adapter is associated.

Parameters:
action - The action.
 o setActionContext
 public void setActionContext(VActionContext actionContext)
Sets the context in which the associated action will be performed.

Parameters:
actionContext - The action context.
 o setEnabled
 public void setEnabled(boolean enabled)
Sets the enabled state of the action.

Parameters:
enabled - true if the action is enabled; false otherwise.

All Packages  Class Hierarchy  This Package  Previous  Next  Index