javax.swing.plaf.basic
Class BasicFileChooserUI.BasicFileView

java.lang.Object
  extended by javax.swing.filechooser.FileView
      extended by javax.swing.plaf.basic.BasicFileChooserUI.BasicFileView
Enclosing class:
BasicFileChooserUI

protected class BasicFileChooserUI.BasicFileView
extends FileView

Provides presentation information about files and directories.


Field Summary
protected  Hashtable<File,Icon> iconCache
          Storage for cached icons.
 
Constructor Summary
BasicFileChooserUI.BasicFileView()
          Creates a new instance.
 
Method Summary
 void cacheIcon(File f, Icon i)
          Adds an icon to the cache, associating it with the given file/directory.
 void clearIconCache()
          Clears the icon cache.
 Icon getCachedIcon(File f)
          Retrieves the icon associated with the specified file/directory, if there is one.
 String getDescription(File f)
          Returns a description of the given file/directory.
 Icon getIcon(File f)
          Returns an icon appropriate for the given file or directory.
 String getName(File f)
          Returns the name for the given file/directory.
 String getTypeDescription(File f)
          Returns a localised description for the type of file/directory.
 Boolean isHidden(File f)
          Returns Boolean.TRUE if the given file/directory is hidden, and Boolean.FALSE otherwise.
 
Methods inherited from class javax.swing.filechooser.FileView
isTraversable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iconCache

protected Hashtable<File,Icon> iconCache
Storage for cached icons.

Constructor Detail

BasicFileChooserUI.BasicFileView

public BasicFileChooserUI.BasicFileView()
Creates a new instance.

Method Detail

cacheIcon

public void cacheIcon(File f,
                      Icon i)
Adds an icon to the cache, associating it with the given file/directory.

Parameters:
f - the file/directory.
i - the icon.

clearIconCache

public void clearIconCache()
Clears the icon cache.


getCachedIcon

public Icon getCachedIcon(File f)
Retrieves the icon associated with the specified file/directory, if there is one.

Parameters:
f - the file/directory.
Returns:
The cached icon (or null).

getDescription

public String getDescription(File f)
Returns a description of the given file/directory. In this implementation, the description is the same as the name returned by getName(File).

Overrides:
getDescription in class FileView
Parameters:
f - the file/directory.
Returns:
A description of the given file/directory.

getIcon

public Icon getIcon(File f)
Returns an icon appropriate for the given file or directory.

Overrides:
getIcon in class FileView
Parameters:
f - the file/directory.
Returns:
An icon.

getName

public String getName(File f)
Returns the name for the given file/directory.

Overrides:
getName in class FileView
Parameters:
f - the file/directory.
Returns:
The name of the file/directory.

getTypeDescription

public String getTypeDescription(File f)
Returns a localised description for the type of file/directory.

Overrides:
getTypeDescription in class FileView
Parameters:
f - the file/directory.
Returns:
A type description for the given file/directory.

isHidden

public Boolean isHidden(File f)
Returns Boolean.TRUE if the given file/directory is hidden, and Boolean.FALSE otherwise.

Parameters:
f - the file/directory.
Returns:
Boolean.TRUE or Boolean.FALSE.