|
LEONARDI Application Composer - 8.9.0.40 by W4 S.A. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectleon.misc.LyResourceBundle
leon.misc.LyImages
public class LyImages
This class is used to manage images of an application. It is based on the mechanism of LyResourceBundle. Images are put in a cache for memory optimization.
Field Summary | |
---|---|
static java.lang.String |
__VERSION
|
static java.lang.String |
DEFAULT_DISABLED_IMAGE
Default disabled image key. |
static java.lang.String |
DEFAULT_IMAGE
Default image key. |
static java.lang.String |
DISABLE_PREFIX
The prefix used for disabled images. |
static int[] |
NOT_FOUND
Not found key (internal use). |
Fields inherited from class leon.misc.LyResourceBundle |
---|
PACKAGE_DIR, PROPERTIES_DIR, UPPER_CASE_KEYS_ONLY |
Constructor Summary | |
---|---|
LyImages(LyEnvironment environment)
Constructor with a given environment. |
|
LyImages(LyEnvironment environment,
java.lang.String name)
Constructor with a given environment and name. |
|
LyImages(LyEnvironment environment,
java.lang.String name,
java.lang.String skin)
Constructor with a given environment and name. |
Method Summary | |
---|---|
boolean |
checkImage(java.lang.String key)
Checks if given key image corresponds to a known image. |
void |
clearCache()
Clears application images (reset the cache). |
void |
free()
Clears all resources of this bundle. |
java.lang.Object |
getDefaultImage()
Gets the current environment view manager default image. |
java.lang.String |
getDisabledImageUrl(java.lang.String key)
Gets the disable image URL corresponding to the given key. |
static java.lang.String |
getDisableImageFileName(java.lang.String imageFileName)
Gets the disable image file name from the given image file name. |
java.lang.Object |
getImage(java.lang.String key,
java.lang.String sizeCode,
boolean defaultImage)
Retrieves an image corresponding to a given key and size. |
java.lang.String |
getImageFileName(java.lang.String key)
Gets the image file name corresponding to the given key. |
java.lang.String |
getImagePath(java.lang.String key)
Gets the image path corresponding to the given key. |
int[] |
getImageSize(java.lang.String path,
boolean enableLoadImage)
This method retrieves information about an image size. |
java.lang.String |
getImageSizeInfo(int width,
int height)
Builds the image size description [ VISIBLE_SEP3 + width +
VISIBLE_SEP2 + height + VISIBLE_SEP3_BIS ]. |
java.lang.String |
getImageUrl(java.lang.String key)
Gets the image URL corresponding to the given key. |
java.lang.String |
getImageUrl(java.lang.String key,
boolean disabled)
Return the image url corresponding to the key passed. |
java.lang.String |
getImageUrl(java.lang.String key,
boolean disabled,
boolean defaultImage)
Gets the image url corresponding to the given key. |
java.lang.String |
getPath(java.lang.String imageName)
Gets path corresponding to given image name for associated environment. |
java.lang.String |
getPathWithoutSize(java.lang.String path)
Retrieves the path of an image without the information about its size. |
java.lang.Object |
getScaledInstance(java.lang.Object image,
int width,
int height)
Creates a scaled version of the given image. |
boolean |
isImageAnimated(java.lang.String path)
Indicates if an image is animated or not. |
boolean |
isInCache(java.lang.Object image)
Indicates whether given image is contained in the images cache. |
java.lang.Object |
loadImage(java.lang.Object component,
java.lang.String path)
Loads an image. |
java.lang.Object |
loadImage(java.lang.Object component,
java.lang.String path,
boolean newImage)
Loads an image. |
java.lang.Object |
loadImage(java.lang.Object component,
java.lang.String path,
boolean newImage,
boolean raiseError)
Loads an image. |
void |
put(java.lang.String key,
java.lang.String value)
Adds a resource in this resource bundle. |
void |
putCache(java.lang.String path,
java.lang.Object image)
Adds the specified pair (path/image) to the image cache. |
void |
removeCache(java.lang.String path)
Removes the image associated to given key from the cache. |
Methods inherited from class leon.misc.LyResourceBundle |
---|
checkKey, get, getKeyList, getKeys, getSonEnvironments, hasKey, remove, removeBundles, saveTo |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String __VERSION
public static java.lang.String DEFAULT_IMAGE
public static java.lang.String DEFAULT_DISABLED_IMAGE
public static final int[] NOT_FOUND
public static java.lang.String DISABLE_PREFIX
Constructor Detail |
---|
public LyImages(LyEnvironment environment)
LyImages(environment, null)
.
environment
- The environment of the images bundle.public LyImages(LyEnvironment environment, java.lang.String name)
LyImages(environment, name, environment.getLocale())
.
environment
- The environment of the images bundle.name
- The name of the images bundle.public LyImages(LyEnvironment environment, java.lang.String name, java.lang.String skin)
LyImages(environment, name, environment.getLocale())
.
environment
- The environment of the images bundle.name
- The name of the images bundle.skin
- The name of the skinMethod Detail |
---|
public void free()
free
in class LyResourceBundle
public java.lang.Object getDefaultImage()
public java.lang.Object getImage(java.lang.String key, java.lang.String sizeCode, boolean defaultImage)
key
- The resource name (key) of the imagesizeCode
- The size code of the image (see LyImages.loadImage())defaultImage
- If true, return default image if not found.
loadImage(Object,String)
,
LyEnvironment.getImageSizeInfo(int,int)
public java.lang.Object getScaledInstance(java.lang.Object image, int width, int height)
image
- The image to scale.width
- The width to which to scale the image.height
- The height to which to scale the image.
LyViewManagerInterface.getScaledInstance(Object, int, int)
public java.lang.String getImageSizeInfo(int width, int height)
VISIBLE_SEP3
+ width +
VISIBLE_SEP2
+ height + VISIBLE_SEP3_BIS
].
width
- requested width or -1 if only the size is specified (keeping aspect ratio)height
- requested height (mandatory)
public boolean isImageAnimated(java.lang.String path)
path
- The relative path of the image file.
public java.lang.Object loadImage(java.lang.Object component, java.lang.String path, boolean newImage, boolean raiseError)
VISIBLE_SEP3
+ width + VISIBLE_SEP2
+ height + VISIBLE_SEP3_BIS
]. The path of the
image must be relative : the image is searched in the classpath of the application.
path
- The relative path of the image file.component
- The client of the image creation.newImage
- Indicates whether a new Image must be created.newImage
- Indicates whether an error message should be displayed if an exception
was thrown while loading image.
getImageSizeInfo(int, int)
public final java.lang.Object loadImage(java.lang.Object component, java.lang.String path)
loadImage(component, path, false)
component
- The client of the image creation.path
- The relative path of the image file.
loadImage(Object, String, boolean)
public java.lang.Object loadImage(java.lang.Object component, java.lang.String path, boolean newImage)
VISIBLE_SEP3
+ width + VISIBLE_SEP2
+ height + VISIBLE_SEP3_BIS
]. The path of the
image must be relative : the image is searched in the classpath of the application.
path
- The relative path of the image file.component
- The client of the image creation.newImage
- Indicates wheter a new Image must be created.
getImageSizeInfo(int, int)
public void clearCache()
clearCache
in class LyResourceBundle
public boolean isInCache(java.lang.Object image)
image
- The image that may be cached.
public void putCache(java.lang.String path, java.lang.Object image)
path
- The image path that must be added to the cache.image
- The image that must be added to the cache.public void removeCache(java.lang.String path)
path
- The image path that must be removed from the cache.public int[] getImageSize(java.lang.String path, boolean enableLoadImage)
path
- The path to check.enableLoadImage
- indicates wether the application is allowed to load the image
getImageSizeInfo(int, int)
public java.lang.String getImagePath(java.lang.String key)
key
- the image resource key
public java.lang.String getPath(java.lang.String imageName)
public java.lang.String getPathWithoutSize(java.lang.String path)
path
- The path of the image.
public final java.lang.String getImageUrl(java.lang.String key)
getImageUrl(key, false)
.
key
- the image resource key
public final java.lang.String getDisabledImageUrl(java.lang.String key)
getImageUrl(key, true)
.
key
- the image resource key
public final java.lang.String getImageUrl(java.lang.String key, boolean disabled)
getImageUrl(key, disabled, true)
.
key
- the image resource keydisabled
- Indicates if disabled image should be searched.
public java.lang.String getImageUrl(java.lang.String key, boolean disabled, boolean defaultImage)
key
- the image resource keydisabled
- Indicates if disabled image should be searched.defaultImage
- If true, return default image if the URL is not found.
public java.lang.String getImageFileName(java.lang.String key)
key
- the image resource key
public static java.lang.String getDisableImageFileName(java.lang.String imageFileName)
imageFileName
- the image file name whose associated disable image file name nned to be retreive
public void put(java.lang.String key, java.lang.String value)
put
in class LyResourceBundle
key
- Key of the resource.value
- Value of this new resource.public boolean checkImage(java.lang.String key)
key
- The resource name (key) of the image
|
(c) January 2013 - W4 S.A. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |