public void encodeBegin(FacesContext facesContext,
UIComponent component) throws IOException {
UIDatePicker link = (UIDatePicker) component;
DatePickerController datePickerController = new DatePickerController();
UIDateInput dateInput = (UIDateInput) link.getForComponent();
if (dateInput == null) {
LOG.error("No required UIDateInput component found.");
return;
}
if (dateInput.getValueBinding(TobagoConstants.ATTR_READONLY) != null) {
link.setValueBinding(TobagoConstants.ATTR_DISABLED, dateInput.getValueBinding(TobagoConstants.ATTR_READONLY));
} else {
if (dateInput.getValueBinding(TobagoConstants.ATTR_DISABLED) != null) {
link.setValueBinding(TobagoConstants.ATTR_DISABLED, dateInput.getValueBinding(TobagoConstants.ATTR_DISABLED));
} else {
link.setDisabled(dateInput.isReadonly() || dateInput.isDisabled());
}
}
String idPrefix = dateInput.getId() + "_picker";
Map<String, Object> attributes = link.getAttributes();
link.setActionListener(datePickerController);
attributes.put(ATTR_LAYOUT_WIDTH, getConfiguredValue(facesContext, component, "pickerWidth"));
UIComponent hidden = (UIComponent) link.getChildren().get(0);
hidden.setId(idPrefix + "Dimension");