super.onComponentPopulated(faceletContext, panel, parent);
if (panel.getChildCount() == 2) {
Application application = faceletContext.getFacesContext().getApplication();
UIViewRoot root = ComponentUtils.findViewRoot(faceletContext, parent);
UIForm form = (UIForm) application.createComponent(UIForm.COMPONENT_TYPE);
form.setRendererType(RendererTypes.FORM);
final String formId = formIdAttribute != null
? formIdAttribute.getValue(faceletContext)
: "_tx_" + faceletContext.generateUniqueId("form");
form.setId(formId);
panel.getChildren().add(form);
UIDatePicker picker = (UIDatePicker) application.createComponent(UIDatePicker.COMPONENT_TYPE);
picker.setRendererType(RendererTypes.DATE_PICKER);
picker.setFor("@auto");
final String pickerId = pickerIdAttribute != null
? pickerIdAttribute.getValue(faceletContext)
: "_tx_" + faceletContext.generateUniqueId("picker");
picker.setId(pickerId);
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);
picker.setValueExpression(Attributes.MARKUP, expression);
}
}
form.getChildren().add(picker);
}
}