|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pfsw.nls.TextContainer
public class TextContainer
This is is a simple container for text strings associated with an identifying key. It also allows to set a default TextContainer which will be checked for a key if this container cannot find it.
Constructor Summary | |
---|---|
TextContainer(java.util.Locale aLocale)
Initialize the new instance with default values. |
Method Summary | |
---|---|
protected void |
addText(java.lang.String key,
java.lang.String text)
Add the given text under the specified key. |
boolean |
containsKey(java.lang.String key)
Returns true if this container or its default container can provide a text for the specified key. |
boolean |
containsNothing()
Returns true if this container holds no text and also its default container contains nothing. |
protected java.util.Map |
createNewTextMap(int initialCapacity)
Creates a new instance of a map implementation. |
IExtendedTextProvider |
getDefaultProvider()
Returns the default container that will be used if a key cannot be found in this container. |
protected int |
getInitialCapacity()
Returns the initial capacity for the entries in this container. |
java.lang.String[] |
getKeys()
Returns an array with all keys of this container. |
java.util.Locale |
getLocale()
Returns the locale for which this container holds the text strings |
java.util.Locale[] |
getLocales()
Returns the locales for which this text provider has text |
protected java.lang.String |
getString(java.lang.String key)
Returns the string or null from the internal map for the given key. |
java.lang.String |
getText(java.lang.String key)
Returns the text associated with the given key or null if the key cannot be found. |
protected java.util.Map |
getTextMap()
|
protected boolean |
hasDefaultContainer()
Returns whether or not this container has a default container |
boolean |
hasKey(java.lang.String key)
Returns true if this container can provide a text for the specified key. |
boolean |
isEmpty()
Returns true if this container holds no text. |
void |
setDefaultProvider(IExtendedTextProvider textContainer)
Sets the default container. |
protected void |
setLocale(java.util.Locale newLocale)
Set the locale for which this container holds the text strings |
protected void |
setTextMap(java.util.Map newValue)
|
int |
size()
Returns the number of entries in this container. |
protected org.pfsw.text.StringUtil |
str()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TextContainer(java.util.Locale aLocale)
Method Detail |
---|
public IExtendedTextProvider getDefaultProvider()
public void setDefaultProvider(IExtendedTextProvider textContainer)
textContainer
- A new default container or null to remove any existingpublic java.util.Locale getLocale()
public java.lang.String getText(java.lang.String key)
getText
in interface ITextProvider
key
- The identifier for the textpublic java.util.Locale[] getLocales()
getLocales
in interface IExtendedTextProvider
public java.lang.String[] getKeys()
public boolean containsKey(java.lang.String key)
key
- The key to lookuphasKey(String)
public boolean hasKey(java.lang.String key)
key
- The key to lookupcontainsKey(String)
public boolean isEmpty()
containsNothing()
public boolean containsNothing()
containsNothing
in interface IExtendedTextProvider
isEmpty()
public int size()
protected java.lang.String getString(java.lang.String key)
protected void addText(java.lang.String key, java.lang.String text)
protected boolean hasDefaultContainer()
protected int getInitialCapacity()
protected java.util.Map createNewTextMap(int initialCapacity)
protected void setLocale(java.util.Locale newLocale)
protected java.util.Map getTextMap()
protected void setTextMap(java.util.Map newValue)
protected org.pfsw.text.StringUtil str()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |