All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.vaccess.AS400ListModel

java.lang.Object
   |
   +----com.ibm.as400.vaccess.AS400ListModel

public class AS400ListModel
extends Object
implements ListModel, Serializable
The AS400ListModel class implements an underlying model for a list, where all information for the model is gathered from the contents of an AS/400 resource, known as the root. You must explicitly call load() to load the information from the AS/400.

Use this class if you want to customize the graphical user interface that presents a list. If you do not need to customize the interface, then use AS400ListPane instead.

Most errors are reported as ErrorEvents rather than throwing exceptions. Users should listen for ErrorEvents in order to diagnose and recover from error conditions.

AS400ListModel objects generate the following events:

The following example creates a list model filled with the contents of a directory in the integrated file system of an AS/400. It then presents the list in a JList object.

// Set up the list model and JList.
AS400 system = new AS400 ("MySystem", "Userid", "Password");
VIFSDirectory directory = new VIFSDirectory (system, "/myDirectory");
AS400ListModel listModel = new AS400ListModel (directory);
listModel.load ();
JList list = new JList (listModel);

// Add the JList to a frame. JFrame frame = new JFrame ("My Window"); frame.getContentPane().add(new JScrollPane(list));

See Also:
AS400ListPane

Constructor Index

 o AS400ListModel()
Constructs an AS400ListModel object.
 o AS400ListModel(VNode)
Constructs an AS400ListModel object.

Method Index

 o addErrorListener(ErrorListener)
Adds a listener to be notified when an error occurs.
 o addListDataListener(ListDataListener)
Adds a listener to be notified when the contents of the list change.
 o addPropertyChangeListener(PropertyChangeListener)
Adds a listener to be notified when the value of any bound property changes.
 o addVetoableChangeListener(VetoableChangeListener)
Adds a listener to be notified when the value of any constrained property changes.
 o addWorkingListener(WorkingListener)
Adds a listener to be notified when work starts and stops on potentially long-running operations.
 o getElementAt(int)
Returns the element at the specifed index.
 o getRoot()
Returns the root, or the AS/400 resource, from which all information for the model is gathered.
 o getSize()
Returns the number of objects in the list.
 o load()
Loads the information from the AS/400.
 o removeErrorListener(ErrorListener)
Removes an error listener.
 o removeListDataListener(ListDataListener)
Removes a list data listener.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a property change listener.
 o removeVetoableChangeListener(VetoableChangeListener)
Removes a vetoable change listener.
 o removeWorkingListener(WorkingListener)
Removes a working listener.
 o setRoot(VNode)
Sets the root, or the AS/400 resource, from which all information for the model is gathered.
 o sort(Object[], boolean[])
Sorts the contents.

Constructors

 o AS400ListModel
 public AS400ListModel()
Constructs an AS400ListModel object.

 o AS400ListModel
 public AS400ListModel(VNode root)
Constructs an AS400ListModel object.

Parameters:
root - The root, or the AS/400 resource, from which all information for the model is gathered.

Methods

 o addErrorListener
 public void addErrorListener(ErrorListener listener)
Adds a listener to be notified when an error occurs.

Parameters:
listener - The listener.
 o addListDataListener
 public void addListDataListener(ListDataListener listener)
Adds a listener to be notified when the contents of the list change.

Parameters:
listener - The listener.
 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 addVetoableChangeListener
 public void addVetoableChangeListener(VetoableChangeListener listener)
Adds a listener to be notified when the value of any constrained property changes.

Parameters:
listener - The listener.
 o addWorkingListener
 public void addWorkingListener(WorkingListener listener)
Adds a listener to be notified when work starts and stops on potentially long-running operations.

Parameters:
listener - The listener.
 o getElementAt
 public Object getElementAt(int index)
Returns the element at the specifed index.

Parameters:
index - The index.
Returns:
The element at the specified index. It will be null if the index is not valid or the root has not been set.
 o getRoot
 public VNode getRoot()
Returns the root, or the AS/400 resource, from which all information for the model is gathered.

Returns:
The root, or the AS/400 resource, from which all information for the model is gathered. It will be null if none has been set.
 o getSize
 public int getSize()
Returns the number of objects in the list.

Returns:
The number of objects in the list.
 o load
 public void load()
Loads the information from the AS/400.

 o removeErrorListener
 public void removeErrorListener(ErrorListener listener)
Removes an error listener.

Parameters:
listener - The listener.
 o removeListDataListener
 public void removeListDataListener(ListDataListener listener)
Removes a list data listener.

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

Parameters:
listener - The listener.
 o removeVetoableChangeListener
 public void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a vetoable change listener.

Parameters:
listener - The listener.
 o removeWorkingListener
 public void removeWorkingListener(WorkingListener listener)
Removes a working listener.

Parameters:
listener - The listener.
 o setRoot
 public void setRoot(VNode root) throws PropertyVetoException
Sets the root, or the AS/400 resource, from which all information for the model is gathered. It will not take effect until load() is done.

Parameters:
root - The root, or the AS/400 resource, from which all information for the model is gathered.
Throws: PropertyVetoException
If the change is vetoed.
 o sort
 public void sort(Object propertyIdentifiers[],
                  boolean orders[])
Sorts the contents. The propertyIdentifer[0], orders[0] combination is used to do the sort. If the values are equal, propertyIdentifier[1], orders[1] is used to break the tie, and so forth.

Parameters:
propertyIdentifiers - The property identifiers. If any of the property identifiers are null, it indicates to sort using the string representation of the object.
orders - The sort orders for each property identifier; true for ascending order, false for descending order.

All Packages  Class Hierarchy  This Package  Previous  Next  Index