com.jgoodies.uifextras.fileaccess
Class ExtFileSystemView

java.lang.Object
  extended by com.jgoodies.uifextras.fileaccess.ExtFileSystemView

public final class ExtFileSystemView
extends Object

An extended version of the Swing FileSystemView class. It is implemented as a singleton, that reinitializes itself each time the look&feel changes.

TODO: Remove the LookChangeListener from unused instances.

Version:
$Revision: 1.12 $
Author:
Karsten Lentzsch
See Also:
FileSystemView

Method Summary
 File getCurrentDirectory()
          Returns the current directory.
 String getDirectoryName(File directory)
          Returns the system's display name for the specified directory.
 File[] getFiles(File file, boolean useFileHiding)
          Returns the Files that are shown as childs of the specified File.
 Icon getIcon(File file, boolean isSelected)
          Looks up and returns an icon for the given file and selection state.
static ExtFileSystemView getInstance()
          Lazily creates and returns the sole instance.
 Icon getLeafIcon(File file)
          Fetches and returns a leaf icon for the given file.
 File[] getRoots()
          Looks up and returns an array of filesystem roots.
 boolean isFileSystem(File file)
          Checks and returns whether the given file is backed up by the file system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ExtFileSystemView getInstance()
Lazily creates and returns the sole instance.

Returns:
the sole instance of the class

getCurrentDirectory

public File getCurrentDirectory()
Returns the current directory. Useful for dialogs that operate on directories to show the directory the user has worked with recently

Returns:
the current directory

getDirectoryName

public String getDirectoryName(File directory)
Returns the system's display name for the specified directory.

Parameters:
directory - the directory File to be checked
Returns:
the directory's system display name

getFiles

public File[] getFiles(File file,
                       boolean useFileHiding)
Returns the Files that are shown as childs of the specified File. A child is either contained in the file system, or a ShellFolder child.

Parameters:
file - the parent file
useFileHiding - true honors the hidden file state
Returns:
the files that are shown as childs of the given parent file

getIcon

public Icon getIcon(File file,
                    boolean isSelected)
Looks up and returns an icon for the given file and selection state. The selection state can be used in renderers to show different icons for the selected and deselected states.

Parameters:
file - the associated file
isSelected - true if we're looking for an icon in selected state
Returns:
an icon that represents the file (type)
See Also:
getLeafIcon(File)

getLeafIcon

public Icon getLeafIcon(File file)
Fetches and returns a leaf icon for the given file. If we know that the file is a leaf, we can guess a better icon, in case the file is absent.

Parameters:
file - the leaf file to lookup the icon for
Returns:
an icon that represents the given file
See Also:
getIcon(File, boolean)

getRoots

public File[] getRoots()
Looks up and returns an array of filesystem roots.

Returns:
an array of the filesystem's roots

isFileSystem

public boolean isFileSystem(File file)
Checks and returns whether the given file is backed up by the file system. Otherwise it is a virtual file or directory, for example, a shell folder like Shared Documents on Windows.

Parameters:
file - the file to check
Returns:
true if the file is backed by the file system, false otherwise


Copyright © 2000-2008 JGoodies Karsten Lentzsch. All Rights Reserved.