01: /*
02: * Created on 13-Jan-2006
03: */
04: package uk.org.ponder.dateutil;
05:
06: import java.text.DateFormatSymbols;
07: import java.util.List;
08:
09: import uk.org.ponder.beanutil.BeanResolver;
10: import uk.org.ponder.localeutil.LocaleReceiver;
11: import uk.org.ponder.stringutil.StringList;
12:
13: /** A bean exposing an indexed range of month names, for a particular Locale.
14: * This bean is expected best used at a short scope (request). **/
15:
16: public class MonthBean extends LocaleReceiver {
17: public static String[] indexarray = { "01", "02", "03", "04", "05",
18: "06", "07", "08", "09", "10", "11", "12" };
19: public static StringList indexes = new StringList(indexarray);
20:
21: private DateFormatSymbols formatsymbols;
22:
23: public void init() {
24: formatsymbols = new DateFormatSymbols(getLocale());
25: }
26:
27: public List getIndexes() {
28: return indexes;
29: }
30:
31: public BeanResolver getNames() {
32: return new BeanResolver() {
33: public String resolveBean(Object bean) {
34: int indexvalue = Integer.parseInt((String) bean);
35: return formatsymbols.getMonths()[indexvalue - 1];
36: }
37: };
38: }
39: }
|