super.onComponentPopulated(faceletContext, panel, parent);
if (panel.getChildCount() == 2) {
Application application = faceletContext.getFacesContext().getApplication();
UIViewRoot root = ComponentSupport.getViewRoot(faceletContext, parent);
UIForm form = (UIForm) application.createComponent(UIForm.COMPONENT_TYPE);
form.setRendererType(RendererTypes.FORM);
form.setId(formIdAttribute != null ? formIdAttribute.getValue(faceletContext) : root.createUniqueId());
panel.getChildren().add(form);
UIDatePicker picker = (UIDatePicker) application.createComponent(UIDatePicker.COMPONENT_TYPE);
picker.setRendererType(RendererTypes.DATE_PICKER);
picker.setFor("@auto");
picker.setId(pickerIdAttribute != null ? pickerIdAttribute.getValue(faceletContext) : root.createUniqueId());
if (picker.getAttributes().get(OnComponentCreated.MARKER) == null) {
picker.getAttributes().put(OnComponentCreated.MARKER, Boolean.TRUE);
picker.onComponentCreated(faceletContext.getFacesContext(), panel);
}
if (markupAttribute != null) {
if (markupAttribute.isLiteral()) {
picker.setMarkup(Markup.valueOf(markupAttribute.getValue()));
} else {
ValueExpression expression = markupAttribute.getValueExpression(faceletContext, Object.class);
ELAdaptor.setExpression(picker, Attributes.MARKUP, expression);
}
}
form.getChildren().add(picker);
}
}