javax.swing.plaf.basic

Class BasicFileChooserUI.BasicFileView

Enclosing Class:
BasicFileChooserUI

protected class BasicFileChooserUI.BasicFileView
extends FileView

Provides presentation information about files and directories.

Field Summary

protected Hashtable
Icon>()
Storage for cached icons.
protected Hashtable
Icon>iconCache
Storage for cached icons.

Constructor Summary

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

getDescription, getIcon, getName, getTypeDescription, isTraversable

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

Icon>()

protected HashtableIcon>()
Storage for cached icons.

Icon>iconCache

protected HashtableIcon>iconCache
Storage for cached icons.

Constructor Details

BasicFileView

public BasicFileView()
Creates a new instance.

Method Details

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 interface 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 interface 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 interface 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 interface 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.

BasicFileChooserUI.java -- Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.