Class ResourceListDetailsModel
- java.lang.Object
-
- com.ibm.as400.vaccess.ResourceListDetailsModel
-
- All Implemented Interfaces:
- java.io.Serializable, javax.swing.table.TableModel
Deprecated.Use Java Swing instead, along with the classes in package com.ibm.as400.access
public class ResourceListDetailsModel extends java.lang.Object implements javax.swing.table.TableModel, java.io.Serializable
The ResourceListDetailsModel class implements an underlying model for a table, where all information for the model is gathered from the contents of aResourceList
object. Every row in the table represents aResource
from the list. You must explicitly call load() to load the information from the resource list.The table columns are specified as an array of column attribute IDs. The table will contain a column for each element of the array. The following can be specified as column attribute IDs:
- null - The entire resource is returned as the table data for the column.
- Resource attribute IDs - These are defined by the
Resource
objects that make up the rows of the table. The corresponding attribute value is returned as the table data for the column.
Use this class if you want to customize the graphical user interface that presents a table. If you do not need to customize the graphical user interface, then use
ResourceListDetailsPane
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.ResourceListDetailsModel objects generate the following events:
- ErrorEvent
- PropertyChangeEvent
- TableModelEvent
- WorkingEvent
The following example creates a details model filled with details about the jobs running on a system. It then presents the table in a JTable object.
// Create the resource list. This example creates // a list of all jobs on the system. AS400 system = new AS400("MYSYSTEM", "MYUSERID", "MYPASSWORD"); RJobList jobList = new RJobList(system);
// Create the ResourceListDetailsModel. In this example, // there are four columns in the table. The first column // contains the icons and names for each job. The remaining // columns contain the status, type, and subtype, respectively, // for each job. Object[] columnAttributeIDs = new Object[] { null, RJob.JOB_STATUS, RJob.JOB_TYPE, RJob.JOB_SUBTYPE }; ResourceListDetailsModel detailsModel = new ResourceListDetailsModel(jobList, columnAttributeIDs);
// Create a JTable using the ResourceListDetailsModel. JTable table = new JTable(detailsModel);
// Add the JTable to a JFrame and show it. JFrame frame = new JFrame("My Window"); frame.getContentPane().add(new JScrollPane(table)); frame.pack(); frame.show();
// The JTable will appear empty until we tell the // ResourceListDetailsModel to load. This gives us // control of when the list of jobs is retrieved // from the system. detailsModel.load();- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description ResourceListDetailsModel()
Deprecated.Constructs a ResourceListDetailsModel object.ResourceListDetailsModel(ResourceList resourceList, java.lang.Object[] columnAttributeIDs)
Deprecated.Constructs a ResourceListDetailsModel 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
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.Adds a listener to be notified when the value of any bound property changes.void
addTableModelListener(javax.swing.event.TableModelListener listener)
Deprecated.Adds a listener to be notified when the contents of the table change.void
addWorkingListener(WorkingListener listener)
Deprecated.Adds a listener to be notified when work starts and stops on potentially long-running operations.java.lang.Object[]
getColumnAttributeIDs()
Deprecated.Returns the column attribute IDs.java.lang.Class
getColumnClass(int columnIndex)
Deprecated.Returns the class for objects that are contained in a column.int
getColumnCount()
Deprecated.Returns the number of columns.java.lang.String
getColumnName(int columnIndex)
Deprecated.Returns the name of a column.int
getColumnWidth(int columnIndex)
Deprecated.Returns the preferred column width, in characters.Resource
getResourceAt(int rowIndex)
Deprecated.Returns the resource at the specified row.ResourceList
getResourceList()
Deprecated.Returns the resource list from which all information for the model is gathered.int
getRowCount()
Deprecated.Returns the number of rows in the table.java.lang.Object
getValueAt(int rowIndex, int columnIndex)
Deprecated.Returns the value at the specified row and column.boolean
isCellEditable(int rowIndex, int columnIndex)
Deprecated.Indicates if the cell is editable.void
load()
Deprecated.Loads the information from the resource list.void
removeErrorListener(ErrorListener listener)
Deprecated.Removes an error listener.void
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.Removes a property change listener.void
removeTableModelListener(javax.swing.event.TableModelListener listener)
Deprecated.Removes a table model listener.void
removeWorkingListener(WorkingListener listener)
Deprecated.Removes a working listener.void
setColumnAttributeIDs(java.lang.Object[] columnAttributeIDs)
Deprecated.Sets the column attribute IDs.void
setResourceList(ResourceList resourceList)
Deprecated.Sets the resource list from which all information for the model is gathered.void
setValueAt(java.lang.Object value, int rowIndex, int columnIndex)
Deprecated.Sets the value at the specified row and column.
-
-
-
Constructor Detail
-
ResourceListDetailsModel
public ResourceListDetailsModel()
Deprecated.Constructs a ResourceListDetailsModel object.
-
ResourceListDetailsModel
public ResourceListDetailsModel(ResourceList resourceList, java.lang.Object[] columnAttributeIDs)
Deprecated.Constructs a ResourceListDetailsModel object.- Parameters:
resourceList
- The resource list from which all information for the model is gathered.columnAttributeIDs
- The column attribute IDs.
-
-
Method Detail
-
addErrorListener
public void addErrorListener(ErrorListener listener)
Deprecated.Adds a listener to be notified when an error occurs.- 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.
-
addTableModelListener
public void addTableModelListener(javax.swing.event.TableModelListener listener)
Deprecated.Adds a listener to be notified when the contents of the table change.- Specified by:
addTableModelListener
in interfacejavax.swing.table.TableModel
- 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.
-
getColumnAttributeIDs
public java.lang.Object[] getColumnAttributeIDs()
Deprecated.Returns the column attribute IDs.- Returns:
- The column attribute IDs.
-
getColumnClass
public java.lang.Class getColumnClass(int columnIndex)
Deprecated.Returns the class for objects that are contained in a column.- Specified by:
getColumnClass
in interfacejavax.swing.table.TableModel
- Parameters:
columnIndex
- The column index (0-based).- Returns:
- The column class.
-
getColumnCount
public int getColumnCount()
Deprecated.Returns the number of columns.- Specified by:
getColumnCount
in interfacejavax.swing.table.TableModel
- Returns:
- The number of columns.
-
getColumnName
public java.lang.String getColumnName(int columnIndex)
Deprecated.Returns the name of a column.- Specified by:
getColumnName
in interfacejavax.swing.table.TableModel
- Parameters:
columnIndex
- The column index (0-based).- Returns:
- The column name.
-
getColumnWidth
public int getColumnWidth(int columnIndex)
Deprecated.Returns the preferred column width, in characters.- Parameters:
columnIndex
- The column index (0-based).- Returns:
- The preferred column width, in characters.
-
getResourceAt
public Resource getResourceAt(int rowIndex)
Deprecated.Returns the resource at the specified row.- Parameters:
rowIndex
- The row index (0-based).- Returns:
- The object at the specified row.
-
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.
-
getRowCount
public int getRowCount()
Deprecated.Returns the number of rows in the table.- Specified by:
getRowCount
in interfacejavax.swing.table.TableModel
- Returns:
- The number of rows in the table, or 0 if the root has not been set.
-
getValueAt
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
Deprecated.Returns the value at the specified row and column.- Specified by:
getValueAt
in interfacejavax.swing.table.TableModel
- Parameters:
rowIndex
- The row index (0-based).columnIndex
- The column index (0-based).- Returns:
- The value at the specified row and column. It will be null if the column index is not valid or the root has not been set.
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex)
Deprecated.Indicates if the cell is editable. This always returns false. No cells are editable.- Specified by:
isCellEditable
in interfacejavax.swing.table.TableModel
- Parameters:
rowIndex
- The row index (0-based).columnIndex
- The column index (0-based).- Returns:
- Always false.
-
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.
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.Removes a property change listener.- Parameters:
listener
- The listener.
-
removeTableModelListener
public void removeTableModelListener(javax.swing.event.TableModelListener listener)
Deprecated.Removes a table model listener.- Specified by:
removeTableModelListener
in interfacejavax.swing.table.TableModel
- Parameters:
listener
- The listener.
-
removeWorkingListener
public void removeWorkingListener(WorkingListener listener)
Deprecated.Removes a working listener.- Parameters:
listener
- The listener.
-
setColumnAttributeIDs
public void setColumnAttributeIDs(java.lang.Object[] columnAttributeIDs)
Deprecated.Sets the column attribute IDs.- Parameters:
columnAttributeIDs
- The column attribute IDs.
-
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.
-
setValueAt
public void setValueAt(java.lang.Object value, int rowIndex, int columnIndex)
Deprecated.Sets the value at the specified row and column. This has no effect, the cells are not editable.- Specified by:
setValueAt
in interfacejavax.swing.table.TableModel
- Parameters:
value
- The value.rowIndex
- The row index (0-based).columnIndex
- The column index (0-based).
-
-