|
SAP NetWeaver 7.31 (SP01) KMC | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sap.ip.collaboration.core.api.util.text.TextBundle
public class TextBundle
Root class for internationalized text bundles with different text lengths.
This class is used by subclassing it. The idea is to have one class per resource bundle file. The subclass defines the new text keys. The default behavior is to load the corresponding resource bundle file by adding "Resources" to the name of the class.
e.g. if the subclass of TextBundle is called com.sapportals.pct.example.MyTextBundle, the corresponding resource bundle property file has the name com.sapportals.pct.example.MyTextBundleResources and it ends with .properties, _en.properties, etc.
This behavior can be replaced constructing the class with a ResourceBundleReader.
The Textbundle class can cache texts. A set of texts for one language that was read once might not be read again by the same TextBundle object. For efficient caching do not recreate the same TextBundle object multiple times. The caching does not work across multiple TextBundle objects that use the same texts.
The texts inside the resource bundle are formatted with the java MessageFormat class. This allows locale specific formatting and filling of place holders.
This class supports retrieving a text in different lengths. This is achieved by adding extensions to the message keys. If a message has the message key "myKey", the short version is stored under "myKey", the medium version under "myKeyMedium" and the long version under "myKeyLong".
This allows for instance a GUI to retrieve a text of the appropriate length type.
There is no fix definition of the text lengths. The three text length types are only a hint. The idea is of cause that short <= medium <= long is true.
There is a fallback mechanism for long texts onto the shorter variant if the resource bundle does not contain the longer versions.
There is an optional fallback onto a technical constructed name if there is no resource bundle at all. The normal behavior is to throw a MissingResourceException
Copyright: Copyright (c) 2002 Company: SAP Portals
| Field Summary | |
|---|---|
static int |
LONG
length type for long text |
static String |
LONG_EXTENSION
extension that is added to a text key to get a long text |
static int |
MEDIUM
length type for medium text |
static String |
MEDIUM_EXTENSION
extension that is added to a text key to get a medium text |
static int |
SHORT
length type for short text |
static String |
SHORT_EXTENSION
extension that is added to a text key to get a short text |
| Constructor Summary | |
|---|---|
TextBundle()
constructs a new TextBundle. |
|
TextBundle(IResourceBundleReader aResourceBundleReader)
constructs a new TextBundle with a separate resource bundle reader |
|
TextBundle(String resourceBundleName)
constructs a new TextBundle. |
|
TextBundle(String resourceBundleName,
ClassLoader classLoader)
constructs a new TextBundle. |
|
| Method Summary | |
|---|---|
String |
getLongText(String aTextKey,
Locale aLocale)
convenience method returning the a long text |
String |
getLongText(String aTextKey,
Locale aLocale,
boolean fallback)
convenience method returning the a long text |
String |
getLongText(String aTextKey,
Object[] textParameters,
Locale aLocale)
convenience method returning the a long text with text parameters |
String |
getLongText(String aTextKey,
Object[] textParameters,
Locale aLocale,
boolean fallback)
convenience method returning the a long text with text parameters |
String |
getMediumText(String aTextKey,
Locale aLocale)
convenience method returning the a medium text |
String |
getMediumText(String aTextKey,
Locale aLocale,
boolean fallback)
convenience method returning the a medium text |
String |
getMediumText(String aTextKey,
Object[] textParameters,
Locale aLocale)
convenience method returning the a medium text with text parameters |
String |
getMediumText(String aTextKey,
Object[] textParameters,
Locale aLocale,
boolean fallback)
convenience method returning the a medium text with text parameters |
String |
getShortText(String aTextKey,
Locale aLocale)
convenience method returning the a short text |
String |
getShortText(String aTextKey,
Locale aLocale,
boolean fallback)
convenience method returning the a short text |
String |
getShortText(String aTextKey,
Object[] textParameters,
Locale aLocale)
convenience method returning the a short text |
String |
getShortText(String aTextKey,
Object[] textParameters,
Locale aLocale,
boolean fallback)
convenience method returning the a short text with text parameters |
IText |
getText(String aTextKey)
returns a text object representing the text. |
IText |
getText(String aTextKey,
Object[] textParameters)
returns a text object representing the text. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String SHORT_EXTENSION
public static final String MEDIUM_EXTENSION
public static final String LONG_EXTENSION
public static final int SHORT
public static final int MEDIUM
public static final int LONG
| Constructor Detail |
|---|
public TextBundle()
public TextBundle(String resourceBundleName)
resourceBundleName - name of the resourceBundle
public TextBundle(String resourceBundleName,
ClassLoader classLoader)
resourceBundleName - name of the resourceBundleclassLoader - classloader of package which contains the resource bundlepublic TextBundle(IResourceBundleReader aResourceBundleReader)
| Method Detail |
|---|
public String getShortText(String aTextKey,
Locale aLocale)
aTextKey - key for the textaLocale - the locale for the text
MissingResourceException - if the text key is missing
public String getShortText(String aTextKey,
Locale aLocale,
boolean fallback)
aTextKey - key for the textaLocale - the locale for the textfallback - true, if a technical name should be contructed when
MissingResourceException - if the text key is missing and fallback is disabled
public String getShortText(String aTextKey,
Object[] textParameters,
Locale aLocale)
aTextKey - key for the texttextParameters - object array with parameters for the textaLocale - the locale for the text
MissingResourceException - if the text key is missing
public String getShortText(String aTextKey,
Object[] textParameters,
Locale aLocale,
boolean fallback)
aTextKey - key for the texttextParameters - object array with parameters for the textaLocale - the locale for the textfallback - true, if a technical name should be contructed when
MissingResourceException - if the text key is missing and fallback is disabled
public String getMediumText(String aTextKey,
Locale aLocale)
aTextKey - key for the textaLocale - the locale for the text
MissingResourceException - if the text key is missing
public String getMediumText(String aTextKey,
Locale aLocale,
boolean fallback)
aTextKey - key for the textaLocale - the locale for the textfallback - true, if a technical name should be contructed when
MissingResourceException - if the text key is missing and fallback is disabled
public String getMediumText(String aTextKey,
Object[] textParameters,
Locale aLocale)
aTextKey - key for the texttextParameters - object array with parameters for the textaLocale - the locale for the text
MissingResourceException - if the text key is missing
public String getMediumText(String aTextKey,
Object[] textParameters,
Locale aLocale,
boolean fallback)
aTextKey - key for the texttextParameters - object array with parameters for the textaLocale - the locale for the textfallback - true, if a technical name should be contructed when
MissingResourceException - if the text key is missing and fallback is disabled
public String getLongText(String aTextKey,
Locale aLocale)
aTextKey - key for the textaLocale - the locale for the text
MissingResourceException - if the text key is missing
public String getLongText(String aTextKey,
Locale aLocale,
boolean fallback)
aTextKey - key for the textaLocale - the locale for the textfallback - true, if a technical name should be contructed when
MissingResourceException - if the text key is missing and fallback is disabled
public String getLongText(String aTextKey,
Object[] textParameters,
Locale aLocale)
aTextKey - key for the texttextParameters - object array with parameters for the textaLocale - the locale for the text
MissingResourceException - if the text key is missing
public String getLongText(String aTextKey,
Object[] textParameters,
Locale aLocale,
boolean fallback)
aTextKey - key for the texttextParameters - object array with parameters for the textaLocale - the locale for the textfallback - true, if a technical name should be contructed when
MissingResourceException - if the text key is missing and fallback is disabledpublic IText getText(String aTextKey)
aTextKey - key for the text
public IText getText(String aTextKey,
Object[] textParameters)
aTextKey - key for the texttextParameters - object array with parameters for the text| Access Rights |
|---|
| SC | DC | Public Part | ACH |
|---|---|---|---|
[sap.com] KMC-WPC
|
[sap.com] tc/kmc/wpc/wpcfacade
|
api
|
EP-PIN-WPC-WCM
|
[sap.com] KMC-CM
|
[sap.com] tc/km/frwk
|
api
|
EP-KM-CM
|
[sap.com] KMC-COLL
|
[sap.com] tc/kmc/coll/util
|
api
|
EP-KM-COL
|
|
SAP NetWeaver 7.31 (SP01) KMC | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||