org.mentawai.list
Class LocalizedListData

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

public class LocalizedListData
extends Object
implements ListData

This class implements a ListData that supports multiple locales. It is a ListData that you can construct by-hand by adding the items using the add methods. The difference of LocalizedListData from SimpleListData is that SimpleListData does not support locales, in other words, it can only be used to construct lists that will return the same list for every locale. (non-localized list)

Since:
1.9
Author:
Sergio Oliveira

Constructor Summary
LocalizedListData(String name)
           
 
Method Summary
 void add(int id, String value, Locale loc)
           
 void add(String id, String value, Locale loc)
           
 void clear()
           
 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

LocalizedListData

public LocalizedListData(String name)
Method Detail

clear

public void clear()

add

public void add(int id,
                String value,
                Locale loc)

add

public void add(String id,
                String value,
                Locale loc)

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.

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(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.

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.

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.

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.