|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.as400.util.html.FileListElement
The FileListElement class represents the contents of an Integrated File System directory.
This example creates an FileListElement object:
// Create a HTMLTree object. HTMLTree tree = new HTMLTree(req);Once the contents are listed and a user traverses the HTML tree down to /QIBM/ProdData/Http/Public/ and clicks on the jt400 directory link, the FileListElement will look something like the following:// Create a URLParser object. URLParser urlParser = new URLParser(httpServletRequest.getRequestURI());
// Create an AS400 object. AS400 system = new AS400(mySystem, myUserId, myPassword);
// Create an IFS object. IFSJavaFile root = new IFSJavaFile(system, "/QIBM");
// Create a DirFilter object and get the directories. DirFilter filter = new DirFilter(); File[] dirList = root.listFiles(filter);
for (int i=0; i < dirList.length; i++) {
// Create a FileTreeElement. FileTreeElement element = new FileTreeElement(dirList[i]);
// Set the Icon URL. ServletHyperlink sl = new ServletHyperlink(urlParser.getURI()); sl.setHttpServletResponse(resp); element.setIconUrl(sl);
// Set the text url so it calls another // servlet to display the contents of the FileTreeElement. ServletHyperlink tl = new ServletHyperlink("/servlet/myListServlet"); tl.setTarget("listFrame");
// Set the TextUrl for the FileTreeElement. element.setTextUrl(tl);
// Add the FileTreeElement to the tree. tree.addElement(element); }
// When the user clicks on text url in the HTMLTree it should call another // servlet to display the contents. It is here that the FileListElement // will be created. AS400 sys = new AS400(mySystem, myUserId, myPassword);
// The FileTreeElment will properly create the text url and pass the // file and path information through the httpservletrequest. FileListElement fileList = new FileListElement(sys, httpservletrequest);
// Create an array of optional html tags. The %p and %f will be replace by the // appropriate path information and filename for each element in the FileListElement list. String[] options = new String[1]; options[0] = "<a href=\"http://myWebServer/servlet/AnotherServlet%p%f?c=download\">Optional Action</a>";
// Set the optional html tag(s). fileList.setOptions(s);
// Output the content of the FileListElement. out.println(fileList.list());
Name | Size | Type | Modified | |
---|---|---|---|---|
com | Directory | 06/09/2000 11:00:46 | ||
lib | Directory | 07/05/2000 11:31:53 | ||
MRI2924 | Directory | 06/09/2000 11:03:12 | ||
SSL56 | Directory | 07/01/2000 09:08:10 | ||
utilities | Directory | 06/09/2000 11:01:58 | ||
ACCESS.LST | 15950 | File | 05/10/2000 10:34:57 | Optional Action |
ACCESS.LVL | 15 | File | 05/10/2000 10:35:19 | Optional Action |
CKSETUP.INI | 88 | File | 05/10/2000 10:35:03 | Optional Action |
GTXSETUP.ini | 102 | File | 05/16/2000 05:51:46 | Optional Action |
JT400.PKG | 19 | File | 09/08/1999 04:25:51 | Optional Action |
OPNAV.LST | 16827 | File | 09/08/1999 04:26:08 | Optional Action |
OPNAV.LVL | 19 | File | 05/16/2000 05:51:31 | Optional Action |
OPV4R5M0.LST | 24121 | File | 09/08/1999 04:26:14 | Optional Action |
OPV4R5M01.LST | 104 | File | 05/16/2000 05:51:46 | Optional Action |
PROXY.LST | 4636 | File | 09/08/1999 04:26:00 | Optional Action |
PROXY.LVL | 20 | File | 05/10/2000 10:35:00 | Optional Action |
PXV4R5M0.LST | 7101 | File | 09/08/1999 04:25:58 | Optional Action |
PXV4R5M01.LST | 38 | File | 05/10/2000 10:35:13 | Optional Action |
READMEGT.TXT | 3480 | File | 05/16/2000 05:52:27 | Optional Action |
READMESP.TXT | 4518 | File | 05/10/2000 10:35:10 | Optional Action |
V4R5M0.LST | 38586 | File | 05/10/2000 10:35:06 | Optional Action |
V4R5M01.LST | 33 | File | 05/10/2000 10:35:09 | Optional Action |
FileTreeElement objects generate the following events:
DirFilter
, Serialized FormConstructor Summary | |
FileListElement()
Constructs a default FileTreeElement object. |
|
FileListElement(AS400 system,
javax.servlet.http.HttpServletRequest request)
Constructs an FileTreeElement with the specified system, and request. |
|
FileListElement(AS400 system,
javax.servlet.http.HttpServletRequest request,
HTMLTable table)
Constructs an FileTreeElement with the specified system, request, and table. |
Method Summary | |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener. |
javax.servlet.http.HttpServletRequest |
getHttpServletRequest()
Returns the Http servlet request. |
java.lang.String[] |
getOptions()
Returns the array optional html tags used in the FileListElement object. |
AS400 |
getSystem()
Returns the AS/400 system. |
HTMLTable |
getTable()
Returns the HTMLTable. |
java.lang.String |
list()
Returns a string containing the list of files and directories in the path defined in the HttpServletRequest. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes the PropertyChangeListener from the internal list. |
void |
setHttpServletRequest(javax.servlet.http.HttpServletRequest request)
Sets the Http servlet request for the element. |
void |
setOptions(java.lang.String[] options)
Sets one or more optional html tags. |
void |
setSystem(AS400 system)
Set the AS/400 system. |
void |
setTable(HTMLTable table)
Set the HTMLTable to use when displaying the file list. |
void |
sort(boolean sort)
Sorts the list elements. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public FileListElement()
public FileListElement(AS400 system, javax.servlet.http.HttpServletRequest request)
system
- The AS/400 system.request
- The Http servlet request.public FileListElement(AS400 system, javax.servlet.http.HttpServletRequest request, HTMLTable table)
system
- The AS/400 system.request
- The Http servlet request.table
- The HTML table.Method Detail |
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The PropertyChangeListener.removePropertyChangeListener(java.beans.PropertyChangeListener)
public javax.servlet.http.HttpServletRequest getHttpServletRequest()
public java.lang.String[] getOptions()
public AS400 getSystem()
public HTMLTable getTable()
public java.lang.String list()
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The PropertyChangeListener.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void setHttpServletRequest(javax.servlet.http.HttpServletRequest request)
request
- The Http servlet request.public void setOptions(java.lang.String[] options)
An Example:
// Create an array of optional html tags. The %p and %f will be replace by the // appropriate path information and filename for each element in the FileListElement list. String[] options = new String[1]; options[0] = "Optional Action";
// Set the optional html tags. fileList.setOptions(s);
options
- The optional html tags.public void setSystem(AS400 system)
The
- system.public void setTable(HTMLTable table)
table
- The HTML table.public void sort(boolean sort)
sort
- true if the elements are sorted; false otherwise.
The default is true.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |