|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.artima.place.info.LocalizableInfo | +--com.artima.place.info.Icons
A set of localizable icons.
The icon images must be arrays of bytes in a resource bundle, with names
composed of the iconKey
passed to a constructor of this
class plus one of the following four suffixes, which are for convenience
defined as constants in this class:
"Color16"
, defined as SUFFIX_COLOR_16x16
"Color32"
, defined as SUFFIX_COLOR_32x32
"Mono16"
, defined as SUFFIX_MONO_16x16
"Mono32"
, defined as SUFFIX_MONO_32x32
For example, if an Icons
object is constructed with an
iconKey
of "calcIcon"
, the color 16 by 16 pixel
icon byte array should be named "calcIconColor16"
in the
resource bundle.
Field Summary | |
static int |
ICON_COLOR_16x16
Constant to indicate a 16 x 16 color icon. |
static int |
ICON_COLOR_32x32
Constant to indicate a 32 x 32 color icon. |
static int |
ICON_MONO_16x16
Constant to indicate a 16 x 16 monochrome icon. |
static int |
ICON_MONO_32x32
Constant to indicate a 32 x 32 monochrome icon. |
static java.lang.String |
SUFFIX_COLOR_16x16
Convenience constant for the suffix applied to the icon key passed to a constructor of this class to form the actual key passed to a resource bundle to retrieve a 16 by 16 color icon. |
static java.lang.String |
SUFFIX_COLOR_32x32
Convenience constant for the suffix applied to the icon key passed to a constructor of this class to form the actual key passed to a resource bundle to retrieve a 32 by 32 color icon. |
static java.lang.String |
SUFFIX_MONO_16x16
Convenience constant for the suffix applied to the icon key passed to a constructor of this class to form the actual key passed to a resource bundle to retrieve a 16 by 16 monochrome icon. |
static java.lang.String |
SUFFIX_MONO_32x32
Convenience constant for the suffix applied to the icon key passed to a constructor of this class to form the actual key passed to a resource bundle to retrieve a 32 by 32 monochrome icon. |
Constructor Summary | |
Icons(java.util.Locale cachedLocale,
byte[] cachedColor16Icon,
byte[] cachedColor32Icon,
byte[] cachedMono16Icon,
byte[] cachedMono32Icon)
Constructs a new Icons with passed cached icon images for
the passed locale, and no icon key or resource bundle loader. |
|
Icons(ResourceBundleLoader loader,
java.lang.String iconKey)
Constructs a new Icons with passed resource bundle
loader, icon key, and no cached icon images. |
|
Icons(ResourceBundleLoader loader,
java.lang.String iconKey,
java.util.Locale cachedLocale,
byte[] cachedColor16Icon,
byte[] cachedColor32Icon,
byte[] cachedMono16Icon,
byte[] cachedMono32Icon)
Constructs a new Icons with passed resource bundle
loader, icon key, and cached icon images (for the passed locale). |
Method Summary | |
java.lang.Object |
clone()
Clones this Icons . |
boolean |
equals(java.lang.Object o)
Compares this Icons to the passed object for equality. |
byte[] |
getIcon(int iconKind)
Gets a URL for the image file of an icon for this
resource, suitable for presentation to users, under the current
locale. |
byte[] |
getIcon(int iconKind,
java.util.Locale desiredLocale)
Gets a URL for the image file of an icon for this
resource, suitable for presentation to users, under the passed
locale. |
int |
hashCode()
Returns a hash code for this object. |
void |
purge()
Purge away information about undesired locales. |
void |
purge(java.util.Locale preserveLocale)
Purge away information about all locales except the passed desired locale. |
Methods inherited from class com.artima.place.info.LocalizableInfo |
clearCachedLocale, clearResourceBundleLoader, compareObjectsOrNull, getBestFitLocale, getBestFitLocale, getCachedLocale, getResourceBundleLoader, getSupportedLocales, hasCachedLocale, hasResourceBundleLoader, setCachedLocale, stripResourceBundleLoader, useCache |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ICON_COLOR_16x16
java.beans.BeanInfo.ICON_COLOR_16x16
.)public static final int ICON_COLOR_32x32
java.beans.BeanInfo.ICON_COLOR_32x32
.)public static final int ICON_MONO_16x16
java.beans.BeanInfo.ICON_MONO_16x16
.)public static final int ICON_MONO_32x32
java.beans.BeanInfo.ICON_MONO_32x32
.)public static final java.lang.String SUFFIX_COLOR_16x16
public static final java.lang.String SUFFIX_COLOR_32x32
public static final java.lang.String SUFFIX_MONO_16x16
public static final java.lang.String SUFFIX_MONO_32x32
Constructor Detail |
public Icons(ResourceBundleLoader loader, java.lang.String iconKey)
Icons
with passed resource bundle
loader, icon key, and no cached icon images.loader
- the ResourceBundleLoader
which can load
ResourceBundle
s for this Icons
.iconKey
- a String
that forms the base of the
String
keys with which the byte[]
resource can be retrieved from a ResourceBundle
provided by the ResourceBundleLoader
public Icons(ResourceBundleLoader loader, java.lang.String iconKey, java.util.Locale cachedLocale, byte[] cachedColor16Icon, byte[] cachedColor32Icon, byte[] cachedMono16Icon, byte[] cachedMono32Icon)
Icons
with passed resource bundle
loader, icon key, and cached icon images (for the passed locale).loader
- the ResourceBundleLoader
which can load
ResourceBundle
s for this Icons
.iconKey
- a String
that forms the base of the
String
keys with which the byte[]
resource can be retrieved from a ResourceBundle
provided by the ResourceBundleLoader
cachedLocale
- the Locale
of the icons passed as
cachedColor16Icon
, cachedColor32Icon
,
cachedMono16Icon
, and cachedMono32Icon
.cachedColor16Icon
- the 16x16 color icon, whose locale is passed
as cachedLocale
, that should be cached by this
Icons
.cachedColor32Icon
- the 32x32 color icon, whose locale is passed
as cachedLocale
, that should be cached by this
Icons
.cachedMono16Icon
- the 16x16 monochrome icon, whose locale is
passed as cachedLocale
, that should be cached by this
Icons
.cachedMono32Icon
- the 32x32 monochrome icon, whose locale is
passed as cachedLocale
, that should be cached by this
Icons
.public Icons(java.util.Locale cachedLocale, byte[] cachedColor16Icon, byte[] cachedColor32Icon, byte[] cachedMono16Icon, byte[] cachedMono32Icon)
Icons
with passed cached icon images for
the passed locale, and no icon key or resource bundle loader.
(Because this Icons
info object contains no resource
bundle loader, it also requires no icon key with which to look up an
icon resource in a resource bundle.cachedLocale
- the Locale
of the icons passed as
cachedColor16Icon
, cachedColor32Icon
,
cachedMono16Icon
, and cachedMono32Icon
.cachedColor16Icon
- the 16x16 color icon, whose locale is passed
as cachedLocale
, that should be cached by this
Icons
.cachedColor32Icon
- the 32x32 color icon, whose locale is passed
as cachedLocale
, that should be cached by this
Icons
.cachedMono16Icon
- the 16x16 monochrome icon, whose locale is
passed as cachedLocale
, that should be cached by this
Icons
.cachedMono32Icon
- the 32x32 monochrome icon, whose locale is
passed as cachedLocale
, that should be cached by this
Icons
.Method Detail |
public byte[] getIcon(int iconKind)
URL
for the image file of an icon for this
resource, suitable for presentation to users, under the current
locale. (The image file is likely either a GIF or JPG file, but could
be any image file format.) The valid parameter values are the same as
for the getIcon
method of
java.beans.BeanInfo
, which for convenience are also
declared in this interface: ICON_COLOR_16x16
,
ICON_COLOR_32x32
, ICON_MONO_16x16
,
ICON_MONO_32x32
.iconKind
- the kind of icon to be returned (one of
ICON_COLOR_16x16
, ICON_COLOR_32x32
,
ICON_MONO_16x16
, or ICON_MONO_32x32
).java.util.MissingResourceException
- if the icon image can't be
retrieved successfullypublic byte[] getIcon(int iconKind, java.util.Locale desiredLocale)
URL
for the image file of an icon for this
resource, suitable for presentation to users, under the passed
locale. (The image file is likely either a GIF or JPG file, but could
be any image file format.) The valid parameter values are the same as
for the getIcon
method of
java.beans.BeanInfo
, which for convenience are also
declared in this interface: ICON_COLOR_16x16
,
ICON_COLOR_32x32
, ICON_MONO_16x16
,
ICON_MONO_32x32
.iconKind
- the kind of icon to be returned (one of
ICON_COLOR_16x16
, ICON_COLOR_32x32
,
ICON_MONO_16x16
, or ICON_MONO_32x32
).desiredLocale
- the locale for which an appropriate icon is
desired.java.util.MissingResourceException
- if the icon image can't be
retrieved successfullypublic void purge()
purge
in class LocalizableInfo
public void purge(java.util.Locale preserveLocale)
purge
in class LocalizableInfo
preserveLocale
- a locale to preserve in this
Icons
.public boolean equals(java.lang.Object o)
Icons
to the passed object for equality. To
be semantically equal, the class of the passed object must be
Icons
, the passed object's cached icon images must be
semantically equal to this object's cached icon images, the passed
object's icon key must be semantically to this object's icon key, and
the equals
method of Icons
's superclass must
return true
.equals
in class LocalizableInfo
an
- object to compare to this Icons
.true
if this Icons
is
semantically equal to the passed Icons
.public int hashCode()
hashCode
in class LocalizableInfo
public java.lang.Object clone()
Icons
.clone
in class LocalizableInfo
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |