1
2
3
4
5
6
7
8
9
10
11 package de.jaret.util.date.iterator;
12
13 import de.jaret.util.date.JaretDate;
14
15
16
17
18
19
20
21 public class MonthIterator extends AbstractDateIterator implements DateIterator {
22
23 protected IIteratorFormatter _defaultFormatter = new IIteratorFormatter() {
24
25
26
27
28 public String getLabel(JaretDate date, Format format) {
29 if (format.equals(Format.SHORT)) {
30 return Integer.toString(date.getMonth()) + ".";
31 } else if (format.equals(Format.MEDIUM)) {
32 return date.getShortMonthString() + " " + date.getYear();
33 } else {
34 return date.getMonthString() + " " + date.getYear();
35 }
36 }
37 };
38
39
40
41
42 protected void advanceDate(JaretDate date) {
43 date.advanceMonths(1);
44 }
45
46
47
48
49 public long getApproxStepMilliSeconds() {
50 return 31L * 24L * 60L * 60L * 1000L;
51 }
52
53
54
55
56 protected JaretDate correctStartDate(JaretDate date) {
57 date.setTime(0, 0, 0);
58 date.setDay(1);
59 return date;
60 }
61
62
63
64
65 protected IIteratorFormatter getDefaultFormatter() {
66 return _defaultFormatter;
67 }
68
69 }