org.mentawai.list
Class I18nListData

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

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

Constructor Detail

I18nListData

public I18nListData(java.lang.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(java.lang.String id,
                java.lang.String i18nKey)
Parameters:
id - the id value
i18nKey - the i18n key

getValue

public java.lang.String getValue(java.lang.String id,
                                 java.util.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 java.lang.String getValue(java.lang.String id)
Description copied from interface: ListData
Returns the strign value fo 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 strint value of the list data item.

getValue

public java.lang.String getValue(int id,
                                 java.util.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 java.util.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 java.util.List<ListItem> getValues(java.util.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 java.lang.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 java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2005 Mentawai Team. All Rights Reserved.