Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

apg_config
Class APGImageCacheManager  view APGImageCacheManager download APGImageCacheManager.java

java.lang.Object
  extended byapg_config.APGImageCacheManager
All Implemented Interfaces:
java.lang.Runnable

public class APGImageCacheManager
extends java.lang.Object
implements java.lang.Runnable

An simple cache system for images files. This system stores pictures in a cache that persists. The SIZE_xxxx constants defines the supported cache sizes.

The only optimization that is performed is the construction of smaller cache entries from their next highest image size. For example, if the 800x600 size is present and a request is made for the 320x240 size, that cache entry will be constructed from the 640x480 image - but since that does not exist, it'll be constructed from the 800x600 image.

If this proves tooooo slow, I might change it to pass-thru the construction properly, so that in the above request the 640x480 cache entry is created in the process!


Nested Class Summary
(package private)  class APGImageCacheManager.MapKey
           
protected  class APGImageCacheManager.ThumbnailRequest
           
 
Field Summary
private  java.awt.Image broken
           
private  APGImageCache[] cache
           
private  java.io.File cacheDir
           
private static int[] cacheSizes
           
private  boolean continueMainThread
           
private static java.lang.String[] dirNames
           
private  APGEntry entry
           
private  APGImageCacheManagerListener listener
           
private  java.awt.Image loading
           
private  java.lang.Thread mainThread
           
private  java.util.SortedMap requestList
           
static int SIZE_120
           
static int SIZE_48
           
static int SIZE_64
           
static int SIZE_96
           
private  java.lang.ThreadGroup threadGroup
           
private  java.util.Map threadList
           
protected static int TOTAL
           
 
Constructor Summary
APGImageCacheManager(APGEntry e)
           
 
Method Summary
 void cancelAllRequests()
          Shut down all existing threads!
 boolean destroyCacheFiles(int size)
           
 java.awt.Image getImage(APGEntryItem item, int size)
           
static int getWidth(int size)
           
 boolean initialise()
           
 boolean isImageIconProcessing(APGEntryItem item, int size)
           
 boolean isImageIconQueued(APGEntryItem item, int size)
           
 void queueImageIcon(APGEntryItem item, int size)
           
 void run()
          This method will be called by whoever wishes to run your class implementing Runnable.
 void setAPGImageCacheManagerListener(APGImageCacheManagerListener l)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOTAL

protected static final int TOTAL
See Also:
Constant Field Values

entry

private APGEntry entry

cacheDir

private java.io.File cacheDir

mainThread

private java.lang.Thread mainThread

continueMainThread

private boolean continueMainThread

cache

private APGImageCache[] cache

listener

private APGImageCacheManagerListener listener

threadGroup

private java.lang.ThreadGroup threadGroup

requestList

private java.util.SortedMap requestList

threadList

private java.util.Map threadList

broken

private java.awt.Image broken

loading

private java.awt.Image loading

dirNames

private static final java.lang.String[] dirNames

cacheSizes

private static final int[] cacheSizes

SIZE_48

public static final int SIZE_48
See Also:
Constant Field Values

SIZE_64

public static final int SIZE_64
See Also:
Constant Field Values

SIZE_96

public static final int SIZE_96
See Also:
Constant Field Values

SIZE_120

public static final int SIZE_120
See Also:
Constant Field Values
Constructor Detail

APGImageCacheManager

public APGImageCacheManager(APGEntry e)
Method Detail

initialise

public boolean initialise()

shutdown

public void shutdown()

cancelAllRequests

public void cancelAllRequests()
Shut down all existing threads!


run

public void run()
Description copied from interface: java.lang.Runnable
This method will be called by whoever wishes to run your class implementing Runnable. Note that there are no restrictions on what you are allowed to do in the run method, except that you cannot throw a checked exception.

Specified by:
run in interface java.lang.Runnable

getWidth

public static int getWidth(int size)

setAPGImageCacheManagerListener

public void setAPGImageCacheManagerListener(APGImageCacheManagerListener l)

destroyCacheFiles

public boolean destroyCacheFiles(int size)

isImageIconQueued

public boolean isImageIconQueued(APGEntryItem item,
                                 int size)

isImageIconProcessing

public boolean isImageIconProcessing(APGEntryItem item,
                                     int size)

queueImageIcon

public void queueImageIcon(APGEntryItem item,
                           int size)

getImage

public java.awt.Image getImage(APGEntryItem item,
                               int size)