com.ibm.as400.vaccess
Class ResourceListModel
- java.lang.Object
-
- com.ibm.as400.vaccess.ResourceListModel
-
- All Implemented Interfaces:
- java.io.Serializable, javax.swing.ListModel
Deprecated.Use Java Swing instead, along with the classes in package com.ibm.as400.access
public class ResourceListModel extends java.lang.Object implements javax.swing.ListModel, java.io.Serializable
The ResourceListModel class implements an underlying model for a list, where all information for the model is gathered from the contents of aResourceList
object. Every item represents aResource
from the list. You must explicitly call load() to load the information from the resource list.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 ResourceListPane 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.
ResourceListModel objects generate the following events:
- ErrorEvent
- ListDataEvent
- PropertyChangeEvent
- WorkingEvent
The following example creates a list model filled with the contents of a user list from a system. It then presents the list in a JList object.
// Create the resource list. This example creates // a list of all users on the system. AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD"); RUserList userList = new RUserList(system);
// Create the ResourceListModel. ResourceListModel listModel = new ResourceListModel(userList);
// Create a JList using the ResourceListModel. JList list = new JList(listModel);
// Add the JList to a JFrame and show it. JFrame frame = new JFrame("My Window"); frame.getContentPane().add(new JScrollPane(list)); frame.pack(); frame.show();
// The JList will appear empty until we tell the // ResourceListModel to load. This gives us control // of when the list of users is retrieved from the // system. listModel.load();- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description ResourceListModel()
Deprecated.Constructs a ResourceListModel object.ResourceListModel(ResourceList resourceList)
Deprecated.Constructs a ResourceListModel object.
-
Method Summary
Methods Modifier and Type Method and Description void
addErrorListener(ErrorListener listener)
Deprecated.Adds a listener to be notified when an error occurs.void
addListDataListener(javax.swing.event.ListDataListener listener)
Deprecated.Adds a listener to be notified when the contents of the list change.void
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.Adds a listener to be notified when the value of any bound property changes.void
addWorkingListener(WorkingListener listener)
Deprecated.Adds a listener to be notified when work starts and stops on potentially long-running operations.java.lang.Object
getElementAt(int rowIndex)
Deprecated.Returns the element at the specified index.ResourceList
getResourceList()
Deprecated.Returns the resource list from which all information for the model is gathered.int
getSize()
Deprecated.Returns the number of objects in the list.void
load()
Deprecated.Loads the information from the resource list.void
removeErrorListener(ErrorListener listener)
Deprecated.Removes an error listener.void
removeListDataListener(javax.swing.event.ListDataListener listener)
Deprecated.Removes a list data listener.void
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.Removes a property change listener.void
removeWorkingListener(WorkingListener listener)
Deprecated.Removes a working listener.void
setResourceList(ResourceList resourceList)
Deprecated.Sets the resource list from which all information for the model is gathered.
-
-
-
Constructor Detail
-
ResourceListModel
public ResourceListModel()
Deprecated.Constructs a ResourceListModel object.
-
ResourceListModel
public ResourceListModel(ResourceList resourceList)
Deprecated.Constructs a ResourceListModel object.- Parameters:
resourceList
- The resource list.
-
-
Method Detail
-
addErrorListener
public void addErrorListener(ErrorListener listener)
Deprecated.Adds a listener to be notified when an error occurs.- Parameters:
listener
- The listener.
-
addListDataListener
public void addListDataListener(javax.swing.event.ListDataListener listener)
Deprecated.Adds a listener to be notified when the contents of the list change.- Specified by:
addListDataListener
in interfacejavax.swing.ListModel
- Parameters:
listener
- The listener.
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.Adds a listener to be notified when the value of any bound property changes.- Parameters:
listener
- The listener.
-
addWorkingListener
public void addWorkingListener(WorkingListener listener)
Deprecated.Adds a listener to be notified when work starts and stops on potentially long-running operations.- Parameters:
listener
- The listener.
-
getElementAt
public java.lang.Object getElementAt(int rowIndex)
Deprecated.Returns the element at the specified index.- Specified by:
getElementAt
in interfacejavax.swing.ListModel
- Parameters:
rowIndex
- The row index (0-based).- Returns:
- The element at the specified index. It will be null if the index is not valid or the root has not been set.
-
getResourceList
public ResourceList getResourceList()
Deprecated.Returns the resource list from which all information for the model is gathered.- Returns:
- The resource list from which all information for the model is gathered. This will be null if none has been set.
-
getSize
public int getSize()
Deprecated.Returns the number of objects in the list.- Specified by:
getSize
in interfacejavax.swing.ListModel
- Returns:
- The number of objects in the list.
-
load
public void load()
Deprecated.Loads the information from the resource list.
-
removeErrorListener
public void removeErrorListener(ErrorListener listener)
Deprecated.Removes an error listener.- Parameters:
listener
- The listener.
-
removeListDataListener
public void removeListDataListener(javax.swing.event.ListDataListener listener)
Deprecated.Removes a list data listener.- Specified by:
removeListDataListener
in interfacejavax.swing.ListModel
- Parameters:
listener
- The listener.
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.Removes a property change listener.- Parameters:
listener
- The listener.
-
removeWorkingListener
public void removeWorkingListener(WorkingListener listener)
Deprecated.Removes a working listener.- Parameters:
listener
- The listener.
-
setResourceList
public void setResourceList(ResourceList resourceList)
Deprecated.Sets the resource list from which all information for the model is gathered.- Parameters:
resourceList
- The resource list from which all information for the model is gathered.
-
-