public class ImageHelper
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
private static class |
ImageHelper.WorkArea
Context state.
|
| Modifier and Type | Field and Description |
|---|---|
private static java.util.Map<java.lang.Integer,java.lang.Object> |
imgDownMap
Map to store pending images for button widget down image.
|
private static java.util.Map<java.lang.Integer,java.lang.Object> |
imgInsMap
Map to store pending images for button widget disabled image.
|
private static java.util.Map<java.lang.Integer,java.lang.Object> |
imgMap
Map to store pending images for image widget.
|
private static java.util.Map<java.lang.Integer,java.lang.Object> |
imgUpMap
Map to store pending images for button widget up image.
|
private static java.util.Map<MousePointer,java.lang.String> |
mousePointerFiles
Map pre-defined MousePointers w/o AWT/JS counterparts to data files
|
private static java.util.Map<MousePointer,CursorType> |
mousePointerTypes
Map pre-defined MousePointers to AWT/JS ones
|
private static ContextLocal<ImageHelper.WorkArea> |
wa
Context state
|
| Constructor and Description |
|---|
ImageHelper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addGlobalImage(int widgetId,
ImageWrapper<?> image)
Registers the image for the supplied widget in the security context.
|
static java.lang.String |
cursorFile(MousePointer ptr)
Get data to create cursor from pre-packaged resource for the mouse pointer.
|
static CursorType |
cursorType(MousePointer ptr)
Get AWT/JS cursor type for the mouse pointer
|
static ImageWrapper<?> |
getGlobalImage(int widgetId,
int uniqueId)
Returns an image previously registered in the security context.
|
static ImageWrapper<?> |
getImageByIndex(int widgetId,
int idx)
Returns an image previously registered in the security context.
|
static byte[] |
getPendingImageData(int wId,
int type)
Gets the new image data byte array for loading at widget realization stage.
|
static java.lang.String |
getPendingImageName(int wId,
int type)
Gets the new image file name for loading at widget realization stage.
|
static byte[] |
getPrepackagedImageData(java.lang.String fileName)
Gets the new image data byte array for prepackaged images.
|
static boolean |
isPrepackaged(java.lang.String fileName)
Checks if the given image file name belongs to the set of the prepackaged images embedded
into project distribution.
|
static void |
removeGlobalImages(int widgetId)
Removes all previously registered images for the supplied widget.
|
static void |
removeGlobalImages(int widgetId,
java.util.Collection<java.lang.Integer> uniqueIds)
Remove selected images for the supplied widget.
|
static boolean |
storePendingImageData(int wId,
int type,
byte[] imageBytes)
Saves the new image data byte array for further loading at widget realization stage.
|
static boolean |
storePendingImageName(int wId,
int type,
java.lang.String fileName)
Saves the new image name for further loading at widget realization stage.
|
private static final java.util.Map<java.lang.Integer,java.lang.Object> imgMap
private static final java.util.Map<java.lang.Integer,java.lang.Object> imgUpMap
private static final java.util.Map<java.lang.Integer,java.lang.Object> imgDownMap
private static final java.util.Map<java.lang.Integer,java.lang.Object> imgInsMap
private static final java.util.Map<MousePointer,CursorType> mousePointerTypes
private static final java.util.Map<MousePointer,java.lang.String> mousePointerFiles
private static ContextLocal<ImageHelper.WorkArea> wa
public static boolean storePendingImageName(int wId,
int type,
java.lang.String fileName)
wId - ID of the widget will own the image.type - Image type to load. Up, Down or Insensitive for buttons or image.fileName - The file name for the image to be loaded.TRUE if operation successful FALSE otherwise.public static boolean storePendingImageData(int wId,
int type,
byte[] imageBytes)
wId - ID of the widget will own the image.type - Image type to load. Up, Down or Insensitive for buttons or image.imageBytes - The byte array data for the image to be loaded.TRUE if operation successful FALSE otherwise.public static byte[] getPendingImageData(int wId,
int type)
wId - ID of the widget will own the image.type - Image type to load. Up, Down or Insensitive for buttons or image.public static java.lang.String getPendingImageName(int wId,
int type)
wId - ID of the widget will own the image.type - Image type to load. Up, Down or Insensitive for buttons or image.public static boolean isPrepackaged(java.lang.String fileName)
fileName - The file name for the image to be checked.TRUE if given image is prepackaged FALSE otherwise.public static byte[] getPrepackagedImageData(java.lang.String fileName)
fileName - The file name for the image to be loaded from p2j.jar.public static CursorType cursorType(MousePointer ptr)
ptr - mouse pointerpublic static java.lang.String cursorFile(MousePointer ptr)
ptr - mouse pointernull if this cursor is not supported.public static void addGlobalImage(int widgetId,
ImageWrapper<?> image)
widgetId - Valid widget id.image - An image to register.public static ImageWrapper<?> getGlobalImage(int widgetId, int uniqueId)
widgetId - Valid widget id.uniqueId - Image unique id.null.public static ImageWrapper<?> getImageByIndex(int widgetId, int idx)
widgetId - Valid widget id.idx - 0-based index in the widget image list.null.public static void removeGlobalImages(int widgetId,
java.util.Collection<java.lang.Integer> uniqueIds)
widgetId - Valid widget id.uniqueIds - IDs of images to be removedpublic static void removeGlobalImages(int widgetId)
widgetId - A valid widget id.