Home » openjdk-7 » javax » swing » filechooser » [javadoc | source]
javax.swing.filechooser
abstract public class: FileSystemView [javadoc | source]
java.lang.Object
   javax.swing.filechooser.FileSystemView

Direct Known Subclasses:
    GenericFileSystemView, WindowsFileSystemView, UnixFileSystemView

FileSystemView is JFileChooser's gateway to the file system. Since the JDK1.1 File API doesn't allow access to such information as root partitions, file type information, or hidden file bits, this class is designed to intuit as much OS-specific file system information as possible.

Java Licensees may want to provide a different implementation of FileSystemView to better handle a given operating system.

Nested Class Summary:
static class  FileSystemView.FileSystemRoot   
Field Summary
static  FileSystemView windowsFileSystemView     
static  FileSystemView unixFileSystemView     
static  FileSystemView genericFileSystemView     
Constructor:
 public FileSystemView() 
Method from javax.swing.filechooser.FileSystemView Summary:
createFileObject,   createFileObject,   createFileSystemRoot,   createNewFolder,   getChild,   getDefaultDirectory,   getFileSystemView,   getFiles,   getHomeDirectory,   getParentDirectory,   getRoots,   getShellFolder,   getSystemDisplayName,   getSystemIcon,   getSystemTypeDescription,   isComputerNode,   isDrive,   isFileSystem,   isFileSystemRoot,   isFloppyDrive,   isHiddenFile,   isParent,   isRoot,   isTraversable
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.filechooser.FileSystemView Detail:
 public File createFileObject(String path) 
    Returns a File object constructed from the given path string.
 public File createFileObject(File dir,
    String filename) 
    Returns a File object constructed in dir from the given filename.
 protected File createFileSystemRoot(File f) 
    Creates a new File object for f with correct behavior for a file system root directory.
 abstract public File createNewFolder(File containingDir) throws IOException
    Creates a new folder with a default folder name.
 public File getChild(File parent,
    String fileName) 
 public File getDefaultDirectory() 
    Return the user's default starting directory for the file chooser.
 public static FileSystemView getFileSystemView() 
 public File[] getFiles(File dir,
    boolean useFileHiding) 
    Gets the list of shown (i.e. not hidden) files.
 public File getHomeDirectory() 
 public File getParentDirectory(File dir) 
    Returns the parent directory of dir.
 public File[] getRoots() 
    Returns all root partitions on this system. For example, on Windows, this would be the "Desktop" folder, while on DOS this would be the A: through Z: drives.
 ShellFolder getShellFolder(File f) throws FileNotFoundException 
    Throws {@code FileNotFoundException} if file not found or current thread was interrupted
 public String getSystemDisplayName(File f) 
    Name of a file, directory, or folder as it would be displayed in a system file browser. Example from Windows: the "M:\" directory displays as "CD-ROM (M:)" The default implementation gets information from the ShellFolder class.
 public Icon getSystemIcon(File f) 
    Icon for a file, directory, or folder as it would be displayed in a system file browser. Example from Windows: the "M:\" directory displays a CD-ROM icon. The default implementation gets information from the ShellFolder class.
 public String getSystemTypeDescription(File f) 
    Type description for a file, directory, or folder as it would be displayed in a system file browser. Example from Windows: the "Desktop" folder is desribed as "Desktop". Override for platforms with native ShellFolder implementations.
 public boolean isComputerNode(File dir) 
    Used by UI classes to decide whether to display a special icon for a computer node, e.g. "My Computer" or a network server. The default implementation has no way of knowing, so always returns false.
 public boolean isDrive(File dir) 
    Used by UI classes to decide whether to display a special icon for drives or partitions, e.g. a "hard disk" icon. The default implementation has no way of knowing, so always returns false.
 public boolean isFileSystem(File f) 
    Checks if f represents a real directory or file as opposed to a special folder such as "Desktop". Used by UI classes to decide if a folder is selectable when doing directory choosing.
 public boolean isFileSystemRoot(File dir) 
    Is dir the root of a tree in the file system, such as a drive or partition. Example: Returns true for "C:\" on Windows 98.
 public boolean isFloppyDrive(File dir) 
    Used by UI classes to decide whether to display a special icon for a floppy disk. Implies isDrive(dir). The default implementation has no way of knowing, so always returns false.
 public boolean isHiddenFile(File f) 
    Returns whether a file is hidden or not.
 public boolean isParent(File folder,
    File file) 
    On Windows, a file can appear in multiple folders, other than its parent directory in the filesystem. Folder could for example be the "Desktop" folder which is not the same as file.getParentFile().
 public boolean isRoot(File f) 
    Determines if the given file is a root in the navigatable tree(s). Examples: Windows 98 has one root, the Desktop folder. DOS has one root per drive letter, C:\, D:\, etc. Unix has one root, the "/" directory. The default implementation gets information from the ShellFolder class.
 public Boolean isTraversable(File f) 
    Returns true if the file (directory) can be visited. Returns false if the directory cannot be traversed.