Author: amarkhel
Date: 2010-12-23 12:08:07 -0500 (Thu, 23 Dec 2010)
New Revision: 20785
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/utils/CalendarHelper.java
trunk/ui/input/ui/src/main/templates/calendar.template.xml
Log:
RF-9482 rich:calendar backed by String not using custom converter
- unused comment was removed in calendar.template.xml
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/utils/CalendarHelper.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/utils/CalendarHelper.java 2010-12-23
17:02:11 UTC (rev 20784)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/utils/CalendarHelper.java 2010-12-23
17:08:07 UTC (rev 20785)
@@ -53,25 +53,22 @@
if (date == null) {
return null;
}
-
Date value = null;
-
+ Converter converter = calendar.getConverter();
+ if (converter == null) {
+ Application application = facesContext.getApplication();
+ converter = application.createConverter(date.getClass());
+ }
if (date instanceof Date) {
value = (Date) date;
- } else if (date instanceof String) {
- value = convertStringToDate(facesContext, calendar, (String) date);
} else if (date instanceof Calendar) {
value = ((Calendar) date).getTime();
- } else {
- Converter converter = calendar.getConverter();
- if (converter == null) {
- Application application = facesContext.getApplication();
- converter = application.createConverter(date.getClass());
- if (converter == null) {
- throw new FacesException("Wrong attibute type or there is no
converter for custom attibute type");
- }
- }
+ } else if (converter != null){
value = convertStringToDate(facesContext, calendar,
converter.getAsString(facesContext, calendar, date));
+ } else if (date instanceof String) {
+ value = convertStringToDate(facesContext, calendar, (String) date);
+ } else {
+ throw new FacesException("Wrong attibute type or there is no converter
for custom attibute type");
}
return value;
Modified: trunk/ui/input/ui/src/main/templates/calendar.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/calendar.template.xml 2010-12-23 17:02:11 UTC
(rev 20784)
+++ trunk/ui/input/ui/src/main/templates/calendar.template.xml 2010-12-23 17:08:07 UTC
(rev 20785)
@@ -86,7 +86,7 @@
new RichFaces.ui.Calendar("#{clientId}", "#{getAsLocale(facesContext,
component).toString()}",
#{toScriptArgs(options)}).load(#{writePreloadBody(facesContext, component)});
- --></script>
+ </script>
</span>
</span>
</cc:implementation>
Show replies by date