|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sourceforge.pavlov.randommedia.AbstractRandomMediaFactory
net.sourceforge.pavlov.randommedia.RandomImageFactory
public class RandomImageFactory
RandomImageFactory provides an interface for retrieving a random image from a filesystem directory tree. Images can be individual files or JAR files of images. JAR files are treated as directories. Directories can be interactively enabled and disabled.
This implementation is thread safe and is an example of the Singleton OOD design pattern.
Note: If the directory tree has closed loops, it will make the current implementation go into an infinite loop. For example if b is a subdirectory of a (a/b) and c is a link in b to a (a/b/c->a), this implementation will add an infinite number of copies of the a and b directories.
| Constructor Summary | |
|---|---|
RandomImageFactory()
Creates a new RandomImageFactory instance. |
|
RandomImageFactory(String rootDir)
Creates a new RandomImageFactory instance. |
|
| Method Summary | |
|---|---|
void |
clearCache()
Clears the cache maintained in the ImageLoader. |
protected ZipCapableFileFilter |
getFileFilter()
Describe getFileFilter method here. |
static int |
getGlobalCacheObjectCount()
|
CacheObject |
getRandomCacheObject()
Gets an image embedded in a CacheObject, which provides some additional information about the image. |
ImageIcon |
getRandomImageIcon(int size)
Gets a random image as an ImageIcon. |
| Methods inherited from class net.sourceforge.pavlov.randommedia.AbstractRandomMediaFactory |
|---|
actionPerformed, addMediaRootChangedListener, clearDirectories, disableDirectory, enableDirectory, enableDirectory, getNumberOfDisabledItems, getNumberOfEnabledItems, getNumberOfTotalItems, getRandomURL, getRootDirectory, getSubDirectoryNames, isDirectoryEnabled, notifyListeners, refresh, setRootDirectory, setRootDirectory, toggleEnabled |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RandomImageFactory()
RandomImageFactory instance.
public RandomImageFactory(String rootDir)
RandomImageFactory instance.
rootDir - a String value| Method Detail |
|---|
public void clearCache()
clearCache in class AbstractRandomMediaFactorypublic CacheObject getRandomCacheObject()
CacheObject value with an random ImageIcon as its
CacheObject.object field.public ImageIcon getRandomImageIcon(int size)
size - an int value
ImageIcon valuepublic static int getGlobalCacheObjectCount()
protected ZipCapableFileFilter getFileFilter()
getFileFilter method here.
getFileFilter in class AbstractRandomMediaFactoryZipCapableFileFilter value
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||