net.java.joglutils.msg.test
Class BasicFetcher<IDENT>

java.lang.Object
  extended by net.java.joglutils.msg.test.BasicFetcher<IDENT>
All Implemented Interfaces:
Fetcher<IDENT>

public class BasicFetcher<IDENT>
extends Object
implements Fetcher<IDENT>

Basic implementation of Fetcher using ImageIO and a single-threaded ExecutorService.

Author:
Kenneth Russell

Constructor Summary
BasicFetcher()
           
 
Method Summary
 void addProgressListener(ProgressListener listener)
          Adds a progress listener to this Fetcher.
 void cancelDownload(Object imageDescriptor, IDENT clientIdentifier, int requestedImageSize)
          Cancels a previously-registered download request from this Fetcher -- one which resulted in null being returned from getImage().
 BufferedImage getImage(Object imageDescriptor, IDENT clientIdentifier, int requestedImageSize)
          Requests the particular image associated with the given element (of arbitrary type) from the ListModel of the ImageBrowser.
 void removeProgressListener(ProgressListener listener)
          Removes a progress listener from this Fetcher.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicFetcher

public BasicFetcher()
Method Detail

getImage

public BufferedImage getImage(Object imageDescriptor,
                              IDENT clientIdentifier,
                              int requestedImageSize)
Description copied from interface: Fetcher
Requests the particular image associated with the given element (of arbitrary type) from the ListModel of the ImageBrowser. The requestedImageSize parameter indicates the desired maximum dimension (width or height) of the returned image. Passing a negative number for this parameter results in always fetching the full-size image. Fetchers that perform their work asynchronously will return null if the image is not available immediately. In this case, progress callbacks will be fired promptly to allow the caller to display an indication of download progress.

Specified by:
getImage in interface Fetcher<IDENT>

cancelDownload

public void cancelDownload(Object imageDescriptor,
                           IDENT clientIdentifier,
                           int requestedImageSize)
Description copied from interface: Fetcher
Cancels a previously-registered download request from this Fetcher -- one which resulted in null being returned from getImage().

Specified by:
cancelDownload in interface Fetcher<IDENT>

addProgressListener

public void addProgressListener(ProgressListener listener)
Description copied from interface: Fetcher
Adds a progress listener to this Fetcher.

Specified by:
addProgressListener in interface Fetcher<IDENT>

removeProgressListener

public void removeProgressListener(ProgressListener listener)
Description copied from interface: Fetcher
Removes a progress listener from this Fetcher.

Specified by:
removeProgressListener in interface Fetcher<IDENT>