[
https://issues.apache.org/jira/browse/TOMAHAWK-3?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Leonardo Uribe resolved TOMAHAWK-3.
-----------------------------------
Resolution: Fixed
Fix Version/s: 1.1.9-SNAPSHOT
Assignee: Leonardo Uribe
DelegateConverter was implemented on MYFACES-1741
The following code was added:
try
{
// value = RendererUtils.getDateValue(inputCalendar);
Converter converter = getConverter(inputCalendar);
if (converter instanceof DateConverter)
{
value = ((DateConverter) converter).getAsDate(facesContext,
component);
}
else
{
//value = RendererUtils.getDateValue(inputCalendar);
Object objectValue = RendererUtils.getObjectValue(component);
if (objectValue == null || objectValue instanceof Date)
{
value = (Date) objectValue;
}
else
{
//Use Converter.getAsString and convert to date using
String stringValue = converter.getAsString(facesContext,
component, objectValue);
if(stringValue ==null || stringValue.trim().length()==0
||stringValue.equals(getHelperString(inputCalendar)))
{
value = null;
}
else
{
String formatStr =
CalendarDateTimeConverter.createJSPopupFormat(facesContext,
inputCalendar.getPopupDateFormat());
Calendar timeKeeper =
Calendar.getInstance(currentLocale);
int firstDayOfWeek = timeKeeper.getFirstDayOfWeek() - 1;
org.apache.myfaces.dateformat.DateFormatSymbols symbols
= new org.apache.myfaces.dateformat.DateFormatSymbols(currentLocale);
SimpleDateFormatter dateFormat = new
SimpleDateFormatter(formatStr, symbols, firstDayOfWeek);
value = dateFormat.parse(stringValue);
}
}
}
}
catch (IllegalArgumentException illegalArgumentException)
{
value = null;
}
It just try to parse the value from Converter.getAsString, so
HtmlCalendarRenderer can render it.
> inputCalendar with CalendarConverter loses value data
> -----------------------------------------------------
>
> Key: TOMAHAWK-3
> URL: https://issues.apache.org/jira/browse/TOMAHAWK-3
> Project: MyFaces Tomahawk
> Issue Type: Bug
> Components: Calendar
> Environment: windows xp pro
> Reporter: Sven Vogt
> Assignee: Leonardo Uribe
> Fix For: 1.1.9-SNAPSHOT
>
>
> When I set a Converter for java.util.Calendar to inputCalendar, the value
> will not be rendered.
> <t:inputCalendar id="calendar_1"
> value="#{exampleInputBean.calendar}"
> renderAsPopup="true">
> <f:converter converterId="de.orgaplan.faces.CalendarConverter" />
> </t:inputCalendar>
> Because the HtmlCalendarRenderer throws an IllegalArgumentException and set
> the value to null.
> My Converter is not an Instance of DateConverter.
> Date value;
> try
> {
> // value = RendererUtils.getDateValue(inputCalendar);
> Converter converter = getConverter(inputCalendar);
> if (converter instanceof DateConverter)
> {
> value = ((DateConverter) converter).getAsDate(facesContext,
> component);
> }
> else
> {
> value = RendererUtils.getDateValue(inputCalendar);
> }
> }
> catch (IllegalArgumentException illegalArgumentException)
> {
> value = null;
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.