com.ibm.as400.util.html

Class FileListRenderer

  • java.lang.Object
    • com.ibm.as400.util.html.FileListRenderer
  • All Implemented Interfaces:
    java.io.Serializable


    public class FileListRenderer
    extends java.lang.Object
    implements java.io.Serializable
    The FileListRenderer class renders the name field for directories and files in a FileListElement.

    If the behavior of the default FileListRenderer is not desired, subclass FileListRenderer and override the appropriate methods until the FileListElement achieves the desired behavior.

    Subclassing FileListRenderer will allow your servlet to include/exclude or change the action of any directory or file in the FileListElement. For example, if a servlet did not want users to see any *.exe files, A subclass of FileListRenderer would be created and the new class would override the getFileName() method to figure out if the File object passed to it was a *.exe file, if it is, null could be returned, which would indicate that the file should not be displayed.

    Overriding the getRowData method will allow the addition of columns in the row data and also enable the reordering of the columns.

    This example creates an FileListElement object with a renderer:

       // Create a FileListElement.
      FileListElement fileList = new FileListElement(sys, httpservletrequest);
      
      // Set the renderer specific to this servlet, which extends
      // FileListRenderer and overrides applicable methods.
      fileList.setRenderer(new myFileListRenderer(request));
      
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      FileListRenderer(javax.servlet.http.HttpServletRequest request)
      Constructs a FileListRenderer with the specified request.
      FileListRenderer(javax.servlet.http.HttpServletRequest request, java.lang.String shareName, java.lang.String sharePath)
      Constructs a FileListRenderer with the specified request, NetServer sharePath, and the NetServer shareName.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      java.lang.String getDirectoryName(java.io.File file)
      Return the directory name string.
      java.lang.String getFileName(java.io.File file)
      Return the file name string.
      java.lang.String getParentName(java.io.File file)
      Return the parent directory name string.
      ListRowData getRowData(java.io.File file, boolean sort, java.text.Collator collator)
      Return the row data to be displayed in the FileListElement.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileListRenderer

        public FileListRenderer(javax.servlet.http.HttpServletRequest request)
        Constructs a FileListRenderer with the specified request.
        Parameters:
        request - The Http servlet request.
      • FileListRenderer

        public FileListRenderer(javax.servlet.http.HttpServletRequest request,
                        java.lang.String shareName,
                        java.lang.String sharePath)
        Constructs a FileListRenderer with the specified request, NetServer sharePath, and the NetServer shareName.
        Parameters:
        request - The Http servlet request.
        shareName - The NetServer share name.
        sharePath - The NetServer share path.
    >
    • Method Detail

      • getDirectoryName

        public java.lang.String getDirectoryName(java.io.File file)
        Return the directory name string. A link to the calling servlet with the directory included in the path info by default. If the directory should not be added to the FileListElement, a null string should be returned.
        Parameters:
        file - The File.
        Returns:
        The directory name string.
      • getFileName

        public java.lang.String getFileName(java.io.File file)
        Return the file name string. The file name will be returned by default. If the file should not be displayed in the FileListElement, a null string should be returned.
        Parameters:
        file - The File.
        Returns:
        The file name string.
      • getParentName

        public java.lang.String getParentName(java.io.File file)
        Return the parent directory name string. A link to the calling servlet with the parent directory included in the path info will be returned by default. If the parent should not be display in the FileListElement, a null string should be returned.
        Parameters:
        file - The File.
        Returns:
        The parent name string.
      • getRowData

        public ListRowData getRowData(java.io.File file,
                             boolean sort,
                             java.text.Collator collator)
                               throws RowDataException
        Return the row data to be displayed in the FileListElement.
        Parameters:
        file - The File.
        sort - true if the elements are sorted; false otherwise. The default is true.
        collator - The Collator.
        Returns:
        ListRowData The row data.
        Throws:
        RowDataException - If a row data error occurs.