public class ListRowData extends RowData implements java.io.Serializable
The list of data is formatted into a series of rows where each row contains a finite number of columns determined by the ListMetaData object. Each column within a row contains an individual data item.
Here are some examples of what a ListRowData object can represent:
A ListRowData object maintains a position in the list that points to its current row of data. The initial position in the list is set before the first row. The next method moves to the next row in the list.
The getObject method is used to retrieve the column value for the current row indexed by the column number. Columns are numbered starting from 0.
The number, types, and properties of the list's columns are provided by the ListMetaData object returned by the getMetaData method.
ListRowData objects generate the following events:
The following example creates a ListRowData object and adds rows to represent a directory in the integrated file system.
// Get the files in a directory. AS400 mySystem = new AS400("mySystem.myCompany.com"); IFSFile f = new IFSFile(mySystem, pathName); FileListener listener = new FileListener(); f.list(listener); Vector files = listener.getFiles(); // Create a metadata object. ListMetaData metaData = new ListMetaData(4); // Set first column to be the file name. metaData.setColumnName(0, "Name"); metaData.setColumnLabel(0, "Name"); metaData.setColumnType(0, RowMetaDataType.STRING_DATA_TYPE); // Set second column to be the file size. metaData.setColumnName(1, "Size"); metaData.setColumnLabel(1, "Size"); metaData.setColumnType(1, RowMetaDataType.INTEGER_DATA_TYPE); // Set third column to the file data/time stamp. metaData.setColumnName(2, "DateTime"); metaData.setColumnLabel(2, "Date/Time"); metaData.setColumnType(2, RowMetaDataType.STRING_DATA_TYPE); // Set fourth column to the file type. metaData.setColumnName(3, "Type"); metaData.setColumnLabel(3, "Type"); metaData.setColumnType(3, RowMetaDataType.STRING_DATA_TYPE); // Create a ListRowData object. ListRowData rowData = new ListRowData(); rowData.setMetaData(metaData); // Add directory entries to list. for (int i=0; i < files.size(); i++) { Object[] row = new Object[4]; IFSFile file = (IFSFile)files.elementAt(i); row[0] = file.getName(); row[1] = new Long(file.length()); row[2] = new java.util.Date(file.lastModified()); if (file.isDirectory()) { row[3] = "Directory"; } else { row[3] = "File"; } rowData.addRow(row); }
ListMetaData
,
Serialized FormrowProperties_, rows_
Constructor and Description |
---|
ListRowData()
Constructs a default ListRowData object.
|
ListRowData(RowMetaData metadata)
Constructs a ListRowData object with the specified metadata.
|
Modifier and Type | Method and Description |
---|---|
void |
addRow(java.lang.Object[] row)
Adds the specified row to the list.
|
void |
addRow(java.lang.Object[] row,
int rowIndex)
Adds the specified row to the list at rowIndex.
|
void |
addRow(java.lang.Object[] row,
java.util.Vector[] properties)
Adds the specified row to the list.
|
void |
addRow(java.lang.Object[] row,
java.util.Vector[] properties,
int rowIndex)
Adds the specified row to the list at rowIndex.
|
void |
addRowDataListener(RowDataListener listener)
Adds a RowDataListener.
|
RowMetaData |
getMetaData()
Returns the metadata.
|
java.lang.Object[] |
getRow()
Returns the data objects for the current row.
|
void |
removeRow(int rowIndex)
Removes the row from the list at the specified rowIndex.
|
void |
removeRowDataListener(RowDataListener listener)
Removes this RowDataListener from the internal list.
|
void |
setMetaData(RowMetaData metadata)
Sets the metadata.
|
void |
setRow(java.lang.Object[] row,
int rowIndex)
Sets the row at the specified rowIndex to be the specified row.
|
void |
setRow(java.lang.Object[] row,
java.util.Vector[] properties,
int rowIndex)
Sets the row at the specified rowIndex to be the specified row.
|
absolute, addPropertyChangeListener, addVetoableChangeListener, afterLast, beforeFirst, first, getCurrentPosition, getObject, getObjectProperties, getRowProperties, isAfterLast, isBeforeFirst, isFirst, isLast, last, length, next, previous, relative, removePropertyChangeListener, removeVetoableChangeListener, setObjectProperties
public ListRowData()
public ListRowData(RowMetaData metadata) throws RowDataException
metadata
- The metadata.RowDataException
- If a row data error occurs.public void addRow(java.lang.Object[] row) throws RowDataException
row
- The row to be added.RowDataException
- If the row length does not match the number
of columns specified in the metadata.public void addRow(java.lang.Object[] row, java.util.Vector[] properties) throws RowDataException
row
- The row to be added.properties
- The properties list.RowDataException
- If the row length does not match the number
of columns specified in the metadata.public void addRow(java.lang.Object[] row, int rowIndex) throws RowDataException
row
- The row.rowIndex
- The row index (0-based).RowDataException
- If the row length does not match the number
of columns specified in the metadata.public void addRow(java.lang.Object[] row, java.util.Vector[] properties, int rowIndex) throws RowDataException
row
- The row.properties
- The properties list.rowIndex
- The row index (0-based).RowDataException
- If the row length does not match the number
of columns specified in the metadata.public void addRowDataListener(RowDataListener listener)
listener
- The RowDataListener.public RowMetaData getMetaData()
getMetaData
in class RowData
public java.lang.Object[] getRow()
public void removeRow(int rowIndex)
rowIndex
- The row index (0-based).public void removeRowDataListener(RowDataListener listener)
listener
- The RowDataListener.public void setMetaData(RowMetaData metadata) throws RowDataException, java.beans.PropertyVetoException
metadata
- The metadata.RowDataException
- If a row data error occurs.java.beans.PropertyVetoException
- If a change is vetoed.public void setRow(java.lang.Object[] row, int rowIndex) throws RowDataException
row
- The updated row.rowIndex
- The row index (0-based).RowDataException
- If the row length does not match the number
of columns specified in the metadata.public void setRow(java.lang.Object[] row, java.util.Vector[] properties, int rowIndex) throws RowDataException
row
- The updated row.properties
- The properties list.rowIndex
- The row index (0-based).RowDataException
- If the row length does not match the number
of columns specified in the metadata.