| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
FileSystemView fsv = FileSystemView.getFileSystemView();
Based on 32 examples
public abstract class FileSystemView extends Object
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.
Constructor Summary | |
---|---|
|
Method Summary | |
---|---|
File |
createFileObject(File dir, String filename) Returns a File object constructed in dir from the given filename. |
File |
createFileObject(String path) Returns a File object constructed from the given path string. |
protected File |
Creates a new File object for f with correct
behavior for a file system root directory.
|
abstract File |
createNewFolder(File containingDir) Creates a new folder with a default folder name. |
File |
|
File |
Return the user's default starting directory for the file chooser. |
File[] |
Gets the list of shown (i.e. |
static FileSystemView |
|
File |
|
File |
getParentDirectory(File dir) Returns the parent directory of dir .
|
File[] |
getRoots() Returns all root partitions on this system. |
String |
Name of a file, directory, or folder as it would be displayed in a system file browser. |
Icon |
Icon for a file, directory, or folder as it would be displayed in a system file browser. |
String |
Type description for a file, directory, or folder as it would be displayed in a system file browser. |
boolean |
isComputerNode(File dir) Used by UI classes to decide whether to display a special icon for a computer node, e.g. |
boolean |
Used by UI classes to decide whether to display a special icon for drives or partitions, e.g. |
boolean |
isFileSystem(File f) Checks if f represents a real directory or file as opposed to a
special folder such as "Desktop" .
|
boolean |
isFileSystemRoot(File dir) Is dir the root of a tree in the file system, such as a drive or partition. |
boolean |
isFloppyDrive(File dir) Used by UI classes to decide whether to display a special icon for a floppy disk. |
boolean |
isHiddenFile(File f) Returns whether a file is hidden or not. |
boolean |
On Windows, a file can appear in multiple folders, other than its parent directory in the filesystem. |
boolean |
Determines if the given file is a root in the navigatable tree(s). |
Boolean |
Returns true if the file (directory) can be visited. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileSystemView()
Method Detail |
---|
public File createFileObject(File dir, String filename)
dir
filename
public File createFileObject(String path)
path
protected File createFileSystemRoot(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
objectpublic abstract File createNewFolder(File containingDir) throws IOException
containingDir
IOException
public File getChild(File parent, String fileName)
parent
- a File
object repesenting a directory or special folderfileName
- 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 File getDefaultDirectory()
File
object representing the default
starting folderpublic File[] getFiles(File dir, boolean useFileHiding)
dir
useFileHiding
public static FileSystemView getFileSystemView()
public File getHomeDirectory()
public File getParentDirectory(File dir)
dir
.
dir
- the File
being querieddir
, or
null
if dir
is null
public File[] getRoots()
public String getSystemDisplayName(File f)
f
- a File
objectpublic Icon getSystemIcon(File f)
f
- a File
objectpublic String getSystemTypeDescription(File f)
f
- a File
objectpublic boolean isComputerNode(File dir)
dir
- a directoryfalse
alwayspublic boolean isDrive(File dir)
dir
- a directoryfalse
alwayspublic boolean isFileSystem(File f)
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
objecttrue
if f
is a real file or directory.public boolean isFileSystemRoot(File dir)
dir
- a File
object representing a directorytrue
if f
is a root of a filesystempublic boolean isFloppyDrive(File dir)
dir
- a directoryfalse
alwayspublic boolean isHiddenFile(File f)
f
public boolean isParent(File folder, File file)
folder
- a File
object repesenting a directory or special folderfile
- a File
objecttrue
if folder
is a directory or special folder and contains file
.public boolean isRoot(File f)
C:\
, D:\
, etc. Unix has one root,
the "/"
directory.
The default implementation gets information from the ShellFolder
class.
f
- a File
object representing a directorytrue
if f
is a root in the navigatable tree.public Boolean isTraversable(File f)
f
- the File
true
if the file/directory can be traversed, otherwise false
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |