< prev index next >
src/java.desktop/share/classes/javax/swing/filechooser/FileSystemView.java
Print this page
*** 129,145 ****
}
/**
* Determines if the given file is a root in the navigable tree(s).
* Examples: Windows 98 has one root, the Desktop folder. DOS has one root
! * per drive letter, <code>C:\</code>, <code>D:\</code>, etc. Unix has one root,
! * the <code>"/"</code> directory.
*
! * The default implementation gets information from the <code>ShellFolder</code> class.
*
! * @param f a <code>File</code> object representing a directory
! * @return <code>true</code> if <code>f</code> is a root in the navigable tree.
* @see #isFileSystemRoot
*/
public boolean isRoot(File f) {
if (f == null || !f.isAbsolute()) {
return false;
--- 129,145 ----
}
/**
* Determines if the given file is a root in the navigable tree(s).
* Examples: Windows 98 has one root, the Desktop folder. DOS has one root
! * per drive letter, {@code C:\}, {@code D:\}, etc. Unix has one root,
! * the {@code "/"} directory.
*
! * The default implementation gets information from the {@code ShellFolder} class.
*
! * @param f a {@code File} object representing a directory
! * @return {@code true} if {@code f} is a root in the navigable tree.
* @see #isFileSystemRoot
*/
public boolean isRoot(File f) {
if (f == null || !f.isAbsolute()) {
return false;
*** 156,167 ****
/**
* Returns true if the file (directory) can be visited.
* Returns false if the directory cannot be traversed.
*
! * @param f the <code>File</code>
! * @return <code>true</code> if the file/directory can be traversed, otherwise <code>false</code>
* @see JFileChooser#isTraversable
* @see FileView#isTraversable
* @since 1.4
*/
public Boolean isTraversable(File f) {
--- 156,167 ----
/**
* Returns true if the file (directory) can be visited.
* Returns false if the directory cannot be traversed.
*
! * @param f the {@code File}
! * @return {@code true} if the file/directory can be traversed, otherwise {@code false}
* @see JFileChooser#isTraversable
* @see FileView#isTraversable
* @since 1.4
*/
public Boolean isTraversable(File f) {
*** 173,183 ****
* a system file browser. Example from Windows: the "M:\" directory
* displays as "CD-ROM (M:)"
*
* The default implementation gets information from the ShellFolder class.
*
! * @param f a <code>File</code> object
* @return the file name as it would be displayed by a native file chooser
* @see JFileChooser#getName
* @since 1.4
*/
public String getSystemDisplayName(File f) {
--- 173,183 ----
* a system file browser. Example from Windows: the "M:\" directory
* displays as "CD-ROM (M:)"
*
* The default implementation gets information from the ShellFolder class.
*
! * @param f a {@code File} object
* @return the file name as it would be displayed by a native file chooser
* @see JFileChooser#getName
* @since 1.4
*/
public String getSystemDisplayName(File f) {
*** 210,220 ****
* a system file browser. Example from Windows: the "Desktop" folder
* is described as "Desktop".
*
* Override for platforms with native ShellFolder implementations.
*
! * @param f a <code>File</code> object
* @return the file type description as it would be displayed by a native file chooser
* or null if no native information is available.
* @see JFileChooser#getTypeDescription
* @since 1.4
*/
--- 210,220 ----
* a system file browser. Example from Windows: the "Desktop" folder
* is described as "Desktop".
*
* Override for platforms with native ShellFolder implementations.
*
! * @param f a {@code File} object
* @return the file type description as it would be displayed by a native file chooser
* or null if no native information is available.
* @see JFileChooser#getTypeDescription
* @since 1.4
*/
*** 227,237 ****
* a system file browser. Example from Windows: the "M:\" directory
* displays a CD-ROM icon.
*
* The default implementation gets information from the ShellFolder class.
*
! * @param f a <code>File</code> object
* @return an icon as it would be displayed by a native file chooser
* @see JFileChooser#getIcon
* @since 1.4
*/
public Icon getSystemIcon(File f) {
--- 227,237 ----
* a system file browser. Example from Windows: the "M:\" directory
* displays a CD-ROM icon.
*
* The default implementation gets information from the ShellFolder class.
*
! * @param f a {@code File} object
* @return an icon as it would be displayed by a native file chooser
* @see JFileChooser#getIcon
* @since 1.4
*/
public Icon getSystemIcon(File f) {
*** 259,271 ****
/**
* 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().
*
! * @param folder a <code>File</code> object representing a directory or special folder
! * @param file a <code>File</code> object
! * @return <code>true</code> if <code>folder</code> is a directory or special folder and contains <code>file</code>.
* @since 1.4
*/
public boolean isParent(File folder, File file) {
if (folder == null || file == null) {
return false;
--- 259,271 ----
/**
* 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().
*
! * @param folder a {@code File} object representing a directory or special folder
! * @param file a {@code File} object
! * @return {@code true} if {@code folder} is a directory or special folder and contains {@code file}.
* @since 1.4
*/
public boolean isParent(File folder, File file) {
if (folder == null || file == null) {
return false;
*** 286,301 ****
}
}
/**
*
! * @param parent a <code>File</code> object representing a directory or special folder
! * @param fileName a name of a file or folder which exists in <code>parent</code>
! * @return a File object. This is normally constructed with <code>new
! * File(parent, fileName)</code> except when parent and child are both
! * special folders, in which case the <code>File</code> is a wrapper containing
! * a <code>ShellFolder</code> object.
* @since 1.4
*/
public File getChild(File parent, String fileName) {
if (parent instanceof ShellFolder) {
File[] children = getFiles(parent, false);
--- 286,301 ----
}
}
/**
*
! * @param parent a {@code File} object representing a directory or special folder
! * @param fileName a name of a file or folder which exists in {@code parent}
! * @return a File object. This is normally constructed with
! * {@code new File(parent, fileName)} except when parent and child are both
! * special folders, in which case the {@code File} is a wrapper containing
! * a {@code ShellFolder} object.
* @since 1.4
*/
public File getChild(File parent, String fileName) {
if (parent instanceof ShellFolder) {
File[] children = getFiles(parent, false);
*** 308,323 ****
return createFileObject(parent, fileName);
}
/**
! * Checks if <code>f</code> represents a real directory or file as opposed to a
! * special folder such as <code>"Desktop"</code>. Used by UI classes to decide if
* a folder is selectable when doing directory choosing.
*
! * @param f a <code>File</code> object
! * @return <code>true</code> if <code>f</code> is a real file or directory.
* @since 1.4
*/
public boolean isFileSystem(File f) {
if (f instanceof ShellFolder) {
ShellFolder sf = (ShellFolder)f;
--- 308,323 ----
return createFileObject(parent, fileName);
}
/**
! * Checks if {@code f} represents a real directory or file as opposed to a
! * special folder such as {@code "Desktop"}. Used by UI classes to decide if
* a folder is selectable when doing directory choosing.
*
! * @param f a {@code File} object
! * @return {@code true} if {@code f} is a real file or directory.
* @since 1.4
*/
public boolean isFileSystem(File f) {
if (f instanceof ShellFolder) {
ShellFolder sf = (ShellFolder)f;
*** 351,362 ****
/**
* 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.
*
! * @param dir a <code>File</code> object representing a directory
! * @return <code>true</code> if <code>f</code> is a root of a filesystem
* @see #isRoot
* @since 1.4
*/
public boolean isFileSystemRoot(File dir) {
return ShellFolder.isFileSystemRoot(dir);
--- 351,362 ----
/**
* 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.
*
! * @param dir a {@code File} object representing a directory
! * @return {@code true} if {@code f} is a root of a filesystem
* @see #isRoot
* @since 1.4
*/
public boolean isFileSystemRoot(File dir) {
return ShellFolder.isFileSystemRoot(dir);
*** 367,377 ****
* for drives or partitions, e.g. a "hard disk" icon.
*
* The default implementation has no way of knowing, so always returns false.
*
* @param dir a directory
! * @return <code>false</code> always
* @since 1.4
*/
public boolean isDrive(File dir) {
return false;
}
--- 367,377 ----
* for drives or partitions, e.g. a "hard disk" icon.
*
* The default implementation has no way of knowing, so always returns false.
*
* @param dir a directory
! * @return {@code false} always
* @since 1.4
*/
public boolean isDrive(File dir) {
return false;
}
*** 381,391 ****
* for a floppy disk. Implies isDrive(dir).
*
* The default implementation has no way of knowing, so always returns false.
*
* @param dir a directory
! * @return <code>false</code> always
* @since 1.4
*/
public boolean isFloppyDrive(File dir) {
return false;
}
--- 381,391 ----
* for a floppy disk. Implies isDrive(dir).
*
* The default implementation has no way of knowing, so always returns false.
*
* @param dir a directory
! * @return {@code false} always
* @since 1.4
*/
public boolean isFloppyDrive(File dir) {
return false;
}
*** 395,405 ****
* for a computer node, e.g. "My Computer" or a network server.
*
* The default implementation has no way of knowing, so always returns false.
*
* @param dir a directory
! * @return <code>false</code> always
* @since 1.4
*/
public boolean isComputerNode(File dir) {
return ShellFolder.isComputerNode(dir);
}
--- 395,405 ----
* for a computer node, e.g. "My Computer" or a network server.
*
* The default implementation has no way of knowing, so always returns false.
*
* @param dir a directory
! * @return {@code false} always
* @since 1.4
*/
public boolean isComputerNode(File dir) {
return ShellFolder.isComputerNode(dir);
}
*** 440,450 ****
}
/**
* Return the user's default starting directory for the file chooser.
*
! * @return a <code>File</code> object representing the default
* starting folder
* @since 1.4
*/
public File getDefaultDirectory() {
File f = (File)ShellFolder.get("fileChooserDefaultFolder");
--- 440,450 ----
}
/**
* Return the user's default starting directory for the file chooser.
*
! * @return a {@code File} object representing the default
* starting folder
* @since 1.4
*/
public File getDefaultDirectory() {
File f = (File)ShellFolder.get("fileChooserDefaultFolder");
*** 541,554 ****
}
/**
! * Returns the parent directory of <code>dir</code>.
! * @param dir the <code>File</code> being queried
! * @return the parent directory of <code>dir</code>, or
! * <code>null</code> if <code>dir</code> is <code>null</code>
*/
public File getParentDirectory(File dir) {
if (dir == null || !dir.exists()) {
return null;
}
--- 541,554 ----
}
/**
! * Returns the parent directory of {@code dir}.
! * @param dir the {@code File} being queried
! * @return the parent directory of {@code dir}, or
! * {@code null} if {@code dir} is {@code null}
*/
public File getParentDirectory(File dir) {
if (dir == null || !dir.exists()) {
return null;
}
*** 599,614 ****
return null;
}
}
/**
! * Creates a new <code>File</code> object for <code>f</code> with correct
* behavior for a file system root directory.
*
! * @param f a <code>File</code> object representing a file system root
* directory, for example "/" on Unix or "C:\" on Windows.
! * @return a new <code>File</code> object
* @since 1.4
*/
protected File createFileSystemRoot(File f) {
return new FileSystemRoot(f);
}
--- 599,614 ----
return null;
}
}
/**
! * Creates a new {@code File} object for {@code f} with correct
* behavior for a file system root directory.
*
! * @param f a {@code File} object representing a file system root
* directory, for example "/" on Unix or "C:\" on Windows.
! * @return a new {@code File} object
* @since 1.4
*/
protected File createFileSystemRoot(File f) {
return new FileSystemRoot(f);
}
< prev index next >