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:
- ErrorEvent
- ListDataEvent
- PropertyChangeEvent
- WorkingEvent
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(JTable.createScrollPaneForTable(list));
- See Also:
- AS400ListPane
-
AS400ListModel()
- Constructs an AS400ListModel object.
-
AS400ListModel(VNode)
- Constructs an AS400ListModel object.
-
addErrorListener(ErrorListener)
- Adds a listener to be notified when an error occurs.
-
addListDataListener(ListDataListener)
- Adds a listener to be notified when the contents of
the list change.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds a listener to be notified when the value of any
bound property changes.
-
addVetoableChangeListener(VetoableChangeListener)
- Adds a listener to be notified when the value of any
constrained property changes.
-
addWorkingListener(WorkingListener)
- Adds a listener to be notified when work starts and stops
on potentially long-running operations.
-
getElementAt(int)
- Returns the element at the specifed index.
-
getRoot()
- Returns the root, or the AS/400 resource, from which all information for the model is gathered.
-
getSize()
- Returns the number of objects in the list.
-
load()
- Loads the information from the AS/400.
-
removeErrorListener(ErrorListener)
- Removes an error listener.
-
removeListDataListener(ListDataListener)
- Removes a list data listener.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes a property change listener.
-
removeVetoableChangeListener(VetoableChangeListener)
- Removes a vetoable change listener.
-
removeWorkingListener(WorkingListener)
- Removes a working listener.
-
setRoot(VNode)
- Sets the root, or the AS/400 resource, from which all information for the model is gathered.
-
sort(Object[], boolean[])
- Sorts the contents.
AS400ListModel
public AS400ListModel()
- Constructs an AS400ListModel object.
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.
addErrorListener
public void addErrorListener(ErrorListener listener)
- Adds a listener to be notified when an error occurs.
- Parameters:
- listener - The listener.
addListDataListener
public void addListDataListener(ListDataListener listener)
- Adds a listener to be notified when the contents of
the list change.
- Parameters:
- listener - The listener.
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
- Adds a listener to be notified when the value of any
bound property changes.
- Parameters:
- listener - The listener.
addVetoableChangeListener
public void addVetoableChangeListener(VetoableChangeListener listener)
- Adds a listener to be notified when the value of any
constrained property changes.
- Parameters:
- listener - The listener.
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.
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.
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.
getSize
public int getSize()
- Returns the number of objects in the list.
- Returns:
- The number of objects in the list.
load
public void load()
- Loads the information from the AS/400.
removeErrorListener
public void removeErrorListener(ErrorListener listener)
- Removes an error listener.
- Parameters:
- listener - The listener.
removeListDataListener
public void removeListDataListener(ListDataListener listener)
- Removes a list data listener.
- Parameters:
- listener - The listener.
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
- Removes a property change listener.
- Parameters:
- listener - The listener.
removeVetoableChangeListener
public void removeVetoableChangeListener(VetoableChangeListener listener)
- Removes a vetoable change listener.
- Parameters:
- listener - The listener.
removeWorkingListener
public void removeWorkingListener(WorkingListener listener)
- Removes a working listener.
- Parameters:
- listener - The listener.
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.
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