com.ibm.as400.util.html

Class FileTreeElement

  • All Implemented Interfaces:
    HTMLTagElement, java.io.Serializable


    public class FileTreeElement
    extends HTMLTreeElement
    implements java.io.Serializable
    The FileTreeElement class represents the Integrated File System within an HTMLTree view.

    This example creates an FileTreeElement object:

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

    // Create a URLParser object. URLParser urlParser = new URLParser(httpServletRequest.getRequestURI());

    // Create a object to represent the connection to the system. 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 node = new FileTreeElement(dirList[i]);

    // Set the Icon URL. ServletHyperlink sl = new ServletHyperlink(urlParser.getURI()); sl.setHttpServletResponse(resp); node.setIconUrl(sl);

    // Add the FileTreeElement to the tree. tree.addElement(node); }

    Once the elements are added to an HTMLTree object, the FileTreeElements will look like this:

    + include
    + locales
    + ProdData
    + Test Folder
    + UserData
    + XML

    FileTreeElement objects generate the following events:

    • ElementEvent - The events fired are:
      • elementAdded
      • elementRemoved
    • PropertyChangeEvent
    See Also:
    DirFilter, Serialized Form
    • Constructor Detail

      • FileTreeElement

        public FileTreeElement()
        Constructs a default FileTreeElement object.
      • FileTreeElement

        public FileTreeElement(java.io.File file)
        Constructs a FileTreeElement with the specified file.
        Parameters:
        file - The file.
      • FileTreeElement

        public FileTreeElement(java.io.File file,
                       java.lang.String parameter)
        Constructs a FileTreeElement with the specified file.
        Parameters:
        file - The file.
      • FileTreeElement

        public FileTreeElement(java.io.File file,
                       java.lang.String shareName,
                       java.lang.String sharePath)
        Constructs a FileTreeElement with the specified file, NetServer shareName and sharePath.
        Parameters:
        file - The file.
        shareName - The name of the NetServer share.
        sharePath - The path of the NetServer share.
      • FileTreeElement

        public FileTreeElement(java.io.File file,
                       java.lang.String shareName,
                       java.lang.String sharePath,
                       java.lang.String parameter)
        Constructs a FileTreeElement with the specified file, NetServer shareName and sharePath.
        Parameters:
        file - The file.
        shareName - The name of the NetServer share.
        sharePath - The path of the NetServer share.
    • Method Detail

      • getFile

        public java.io.File getFile()
        Returns the file represented by this FileTreeElement.
      • getShareName

        public java.lang.String getShareName()
        Returns the NetServer share name.
      • getSharePath

        public java.lang.String getSharePath()
        Returns the NetServer share path.
      • isLeaf

        public boolean isLeaf()
        Indicates if the FileTreeElement is a leaf.
        Overrides:
        isLeaf in class HTMLTreeElement
        Returns:
        true if the element is a leaf, false otherwise.
      • selected

        public void selected(int hashcode)
        Indicates which FileTreeElement is selected. The hashcode is used to determine which element within the tree to expand or collapse.
        Overrides:
        selected in class HTMLTreeElement
        Parameters:
        hashcode - The hashcode.
      • setFile

        public void setFile(java.io.File file)
        Sets the file represented by this FileTreeElement.
        Parameters:
        file - The File.
      • setShareName

        public void setShareName(java.lang.String shareName)
        Sets the name of the NetServer share.
        Parameters:
        shareName - The share name..
      • setSharePath

        public void setSharePath(java.lang.String sharePath)
        Sets the NetServer share path.
        Parameters:
        sharePath - The share path.
      • setPatternMatching

        public void setPatternMatching(int patternMatching)
        Sets the pattern-matching behavior used when files are listed. The default is PATTERN_POSIX.
        Parameters:
        patternMatching - Either PATTERN_POSIX, PATTERN_POSIX_ALL, or PATTERN_OS2