Author: akushunin
Date: 2007-10-03 09:05:34 -0400 (Wed, 03 Oct 2007)
New Revision: 3224
Modified:
trunk/ui/calendar/src/main/config/component/calendar.xml
trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
Log:
RF-933
Modified: trunk/ui/calendar/src/main/config/component/calendar.xml
===================================================================
--- trunk/ui/calendar/src/main/config/component/calendar.xml 2007-10-03 12:24:54 UTC (rev
3223)
+++ trunk/ui/calendar/src/main/config/component/calendar.xml 2007-10-03 13:05:34 UTC (rev
3224)
@@ -86,9 +86,9 @@
</description>
<defaultvalue>getDefaultTimeZone()</defaultvalue>
</property>
- <property elonly="true">
+ <property>
<name>preloadDateRangeBegin</name>
- <classname>java.util.Date</classname>
+ <classname>java.lang.Object</classname>
<description>
Define the initial range of date which will be loaded to
client from dataModel under rendering
@@ -97,9 +97,9 @@
getDefaultPreloadBegin(getCurrentDateOrDefault())
</defaultvalue>
</property>
- <property elonly="true">
+ <property>
<name>preloadDateRangeEnd</name>
- <classname>java.util.Date</classname>
+ <classname>java.lang.Object</classname>
<description>
Defines the last range of date which will be loaded to
client from dataModel under rendering
@@ -108,9 +108,9 @@
getDefaultPreloadEnd(getCurrentDateOrDefault())
</defaultvalue>
</property>
- <property elonly="true">
+ <property >
<name>currentDate</name>
- <classname>java.util.Date</classname>
+ <classname>java.lang.Object</classname>
<description>Defines current date</description>
</property>
<property>
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-03
12:24:54 UTC (rev 3223)
+++ trunk/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-10-03
13:05:34 UTC (rev 3224)
@@ -79,17 +79,17 @@
public abstract void setTimeZone(TimeZone timeZone);
- public abstract Date getPreloadDateRangeBegin();
+ public abstract Object getPreloadDateRangeBegin();
- public abstract void setPreloadDateRangeBegin(Date date);
+ public abstract void setPreloadDateRangeBegin(Object date);
- public abstract Date getPreloadDateRangeEnd();
+ public abstract Object getPreloadDateRangeEnd();
- public abstract void setPreloadDateRangeEnd(Date date);
+ public abstract void setPreloadDateRangeEnd(Object date);
- public abstract Date getCurrentDate();
+ public abstract Object getCurrentDate();
- public abstract void setCurrentDate(Date date);
+ public abstract void setCurrentDate(Object date);
public abstract CalendarDataModel getDataModel();
@@ -222,7 +222,7 @@
public Date getCurrentDateOrDefault() {
- Date date = getCurrentDate();
+ Date date = getAsDate(getCurrentDate());
if (date != null) {
return date;
@@ -405,7 +405,7 @@
} else {
Date currentDate1 = dateChangeEvent.getCurrentDate();
- Date currentDate2 = getCurrentDate();
+ Date currentDate2 = getAsDate(getCurrentDate());
if (!currentDate1.equals(currentDate2)) {
updateCurrentDate(facesContext, currentDate1);
ValueChangeEvent changeEvent = new ValueChangeEvent(
@@ -443,8 +443,8 @@
}
public Date[] getPreloadDateRange() {
- Date dateRangeBegin = this.getPreloadDateRangeBegin();
- Date dateRangeEnd = this.getPreloadDateRangeEnd();
+ Date dateRangeBegin = getAsDate(this.getPreloadDateRangeBegin());
+ Date dateRangeEnd = getAsDate(this.getPreloadDateRangeEnd());
if (dateRangeBegin == null && dateRangeEnd == null) {
return null;
Modified:
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
---
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-10-03
12:24:54 UTC (rev 3223)
+++
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-10-03
13:05:34 UTC (rev 3224)
@@ -232,31 +232,19 @@
UICalendar input = (UICalendar) component;
// XXX nick - nick - can contain either Date or String instance
- Object value = input.getSubmittedValue();
- Object curVal = input.getValue();
- if (value == null) {
+ Date value = input.getAsDate(input.getSubmittedValue());
+ Date curVal = input.getAsDate(input.getValue());
+
DateTimeConverter converter = new DateTimeConverter();
converter.setPattern(input.getDatePattern());
converter.setLocale(input.getLocale());
converter.setTimeZone(input.getTimeZone());
+ if (value == null) {
return converter.getAsString(context, input, curVal);
+ }else{
+ return converter.getAsString(context, input, value);
}
- if (value instanceof Date) {
-
- DateTimeConverter converter = new DateTimeConverter();
- converter.setPattern(input.getDatePattern());
- converter.setLocale(input.getLocale());
- return converter.getAsString(context, input, value);
- }
- if (value instanceof String) {
-
- Converter converter = SelectUtils.getConverterForProperty(context,
- input, "value");
- return converter.getAsString(context, input, value);
-
- }
- return null;
}
public void writeSymbols(FacesContext facesContext, UICalendar calendar)
@@ -358,18 +346,13 @@
public String getSelectedDate(FacesContext context, UICalendar calendar)
throws IOException {
- Object submittedValue = calendar.getSubmittedValue();
+ Date submittedValue = calendar.getAsDate(calendar.getSubmittedValue());
Date date;
- if (submittedValue instanceof String) {
- Converter converter = SelectUtils.getConverterForProperty(context,
- calendar, "value");
- date = (Date) converter.getAsObject(context, calendar,
- (String) submittedValue);
- } else if (submittedValue != null) {
- date = (Date) submittedValue;
+ if (submittedValue != null) {
+ date = submittedValue;
} else {
- date = (Date) calendar.getValue();
+ date = calendar.getAsDate(calendar.getValue());
}
if (date != null) {
Show replies by date