|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.artima.place.attribute.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.
Inner Class Summary | |
static class |
Icons.Cache
Contains cached icons and their Locale , the cache
for a Icons object. |
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. |
Icons.Cache |
getCache()
Returns this Icons's Cache , or null if none exists. |
byte[] |
getIcon(int iconKind)
Gets an array of bytes containing the image 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. |
java.lang.String |
getIconKey()
Returns the String icon key contained in this Icons ,
or null if none exists. |
ResourceBundleLoader |
getResourceBundleLoader()
Returns the ResourceBundleLoader contained in this Icons ,
or null if none exists. |
boolean |
hasCache()
Indicates whether this Icons object has a cached icons and their Locale . |
int |
hashCode()
Returns a hash code for this object. |
boolean |
hasResources()
Indicates whether this Icons object has a ResourceBundleLoader and String icon key. |
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
NullPointerException
- if either of the passed
loader
or iconKey
references are
null
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
.NullPointerException
- if any of passed loader
,
iconKey
, cachedLocale
, or
cached...Icon
references are null
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
.NullPointerException
- if any of passed
cachedLocale
, or cached...Icon
references are null
Method Detail |
public byte[] getIcon(int iconKind)
getIcon
method of
java.beans.BeanInfo
, which for convenience are also
declared in this class: 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 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 java.lang.Object
an
- object to compare to this Icons
.true
if this Icons
is
semantically equal to the passed Icons
.public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object clone()
Icons
.clone
in class java.lang.Object
public Icons.Cache getCache()
Cache
, or null
if none exists.
This method will return null
only if this Icons
object contains
no cached icons. Otherwise, this method will return a Icons.Cache
object containing this object's cached icons and the Locale
of those cached
icons (the "cached locale").Icons.Cache
, which contains this object's
cached icons and locale, or null
if this object contains
no cachepublic boolean hasResources()
Icons
object has a ResourceBundleLoader
and String
icon key.Icons
object has a ResourceBundleLoader
and String
icon key.public boolean hasCache()
Icons
object has a cached icons and their Locale
.Icons
object has a cached icons and their Locale
.public ResourceBundleLoader getResourceBundleLoader()
ResourceBundleLoader
contained in this Icons
,
or null
if none exists.ResourceBundleLoader
, or null
if this object contains no
ResourceBundleLoader
.public java.lang.String getIconKey()
String
icon key contained in this Icons
,
or null
if none exists.String
icon key, or null
if this object contains no
icon key.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |