|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mentawai.list.BaseListData
public class BaseListData
A base implementation for a ListData that will load files and sort. The files should be i18n files inside a given directory (or the default). Sorting is supported and can be by id, by value or by the order they appear in the file.
| Field Summary | |
|---|---|
static int |
ORDER_BY_FILE
Sort the list according to the order they appear inside the filename (don't sort) |
static int |
ORDER_BY_ID
Sort the list according to the id (key) values, which can be integers |
static int |
ORDER_BY_STRING_ID
Sort the list according to the id (key) values, which can be strings |
static int |
ORDER_BY_VALUE
Sort the list according to item values, which are strings |
| Constructor Summary | |
|---|---|
BaseListData(java.lang.String listname)
Creates a new BaseListData, looking for files inside the default directory "/lists", and using the default sort order ORDER_BY_VALUE. |
|
BaseListData(java.lang.String listname,
int ordertype)
Creates a new BaseListData, looking for files inside the default directory "/lists". |
|
BaseListData(java.lang.String listname,
int ordertype,
java.lang.String listDir)
Creates a new BaseListData |
|
| Method Summary | |
|---|---|
java.lang.String |
getName()
The name of this list, for example "genders" |
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)
Given an id and a locale return the list item value. |
java.util.List<ListItem> |
getValues()
Returns a list of ListItem for the default locale. |
java.util.List<ListItem> |
getValues(java.util.Locale loc)
Return a list of ListItem objects so you can print the whole list for this locale. |
int |
size()
The size of the list, for example a "genders" list should have 2 items. |
protected void |
sort(java.util.List<ListItem> list,
int ordertype)
Sort the list acording to the order type. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ORDER_BY_ID
public static final int ORDER_BY_STRING_ID
public static final int ORDER_BY_VALUE
public static final int ORDER_BY_FILE
| Constructor Detail |
|---|
public BaseListData(java.lang.String listname,
int ordertype,
java.lang.String listDir)
throws java.io.IOException
listname - The name of the listordertype - How this list should be sortedlistDir - The directory where to look for list files.
java.io.IOException
public BaseListData(java.lang.String listname,
int ordertype)
throws java.io.IOException
listname - The name of the listordertype - How this list should be sorted.
java.io.IOException
public BaseListData(java.lang.String listname)
throws java.io.IOException
listname - The name of the list
java.io.IOException| Method Detail |
|---|
public java.lang.String getName()
getName in interface ListDatapublic int size()
size in interface ListDatapublic java.util.List<ListItem> getValues(java.util.Locale loc)
getValues in interface ListDataloc - The locale of the list
public java.util.List<ListItem> getValues()
ListData
getValues in interface ListData
public java.lang.String getValue(java.lang.String id,
java.util.Locale loc)
getValue in interface ListDataid - The id of the list itemloc - The locale of the list from where to get the value.
public java.lang.String getValue(java.lang.String id)
ListData
getValue in interface ListData
public java.lang.String getValue(int id,
java.util.Locale loc)
ListData
getValue in interface ListDataid - The id of the list data item.loc - The locale of the list data item.
protected void sort(java.util.List<ListItem> list,
int ordertype)
list - The list of ListItems to sort.ordertype - The order type (how to sort)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||