TWE 2.4-1 API

org.enhydra.jawe
Class ResourceManager

java.lang.Object
  extended byorg.enhydra.jawe.ResourceManager

public class ResourceManager
extends java.lang.Object

Utility for implementing multi language support, and other manipulation with property files.

Author:
Sasa Bojanic

Field Summary
protected static AdditionalResourceManager addResMgr
           
protected static java.util.Locale choosenLocale
           
protected static java.util.ResourceBundle choosenResourceBundle
           
protected static java.util.Locale defaultLocale
           
protected static java.util.ResourceBundle defaultResourceBoundle
           
static java.lang.String RESOURCE_PATH
           
 
Constructor Summary
ResourceManager()
           
 
Method Summary
static java.util.Locale getChoosenLocale()
          Returns the current locale.
static java.util.ResourceBundle getChoosenResourceBundle()
          Returns the current locale.
static java.util.Locale getDefaultLocale()
          Returns the default locale.
static java.util.ResourceBundle getDefaultResourceBundle()
          Returns the default resource bundle.
static java.lang.String getLanguageDependentString(AdditionalResourceManager arm, java.lang.String nm)
           
static java.lang.String getLanguageDependentString(java.lang.String nm)
          Gets a language dependent string from the resource bundle.
static java.net.URL getResource(java.util.Properties properties, java.lang.String key)
          Gets the url from a resource string.
static java.lang.String getResourceString(java.util.Properties properties, java.lang.String nm)
           
static java.util.List getResourceStrings(java.util.Properties properties, java.lang.String startsWith)
           
static java.util.List getResourceStrings(java.util.Properties properties, java.lang.String startsWith, boolean values)
           
static void reconfigure()
           
static void setChoosen(java.util.Locale loc)
          Sets the new resource and locale to be used.
static void setDefault()
           
static void setSystem()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_PATH

public static final java.lang.String RESOURCE_PATH
See Also:
Constant Field Values

defaultLocale

protected static java.util.Locale defaultLocale

defaultResourceBoundle

protected static java.util.ResourceBundle defaultResourceBoundle

choosenLocale

protected static java.util.Locale choosenLocale

choosenResourceBundle

protected static java.util.ResourceBundle choosenResourceBundle

addResMgr

protected static AdditionalResourceManager addResMgr
Constructor Detail

ResourceManager

public ResourceManager()
Method Detail

getLanguageDependentString

public static java.lang.String getLanguageDependentString(java.lang.String nm)
Gets a language dependent string from the resource bundle.

Resource bundle represents the property file. For example, if property file contains something like this:

menubar=file edit help
method call getLanguageDependentString("menubar") will give the string file edit help as a result.
This method reads information from property file. If can't find desired resource, returns null.

Parameters:
nm - name of the resource to fetch.
Returns:
String value of named resource.

getLanguageDependentString

public static java.lang.String getLanguageDependentString(AdditionalResourceManager arm,
                                                          java.lang.String nm)

getResourceString

public static java.lang.String getResourceString(java.util.Properties properties,
                                                 java.lang.String nm)

getResourceStrings

public static java.util.List getResourceStrings(java.util.Properties properties,
                                                java.lang.String startsWith)

getResourceStrings

public static java.util.List getResourceStrings(java.util.Properties properties,
                                                java.lang.String startsWith,
                                                boolean values)

getResource

public static java.net.URL getResource(java.util.Properties properties,
                                       java.lang.String key)
Gets the url from a resource string.

Parameters:
key - the string key to the url in the properties.
Returns:
the resource location.
See Also:
Class.getResource(java.lang.String)

setDefault

public static void setDefault()

setSystem

public static void setSystem()

getDefaultResourceBundle

public static java.util.ResourceBundle getDefaultResourceBundle()
Returns the default resource bundle.


getChoosenResourceBundle

public static java.util.ResourceBundle getChoosenResourceBundle()
Returns the current locale.


getDefaultLocale

public static java.util.Locale getDefaultLocale()
Returns the default locale.


getChoosenLocale

public static java.util.Locale getChoosenLocale()
Returns the current locale.


setChoosen

public static void setChoosen(java.util.Locale loc)
                       throws java.util.MissingResourceException
Sets the new resource and locale to be used.

Throws:
java.util.MissingResourceException

reconfigure

public static void reconfigure()

TWE 2.4-1 API