|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ice.util.ResourceManager
This class attempts to manage a set of ResourceBundles. For example, an application may have one set of resources for the GUI elements in the application, and another set of resources for context help, and yet another set for builtin scripts. Each ResourceManager instance is identified by an id. Class methods provided to allow quick access to any ResourceManager by id. ResourceManager, aside from manager multiple instances by id, also add an additional method beyond that provided by ResourceBundle - getFormat(). This method is like getString() in that is returns a String resource, however, getFormat() formats the resource using arguments passed to the method. This makes it easy to use resources for both constant strings and formatted strings.
Field Summary | |
static java.lang.String |
RCS_ID
|
static java.lang.String |
RCS_REV
|
Constructor Summary | |
ResourceManager(java.lang.String name,
java.util.ResourceBundle rsrc)
Construct a ResourceManager with the given name and ResourceBundle. |
Method Summary | |
static ResourceManager |
get(java.lang.String id)
Get a ResourceManager keyed by id. |
java.lang.String |
getFormat(java.lang.String key,
java.lang.Object[] args)
Format a string resource from the ResourceBundle that this ResourceManager is managing. |
java.lang.String |
getString(java.lang.String key)
Get a string resource from the ResourceBundle that this ResourceManager is managing. |
static void |
initialize()
Initializes the class by instantiating the bundles Hashtable. |
static void |
load(java.lang.String id,
java.lang.String name)
Load a PropertyResourceBundle using the name, and add it to the bundles Hashtable keyed by id. |
static ResourceManager |
put(java.lang.String id,
ResourceManager rMgr)
Put a ResourceManager into the bundles Hashtable, keyed by id. |
void |
setDebug(boolean debug)
Set the debugging flag for this ResourceManager. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String RCS_ID
public static final java.lang.String RCS_REV
Constructor Detail |
public ResourceManager(java.lang.String name, java.util.ResourceBundle rsrc) throws java.util.MissingResourceException
name
- The (display) name of this resource bundle.rsrc
- The resource bundle to be managed.Method Detail |
public static void initialize()
public static void load(java.lang.String id, java.lang.String name)
id
- The id of the ResourceManager. This is used as the
key into the bundles table.name
- The name of the ResourceManager. This is used to
load the resource bundle.public static ResourceManager get(java.lang.String id)
id
- The id of the ResourceManager to be returned.
public static ResourceManager put(java.lang.String id, ResourceManager rMgr)
id
- The id used to identify this ResourceManager.rMgr
- The resource manager to be managed.
public void setDebug(boolean debug)
debug
- The new debugging setting.public java.lang.String getString(java.lang.String key)
key
- The key of the resource to retrieve.
public java.lang.String getFormat(java.lang.String key, java.lang.Object[] args)
key
- The key of the resource that is the message format.args
- The arguments to be used to format the message.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |