Author: amarkhel
Date: 2010-12-22 10:34:44 -0500 (Wed, 22 Dec 2010)
New Revision: 20745
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
Log:
RF-9779 Calendar: component broken when monthLabels evaluated to null
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-12-22
15:14:43 UTC (rev 20744)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-12-22
15:34:44 UTC (rev 20745)
@@ -462,14 +462,14 @@
RenderKitUtils.addToScriptHash(map, WEEK_DAY_LABELS_SHORT, weekDayLabelsShort);
String [] monthLabels =
RenderKitUtils.asArray(calendarComponent.getMonthLabels());
- if (monthLabels == null) {
+ if (isEmptyArray(monthLabels)) {
monthLabels = dateFormat.getMonths();
monthLabels = shiftDates(monthMin, monthMax, monthLabels);
}
RenderKitUtils.addToScriptHash(map, MONTH_LABELS, monthLabels);
String [] monthLabelsShort =
RenderKitUtils.asArray(calendarComponent.getMonthLabelsShort());
- if (monthLabelsShort == null) {
+ if (isEmptyArray(monthLabelsShort)) {
monthLabelsShort = dateFormat.getShortMonths();
monthLabelsShort = shiftDates(monthMin, monthMax, monthLabelsShort);
}
@@ -500,6 +500,17 @@
return map;
}
+ private boolean isEmptyArray(String[] array) {
+ if (array != null) {
+ for (String str : array) {
+ if (str.trim().length() > 0) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
public String getStyleWithZindex(FacesContext facesContext, UIComponent component) {
AbstractCalendar calendar = (AbstractCalendar) component;
String style = HtmlUtil.concatStyles("z-index: " +
calendar.getZindex(), calendar.getStyle());
Show replies by date