01: package com.jidesoft.grouper.date;
02:
03: import com.jidesoft.converter.ConverterContext;
04: import com.jidesoft.converter.YearNameConverter;
05: import com.jidesoft.grouper.GroupResources;
06: import com.jidesoft.grouper.GrouperContext;
07:
08: import java.util.Calendar;
09: import java.util.Locale;
10:
11: /**
12: */
13: public class DateYearGrouper extends DateGrouper {
14: public static GrouperContext CONTEXT = new GrouperContext(
15: "DateYear");
16:
17: public Object getValue(Object value) {
18: return getCalendarField(value, Calendar.YEAR);
19: }
20:
21: public String getName() {
22: return GroupResources.getResourceBundle(Locale.getDefault())
23: .getString("Date.year");
24: }
25:
26: // public static void main(String[] args) {
27: // ObjectGrouper grouper = new DateYearGrouper();
28: // Calendar calendar = Calendar.getInstance();
29: // for (int i = 0; i < 40; i++) {
30: // System.out.println(grouper.getGroupValue(calendar));
31: // calendar.roll(Calendar.YEAR, 1);
32: // }
33: // }
34:
35: @Override
36: public ConverterContext getConverterContext() {
37: return YearNameConverter.CONTEXT;
38: }
39: }
|