|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlhmc.gui.thumbnail.ThumbnailsManager
public class ThumbnailsManager
creates and manages image thumbnails.
Nested Class Summary | |
---|---|
class |
ThumbnailsManager.BackgroundLoader
|
Constructor Summary | |
---|---|
ThumbnailsManager()
creates a new thumbnails manager. |
Method Summary | |
---|---|
void |
checkCacheSizeLimit()
|
java.awt.image.BufferedImage |
checkCreateThumbnail(java.lang.String imagePathName,
java.awt.image.BufferedImage originalImage)
return a thumbnail image for the specified original image. |
void |
checkCreateThumbnailsDirectory(java.io.File dir)
check whether the given directory exists; create it if necessary. |
void |
checkCreateThumbnailsForDirectory(java.io.File dir)
create thumbnails for all (image) file in the given directory. |
void |
clearCache()
clear the thumbnails cache, no questions asked. |
java.awt.image.BufferedImage |
createDirnameThumbnail(java.lang.String dir)
create a special "directory thumbnail" image for the given directory. |
java.awt.image.BufferedImage |
createErrorThumbnail(java.lang.String path)
create a special "error thumbnail" for the given file. |
java.awt.image.BufferedImage |
createThumbnailImage(java.net.URL imageURL,
java.awt.image.BufferedImage image,
boolean allowExifThumbnail)
create a thumbnail for the given source image. |
void |
deleteThumbnail(java.lang.String imagePathName)
delete the thumbnail image file for the given source image file. |
void |
deleteThumbnailDirectory(java.lang.String imageDirectoryName)
delete the thumbnail directory for the given source image directory. |
java.awt.image.BufferedImage |
getCachedThumbnailOrNull(java.lang.String imagePathName,
javax.swing.JComponent target)
request a thumbnail image for the thumnails cache. |
java.lang.String |
getDirectoryName(java.lang.String path)
|
int |
getHashForString(java.lang.String s)
calculate a hash code for a given string. |
java.awt.image.BufferedImage |
getThumbnail(java.lang.String imagePathName)
return the cached thumbnail image for the given source image, or null if no thumbnail exists. |
java.io.File |
getThumbnailFilename(java.lang.String imagePathName)
calculates the file (name) used for the thumbnail for the given original image name. |
java.lang.String |
getThumbnailsBaseDirectoryName()
|
java.lang.String |
getThumbnailsDirectoryName(java.lang.String dirname)
return a (short) directory name used to store the thumbnail images for the given source directory name. |
boolean |
isInsideThumbnailsDirectory(java.io.File dir)
|
static void |
main(java.lang.String[] args)
|
java.awt.image.BufferedImage |
paintScaledThumbnail(java.awt.image.BufferedImage image)
returns a thumbnail image of (size)x(size) pixel by rescaling the given (non-null!) |
java.awt.image.BufferedImage |
readThumbnail(java.io.File file)
return a BufferedImage for the given thumbnail file. |
void |
updateThumbnail(java.lang.String imagePathName,
java.awt.Image image)
Intended to (re-) create a thumbnail from the given source image, even if the thumbnail already exists. |
static java.lang.String |
usage()
|
void |
writeThumbnail(java.awt.image.BufferedImage thumbnail,
java.lang.String filename)
write the given image to the given file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ThumbnailsManager()
Method Detail |
---|
public void clearCache()
public void checkCacheSizeLimit()
public java.awt.image.BufferedImage getCachedThumbnailOrNull(java.lang.String imagePathName, javax.swing.JComponent target)
public java.io.File getThumbnailFilename(java.lang.String imagePathName) throws java.io.IOException
java.io.IOException
public java.awt.image.BufferedImage getThumbnail(java.lang.String imagePathName)
This method does NOT trigger the background creation of thumbnails that don't exist. It also does NOT check whether an existing thumbnail is up to date. Use checkCreateThumbnail instead.
This method handles the special case of a thumbnail being requested for a thumbnail image by returning the thumbnail... the extra check seems cheap when compared to the complications arising otherwise.
public java.awt.image.BufferedImage checkCreateThumbnail(java.lang.String imagePathName, java.awt.image.BufferedImage originalImage)
This first calculates the thumbnail directory name corresponding to the source image directory, and creates the thumbnail directory if necessary.
Next, we check whether the thumbnail exists. If yes, we check whether the thumbnail is up-to-date (newer than the original image). If so, we read the thumbnail image and return it. Otherwise, we create the thumbnail image and store it into the thumbnails directory, before returning the thumbnail image. FIXME: this should probably also check the file modification times before deciding whether to use or (re-) create a thumbnail.
public void deleteThumbnail(java.lang.String imagePathName)
public void deleteThumbnailDirectory(java.lang.String imageDirectoryName)
public void updateThumbnail(java.lang.String imagePathName, java.awt.Image image)
public java.awt.image.BufferedImage readThumbnail(java.io.File file)
public void checkCreateThumbnailsDirectory(java.io.File dir)
public java.awt.image.BufferedImage createDirnameThumbnail(java.lang.String dir)
public java.awt.image.BufferedImage createErrorThumbnail(java.lang.String path)
public java.awt.image.BufferedImage createThumbnailImage(java.net.URL imageURL, java.awt.image.BufferedImage image, boolean allowExifThumbnail)
public java.awt.image.BufferedImage paintScaledThumbnail(java.awt.image.BufferedImage image)
public void writeThumbnail(java.awt.image.BufferedImage thumbnail, java.lang.String filename)
public void checkCreateThumbnailsForDirectory(java.io.File dir)
public java.lang.String getDirectoryName(java.lang.String path)
public int getHashForString(java.lang.String s)
public java.lang.String getThumbnailsDirectoryName(java.lang.String dirname)
public java.lang.String getThumbnailsBaseDirectoryName()
public boolean isInsideThumbnailsDirectory(java.io.File dir)
public static java.lang.String usage()
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |