public class ResourceListDetailsModel
extends java.lang.Object
implements javax.swing.table.TableModel, java.io.Serializable
ResourceList
object. Every row in the table represents a
Resource
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:
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:
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();
Constructor and Description |
---|
ResourceListDetailsModel()
Deprecated.
Constructs a ResourceListDetailsModel object.
|
ResourceListDetailsModel(ResourceList resourceList,
java.lang.Object[] columnAttributeIDs)
Deprecated.
Constructs a ResourceListDetailsModel object.
|
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.
|
public ResourceListDetailsModel()
public ResourceListDetailsModel(ResourceList resourceList, java.lang.Object[] columnAttributeIDs)
resourceList
- The resource list from which all information for the model is gathered.columnAttributeIDs
- The column attribute IDs.public void addErrorListener(ErrorListener listener)
listener
- The listener.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The listener.public void addTableModelListener(javax.swing.event.TableModelListener listener)
addTableModelListener
in interface javax.swing.table.TableModel
listener
- The listener.public void addWorkingListener(WorkingListener listener)
listener
- The listener.public java.lang.Object[] getColumnAttributeIDs()
public java.lang.Class getColumnClass(int columnIndex)
getColumnClass
in interface javax.swing.table.TableModel
columnIndex
- The column index (0-based).public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
public java.lang.String getColumnName(int columnIndex)
getColumnName
in interface javax.swing.table.TableModel
columnIndex
- The column index (0-based).public int getColumnWidth(int columnIndex)
columnIndex
- The column index (0-based).public Resource getResourceAt(int rowIndex)
rowIndex
- The row index (0-based).public ResourceList getResourceList()
public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public java.lang.Object getValueAt(int rowIndex, int columnIndex)
getValueAt
in interface javax.swing.table.TableModel
rowIndex
- The row index (0-based).columnIndex
- The column index (0-based).public boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface javax.swing.table.TableModel
rowIndex
- The row index (0-based).columnIndex
- The column index (0-based).public void load()
public void removeErrorListener(ErrorListener listener)
listener
- The listener.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The listener.public void removeTableModelListener(javax.swing.event.TableModelListener listener)
removeTableModelListener
in interface javax.swing.table.TableModel
listener
- The listener.public void removeWorkingListener(WorkingListener listener)
listener
- The listener.public void setColumnAttributeIDs(java.lang.Object[] columnAttributeIDs)
columnAttributeIDs
- The column attribute IDs.public void setResourceList(ResourceList resourceList)
resourceList
- The resource list from which all information for the model is gathered.public void setValueAt(java.lang.Object value, int rowIndex, int columnIndex)
setValueAt
in interface javax.swing.table.TableModel
value
- The value.rowIndex
- The row index (0-based).columnIndex
- The column index (0-based).