|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.clackrouter.jgraph.pad.resources.Translator
public class Translator
Contains ResourceBundle objects. The first (deepest) bundle is the Graphpad bundle. If a user wants to use Graphpad as a framework he can push his own bundle with the pushBundle method. Requests will procnetre with the following logic: The translator asks the highest bundle for a localized text string. If the bundle has no entry for the specified key. The next bundle will ask for the key. If the deepest bundle hasn't a value for the key the key will return.
Field Summary | |
---|---|
protected static java.util.Stack |
bundleNames
Contains ResourceBundle names The first bundlename is the Graphpad bundle. |
protected static java.util.Stack |
bundles
Contains ResourceBundle objects. |
protected static DefaultResourceBundle |
defaultBundle
Resouce Bundle with proper names. |
protected static java.util.Vector |
listeners
Container for the registered LocaleChangeListener. |
protected static boolean |
logNotFoundResources
The translator creates outputs on the System.err if a resource wasn't found and this boolean is true |
Constructor Summary | |
---|---|
Translator()
|
Method Summary | |
---|---|
static void |
addLocaleChangeListener(LocaleChangeListener listener)
Adds a locale change listener to this Translator. |
static DefaultResourceBundle |
getDefaultResourceBundle()
Returns the resouce bundle with the proper names. |
static java.util.Locale |
getLocale()
Returns the current locale |
static java.lang.String |
getString(int bundleIndex,
java.lang.String sKey)
Returns the localized String for the key. |
static java.lang.String |
getString(int bundleIndex,
java.lang.String sKey,
java.lang.Object[] oValues)
Returns the localized String for the key. |
static java.lang.String |
getString(java.lang.String sKey)
Returns the localized String for the key. |
static java.lang.String |
getString(java.lang.String sKey,
java.lang.Object[] values)
Returns the localized String for the key. |
static boolean |
isLogNotFoundResources()
Returns the logNotFoundResources. |
static void |
popBundle()
Pops the highest bundle on the stack |
static void |
pushBundle(java.lang.String filename)
Pushes the specified bundle on the stack. |
static void |
reloadBundles()
Reloads the bundles at the stack by using the default locale. |
static void |
removeBundle(int index)
removes the specified bundle |
static void |
removeLocaleChangeListener(LocaleChangeListener listener)
Removes the registered Listener |
static void |
setLocale(java.util.Locale locale)
Sets the new locale and fires events to the locale change listener. |
static void |
setLogNotFoundResources(boolean logNotFoundResources)
Sets the logNotFoundResources. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.util.Vector listeners
LocaleChangeListener
protected static boolean logNotFoundResources
protected static java.util.Stack bundles
protected static java.util.Stack bundleNames
protected static DefaultResourceBundle defaultBundle
Constructor Detail |
---|
public Translator()
Method Detail |
---|
public static DefaultResourceBundle getDefaultResourceBundle()
public static java.lang.String getString(java.lang.String sKey)
sKey
- Key for the localized String.public static java.lang.String getString(int bundleIndex, java.lang.String sKey)
bundleIndex
- The bundle index for the request.
The method requests the bundle
at the specified position and
at all deeper positions.sKey
- Key for the localized String.public static java.lang.String getString(java.lang.String sKey, java.lang.Object[] values)
sKey
- Key for the localized String.values
- Object array for placeholders.MessageFormat.format(String, Object[])
public static java.lang.String getString(int bundleIndex, java.lang.String sKey, java.lang.Object[] oValues)
sKey
- Key for the localized String.oValues
- Object array for placeholders.MessageFormat.format(String, Object[])
public static void addLocaleChangeListener(LocaleChangeListener listener)
public static void removeLocaleChangeListener(LocaleChangeListener listener)
public static java.util.Locale getLocale()
public static void setLocale(java.util.Locale locale)
public static void reloadBundles()
public static void pushBundle(java.lang.String filename)
ResourceBundle.getBundle(java.lang.String)
public static void popBundle()
public static void removeBundle(int index)
public static boolean isLogNotFoundResources()
public static void setLogNotFoundResources(boolean logNotFoundResources)
logNotFoundResources
- The logNotFoundResources to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |