FileTreeElement class

The FileTreeElement class represents the Integrated File System within an HTMLTree view.

Many tree element attributes can be retrieved or updating using methods that are provided in the HTMLTreeElement class. You can also get and set the name and path of NetServerâ„¢ shared drives.

Some of the actions these methods enable you to perform are:

Example: Using FileTreeElement

The following example creates a FileTreeElement object and displays the tag:

       // Create an HTMLTree.
       HTMLTree tree = new HTMLTree();

       // Create a URLParser object.
      URLParser urlParser = new URLParser(httpServletRequest.getRequestURI());
  
       // Create an AS400 object.
       AS400 system = new AS400(mySystem, myUserId, myPassword);
  
       // Create an IFSJavaFile 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 node = new FileTreeElement(dirList[i]);
     
           // Set the Icon URL.
           ServletHyperlink sl = new ServletHyperlink(urlParser.getURI());
           sl.setHttpServletResponse(resp);
           element.setIconUrl(sl);
     
           // Add the FileTreeElement to the tree.
           tree.addElement(element);
       }

       System.out.println(tree.getTag());

The getTag() method above gives the output of the example.