Class XFileSystemView

java.lang.Object
javax.swing.filechooser.FileSystemView
com.sun.xfilechooser.XFileSystemView

public abstract class XFileSystemView extends FileSystemView
XFileSystemView class allows the XFileChooser to provide XFile object data to the FileSystemView of the JFileChooser. This class overrides the FileSystemView provided by JFileChooser. Whenever an XFileChooser constructor is called the FileSystemView that is set would be the XFileSystemView.
  • Constructor Details

    • XFileSystemView

      public XFileSystemView()
  • Method Details

    • getFileSystemView

      public static FileSystemView getFileSystemView()
      Depending on type of operating system (e.g. unix, windows, or generic) it would return the file system view.
      Returns:
      FileSystemView the operating system file system view
    • createFileObject

      public File createFileObject(File dir, String filename)
      Creates a File object constructed from File obj and filename
      Overrides:
      createFileObject in class FileSystemView
      Parameters:
      dir - file object of directory
      filename - name of file in directory
      Returns:
      File object created
    • createFileObject

      public File createFileObject(String path)
      Creates a file object constructed from give pathname
      Overrides:
      createFileObject in class FileSystemView
      Returns:
      File object constructed from the given path string.
    • getFiles

      public File[] getFiles(File dir, boolean useFileHiding)
      Returns the list of files in a directory
      Overrides:
      getFiles in class FileSystemView
      Parameters:
      dir - directory
      useFileHiding - flag to indicate to either show files hidden or not.
      Returns:
      File[] array of files in the directory
    • getHomeDirectory

      public File getHomeDirectory()
      Returns the user's home directory
      Overrides:
      getHomeDirectory in class FileSystemView
      Returns:
      File object of user's home directory
    • getParentDirectory

      public File getParentDirectory(File dir)
      Returns the parent directory of specified directory/file object
      Overrides:
      getParentDirectory in class FileSystemView
      Parameters:
      dir - directory
      Returns:
      parent directory
    • isRoot

      public boolean isRoot(File f)
      Returns true if the given file object is root.
      Overrides:
      isRoot in class FileSystemView
      Parameters:
      f - file object to check if root
      Returns:
      boolean value if file object is root (true) or not (false)