|
SAP NetWeaver '04 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sap.localization.LocalizableTextFormatter
The LocalizableTextFormatter object is an implementation of the LocalizableText interface.
This class provides the infrastructure to enable the retrieval
of translated text to any desired locale/time zone in
a distributed environment. With the use of a LocalizableTextFormatter
object, the user can set the needed information in a language neutral way.
When the information is needed to be displayed to a user, the object can
be formatted into the locale/time zone of the user. Typical uses will
be to hold error and exception information, GUI screen information and
so forth.
The formatting can be done either locally or remotely/centrally.
That means it is possible that the resource bundles are kept
centrally in a server environment and that LocalizableTextFormatter
object can be sent across system boundaries without localization.
The client can localize the text with its own locale and time zone
at a particular time. Whether the localization is done locally or centrally
is transparent to the user.
Note: Currently, central localization is not supported.
| Nested Class Summary |
| Nested classes inherited from class com.sap.localization.LocalizableText |
LocalizableText.Key0, LocalizableText.Key1, LocalizableText.Key2, LocalizableText.Key3, LocalizableText.Key4, LocalizableText.Key5, LocalizableText.Key6, LocalizableText.Msg |
| Field Summary |
| Fields inherited from interface com.sap.localization.Localizable |
defaultLocale |
| Constructor Summary | |
LocalizableTextFormatter()
Simple constructor for LocalizableTextFormatter. |
|
LocalizableTextFormatter(ResourceAccessor resourceAccessor,
LocalizableText.Msg msg)
Constructor with specified resource accessor, key and format arguments. |
|
LocalizableTextFormatter(ResourceAccessor resourceAccessor,
String patternKey)
Constructor with specified resource accessor and key. |
|
LocalizableTextFormatter(ResourceAccessor resourceAccessor,
String patternKey,
Object[] args)
Constructor with specified resource accessor, key and format arguments. |
|
LocalizableTextFormatter(ResourceAccessor resourceAccessor,
String patternKey,
Object[] args,
String applicationName)
Constructor with specified resource accessor, key, default text and name of the formatting bean. |
|
| Method Summary | |
void |
clearCache()
Removes the cached localized message. |
void |
clearLocalizableTextFormatter()
Restores the initial state. |
static LocalizableText.Key0 |
createKey0(String key)
Creates message key. |
static LocalizableText.Key1 |
createKey1(String key)
Creates message key. |
static LocalizableText.Key2 |
createKey2(String key)
Creates message key. |
static LocalizableText.Key3 |
createKey3(String key)
Creates message key. |
static LocalizableText.Key4 |
createKey4(String key)
Creates message key. |
static LocalizableText.Key5 |
createKey5(String key)
Creates message key. |
static LocalizableText.Key6 |
createKey6(String key)
Creates message key. |
void |
finallyLocalize()
Finally localize the message text. |
void |
finallyLocalize(Locale loc)
Finally localize the message text. |
void |
finallyLocalize(Locale loc,
TimeZone tZone)
Finally localize the message text. |
void |
finallyLocalize(TimeZone tZone)
Finally localize the message text. |
String |
format()
Returns the message text. |
String |
format(Locale loc)
Returns the message text. |
String |
format(Locale loc,
TimeZone tZone)
Returns the message text. |
String |
format(TimeZone tZone)
Returns the message text. |
static String |
formatString(ResourceAccessor resourceAccessor,
LocalizableText.Msg msg)
Formats a specified message with the default locale and time zone. |
static String |
formatString(ResourceAccessor resourceAccessor,
LocalizableText.Msg msg,
Locale loc,
TimeZone timeZone)
Formats a specified message. |
static String |
formatString(ResourceAccessor resourceAccessor,
String patternKey)
Formats a specified message. |
static String |
formatString(ResourceAccessor resourceAccessor,
String patternKey,
Object[] args)
Formats a specified message. |
static String |
formatString(ResourceAccessor resourceAccessor,
String patternKey,
Object[] args,
Locale loc,
TimeZone timeZone)
Formats a specified message. |
String |
getApplicationName()
Getter method for name of the formatting enterprise bean |
Object[] |
getArguments()
Getter method for the format arguments. |
String |
getCacheEntry()
Getter method for the cached entry. |
Locale |
getLocale()
Getter method for the locale. |
String |
getPatternKey()
Getter method for the pattern key. |
ResourceAccessor |
getResourceAccessor()
Getter method for the resource accessor. |
String |
getResourceBundleName()
Getter method for the resource bundle name. |
TimeZone |
getTimeZone()
Getter method for the time zone. |
boolean |
isCacheSetting()
Returns whether caching is activated. |
boolean |
isFinallySetting()
Returns whether the finally setting is activated. |
boolean |
isLocalFormat()
Returns whether local formatting is enabled. |
void |
setApplicationName(String applicationName)
Setter method for name of the formatting enterprise bean |
void |
setArguments(Object[] obj)
Setter method for the format arguments. |
void |
setCacheSetting(boolean setting)
Determines the cache setting. |
void |
setLocale(Locale locale)
Setter method for the locale. |
void |
setLocalFormat(boolean local)
Setter method for local formatting mode. |
void |
setPatternKey(String patternKey)
Setter method for the pattern key. |
void |
setResourceAccessor(ResourceAccessor resAccessor)
Setter method for the resource accessor. |
void |
setTimeZone(TimeZone timeZone)
Setter method for the time zone. |
String |
toString()
Gets the localized string. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public LocalizableTextFormatter()
public LocalizableTextFormatter(ResourceAccessor resourceAccessor,
String patternKey)
resourceAccessor - resource accessorpatternKey - key used as index in the resource bundle
public LocalizableTextFormatter(ResourceAccessor resourceAccessor,
String patternKey,
Object[] args)
resourceAccessor - resource accessorpatternKey - key used as index in the resource bundleargs - format objects
public LocalizableTextFormatter(ResourceAccessor resourceAccessor,
String patternKey,
Object[] args,
String applicationName)
resourceAccessor - resource accessorpatternKey - key used as index in the resource bundleargs - format argumentsapplicationName - name of the formatting bean
public LocalizableTextFormatter(ResourceAccessor resourceAccessor,
LocalizableText.Msg msg)
resourceAccessor - resource accessormsg - message containing message key and arguments| Method Detail |
public static String formatString(ResourceAccessor resourceAccessor,
String patternKey)
throws LocalizationException
resourceAccessor - resource accessorpatternKey - message key
LocalizationException - if an error occurred
public static String formatString(ResourceAccessor resourceAccessor,
String patternKey,
Object[] args)
throws LocalizationException
resourceAccessor - resource accessorpatternKey - message keyargs - message parameters
LocalizationException - if an error occurred
public static String formatString(ResourceAccessor resourceAccessor,
String patternKey,
Object[] args,
Locale loc,
TimeZone timeZone)
throws LocalizationException
resourceAccessor - resource accessorpatternKey - message keyargs - message parametersloc - localetimeZone - time zone
LocalizationException - if an error occurred
public static String formatString(ResourceAccessor resourceAccessor,
LocalizableText.Msg msg)
throws LocalizationException
resourceAccessor - resource accessormsg - message containing key and arguments
LocalizationException - if an error occurred
public static String formatString(ResourceAccessor resourceAccessor,
LocalizableText.Msg msg,
Locale loc,
TimeZone timeZone)
throws LocalizationException
resourceAccessor - resource accessormsg - message containing key and argumentsloc - localetimeZone - time zone
LocalizationException - if an error occurred
public String format(Locale loc)
throws LocalizationException
finallyLocalize method was called before,
the already localized message is returned.
If the cache setting was activated, the cached value
is returned (if existent and the cached version corresponds with
the specified locale).
format in interface LocalizableTextloc - locale
LocalizationException - if an error occurredLocalizableText.format()
public String format(TimeZone tZone)
throws LocalizationException
finallyLocalize method was called before,
the already localized message is returned.
If the cache setting was activated, the cached value
is returned (if existent and the cached version corresponds with
the specified time zone).
format in interface LocalizableTexttZone - time zone
LocalizationException - if an error occurredLocalizableText.format()
public String format(Locale loc,
TimeZone tZone)
throws LocalizationException
finallyLocalize method was called before,
the already localized message is returned.
If the cache setting was activated, the cached value
is returned (if existent and the cached version corresponds with
the specified time zone and locale).
format in interface LocalizableTextloc - localetZone - time zone
LocalizationException - if an error occurredLocalizableText.format()
public String format()
throws LocalizationException
finallyLocalize method was called before,
the already localized message is returned.
If the cache setting was activated, the cached value
is returned (if existent).
format in interface LocalizableTextLocalizationException - if an error occurredLocalizableText.format()
public void finallyLocalize()
throws LocalizationException
finallyLocalize in interface LocalizableTextLocalizationException - if an error occurredLocalizableText.finallyLocalize()
public void finallyLocalize(Locale loc)
throws LocalizationException
finallyLocalize in interface LocalizableTextloc - locale
LocalizationException - if an error occurredLocalizableText.finallyLocalize()
public void finallyLocalize(TimeZone tZone)
throws LocalizationException
finallyLocalize in interface LocalizableTexttZone - timeZone
LocalizationException - if an error occurredLocalizableText.finallyLocalize()
public void finallyLocalize(Locale loc,
TimeZone tZone)
throws LocalizationException
finallyLocalize in interface LocalizableTextloc - localetZone - time zone
LocalizationException - if an error occurredLocalizableText.finallyLocalize()public void setLocale(Locale locale)
LocalizableText,
the locale setting is propagated.
setLocale in interface Localizablelocale - used for local-sensitive formatting.Localizable.setLocale(Locale)public Locale getLocale()
getLocale in interface LocalizableLocalizable.getLocale()public void setTimeZone(TimeZone timeZone)
setTimeZone in interface LocalizabletimeZone - used for determining the local date and time.Localizable.setTimeZone(TimeZone)public TimeZone getTimeZone()
getTimeZone in interface LocalizableLocalizable.getTimeZone()public void setApplicationName(String applicationName)
applicationName - name of the formatting enterprise beanpublic String getApplicationName()
public String getResourceBundleName()
public void setPatternKey(String patternKey)
patternKey - the message catalog keypublic String getPatternKey()
public void setArguments(Object[] obj)
obj - format argumentspublic Object[] getArguments()
public void setResourceAccessor(ResourceAccessor resAccessor)
resAccessor - resource accessorpublic ResourceAccessor getResourceAccessor()
public void setCacheSetting(boolean setting)
true, caching is
activated; otherwise caching is disabled and
the cache is cleared.
setting - true, if caching should be enabledpublic boolean isCacheSetting()
public void setLocalFormat(boolean local)
local - true, if the local formatting mode should be enabled;
otherwise falsepublic boolean isLocalFormat()
public boolean isFinallySetting()
public void clearCache()
public void clearLocalizableTextFormatter()
public String getCacheEntry()
public String toString()
public static LocalizableText.Key0 createKey0(String key)
key - message key
public static LocalizableText.Key1 createKey1(String key)
key - message key
public static LocalizableText.Key2 createKey2(String key)
key - message key
public static LocalizableText.Key3 createKey3(String key)
key - message key
public static LocalizableText.Key4 createKey4(String key)
key - message key
public static LocalizableText.Key5 createKey5(String key)
key - message key
public static LocalizableText.Key6 createKey6(String key)
key - message key
|
SAP NetWeaver '04 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||