public abstract class FileSystemView extends Object
Java Licensees may want to provide a different implementation of FileSystemView to better handle a given operating system.
| Constructor and Description |
|---|
FileSystemView()
|
| Modifier and Type | Method and Description |
|---|---|
File |
createFileObject(File
Returns a File object constructed in dir from the given filename.
|
File |
createFileObject(String
Returns a File object constructed from the given path string.
|
protected File |
createFileSystemRoot(File
Creates a new
File object for
f with correct behavior for a file system root directory.
|
abstract File |
createNewFolder(File
Creates a new folder with a default folder name.
|
File |
getChild(File
|
File |
getDefaultDirectory()
Return the user's default starting directory for the file chooser.
|
File |
getFiles(File
Gets the list of shown (i.e.
|
static FileSystemView |
getFileSystemView()
|
File |
getHomeDirectory()
|
File |
getParentDirectory(File
Returns the parent directory of
dir.
|
File |
getRoots()
Returns all root partitions on this system.
|
String |
getSystemDisplayName(File
Name of a file, directory, or folder as it would be displayed in a system file browser.
|
Icon |
getSystemIcon(File
Icon for a file, directory, or folder as it would be displayed in a system file browser.
|
String |
getSystemTypeDescription(File
Type description for a file, directory, or folder as it would be displayed in a system file browser.
|
boolean |
isComputerNode(File
Used by UI classes to decide whether to display a special icon for a computer node, e.g.
|
boolean |
isDrive(File
Used by UI classes to decide whether to display a special icon for drives or partitions, e.g.
|
boolean |
isFileSystem(File
Checks if
f represents a real directory or file as opposed to a special folder such as
"Desktop".
|
boolean |
isFileSystemRoot(File
Is dir the root of a tree in the file system, such as a drive or partition.
|
boolean |
isFloppyDrive(File
Used by UI classes to decide whether to display a special icon for a floppy disk.
|
boolean |
isHiddenFile(File
Returns whether a file is hidden or not.
|
boolean |
isParent(File
On Windows, a file can appear in multiple folders, other than its parent directory in the filesystem.
|
boolean |
isRoot(File
Determines if the given file is a root in the navigable tree(s).
|
Boolean |
isTraversable(File
Returns true if the file (directory) can be visited.
|
public static FileSystemViewgetFileSystemView()
public boolean isRoot(Filef)
C:\,
D:\, etc. Unix has one root, the
"/" directory. The default implementation gets information from the
ShellFolder class.
f - a
File object representing a directory
true if
f is a root in the navigable tree.
isFileSystemRoot(java.io.File)
public BooleanisTraversable(File f)
f - the
File
true if the file/directory can be traversed, otherwise
false
JFileChooser.isTraversable(java.io.File) ,
FileView.isTraversable(java.io.File)
public StringgetSystemDisplayName(File f)
f - a
File object
JFileChooser.getName(java.io.File)
public StringgetSystemTypeDescription(File f)
f - a
File object
JFileChooser.getTypeDescription(java.io.File)
public IcongetSystemIcon(File f)
f - a
File object
JFileChooser.getIcon(java.io.File)
public boolean isParent(Filefolder, File file)
folder - a
File object representing a directory or special folder
file - a
File object
true if
folder is a directory or special folder and contains
file.
public FilegetChild(File parent, String fileName)
parent - a
File object representing a directory or special folder
fileName - a name of a file or folder which exists in
parent
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.
public boolean isFileSystem(Filef)
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.
f - a
File object
true if
f is a real file or directory.
public abstract FilecreateNewFolder(File containingDir) throws IOException
IOException
public boolean isHiddenFile(Filef)
public boolean isFileSystemRoot(Filedir)
dir - a
File object representing a directory
true if
f is a root of a filesystem
isRoot(java.io.File)
public boolean isDrive(Filedir)
dir - a directory
false always
public boolean isFloppyDrive(Filedir)
dir - a directory
false always
public boolean isComputerNode(Filedir)
dir - a directory
false always
public File[] getRoots()
public FilegetHomeDirectory()
public FilegetDefaultDirectory()
File object representing the default starting folder
public FilecreateFileObject(File dir, String filename)
public FilecreateFileObject(String path)
public File[] getFiles(File dir, boolean useFileHiding)
public FilegetParentDirectory(File dir)
dir.
dir - the
File being queried
dir, or
null if
dir is
null
protected FilecreateFileSystemRoot(File f)
File object for
f with correct behavior for a file system root directory.
f - a
File object representing a file system root directory, for example "/" on Unix or "C:\" on Windows.
File object