Author: nbelaevski
Date: 2007-07-31 10:09:51 -0400 (Tue, 31 Jul 2007)
New Revision: 1952
Modified:
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
Log:
MonthLabels & MonthLabelsShort contained empty entries - fixed
Modified:
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
---
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-07-31
14:01:34 UTC (rev 1951)
+++
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-07-31
14:09:51 UTC (rev 1952)
@@ -266,9 +266,9 @@
}
}
- private static String[] shiftDates(int firstDayOfWeek, int minimum,
+ private static String[] shiftDates(int minimum,
int maximum, String[] labels) {
- if (minimum == 0) {
+ if (minimum == 0 && (maximum - minimum + 1 == labels.length)) {
return labels;
}
@@ -286,7 +286,6 @@
Calendar cal = calendar.getCalendar();
int maximum = cal.getActualMaximum(Calendar.DAY_OF_WEEK);
int minimum = cal.getActualMinimum(Calendar.DAY_OF_WEEK);
- int firstDayOfWeek = cal.getFirstDayOfWeek();
// .getInstance(locale) changed to new DateFormatSymbols(locale) by
// Alexej Kushunin ;
@@ -295,7 +294,7 @@
.getWeekDayLabels());
if (weekDayLabels == null) {
weekDayLabels = symbols.getWeekdays();
- weekDayLabels = shiftDates(firstDayOfWeek, minimum, maximum,
+ weekDayLabels = shiftDates(minimum, maximum,
weekDayLabels);
}
@@ -303,19 +302,26 @@
.getWeekDayLabelsShort());
if (weekDayLabelsShort == null) {
weekDayLabelsShort = symbols.getShortWeekdays();
- weekDayLabelsShort = shiftDates(firstDayOfWeek, minimum, maximum,
+ weekDayLabelsShort = shiftDates(minimum, maximum,
weekDayLabelsShort);
}
+ int monthMax = cal.getActualMaximum(Calendar.MONTH);
+ int monthMin = cal.getActualMinimum(Calendar.MONTH);
+
String[] monthLabels = ComponentUtil.asArray(calendar.getMonthLabels());
if (monthLabels == null) {
monthLabels = symbols.getMonths();
+ monthLabels = shiftDates(monthMin, monthMax,
+ monthLabels);
}
String[] monthLabelsShort = ComponentUtil.asArray(calendar
.getMonthLabelsShort());
if (monthLabelsShort == null) {
monthLabelsShort = symbols.getShortMonths();
+ monthLabelsShort = shiftDates(monthMin, monthMax,
+ monthLabelsShort);
}
map.put(WEEK_DAY_LABELS, weekDayLabels);
Show replies by date