Package org.adempiere.webui.util
Class ManageImageCache
java.lang.Object
org.adempiere.webui.util.ManageImageCache
Images can come from inside system or from outside system.
For images from outside, we will cache it for better performance.
This class is for management of image cache and provide related helper function.
For images from outside, we will cache it for better performance.
This class is for management of image cache and provide related helper function.
- Author:
- hieplq
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.zkoss.image.Image
If image is not in cache, load it (imagePath can be id of MImage).org.zkoss.image.Image
Get image from URL or cache.static URL
Investigate image path, if path is internal return internal url, otherwise return null.static URL
getImageInternalUrl
(MImage image) nvestigate path of MImage, if path is internal return internal url, otherwise return null.static ManageImageCache
instance()
Get singleton instanceprotected void
loadExtend
(String imagePath) load external image into cacheIf MImage has image URL or binary image data, load it into cache and return key (id or url).protected static byte[]
loadImageData
(String imagePath) Load image from url
-
Field Details
-
log
-
-
Constructor Details
-
ManageImageCache
public ManageImageCache()
-
-
Method Details
-
instance
Get singleton instance- Returns:
- ManageImageCache instance
-
getImageInternalUrl
nvestigate path of MImage, if path is internal return internal url, otherwise return null.- Parameters:
image
-- Returns:
- URL of image or null
-
getImageInternalUrl
Investigate image path, if path is internal return internal url, otherwise return null.- Parameters:
url
-- Returns:
- URL of image or null
-
loadImageData
Load image from url- Parameters:
imagePath
-- Returns:
- image data
-
getImage
If image is not in cache, load it (imagePath can be id of MImage).- Parameters:
imagePath
-- Returns:
- image from cache or loaded from path. null if there is exception in loading.
-
getImage
Get image from URL or cache.- Parameters:
url
-- Returns:
Image
-
loadImage
If MImage has image URL or binary image data, load it into cache and return key (id or url). other return null- Parameters:
mImage
-- Returns:
-
loadExtend
load external image into cache- Parameters:
imagePath
-
-