com.smartwerkz.jupload.classic.image
Class ImageCache

java.lang.Object
  extended by com.smartwerkz.jupload.classic.image.ImageCache

public class ImageCache
extends java.lang.Object

Caches Image information for once read imagefiles.

Since:
Jan 17, 2006, 4:10:54 PM
Author:
Dominik Seifert

Constructor Summary
ImageCache()
           
 
Method Summary
static boolean busy()
           
static void cancelLoad()
           
static java.awt.image.BufferedImage createThumbnail(UploadImageFile file)
           
static void execute(Task t)
          The ImageCache's Executor executes the given task
static ImageInfo getInfo(java.io.File file)
           
static java.awt.image.BufferedImage getOrCreateScaledThumbnail(java.io.File file, int w, int h)
          Returns a scaled thumbnail.
static java.awt.image.BufferedImage getOrCreateScaledThumbnail(UploadImageFile node, int w, int h)
          Returns a scaled thumbnail.
static void getOrCreateScaledThumbnailLater(ImageLoadTask task)
          Instantly returns and will call the given ImageTask's methods when succeeded caching or failed respectively.
static java.awt.image.BufferedImage getOrCreateThumbnail(java.io.File file)
          Returns a thumbnail for the given file from the cache.
static java.awt.image.BufferedImage getOrCreateThumbnail(UploadImageFile node)
          Returns a thumbnail for the given file from the cache.
static java.awt.image.BufferedImage getThumbnail(java.io.File file)
          Returns a thumbnail for the given file from the cache.
static java.awt.image.BufferedImage getThumbnail(UploadImageFile node)
          Returns a thumbnail for the given file from the cache.
static void init(java.awt.Dimension maxThumbnailSize, boolean renderSmooth)
           
static boolean isSmooth()
           
static void setSmooth(boolean renderSmooth)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageCache

public ImageCache()
Method Detail

init

public static void init(java.awt.Dimension maxThumbnailSize,
                        boolean renderSmooth)

setSmooth

public static void setSmooth(boolean renderSmooth)

isSmooth

public static boolean isSmooth()

cancelLoad

public static void cancelLoad()

busy

public static boolean busy()
Returns:
Wethere currently images are being cached in the background.

getInfo

public static ImageInfo getInfo(java.io.File file)

getThumbnail

public static java.awt.image.BufferedImage getThumbnail(java.io.File file)
Returns a thumbnail for the given file from the cache. If the cache does not contain any Image for the given file it will return null.


getThumbnail

public static java.awt.image.BufferedImage getThumbnail(UploadImageFile node)
Returns a thumbnail for the given file from the cache. If the cache does not contain any Image for the given file it will return null.


getOrCreateThumbnail

public static java.awt.image.BufferedImage getOrCreateThumbnail(java.io.File file)
                                                         throws java.io.IOException
Returns a thumbnail for the given file from the cache. If the cache does not contain any Image for the given file it will be created and added to the cache. Make sure to call this method only on image files.

Throws:
java.io.IOException

getOrCreateThumbnail

public static java.awt.image.BufferedImage getOrCreateThumbnail(UploadImageFile node)
                                                         throws java.io.IOException
Returns a thumbnail for the given file from the cache. If the cache does not contain any Image for the given file it will be created and added to the cache. Make sure to call this method only on image files.

Throws:
java.io.IOException

getOrCreateScaledThumbnail

public static java.awt.image.BufferedImage getOrCreateScaledThumbnail(UploadImageFile node,
                                                                      int w,
                                                                      int h)
                                                               throws java.io.IOException
Returns a scaled thumbnail. Therefore it takes the average-sized picture and returns a scaled copy of it (keeps the aspect ratio).

Throws:
java.io.IOException

getOrCreateScaledThumbnail

public static java.awt.image.BufferedImage getOrCreateScaledThumbnail(java.io.File file,
                                                                      int w,
                                                                      int h)
                                                               throws java.io.IOException
Returns a scaled thumbnail. Therefore it takes the average-sized picture and returns a scaled copy of it (keeps the aspect ratio).

Throws:
java.io.IOException

getOrCreateScaledThumbnailLater

public static void getOrCreateScaledThumbnailLater(ImageLoadTask task)
Instantly returns and will call the given ImageTask's methods when succeeded caching or failed respectively.


createThumbnail

public static java.awt.image.BufferedImage createThumbnail(UploadImageFile file)
                                                    throws java.io.IOException
Throws:
java.io.IOException

execute

public static void execute(Task t)
The ImageCache's Executor executes the given task



Copyright © 2007 smartwerkz.com. All Rights Reserved.