com.ibm.as400.util.html
Class FileListRenderer

java.lang.Object
  extended by com.ibm.as400.util.html.FileListRenderer
All Implemented Interfaces:
Serializable

public class FileListRenderer
extends Object
implements 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
FileListRenderer(javax.servlet.http.HttpServletRequest request)
          Constructs a FileListRenderer with the specified request.
FileListRenderer(javax.servlet.http.HttpServletRequest request, String shareName, String sharePath)
          Constructs a FileListRenderer with the specified request, NetServer sharePath, and the NetServer shareName.
 
Method Summary
 String getDirectoryName(File file)
          Return the directory name string.
 String getFileName(File file)
          Return the file name string.
 String getParentName(File file)
          Return the parent directory name string.
 ListRowData getRowData(File file, boolean sort, 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,
                        String shareName,
                        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 String getDirectoryName(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 String getFileName(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 String getParentName(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(File file,
                              boolean sort,
                              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.