Quaqua 5.4.1 2009-07-14

ch.randelshofer.quaqua.panther.filechooser
Class OSXPantherFileSystemView

java.lang.Object
  extended by javax.swing.filechooser.FileSystemView
      extended by ch.randelshofer.quaqua.filechooser.FileSystemViewFilter
          extended by ch.randelshofer.quaqua.filechooser.QuaquaFileSystemView
              extended by ch.randelshofer.quaqua.panther.filechooser.OSXPantherFileSystemView

public class OSXPantherFileSystemView
extends QuaquaFileSystemView

A file system view for Mac OS X 10.3 (Panther).

Version:
4.0 2008-05-09 If native code is available, use native methods from Files class to retrieve file infos. If no native code is available, fall back to FileSystemView.getFileSystemView() rather than relying on Apple's FileView class.
3.2 2007-01-24 Determine system volume lazily. Create file view lazily.
3.1 2005-11-26 Added more hidden top level files.
3.0 2005-08-26 Rewritten.
2.1 2004-12-28 Added "TheVolumeSettingsFolder" to the list of hiddenTopLevelNames. Removed "Desktop Folder" from the list of hiddenTopLevelNames as it appears on the Finder on Mac OS X 10.3. Filenames that end with 0x0d are considered as hidden.
2.0 2004-10-31 New super class QuaquaFileSystemView.
1.0.1 2004-10-12 Made static initializer robust against IO exceptions that may occur, when we attempt to canonicalize a file name.
1.0 2004-06-30 Created.
Author:
Werner Randelshofer

Field Summary
 
Fields inherited from class ch.randelshofer.quaqua.filechooser.FileSystemViewFilter
target
 
Constructor Summary
OSXPantherFileSystemView()
           
 
Method Summary
 java.io.File getChild(java.io.File parent, java.lang.String fileName)
           
 java.io.File getComputer()
          Returns the file that represents this computer node.
 java.io.File getDefaultDirectory()
          Return the user's default starting directory for the file chooser.
 java.io.File getHomeDirectory()
           
 java.io.File getParentDirectory(java.io.File dir)
          Returns the parent directory of dir.
 java.io.File[] getRoots()
          Returns all root partitians on this system.
 java.io.File getSystemVolume()
          Returns the file that represents the system (boot) volume of this computer.
 boolean isFileSystemRoot(java.io.File dir)
          Is dir the root of a tree in the file system, such as a drive or partition.
 boolean isHiddenFile(java.io.File f)
          Returns whether a file is hidden or not.
 boolean isParent(java.io.File folder, java.io.File file)
          On Windows, a file can appear in multiple folders, other than its parent directory in the filesystem.
 boolean isRoot(java.io.File aFile)
          Determines if the given file is a root partition or drive.
 
Methods inherited from class ch.randelshofer.quaqua.filechooser.QuaquaFileSystemView
createFileView, getQuaquaFileSystemView, getSystemDisplayName, getSystemIcon, getSystemTypeDescription, isTraversable, setQuaquaFileSystemView
 
Methods inherited from class ch.randelshofer.quaqua.filechooser.FileSystemViewFilter
createFileObject, createFileObject, createNewFolder, getFiles, isComputerNode, isDrive, isFileSystem, isFloppyDrive
 
Methods inherited from class javax.swing.filechooser.FileSystemView
createFileSystemRoot, getFileSystemView
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OSXPantherFileSystemView

public OSXPantherFileSystemView()
Method Detail

getSystemVolume

public java.io.File getSystemVolume()
Description copied from class: QuaquaFileSystemView
Returns the file that represents the system (boot) volume of this computer.

Specified by:
getSystemVolume in class QuaquaFileSystemView

getComputer

public java.io.File getComputer()
Description copied from class: QuaquaFileSystemView
Returns the file that represents this computer node.

Specified by:
getComputer in class QuaquaFileSystemView

getParentDirectory

public java.io.File getParentDirectory(java.io.File dir)
Returns the parent directory of dir. This method returns the system volume instead of the computer folder ("/").

Overrides:
getParentDirectory in class FileSystemViewFilter
Parameters:
dir - the File being queried
Returns:
the parent directory of dir, or null if dir is null

getRoots

public java.io.File[] getRoots()
Returns all root partitians on this system. This method returns the contents of the volumes folder. The computer folder ("/") is considered as hidden and not returned by this method.

Overrides:
getRoots in class FileSystemViewFilter

isHiddenFile

public boolean isHiddenFile(java.io.File f)
Returns whether a file is hidden or not.

Overrides:
isHiddenFile in class FileSystemViewFilter

isRoot

public boolean isRoot(java.io.File aFile)
Determines if the given file is a root partition or drive.

Overrides:
isRoot in class FileSystemViewFilter
Parameters:
aFile - a File object representing a directory
Returns:
true if f is a root in the navigatable tree.
See Also:
FileSystemViewFilter.isFileSystemRoot(java.io.File)

isParent

public boolean isParent(java.io.File folder,
                        java.io.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().

Overrides:
isParent in class FileSystemViewFilter
Parameters:
folder - a File object repesenting a directory or special folder
file - a File object
Returns:
true if folder is a directory or special folder and contains file.

getChild

public java.io.File getChild(java.io.File parent,
                             java.lang.String fileName)
Overrides:
getChild in class FileSystemViewFilter
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.

isFileSystemRoot

public boolean isFileSystemRoot(java.io.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.

Overrides:
isFileSystemRoot in class FileSystemViewFilter
Parameters:
dir - a File object representing a directory
Returns:
true if f is a root of a filesystem
See Also:
isRoot(java.io.File)

getHomeDirectory

public java.io.File getHomeDirectory()
Overrides:
getHomeDirectory in class FileSystemViewFilter

getDefaultDirectory

public java.io.File getDefaultDirectory()
Return the user's default starting directory for the file chooser.

Specified by:
getDefaultDirectory in class FileSystemViewFilter
Returns:
a File object representing the default starting folder

Copyright 2003-2007 (c) Werner Randelshofer.
All rights reserved.