javax.swing.filechooser
Class WindowsFileSystemView

java.lang.Object
  extended byjavax.swing.filechooser.FileSystemView
      extended byjavax.swing.filechooser.WindowsFileSystemView

class WindowsFileSystemView
extends FileSystemView

FileSystemView that handles some specific windows concepts.


Nested Class Summary
 
Nested classes inherited from class javax.swing.filechooser.FileSystemView
FileSystemView.FileSystemRoot
 
Field Summary
private static String newFolderNextString
           
private static String newFolderString
           
 
Fields inherited from class javax.swing.filechooser.FileSystemView
genericFileSystemView, unixFileSystemView, windowsFileSystemView
 
Constructor Summary
(package private) WindowsFileSystemView()
           
 
Method Summary
 File createFileObject(String path)
          Returns a File object constructed from the given path string.
protected  File createFileSystemRoot(File f)
          Creates a new File object for f with correct behavior for a file system root directory.
 File createNewFolder(File containingDir)
          Creates a new folder with a default folder name.
 File getChild(File parent, String fileName)
           
 File getHomeDirectory()
           
 String getSystemTypeDescription(File f)
          Type description for a file, directory, or folder as it would be displayed in a system file browser.
 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.
 boolean isFloppyDrive(File dir)
          Used by UI classes to decide whether to display a special icon for a floppy disk.
 Boolean isTraversable(File f)
          Returns true if the file (directory) can be visited.
 
Methods inherited from class javax.swing.filechooser.FileSystemView
createFileObject, getDefaultDirectory, getFiles, getFileSystemView, getParentDirectory, getRoots, getShellFolder, getSystemDisplayName, getSystemIcon, isComputerNode, isFileSystem, isFileSystemRoot, isHiddenFile, isParent, isRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

newFolderString

private static final String newFolderString

newFolderNextString

private static final String newFolderNextString
Constructor Detail

WindowsFileSystemView

WindowsFileSystemView()
Method Detail

isTraversable

public Boolean isTraversable(File f)
Description copied from class: FileSystemView
Returns true if the file (directory) can be visited. Returns false if the directory cannot be traversed.

Overrides:
isTraversable in class FileSystemView
Parameters:
f - the File
Returns:
true if the file/directory can be traversed, otherwise false
See Also:
JFileChooser.isTraversable(java.io.File), FileView.isTraversable(java.io.File)

getChild

public File getChild(File parent,
                     String fileName)
Overrides:
getChild in class FileSystemView
Parameters:
parent - a File object repesenting a directory or special folder
fileName - a name of a file or folder which exists in parent
Returns:
a File object. This is normally constructed with new File(parent, fileName) except when parent and child are both special folders, in which case the File is a wrapper containing a ShellFolder object.

getSystemTypeDescription

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". The Windows implementation gets information from the ShellFolder class.

Overrides:
getSystemTypeDescription in class FileSystemView
Parameters:
f - a File object
Returns:
the file type description as it would be displayed by a native file chooser or null if no native information is available.
See Also:
JFileChooser.getTypeDescription(java.io.File)

getHomeDirectory

public File getHomeDirectory()
Overrides:
getHomeDirectory in class FileSystemView
Returns:
the Desktop folder.

createNewFolder

public File createNewFolder(File containingDir)
                     throws IOException
Creates a new folder with a default folder name.

Specified by:
createNewFolder in class FileSystemView
Throws:
IOException

isDrive

public boolean isDrive(File dir)
Description copied from class: FileSystemView
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.

Overrides:
isDrive in class FileSystemView
Parameters:
dir - a directory
Returns:
false always

isFloppyDrive

public boolean isFloppyDrive(File dir)
Description copied from class: FileSystemView
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.

Overrides:
isFloppyDrive in class FileSystemView
Parameters:
dir - a directory
Returns:
false always

createFileObject

public File createFileObject(String path)
Returns a File object constructed from the given path string.

Overrides:
createFileObject in class FileSystemView

createFileSystemRoot

protected File createFileSystemRoot(File f)
Description copied from class: FileSystemView
Creates a new File object for f with correct behavior for a file system root directory.

Overrides:
createFileSystemRoot in class FileSystemView
Parameters:
f - a File object representing a file system root directory, for example "/" on Unix or "C:\" on Windows.
Returns:
a new File object