public class ImageDownloadService
- Object
- ConnectionRequest
- ImageDownloadService
ImplementsIOProgressListener
See also
Constructors
public ImageDownloadService(String url, ActionListener l) | Accepts the url to bind to the list renderer, on completion the action listener will be invoked with the image so a list can be updated with the data |
public ImageDownloadService(String url, Component targetList, int targetOffset, String targetKey) | Constructs an image request that will automatically populate the given list when the response arrives. |
public ImageDownloadService(String url, List targetList, int targetOffset, String targetKey) | Constructs an image request that will automatically populate the given list when the response arrives. |
public ImageDownloadService(String url, Label parentLabel) | Accepts the url to bind to the label, on completion the label will be updated and revalidated with the new image. |
Methods
Inherited nested types
Inherited fields
Inherited methods
From ConnectionRequest
getDefaultCacheMode, setDefaultCacheMode, isReadResponseForErrorsDefault, setReadResponseForErrorsDefault, isHandleErrorCodesInGlobalErrorHandler, setHandleErrorCodesInGlobalErrorHandler, getCookieHeader, setCookieHeader, isCookiesEnabledDefault, setCookiesEnabledDefault, isDefaultFollowRedirects, setDefaultFollowRedirects, isReadTimeoutSupported, purgeCacheDirectory, getDefaultUserAgent, setDefaultUserAgent, setUseNativeCookieStore, isNativeCookieSharingSupported, fetchJSON, fetchJSONAsync, getCacheMode, setCacheMode, isCheckSSLCertificates, setCheckSSLCertificates, isInsecure, setInsecure, getResponseData, getHttpMethod, setHttpMethod, addRequestHeader, removeRequestHeader, removeRequestHeaderIfUnchanged, checkSSLCertificates, getReadTimeout, setReadTimeout, initConnection, getCachedData, purgeCache, cacheUnmodified, cookieReceived, cookieSent, initCookieHeader, getResponseCode, getResposeCode, shouldConvertPostToGetOnRedirect, readHeaders, readErrorCodeHeaders, getHeader, getHeaders, getHeaderFieldNames, getYield, shouldAutoCloseResponse, handleIOException, handleRuntimeException, canGetSSLCertificates, getSSLCertificates, retry, onRedirect, createRequestURL, buildRequestBody, shouldWriteUTFAsGetBytes, kill, shouldStop, isPausable, pause, resume, isPost, setPost, addArgument, removeArgument, removeAllArguments, addArgumentNoEncoding, addArgumentNoEncoding, addArgumentNoEncodingArray, addArgument, addArgumentArray, addArgument, addArguments, getContentType, setContentType, isWriteRequest, setWriteRequest, isReadRequest, setReadRequest, isPaused, setPaused, isKilled, setKilled, getPriority, setPriority, getUserAgent, setUserAgent, isFollowRedirects, setFollowRedirects, getTimeout, setTimeout, getContentLength, ioStreamUpdate, getUrl, setUrl, addResponseListener, removeResponseListener, addResponseCodeListener, addExceptionListener, removeResponseCodeListener, removeExceptionListener, hasResponseListeners, fireResponseListener, isDuplicateSupported, setDuplicateSupported, validate, getDisposeOnCompletion, setDisposeOnCompletion, getShowOnInit, setShowOnInit, getSilentRetryCount, setSilentRetryCount, isFailSilently, setFailSilently, isReadResponseForErrors, setReadResponseForErrors, getResponseContentType, isRedirecting, getDestinationFile, setDestinationFile, getDestinationStorage, setDestinationStorage, isCookiesEnabled, setCookiesEnabled, setChunkedStreamingMode, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, getRequestBody, setRequestBody, setRequestBody, getRequestBodyData, getResponseErrorMessage
Constructor details
ImageDownloadService
public ImageDownloadService(String url, ActionListener l)Parameters
urlString- the image URL
lActionListener- an action listener callback
ImageDownloadService
public ImageDownloadService(String url, Component targetList, int targetOffset, String targetKey)Parameters
urlString- the image URL
targetListComponent- the list that should be updated when the data arrives
targetOffsetint- the offset within the list to insert the image
targetKeyString- the key for the map in the target offset
ImageDownloadService
public ImageDownloadService(String url, List targetList, int targetOffset, String targetKey)Parameters
urlString- the image URL
targetListList- the list that should be updated when the data arrives
targetOffsetint- the offset within the list to insert the image
targetKeyString- the key for the map in the target offset
ImageDownloadService
public ImageDownloadService(String url, Label parentLabel)Parameters
urlString- the image URL
parentLabelLabel- the label to update
Method details
isFastScale
public static boolean isFastScale()Returns
setFastScale
public static void setFastScale(boolean aFastScale)Parameters
aFastScaleboolean- the fastScale to set
isAlwaysRevalidate
public static boolean isAlwaysRevalidate()Returns
setAlwaysRevalidate
public static void setAlwaysRevalidate(boolean aAlwaysRevalidate)Parameters
aAlwaysRevalidateboolean- the alwaysRevalidate to set
isDefaultMaintainAspectRatio
public static boolean isDefaultMaintainAspectRatio()Returns
setDefaultMaintainAspectRatio
public static void setDefaultMaintainAspectRatio(boolean aDefaultMaintainAspectRatio)Parameters
aDefaultMaintainAspectRatioboolean- the defaultMaintainAspectRatio to set
getDefaultTimeout
public static int getDefaultTimeout()Returns
setDefaultTimeout
public static void setDefaultTimeout(int aDefaultTimeout)Parameters
aDefaultTimeoutint- the defaultTimeout to set
createImageToFileSystem
public static void createImageToFileSystem(String url, List targetList, int targetOffset, String targetKey, String destFile, Dimension toScale)Parameters
urlString- the image URL
targetListList- the list that should be updated when the data arrives
targetOffsetint- the offset within the list to insert the image
targetKeyString- the key for the map in the target offset
destFileString- local file to store the data into the given path
toScaleDimension- Not documented.
createImageToFileSystem
public static void createImageToFileSystem(String url, Component targetList, int targetOffset, String targetKey, String destFile, Dimension toScale, byte priority)Parameters
urlString- the image URL
targetListComponent- the list that should be updated when the data arrives
targetOffsetint- the offset within the list to insert the image
targetKeyString- the key for the map in the target offset
destFileString- local file to store the data into the given path
toScaleDimension- Not documented.
prioritybyte- Not documented.
createImageToFileSystem
public static void createImageToFileSystem(String url, Component targetList, int targetOffset, String targetKey, String destFile, Image placeholder, byte priority)Parameters
urlString- the image URL
targetListComponent- the list that should be updated when the data arrives
targetOffsetint- the offset within the list to insert the image
targetKeyString- the key for the map in the target offset
destFileString- local file to store the data into the given path
placeholderImage- Not documented.
prioritybyte- Not documented.
createImageToFileSystem
public static void createImageToFileSystem(String url, Component targetList, ListModel model, int targetOffset, String targetKey, String destFile, Image placeholder, byte priority)Parameters
urlString- the image URL
targetListComponent- the list that should be updated when the data arrives
modelListModel- the list model
targetOffsetint- the offset within the list to insert the image
targetKeyString- the key for the map in the target offset
destFileString- local file to store the data into the given path
placeholderImage- Not documented.
prioritybyte- Not documented.
addErrorListener
public static synchronized void addErrorListener(ActionListener listener)Parameters
listenerActionListener- the listener
removeErrorListener
public static synchronized void removeErrorListener(ActionListener listener)Parameters
listenerActionListener- the listener
createImageToStorage
public static void createImageToStorage(String url, List targetList, int targetOffset, String targetKey, String cacheId, Dimension scale)Parameters
urlString- the image URL
targetListList- the list that should be updated when the data arrives
targetOffsetint- the offset within the list to insert the image
targetKeyString- the key for the map in the target offset
cacheIdString- a unique identifier to be used to store the image into storage
scaleDimension- the scale of the image to put in the List or null
createImageToStorage
public static void createImageToStorage(String url, Component targetList, int targetOffset, String targetKey, String cacheId, Dimension scale, byte priority)Parameters
urlString- the image URL
targetListComponent- the list that should be updated when the data arrives
targetOffsetint- the offset within the list to insert the image
targetKeyString- the key for the map in the target offset
cacheIdString- a unique identifier to be used to store the image into storage
scaleDimension- the scale of the image to put in the List or null
prioritybyte- Not documented.
createImageToStorage
public static void createImageToStorage(String url, Component targetList, int targetOffset, String targetKey, String cacheId, Image placeholderImage, byte priority)Parameters
urlString- the image URL
targetListComponent- the list that should be updated when the data arrives
targetOffsetint- the offset within the list to insert the image
targetKeyString- the key for the map in the target offset
cacheIdString- a unique identifier to be used to store the image into storage
placeholderImageImage- the image placeholder
prioritybyte- Not documented.
createImageToStorage
public static void createImageToStorage(String url, Component targetList, ListModel model, int targetOffset, String targetKey, String cacheId, Image placeholderImage, byte priority)Parameters
urlString- the image URL
targetListComponent- the list that should be updated when the data arrives
modelListModel- the model destination
targetOffsetint- the offset within the list to insert the image
targetKeyString- the key for the map in the target offset
cacheIdString- a unique identifier to be used to store the image into storage
placeholderImageImage- the image placeholder
prioritybyte- Not documented.
createImageToStorage
public static void createImageToStorage(String url, Label l, String cacheId, Dimension toScale)Parameters
urlString- the image URL
lLabel- the Label that should be updated when the data arrives to just use storage and the url as the key
cacheIdString- a unique identifier to be used to store the image into storage
toScaleDimension- the scale dimension or null
createImageToStorage
public static void createImageToStorage(String url, Label l, String cacheId, Dimension toScale, byte priority)Parameters
urlString- the image URL
lLabel- the Label that should be updated when the data arrives to just use storage and the url as the key
cacheIdString- a unique identifier to be used to store the image into storage
toScaleDimension- the scale dimension or null
prioritybyte- the priority for the task
createImageToStorage
public static void createImageToStorage(String url, Label l, String cacheId, Image placeholder, byte priority)Parameters
urlString- the image URL
lLabel- the Label that should be updated when the data arrives to just use storage and the url as the key
cacheIdString- a unique identifier to be used to store the image into storage
placeholderImage- the image that will appear as a placeholder
prioritybyte- the priority for the task
createImageToFileSystem
public static void createImageToFileSystem(String url, ActionListener callback, String destFile)Parameters
urlString- the image URL
callbackActionListener- the callback that should be updated when the data arrives
destFileString- local file to store the data into the given path
createImageToStorage
public static void createImageToStorage(String url, ActionListener callback, String cacheId)createImageToStorage
public static void createImageToStorage(String url, ActionListener callback, String cacheId, boolean keep)Parameters
urlString- the image URL
callbackActionListener- the callback that should be updated when the data arrives
cacheIdString- a unique identifier to be used to store the image into storage
keepboolean- if set to true keeps the file in RAM once loaded
setEntryInListModel
protected void setEntryInListModel(int offset, Image img)Parameters
offsetint- the offset in the list given when creating the service
imgImage- the image
handleException
protected void handleException(Exception err)Parameters
errException- the exception thrown
handleErrorResponseCode
protected void handleErrorResponseCode(int code, String message)Parameters
codeint- the response code from the server
messageString- the response message from the server
postResponse
protected void postResponse()readResponse
protected void readResponse(InputStream input)
throws IOExceptionParameters
inputInputStream- the input stream containing the response
Throws
IOException- when a read input occurs
getResult
public EncodedImage getResult()Returns
isDownloadToStyles
public boolean isDownloadToStyles()Returns
setDownloadToStyles
public void setDownloadToStyles(boolean downloadToStyles)Parameters
downloadToStylesboolean- the downloadToStyles to set
equals
public boolean equals(Object o)hashCode
public int hashCode()isMaintainAspectRatio
public boolean isMaintainAspectRatio()Returns
setMaintainAspectRatio
public void setMaintainAspectRatio(boolean maintainAspectRatio)Parameters
maintainAspectRatioboolean- the maintainAspectRatio to set