|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vizzini.ui.ResourceProvider
public class ResourceProvider
Provides locale specific resources. This class searches resource bundles,
where the resource bundles can "inherit" from parent resource bundles.
Parents are specified in the properties file with the key represented by
PARENT_BUNDLE_NAME_KEY
.
If a locale other than the default is desired, it must be set using
setLocale()
prior to calling get()
.
Field Summary | |
---|---|
static String |
CONFIG_BUNDLE_NAME
Standard configuration resources filename. |
protected static String |
PARENT_BUNDLE_NAME_KEY
Parent resource bundle name key. |
static String |
STRING_BUNDLE_NAME
Standard string resources filename. |
Constructor Summary | |
---|---|
protected |
ResourceProvider(String bundleName)
Construct this object. |
Method Summary | |
---|---|
static void |
clear()
Clear all instances so they can be recreated. |
static String |
convertToBundleName(Class aClass,
String bundleFilename)
Convert the given class and bundle filename into a fully qualified bundle name. |
protected static ResourceProvider |
createInstance(Class aClass,
String bundleFilename)
Create a resource provider instance. |
protected static ResourceProvider |
createInstance(String bundleName)
Create a resource provider instance. |
static ResourceProvider |
get(Class aClass,
String bundleFilename)
Return the instance associated with the given bundle name. |
static ResourceProvider |
get(String bundleName)
Return the instance associated with the given bundle name. |
AudioClip |
getAudioClip(String key)
Return the audio clip specified by the given key. |
boolean |
getBoolean(String key)
Return the boolean specified by the given key. |
boolean |
getBoolean(String key,
boolean defaultValue)
Return the boolean specified by the given key, or the given
default value if the key is not found. |
Class |
getClass(String key)
Return the Class specified by the given key. |
Color |
getColor(String key)
Return the color specified by the given key. |
Color |
getColor(String key,
Color defaultColor)
Return the color specified by the given key, or the given default color if the key is not found. |
Font |
getFont(String key)
Return the font specified by the given key. |
Font |
getFont(String key,
Font defaultFont)
Return the font specified by the given key, or the given default font if the key is not found. |
Icon |
getIcon(String key)
Return the icon specified by the given key. |
int |
getInt(String key)
Return the int specified by the given key. |
int |
getInt(String key,
int defaultValue)
Return the int specified by the given key, or the given
default value if the key is not found. |
protected int |
getIntFromString(String string)
Return an integer from the given string. |
String |
getString(String key)
Return the string specified by the given key. |
String |
getString(String key,
String defaultString)
Return the string specified by the given key, or the given default string if the key is not found. |
static void |
remove(String bundleName)
Remove the instance associated with the given bundle name so that it can be recreated. |
static void |
setLocale(Locale locale)
Set the locale. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String STRING_BUNDLE_NAME
public static final String CONFIG_BUNDLE_NAME
protected static final String PARENT_BUNDLE_NAME_KEY
Constructor Detail |
---|
protected ResourceProvider(String bundleName)
Method Detail |
---|
public static void clear()
public static String convertToBundleName(Class aClass, String bundleFilename)
aClass
- Class from which to extract the fully qualified
package name.bundleFilename
- Simple filename of the bundle.
public static ResourceProvider get(String bundleName)
bundleName
- Fully qualified bundle name.public static ResourceProvider get(Class aClass, String bundleFilename)
public static void remove(String bundleName)
public static void setLocale(Locale locale)
public AudioClip getAudioClip(String key)
public boolean getBoolean(String key)
boolean
specified by the given key.
public boolean getBoolean(String key, boolean defaultValue)
boolean
specified by the given key, or the given
default value if the key is not found.
public Class getClass(String key)
Class
specified by the given key.
public Color getColor(String key)
public Color getColor(String key, Color defaultColor)
public Font getFont(String key)
public Font getFont(String key, Font defaultFont)
public Icon getIcon(String key)
public int getInt(String key)
int
specified by the given key.
public int getInt(String key, int defaultValue)
int
specified by the given key, or the given
default value if the key is not found.
public String getString(String key)
public String getString(String key, String defaultString)
protected static ResourceProvider createInstance(String bundleName)
protected static ResourceProvider createInstance(Class aClass, String bundleFilename)
protected int getIntFromString(String string)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2007 Vizzini.org. All Rights Reserved. | 2007.12.25.03.00.02 |