public class FileListRenderer
extends java.lang.Object
implements java.io.Serializable
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));
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.
|
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.
|
public FileListRenderer(javax.servlet.http.HttpServletRequest request)
request
- The Http servlet request.public FileListRenderer(javax.servlet.http.HttpServletRequest request, java.lang.String shareName, java.lang.String sharePath)
request
- The Http servlet request.shareName
- The NetServer share name.sharePath
- The NetServer share path.public java.lang.String getDirectoryName(java.io.File file)
file
- The File.public java.lang.String getFileName(java.io.File file)
file
- The File.public java.lang.String getParentName(java.io.File file)
file
- The File.public ListRowData getRowData(java.io.File file, boolean sort, java.text.Collator collator) throws RowDataException
file
- The File.sort
- true if the elements are sorted; false otherwise.
The default is true.collator
- The Collator.RowDataException
- If a row data error occurs.