org.pf.nls
Class TextContainerList

java.lang.Object
  extended by org.pf.util.AssociationList<String,V>
      extended by org.pf.util.NamedValueList<TextContainer>
          extended by org.pf.nls.TextContainerList
All Implemented Interfaces:
Serializable, IExtendedTextProvider, ITextProvider, org.pfsw.bif.facet.IReadOnlyNamedValues<TextContainer>

public class TextContainerList
extends org.pf.util.NamedValueList<TextContainer>
implements IExtendedTextProvider

Can hold many TextContainer objects which can be accessed via a locale name or a Locale object.

Version:
1.0
Author:
M.Duchrow
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.pf.util.NamedValueList
EMPTY_NAMED_VALUE_ARRAY
 
Fields inherited from class org.pf.util.AssociationList
EMPTY_ASSOCIATION_ARRAY
 
Constructor Summary
TextContainerList()
          Initialize the new instance with default values.
 
Method Summary
 void add(String name, TextContainer container)
          Add the text container to this list.
 boolean containsNothing()
          Returns true if this text provider holds no text and also its default text provider contains nothing.
 Locale[] getLocales()
          Returns the locales for which this list has an associated text container
 Locale[] getLookupOrder()
          Returns the current lookup order that will be used within getText(String).
 String getText(String key)
          Returns the text associated with the given key or null if the key cannot be found.
 TextContainer getTextContainer(Locale locale)
          Returns the text container for the given locale or null if none can be found.
 TextContainer getTextContainer(String localeName)
          Returns the text container for the given locale name or null if none can be found.
 void setLookupOrder(Locale[] newValue)
          Set the lookup order that will be used within getText(String).
 TextContainer textContainerAt(int index)
          Returns the text container at the specified index of null
 
Methods inherited from class org.pf.util.NamedValueList
add, add, addAll, containsName, findNamedValue, getNames, getValue, nameAt, namedValueArray, namedValueArray, namedValueAt, names, remove, setNamedValueAt, sort, sort, valueAt
 
Methods inherited from class org.pf.util.AssociationList
addAll, addAll, addAll, addAllToMap, asHashMap, asHashtable, asList, associationArray, associationArray, associationAt, clear, containsKey, findAssociation, indexOf, isEmpty, keyAt, keys, processEach, put, put, putAll, putAll, remove, remove, removeAll, removeKey, setAssociationAt, size, valueAt, values
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.pfsw.bif.facet.IReadOnlyNamedValues
isEmpty
 

Constructor Detail

TextContainerList

public TextContainerList()
Initialize the new instance with default values.

Method Detail

getTextContainer

public TextContainer getTextContainer(String localeName)
Returns the text container for the given locale name or null if none can be found.


getTextContainer

public TextContainer getTextContainer(Locale locale)
Returns the text container for the given locale or null if none can be found.


add

public void add(String name,
                TextContainer container)
Add the text container to this list. If it already exists then replace it.

Overrides:
add in class org.pf.util.NamedValueList<TextContainer>

getLocales

public Locale[] getLocales()
Returns the locales for which this list has an associated text container

Specified by:
getLocales in interface IExtendedTextProvider

getText

public String getText(String key)
Returns the text associated with the given key or null if the key cannot be found.
If the specified key is null then null will be returned.

Iterates over all containers according to the lookup order or if absent just sequential. Returns the first value found.

Specified by:
getText in interface ITextProvider
Parameters:
key - The identifier for the text
See Also:
setLookupOrder(Locale[])

containsNothing

public boolean containsNothing()
Returns true if this text provider holds no text and also its default text provider contains nothing.

Specified by:
containsNothing in interface IExtendedTextProvider

getLookupOrder

public Locale[] getLookupOrder()
Returns the current lookup order that will be used within getText(String).

See Also:
getText(String)

setLookupOrder

public void setLookupOrder(Locale[] newValue)
Set the lookup order that will be used within getText(String).

See Also:
getText(String)

textContainerAt

public TextContainer textContainerAt(int index)
Returns the text container at the specified index of null



Copyright © 2015 Manfred Duchrow Consulting & Software. All rights reserved.