All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.util.servlet.ListRowData

java.lang.Object
   |
   +----com.ibm.as400.util.servlet.RowData
           |
           +----com.ibm.as400.util.servlet.ListRowData

public class ListRowData
extends RowData
implements Serializable
The ListRowData class represents a list of data.

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); }

See Also:
ListMetaData

Constructor Index

 o ListRowData()
Constructs a default ListRowData object.
 o ListRowData(RowMetaData)
Constructs a ListRowData object with the specified metadata.

Method Index

 o addRow(Object[])
Adds the specified row to the list.
 o addRow(Object[], int)
Adds the specified row to the list at rowIndex.
 o addRow(Object[], Vector[])
Adds the specified row to the list.
 o addRow(Object[], Vector[], int)
Adds the specified row to the list at rowIndex.
 o addRowDataListener(RowDataListener)
Adds a RowDataListener.
 o getMetaData()
Returns the metadata.
 o getRow()
Returns the data objects for the current row.
 o removeRow(int)
Removes the row from the list at the specified rowIndex.
 o removeRowDataListener(RowDataListener)
Removes this RowDataListener from the internal list.
 o setMetaData(RowMetaData)
Sets the metadata.
 o setRow(Object[], int)
Sets the row at the specified rowIndex to be the specified row.
 o setRow(Object[], Vector[], int)
Sets the row at the specified rowIndex to be the specified row.

Constructors

 o ListRowData
 public ListRowData()
Constructs a default ListRowData object.

 o ListRowData
 public ListRowData(RowMetaData metadata) throws RowDataException
Constructs a ListRowData object with the specified metadata.

Parameters:
metadata - The metadata.
Throws: RowDataException
If a row data error occurs.

Methods

 o addRow
 public void addRow(Object row[]) throws RowDataException
Adds the specified row to the list. The metadata needs to be set before adding a row to the list.

Parameters:
row - The row to be added.
Throws: RowDataException
If the row length does not match the number of columns specified in the metadata.
 o addRow
 public void addRow(Object row[],
                    Vector properties[]) throws RowDataException
Adds the specified row to the list. Each object in the row is assigned a list of properties specified by properties. The metadata needs to be set before adding a row to the list.

Parameters:
row - The row to be added.
properties - The properties list.
Throws: RowDataException
If the row length does not match the number of columns specified in the metadata.
 o addRow
 public void addRow(Object row[],
                    int rowIndex) throws RowDataException
Adds the specified row to the list at rowIndex. The metadata needs to be set before adding a row to the list.

Parameters:
row - The row.
rowIndex - The row index (0-based).
Throws: RowDataException
If the row length does not match the number of columns specified in the metadata.
 o addRow
 public void addRow(Object row[],
                    Vector properties[],
                    int rowIndex) throws RowDataException
Adds the specified row to the list at rowIndex. Each object in row is assigned a properties list specified by properties. The metadata needs to be set before adding a row to the list.

Parameters:
row - The row.
properties - The properties list.
rowIndex - The row index (0-based).
Throws: RowDataException
If the row length does not match the number of columns specified in the metadata.
 o addRowDataListener
 public void addRowDataListener(RowDataListener listener)
Adds a RowDataListener. The RowDataListener object is added to an internal list of RowDataListeners; it can be removed with removeRowDataListener.

Parameters:
listener - The RowDataListener.
 o getMetaData
 public RowMetaData getMetaData()
Returns the metadata.

Returns:
The metadata.
Overrides:
getMetaData in class RowData
 o getRow
 public Object[] getRow()
Returns the data objects for the current row.

Returns:
The row.
 o removeRow
 public void removeRow(int rowIndex)
Removes the row from the list at the specified rowIndex.

Parameters:
rowIndex - The row index (0-based).
 o removeRowDataListener
 public void removeRowDataListener(RowDataListener listener)
Removes this RowDataListener from the internal list. If the RowDataListener is not on the list, nothing is done.

Parameters:
listener - The RowDataListener.
 o setMetaData
 public void setMetaData(RowMetaData metadata) throws RowDataException, PropertyVetoException
Sets the metadata.

Parameters:
metadata - The metadata.
Throws: RowDataException
If a row data error occurs.
Throws: PropertyVetoException
If a change is vetoed.
 o setRow
 public void setRow(Object row[],
                    int rowIndex) throws RowDataException
Sets the row at the specified rowIndex to be the specified row.

Parameters:
row - The updated row.
rowIndex - The row index (0-based).
Throws: RowDataException
If the row length does not match the number of columns specified in the metadata.
 o setRow
 public void setRow(Object row[],
                    Vector properties[],
                    int rowIndex) throws RowDataException
Sets the row at the specified rowIndex to be the specified row. Each object in the row is assigned a properties list specified by properties.

Parameters:
row - The updated row.
properties - The properties list.
rowIndex - The row index (0-based).
Throws: RowDataException
If the row length does not match the number of columns specified in the metadata.

All Packages  Class Hierarchy  This Package  Previous  Next  Index