|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.townleyenterprises.common.OverrideManager com.townleyenterprises.common.ResourceManager
This class provides a way of managing resource hierarchies
independent of the locale of a resource bundle. The default
resolution strategy is an instance of UseLastOverrideStrategy
which should
"do the right thing" in almost all of the cases.
Constructor Summary | |
ResourceManager()
This method sets up the default resolution strategy. |
Method Summary | |
void |
addProvider(ResourceProvider provider)
This method is used to add a resource provider. |
java.lang.String |
format(java.lang.String key,
java.util.Locale locale,
java.lang.Object[] args)
This method is used to format a given message located in the resource bundle. |
java.lang.String |
format(java.lang.String key,
java.lang.Object[] args)
This method is used to format a given message located in the resource bundle. |
javax.swing.ImageIcon |
getIcon(java.lang.String key)
This method is used to retrieve the specified image icon for the default locale. |
javax.swing.ImageIcon |
getIcon(java.lang.String key,
java.util.Locale locale)
This method is used to retrieve the specified image icon for the specified locale. |
protected java.util.Collection |
getKeys(java.lang.Object object)
This method is used to retrieve the property keys from the specified object. |
static java.lang.String[] |
getResourceNames(java.lang.String base,
java.util.Locale locale)
This method is used to return the possible variants of a given base resource name for the given locale. |
java.lang.String |
getString(java.lang.String key)
This method will return the value for the key or the key if the value does not exist. |
java.lang.String |
getString(java.lang.String key,
java.util.Locale locale)
This method is used to find a given resource string based on the specified locale. |
protected java.lang.Object |
getValue(java.lang.Object key,
java.lang.Object object)
This method is used to retrieve the value for the specific property key given the managed object. |
void |
manage(java.lang.Object object)
This method keeps track of the objects managed so that the icons can be resolved in the right order. |
Methods inherited from class com.townleyenterprises.common.OverrideManager |
get, getKeys, getNode, resolve, setOverrideStrategy |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.townleyenterprises.common.ResourceProvider |
getKeys |
Constructor Detail |
public ResourceManager()
Method Detail |
public static java.lang.String[] getResourceNames(java.lang.String base, java.util.Locale locale)
base
- the base namelocale
- the locale
public java.lang.String getString(java.lang.String key)
getString
in interface ResourceProvider
key
- the resource string key
public java.lang.String getString(java.lang.String key, java.util.Locale locale)
ResourceProvider
getString
in interface ResourceProvider
key
- the resource string keylocale
- the locale
public javax.swing.ImageIcon getIcon(java.lang.String key)
ResourceProvider
getIcon
in interface ResourceProvider
key
- the key (usually the name) of the icon
public javax.swing.ImageIcon getIcon(java.lang.String key, java.util.Locale locale)
ResourceProvider
getIcon
in interface ResourceProvider
key
- the key (usually the name) of the iconlocale
- the locale
public void manage(java.lang.Object object)
manage
in class OverrideManager
object
- the object to managepublic void addProvider(ResourceProvider provider)
manage(java.lang.Object)
method, but it provides some
type checking.
provider
- the ResourceProviderpublic java.lang.String format(java.lang.String key, java.util.Locale locale, java.lang.Object[] args)
key
- the message keylocale
- the localeargs
- the format argumentspublic java.lang.String format(java.lang.String key, java.lang.Object[] args)
key
- the message keyargs
- the format argumentsprotected java.util.Collection getKeys(java.lang.Object object)
getKeys
in class OverrideManager
object
- the object to manage
protected java.lang.Object getValue(java.lang.Object key, java.lang.Object object)
getValue
in class OverrideManager
key
- the key to retrieveobject
- the object to manipulate
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |