org.mentawai.list
Class I18nListData

java.lang.Object
  extended by org.mentawai.list.I18nListData
All Implemented Interfaces:
ListData

public class I18nListData
extends Object
implements ListData

This class implements a more sophisticated data list then a SimpleListData, with locales and i18n files. Use this class if you want to deal with internationalization and i18n files, in other words, you want a internacionalizable list.

Since:
1.9
Author:
Marvin Froeder

Constructor Summary
I18nListData(String listname)
           
 
Method Summary
 void add(String id, String i18nKey)
           
 String getName()
          Returns the name of this list.
 String getValue(int id)
          Returns the string value of the list data item with the given id with the default locale.
 String getValue(int id, Locale loc)
          Returns the string value of the list data item with the given id in the given locale.
 String getValue(String id)
          Returns the string value for the list data item with the default locale.
 String getValue(String id, Locale loc)
          Returns the string value of the list data item with the given id in the given locale.
 List<ListItem> getValues()
          Returns a list of ListItem for the default locale.
 List<ListItem> getValues(Locale loc)
          Returns a list of ListItem in the given locale.
 int size()
          Returns the size of this list.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

I18nListData

public I18nListData(String listname)
Parameters:
listname - the list name, must be the same name of the i18n file.
See Also:
ListManager
Method Detail

add

public void add(String id,
                String i18nKey)
Parameters:
id - the id value
i18nKey - the i18n key

getValue

public String getValue(String id,
                       Locale loc)
Description copied from interface: ListData
Returns the string value of the list data item with the given id in the given locale.

Specified by:
getValue in interface ListData
Parameters:
id - The id of the list data item.
loc - The locale of the list data item.
Returns:
The string value for the list data item.

getValue

public String getValue(String id)
Description copied from interface: ListData
Returns the string value for the list data item with the default locale. If there is no value for the default locale, use any locale available to return the value.

Specified by:
getValue in interface ListData
Returns:
The string value of the list data item.

getValue

public String getValue(int id)
Description copied from interface: ListData
Returns the string value of the list data item with the given id with the default locale.

Specified by:
getValue in interface ListData
Parameters:
id - The id of the list data item
Returns:
The string value of the list data item

getValue

public String getValue(int id,
                       Locale loc)
Description copied from interface: ListData
Returns the string value of the list data item with the given id in the given locale.

Specified by:
getValue in interface ListData
Parameters:
id - The id of the list data item.
loc - The locale of the list data item.
Returns:
The string value for the list data item.

getValues

public List<ListItem> getValues()
Description copied from interface: ListData
Returns a list of ListItem for the default locale. If there is no list for the default locale, then try any locale in order to return a list.

Specified by:
getValues in interface ListData
Returns:
A list of ListItems.

getValues

public List<ListItem> getValues(Locale loc)
Description copied from interface: ListData
Returns a list of ListItem in the given locale.

Specified by:
getValues in interface ListData
Parameters:
loc - The locale of the ListItems.
Returns:
A list of ListItems.

getName

public String getName()
Description copied from interface: ListData
Returns the name of this list.

Specified by:
getName in interface ListData
Returns:
The name of the list.

size

public int size()
Description copied from interface: ListData
Returns the size of this list. Note: the size does not depend on the number of locales.

Specified by:
size in interface ListData
Returns:
The size of the list.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.