I have composite JSF component TimePicker.xhtml
with a backing component timePickerComponent
which is used as below:
<mi:timePicker style="display: initial;"
widgetVar="toTimepickerWidget"
converter="#{timePickerConverter}"
value="#{calendarBean.event.to}"
/>
And timePickerConverter
created in usual way:
public class TimePickerConverter implements Converter, Serializable {
@Override
public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2)
throws ConverterException {
// TODO Auto-generated method stub
return null;
}
@Override
public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2)
throws ConverterException {
// TODO Auto-generated method stub
return null;
}
}
How can I use this converter in composite component?
UPDATE:
This is code of the Composite Component:
<cc:implementation componentType="timePickerComponent">
<h:outputScript name="js/timepicker/timepicker_helper.js" target="head"/>
<div id="#{cc.clientId}" style="#{cc.attrs.style}">
<p:inputText id="timepicker"
scrollHeight="200"
value="#{cc.timeLocal}"
size="5"/>
</div>
</cc:implementation>
Basically what do I want is to convert plain text from inputText
to Date
object. Date's part irrelevant for me, I only need Time's part of the object.
Btw, as a temporary solution I'll use getConvertedValue
as described in this article from BalusC Composite component with multiple input fieldsBut would like to know how to delegate this functionality to an external converter too, as described in the article
Normally this method is not to be overridden and everything is delegated to default JSF Converter mechanisms