Author: akushunin
Date: 2007-10-08 06:12:13 -0400 (Mon, 08 Oct 2007)
New Revision: 3290
Modified:
trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
Log:
RF-1073
Modified: trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
===================================================================
--- trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-10-05
23:30:08 UTC (rev 3289)
+++ trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-10-08
10:12:13 UTC (rev 3290)
@@ -53,6 +53,9 @@
import org.richfaces.model.CalendarDataModelItem;
import org.richfaces.renderkit.CalendarRendererBase;
+import java.text.DateFormat;
+
+
// import org.richfaces.renderkit.html.BaseGradient.Data;
/**
@@ -191,16 +194,30 @@
super.validateValue(context, newValue);
}
- public void updateCurrentDate(FacesContext context, Date currentDate) {
+ public void updateCurrentDate(FacesContext context, Object currentDate) {
if (context == null) {
throw new NullPointerException();
}
+ //RF-1073
try {
ValueBinding vb = getValueBinding("currentDate");
if (vb != null) {
- vb.setValue(context, currentDate);
- return;
+ if(vb.getType(context).equals(String.class)){
+ DateTimeConverter convert = new DateTimeConverter();
+ convert.setLocale(getLocale());
+ convert.setPattern(getDatePattern());
+ vb.setValue(context,convert.getAsString(context, this, currentDate));
+ return;
+ }else if(vb.getType(context).equals(Calendar.class)){
+ Calendar c = Calendar.getInstance();
+ c.setTime((Date) currentDate);
+ vb.setValue(context, c);
+ return;
+ }else{
+ vb.setValue(context, currentDate);
+ return;
+ }
} else {
setCurrentDate(currentDate);
}