|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface CacheableFileIconProvider
CacheableFileIconProvider is an interface to be implemented by file icon providers that wish to use
some icon caching to improve performance. This interface is to be used in conjunction with CachedFileIconProvider
to form a functional cached provider.
| Method Summary | |
|---|---|
void |
addToCache(AbstractFile file,
javax.swing.Icon icon,
java.awt.Dimension preferredResolution)
This method is called by CachedFileIconProvider.getFileIcon(com.mucommander.file.AbstractFile, java.awt.Dimension)
to give implementations a chance to cache an icon fetched with FileIconProvider.getFileIcon(com.mucommander.file.AbstractFile, java.awt.Dimension)
and have it returned later by lookupCache(com.mucommander.file.AbstractFile, java.awt.Dimension). |
boolean |
isCacheable(AbstractFile file,
java.awt.Dimension preferredResolution)
Returns true if the icon cache can be used for the specified file and preferred resolution. |
javax.swing.Icon |
lookupCache(AbstractFile file,
java.awt.Dimension preferredResolution)
This method is called by CachedFileIconProvider.getFileIcon(com.mucommander.file.AbstractFile, java.awt.Dimension)
to perform a cache lookup and give implementations a chance to re-use a cached icon. |
| Methods inherited from interface com.mucommander.file.icon.FileIconProvider |
|---|
getFileIcon |
| Method Detail |
|---|
boolean isCacheable(AbstractFile file,
java.awt.Dimension preferredResolution)
true if the icon cache can be used for the specified file and preferred resolution. This
method allows the icon cache to be used only for certain types of files and/or preferred resolutions.
This method is called by CachedFileIconProvider.getFileIcon(com.mucommander.file.AbstractFile, java.awt.Dimension)
each time an icon is requested. If true is returned, the icon cache will be looked up with
lookupCache(com.mucommander.file.AbstractFile, java.awt.Dimension) and if the cache did not return
an icon, the icon will be be added to the cache with addToCache(com.mucommander.file.AbstractFile, javax.swing.Icon, java.awt.Dimension).
On the other hand, if false is returned, FileIconProvider.getFileIcon(com.mucommander.file.AbstractFile, java.awt.Dimension)
will simply be called, without querying or adding to the cache.
file - the file for which to retrieve an iconpreferredResolution - the preferred resolution for the icon
javax.swing.Icon lookupCache(AbstractFile file,
java.awt.Dimension preferredResolution)
CachedFileIconProvider.getFileIcon(com.mucommander.file.AbstractFile, java.awt.Dimension)
to perform a cache lookup and give implementations a chance to re-use a cached icon. If a non-null value is
returned, the returned icon will be used.
null is returned, the icon will be fetched using FileIconProvider.getFileIcon(com.mucommander.file.AbstractFile, java.awt.Dimension)
followed by a call to addToCache(com.mucommander.file.AbstractFile, javax.swing.Icon,java.awt.Dimension)
to add the freshly-retrieved icon to the cache.
This method is called only if the prior call to isCacheable(com.mucommander.file.AbstractFile, java.awt.Dimension)
returned true.
file - the file for which to look for a previously cached iconpreferredResolution - the preferred resolution for the icon
void addToCache(AbstractFile file,
javax.swing.Icon icon,
java.awt.Dimension preferredResolution)
CachedFileIconProvider.getFileIcon(com.mucommander.file.AbstractFile, java.awt.Dimension)
to give implementations a chance to cache an icon fetched with FileIconProvider.getFileIcon(com.mucommander.file.AbstractFile, java.awt.Dimension)
and have it returned later by lookupCache(com.mucommander.file.AbstractFile, java.awt.Dimension).
This method is called only if the prior call to isCacheable(com.mucommander.file.AbstractFile, java.awt.Dimension)
returned true.
file - the file that corresponds to the given iconicon - the icon to add to the cachepreferredResolution - the preferred icon resolution that was originally requested
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard