public class ImageDownloadService extends ConnectionRequest
ConnectionRequest.CachingMode, ConnectionRequest.SSLCertificate
PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_LOW, PRIORITY_NORMAL, PRIORITY_REDUNDANT
Constructor and Description |
---|
ImageDownloadService(String url,
ActionListener l)
Deprecated.
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
|
ImageDownloadService(String url,
Component targetList,
int targetOffset,
String targetKey)
Deprecated.
Constructs an image request that will automatically populate the given list
when the response arrives.
|
ImageDownloadService(String url,
Label parentLabel)
Deprecated.
Accepts the url to bind to the label, on completion the label will be updated
and revalidated with the new image.
|
ImageDownloadService(String url,
List targetList,
int targetOffset,
String targetKey)
Deprecated.
Constructs an image request that will automatically populate the given list
when the response arrives.
|
Modifier and Type | Method and Description |
---|---|
static void |
addErrorListener(ActionListener listener)
Deprecated.
Binds an error listener that will fire an instance of NetworkEvent with an error
for a specific fetch operation if applicable
|
static void |
createImageToFileSystem(String url,
ActionListener callback,
String destFile)
Deprecated.
Constructs an image request that will automatically populate the given Label
when the response arrives, it will cache the file locally.
|
static void |
createImageToFileSystem(String url,
Component targetList,
int targetOffset,
String targetKey,
String destFile,
Dimension toScale,
byte priority)
Deprecated.
Constructs an image request that will automatically populate the given list
when the response arrives, it will cache the file locally as a file
in the file storage.
|
static void |
createImageToFileSystem(String url,
Component targetList,
int targetOffset,
String targetKey,
String destFile,
Image placeholder,
byte priority)
Deprecated.
Constructs an image request that will automatically populate the given list
when the response arrives, it will cache the file locally as a file
in the file storage.
|
static void |
createImageToFileSystem(String url,
Component targetList,
ListModel model,
int targetOffset,
String targetKey,
String destFile,
Image placeholder,
byte priority)
Deprecated.
Constructs an image request that will automatically populate the given list
when the response arrives, it will cache the file locally as a file
in the file storage.
|
static void |
createImageToFileSystem(String url,
List targetList,
int targetOffset,
String targetKey,
String destFile,
Dimension toScale)
Deprecated.
Constructs an image request that will automatically populate the given list
when the response arrives, it will cache the file locally as a file
in the file storage.
|
static void |
createImageToStorage(String url,
ActionListener callback,
String cacheId)
Deprecated.
|
static void |
createImageToStorage(String url,
ActionListener callback,
String cacheId,
boolean keep)
Deprecated.
Constructs an image request that will automatically populate the given Label
when the response arrives, it will cache the file locally.
|
static void |
createImageToStorage(String url,
Component targetList,
int targetOffset,
String targetKey,
String cacheId,
Dimension scale,
byte priority)
Deprecated.
Constructs an image request that will automatically populate the given list
when the response arrives, it will cache the file locally as a file
in the file storage.
|
static void |
createImageToStorage(String url,
Component targetList,
int targetOffset,
String targetKey,
String cacheId,
Image placeholderImage,
byte priority)
Deprecated.
Constructs an image request that will automatically populate the given list
when the response arrives, it will cache the file locally as a file
in the file storage.
|
static void |
createImageToStorage(String url,
Component targetList,
ListModel model,
int targetOffset,
String targetKey,
String cacheId,
Image placeholderImage,
byte priority)
Deprecated.
Constructs an image request that will automatically populate the given list
when the response arrives, it will cache the file locally as a file
in the file storage.
|
static void |
createImageToStorage(String url,
Label l,
String cacheId,
Dimension toScale)
Deprecated.
Constructs an image request that will automatically populate the given Label
when the response arrives, it will cache the file locally to the Storage
|
static void |
createImageToStorage(String url,
Label l,
String cacheId,
Dimension toScale,
byte priority)
Deprecated.
Constructs an image request that will automatically populate the given Label
when the response arrives, it will cache the file locally to the Storage
|
static void |
createImageToStorage(String url,
Label l,
String cacheId,
Image placeholder,
byte priority)
Deprecated.
Constructs an image request that will automatically populate the given Label
when the response arrives, it will cache the file locally to the Storage
|
static void |
createImageToStorage(String url,
List targetList,
int targetOffset,
String targetKey,
String cacheId,
Dimension scale)
Deprecated.
Constructs an image request that will automatically populate the given list
when the response arrives, it will cache the file locally as a file
in the file storage.
|
boolean |
equals(Object o)
Deprecated.
Indicates whether some other object is "equal to" this one.
|
static int |
getDefaultTimeout()
Deprecated.
Indicates the default timeout to use for image download service, -1 indicates no default is set.
|
EncodedImage |
getResult()
Deprecated.
Returns the image returned from the server, this method is useful for renderers
|
protected void |
handleErrorResponseCode(int code,
String message)
Deprecated.
Handles a server response code that is not 200 and not a redirect (unless redirect handling is disabled)
|
protected void |
handleException(Exception err)
Deprecated.
Handles an exception thrown when performing a network operation, the default
implementation shows a retry dialog.
|
static boolean |
isAlwaysRevalidate()
Deprecated.
By default lists don't revalidate on every change to avoid "jumpiness" when scrolling
|
static boolean |
isDefaultMaintainAspectRatio()
Deprecated.
|
boolean |
isDownloadToStyles()
Deprecated.
Downloads the image to the style objects associated with this component, effectively
sets the bgImage property on all the styles for the component instead of invoking setIcon
|
static boolean |
isFastScale()
Deprecated.
Fast scaling uses runtime draw scaling rather than the Image scaled method.
|
boolean |
isMaintainAspectRatio()
Deprecated.
|
protected void |
postResponse()
Deprecated.
A callback method that's invoked on the EDT after the readResponse() method has finished,
this is the place where developers should change their Codename One user interface to
avoid race conditions that might be triggered by modifications within readResponse.
|
protected void |
readResponse(InputStream input)
Deprecated.
Callback for the server response with the input stream from the server.
|
static void |
removeErrorListener(ActionListener listener)
Deprecated.
Unbinds an error listener that will fire an instance of NetworkEvent with an error
for a specific fetch operation if applicable
|
static void |
setAlwaysRevalidate(boolean aAlwaysRevalidate)
Deprecated.
By default lists don't revalidate on every change to avoid "jumpiness" when scrolling
|
static void |
setDefaultMaintainAspectRatio(boolean aDefaultMaintainAspectRatio)
Deprecated.
|
static void |
setDefaultTimeout(int aDefaultTimeout)
Deprecated.
Indicates the default timeout to use for image download service, -1 indicates no default is set.
|
void |
setDownloadToStyles(boolean downloadToStyles)
Deprecated.
Downloads the image to the style objects associated with this component, effectively
sets the bgImage property on all the styles for the component instead of invoking setIcon
|
protected void |
setEntryInListModel(int offset,
Image img)
Deprecated.
This method is invoked when an image finished downloading and should be set to an offset in the list
model.
|
static void |
setFastScale(boolean aFastScale)
Deprecated.
Fast scaling uses runtime draw scaling rather than the Image scaled method.
|
void |
setMaintainAspectRatio(boolean maintainAspectRatio)
Deprecated.
|
addArgument, addArgument, addArgument, addArgumentArray, addArgumentNoEncoding, addArgumentNoEncoding, addArgumentNoEncodingArray, addArguments, addExceptionListener, addRequestHeader, addResponseCodeListener, addResponseListener, buildRequestBody, cacheUnmodified, canGetSSLCertificates, checkSSLCertificates, cookieReceived, cookieSent, createRequestURL, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToFileSystem, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, downloadImageToStorage, fetchJSON, fetchJSONAsync, fireResponseListener, getCachedData, getCacheMode, getContentLength, getContentType, getCookieHeader, getDefaultCacheMode, getDefaultUserAgent, getDestinationFile, getDestinationStorage, getDisposeOnCompletion, getHeader, getHeaderFieldNames, getHeaders, getHttpMethod, getPriority, getReadTimeout, getRequestBody, getRequestBodyData, getResponseCode, getResponseContentType, getResponseData, getResponseErrorMessage, getResposeCode, getShowOnInit, getSilentRetryCount, getSSLCertificates, getTimeout, getUrl, getUserAgent, getYield, handleIOException, handleRuntimeException, hashCode, hasResponseListeners, initConnection, initCookieHeader, ioStreamUpdate, isCheckSSLCertificates, isCookiesEnabled, isCookiesEnabledDefault, isDefaultFollowRedirects, isDuplicateSupported, isFailSilently, isFollowRedirects, isHandleErrorCodesInGlobalErrorHandler, isInsecure, isKilled, isNativeCookieSharingSupported, isPausable, isPaused, isPost, isReadRequest, isReadResponseForErrors, isReadResponseForErrorsDefault, isReadTimeoutSupported, isRedirecting, isWriteRequest, kill, onRedirect, pause, purgeCache, purgeCacheDirectory, readErrorCodeHeaders, readHeaders, removeAllArguments, removeArgument, removeExceptionListener, removeResponseCodeListener, removeResponseListener, resume, retry, setCacheMode, setCheckSSLCertificates, setChunkedStreamingMode, setContentType, setCookieHeader, setCookiesEnabled, setCookiesEnabledDefault, setDefaultCacheMode, setDefaultFollowRedirects, setDefaultUserAgent, setDestinationFile, setDestinationStorage, setDisposeOnCompletion, setDuplicateSupported, setFailSilently, setFollowRedirects, setHandleErrorCodesInGlobalErrorHandler, setHttpMethod, setInsecure, setKilled, setPaused, setPost, setPriority, setReadRequest, setReadResponseForErrors, setReadResponseForErrorsDefault, setReadTimeout, setRequestBody, setRequestBody, setShowOnInit, setSilentRetryCount, setTimeout, setUrl, setUseNativeCookieStore, setUserAgent, setWriteRequest, shouldAutoCloseResponse, shouldConvertPostToGetOnRedirect, shouldStop, shouldWriteUTFAsGetBytes, validate
public ImageDownloadService(String url, ActionListener l)
url
- the image URLl
- an action listener callbackpublic ImageDownloadService(String url, Component targetList, int targetOffset, String targetKey)
url
- the image URLtargetList
- the list that should be updated when the data arrivestargetOffset
- the offset within the list to insert the imagetargetKey
- the key for the map in the target offsetpublic ImageDownloadService(String url, List targetList, int targetOffset, String targetKey)
url
- the image URLtargetList
- the list that should be updated when the data arrivestargetOffset
- the offset within the list to insert the imagetargetKey
- the key for the map in the target offsetpublic static boolean isFastScale()
public static void setFastScale(boolean aFastScale)
aFastScale
- the fastScale to setpublic static boolean isAlwaysRevalidate()
public static void setAlwaysRevalidate(boolean aAlwaysRevalidate)
aAlwaysRevalidate
- the alwaysRevalidate to setpublic static boolean isDefaultMaintainAspectRatio()
public static void setDefaultMaintainAspectRatio(boolean aDefaultMaintainAspectRatio)
aDefaultMaintainAspectRatio
- the defaultMaintainAspectRatio to setpublic static int getDefaultTimeout()
public static void setDefaultTimeout(int aDefaultTimeout)
aDefaultTimeout
- the defaultTimeout to setprotected void setEntryInListModel(int offset, Image img)
offset
- the offset in the list given when creating the serviceimg
- the imagepublic static void createImageToFileSystem(String url, List targetList, int targetOffset, String targetKey, String destFile, Dimension toScale)
url
- the image URLtargetList
- the list that should be updated when the data arrivestargetOffset
- the offset within the list to insert the imagetargetKey
- the key for the map in the target offsetdestFile
- local file to store the data into the given pathpublic static void createImageToFileSystem(String url, Component targetList, int targetOffset, String targetKey, String destFile, Dimension toScale, byte priority)
url
- the image URLtargetList
- the list that should be updated when the data arrivestargetOffset
- the offset within the list to insert the imagetargetKey
- the key for the map in the target offsetdestFile
- local file to store the data into the given pathpublic static void createImageToFileSystem(String url, Component targetList, int targetOffset, String targetKey, String destFile, Image placeholder, byte priority)
url
- the image URLtargetList
- the list that should be updated when the data arrivestargetOffset
- the offset within the list to insert the imagetargetKey
- the key for the map in the target offsetdestFile
- local file to store the data into the given pathpublic static void createImageToFileSystem(String url, Component targetList, ListModel model, int targetOffset, String targetKey, String destFile, Image placeholder, byte priority)
url
- the image URLtargetList
- the list that should be updated when the data arrivesmodel
- the list modeltargetOffset
- the offset within the list to insert the imagetargetKey
- the key for the map in the target offsetdestFile
- local file to store the data into the given pathprotected void handleException(Exception err)
handleException
in class ConnectionRequest
err
- the exception thrownprotected void handleErrorResponseCode(int code, String message)
handleErrorResponseCode
in class ConnectionRequest
code
- the response code from the servermessage
- the response message from the serverpublic static void addErrorListener(ActionListener listener)
listener
- the listenerpublic static void removeErrorListener(ActionListener listener)
listener
- the listenerpublic static void createImageToStorage(String url, List targetList, int targetOffset, String targetKey, String cacheId, Dimension scale)
url
- the image URLtargetList
- the list that should be updated when the data arrivestargetOffset
- the offset within the list to insert the imagetargetKey
- the key for the map in the target offsetcacheId
- a unique identifier to be used to store the image into storagescale
- the scale of the image to put in the List or nullpublic static void createImageToStorage(String url, Component targetList, int targetOffset, String targetKey, String cacheId, Dimension scale, byte priority)
url
- the image URLtargetList
- the list that should be updated when the data arrivestargetOffset
- the offset within the list to insert the imagetargetKey
- the key for the map in the target offsetcacheId
- a unique identifier to be used to store the image into storagescale
- the scale of the image to put in the List or nullpublic static void createImageToStorage(String url, Component targetList, int targetOffset, String targetKey, String cacheId, Image placeholderImage, byte priority)
url
- the image URLtargetList
- the list that should be updated when the data arrivestargetOffset
- the offset within the list to insert the imagetargetKey
- the key for the map in the target offsetcacheId
- a unique identifier to be used to store the image into storageplaceholderImage
- the image placeholderpublic static void createImageToStorage(String url, Component targetList, ListModel model, int targetOffset, String targetKey, String cacheId, Image placeholderImage, byte priority)
url
- the image URLtargetList
- the list that should be updated when the data arrivesmodel
- the model destinationtargetOffset
- the offset within the list to insert the imagetargetKey
- the key for the map in the target offsetcacheId
- a unique identifier to be used to store the image into storageplaceholderImage
- the image placeholderpublic static void createImageToStorage(String url, Label l, String cacheId, Dimension toScale)
url
- the image URLl
- the Label that should be updated when the data arrives
to just use storage and the url as the keycacheId
- a unique identifier to be used to store the image into storagetoScale
- the scale dimension or nullpublic static void createImageToStorage(String url, Label l, String cacheId, Dimension toScale, byte priority)
url
- the image URLl
- the Label that should be updated when the data arrives
to just use storage and the url as the keycacheId
- a unique identifier to be used to store the image into storagetoScale
- the scale dimension or nullpriority
- the priority for the taskpublic static void createImageToStorage(String url, Label l, String cacheId, Image placeholder, byte priority)
url
- the image URLl
- the Label that should be updated when the data arrives
to just use storage and the url as the keycacheId
- a unique identifier to be used to store the image into storageplaceholder
- the image that will appear as a placeholderpriority
- the priority for the taskpublic static void createImageToFileSystem(String url, ActionListener callback, String destFile)
url
- the image URLcallback
- the callback that should be updated when the data arrivesdestFile
- local file to store the data into the given pathpublic static void createImageToStorage(String url, ActionListener callback, String cacheId)
public static void createImageToStorage(String url, ActionListener callback, String cacheId, boolean keep)
url
- the image URLcallback
- the callback that should be updated when the data arrivescacheId
- a unique identifier to be used to store the image into storagekeep
- if set to true keeps the file in RAM once loadedprotected void postResponse()
postResponse
in class ConnectionRequest
protected void readResponse(InputStream input) throws IOException
readResponse
in class ConnectionRequest
input
- the input stream containing the responseIOException
- when a read input occurspublic EncodedImage getResult()
public boolean isDownloadToStyles()
public void setDownloadToStyles(boolean downloadToStyles)
downloadToStyles
- the downloadToStyles to setpublic boolean equals(Object o)
equals
in class ConnectionRequest
public boolean isMaintainAspectRatio()
public void setMaintainAspectRatio(boolean maintainAspectRatio)
maintainAspectRatio
- the maintainAspectRatio to set