|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecteu.beesoft.gaia.util.Language
public class Language
Encapsulates the work with resource bundles and language dependent texts.
Constructor Summary | |
---|---|
protected |
Language()
Creates a new instance of the Language. |
Method Summary | |
---|---|
void |
addLanguageListener(LanguageListener listener)
Adds LanguageListener to the listeners list. |
static Language |
getInstance()
Returns the last created instance of Language. |
java.util.Locale |
getLocale()
Returns a Locale for this object. |
java.text.DateFormat |
getLongDateFormat()
Returns a long date format for current locale. |
java.text.DateFormat |
getLongTimeFormat()
Returns a long time format for current locale. |
java.text.DateFormat |
getMediumDateFormat()
Returns a medium date format for current locale. |
java.text.DateFormat |
getMediumTimeFormat()
Returns a medium time format for current locale. |
java.util.ResourceBundle |
getResourceBundle(java.lang.String name)
Returns a resource bundle with given name and for current
object's locale. |
java.text.DateFormat |
getShortDateFormat()
Returns a short date format for current locale. |
java.text.DateFormat |
getShortTimeFormat()
Returns a short time format for current locale. |
java.lang.String |
getText(java.lang.Object resourceBundleOwner,
java.lang.String textKey)
Returns a text from resource bundle related to the given resourceBundleOwner for the textKey . |
java.lang.String |
getText(java.lang.Object resourceBundleOwner,
java.lang.String textKey,
java.lang.String defaultValue)
Returns a text from resource bundle related to the given resourceBundleOwner for the textKey . |
java.lang.String |
getText(java.lang.String resourceBundleName,
java.lang.String textKey)
Returns a text from resource bundle for given textKey . |
java.lang.String |
getText(java.lang.String resourceBundleName,
java.lang.String textKey,
java.lang.String defaultValue)
Returns a text from resource bundle for given textKey . |
void |
removeLanguageListener(LanguageListener listener)
Removes LanguageListener from the listeners list. |
void |
setLocale(java.util.Locale locale)
Sets Locale for this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Language()
Method Detail |
---|
public static Language getInstance()
public void addLanguageListener(LanguageListener listener)
listener
- - a listener to addpublic void removeLanguageListener(LanguageListener listener)
listener
- - a listener to removepublic void setLocale(java.util.Locale locale)
locale
- - a locale to setpublic java.util.Locale getLocale()
public java.text.DateFormat getLongDateFormat()
public java.text.DateFormat getMediumDateFormat()
public java.text.DateFormat getShortDateFormat()
public java.text.DateFormat getLongTimeFormat()
public java.text.DateFormat getMediumTimeFormat()
public java.text.DateFormat getShortTimeFormat()
public java.util.ResourceBundle getResourceBundle(java.lang.String name)
name
and for current
object's locale. Returns null, if no resource bundle is found, no
exception is thrown.
name
- - the base name of the resource bundle, a fully qualified
class name
public java.lang.String getText(java.lang.Object resourceBundleOwner, java.lang.String textKey)
resourceBundleOwner
for the textKey
. If key is
not found, returns textKey
.
This method obtains the qualified class name of the
resourceBundleOwner
and uses it to get ResourceBundle and
text for the textKey
from it. If text not found, it takes a
superclass of resourceBundleOwner
and repeats these steps.
resourceBundleOwner
- - the base name of the resource bundle, a fully qualified
class nametextKey
- - the key for the desired text
public java.lang.String getText(java.lang.Object resourceBundleOwner, java.lang.String textKey, java.lang.String defaultValue)
resourceBundleOwner
for the textKey
. If key is
not found, returns defaultValue
.
This method obtains the qualified class name of the
resourceBundleOwner
and uses it to get ResourceBundle and
text for the textKey
from it. If text not found, it takes a
superclass of resourceBundleOwner
and repeats these steps.
resourceBundleOwner
- - the base name of the resource bundle, a fully qualified
class nametextKey
- - the key for the desired textdefaultValue
- - value is used when no value for textKey is found
public java.lang.String getText(java.lang.String resourceBundleName, java.lang.String textKey)
textKey
. If
key is not found, returns textKey
.
resourceBundleName
- - the base name of the resource bundle, a fully qualified
class nametextKey
- - the key for the desired text
public java.lang.String getText(java.lang.String resourceBundleName, java.lang.String textKey, java.lang.String defaultValue)
textKey
. If
key is not found, returns defaultValue
.
resourceBundleName
- - the base name of the resource bundle, a fully qualified
class nametextKey
- - the key for the desired textdefaultValue
- - value is used when no value for textKey is found
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |