com.ibm.as400.util.servlet

Class ResourceListRowData

  • All Implemented Interfaces:
    java.io.Serializable


    public class ResourceListRowData
    extends RowData
    implements java.io.Serializable
    The ResourceListRowData class represents a resource 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 number of column attribute ID's. Each column within a row contains an individual data item.

    A ResourceListRowData object can represent any implementation of the ResourceList interface. The row data columns are specified as an array of column attribute IDs. The row data will contain a column for each element of the array. The following can be specified as column attribute IDs:

    • null - The name from each Resource's Presentation object are presented in the column.
    • Resource attribute IDs - These are defined by the Resource objects that make up the rows data. The corresponding attribute value is presented in the column.

    A ResourceListRowData object maintains a position in the resource 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 following example creates a ResourceListRowData object using an RUserList:

      // Create an object to represent the system.
      AS400 mySystem = new AS400("mySystem.myCompany.com");
      
      // Create a resource user list.
      RUserList userList = new RUserList(sys);
      
      // Set the selection so that all user profiles
      // are included in the list.
      userList.setSelectionValue(RUserList.SELECTION_CRITERIA, RUserList.ALL);
      
      // Create an HTMLTableConverter object.
      HTMLTableConverter converter = new HTMLTableConverter();
      
      // Set up the table tag with a maximum of 20 rows per table.
      converter.setMaximumTableSize(20);
      
      // Create an HTMLTable and use the meta data for the table headers.
      HTMLTable table = new HTMLTable();
      table.setCellSpacing(6);
      table.setBorderWidth(8);
      converter.setTable(table);
      converter.setUseMetaData(true);
      
      // Create a ResourceListRowData.
      ResourceListRowData rowdata = new ResourceListRowData(userList, new Object[] { null, RUser.TEXT_DESCRIPTION } );
     
      // Convert the ResourceListRowData into an HTMLTable.
      String[] html = converter.convert(rowdata);
     
      // Print out the first table of 20 users from the html array.
      System.out.println(html[0]);
    
     
    See Also:
    Serialized Form
    • Constructor Detail

      • ResourceListRowData

        public ResourceListRowData()
        Constructs a default ResourceListRowData object.
      • ResourceListRowData

        public ResourceListRowData(ResourceList resourceList,
                           java.lang.Object[] columnAttributeIDs)
        Constructs a ResourceListRowData object with the specified resourceList and columnAttributeIDs.
        Parameters:
        resourceList - The resource list.
        columnAttributeIDs - The array of column attributes.
        See Also:
        ResourceList
    >
    • Method Detail

      • getColumnAttributeIDs

        public java.lang.Object[] getColumnAttributeIDs()
        Returns the array of column attribute IDs.
        Returns:
        The column attribute IDs.
      • getObject

        public java.lang.Object getObject(int columnIndex)
                                   throws RowDataException
        Returns the current row's column data specified at columnIndex.
        Overrides:
        getObject in class RowData
        Parameters:
        columnIndex - The column index (0-based).
        Returns:
        The column object.
        Throws:
        RowDataException - If a row data error occurs.
      • getResourceList

        public ResourceList getResourceList()
        Return the resource list.
        Returns:
        The resource list.
      • length

        public int length()
        Returns the number of rows in the resource list.
        Overrides:
        length in class RowData
        Returns:
        The number of rows.
      • setColumnAttributeIDs

        public void setColumnAttributeIDs(java.lang.Object[] columnAttributeIDs)
        Sets the resource list column attribute IDs.
        Parameters:
        columnAttributeIDs - The column attribute IDs.
      • setResourceList

        public void setResourceList(ResourceList resourceList)
        Sets the resource list.
        Parameters:
        resourceList - The resource list.
        See Also:
        ResourceList