}
@Override
protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException
{
UIDecorate decorate = (UIDecorate) component;
storeOriginalValues(storeOriginals, Contexts.getEventContext());
Contexts.getEventContext().set("invalid", Decoration.hasMessage(decorate, context));
Contexts.getEventContext().set("required", Decoration.hasRequired(component, context));
boolean hasMessage = decorate.hasMessage();
if (decorate.isEnclose())
{
writer.startElement(decorate.getElement(), decorate);
if (decorate.getStyleClass() != null)
{
writer.writeAttribute(HTML.CLASS_ATTR, decorate.getStyleClass(), HTML.CLASS_ATTR);
}
if (decorate.getStyle() != null)
{
writer.writeAttribute(HTML.STYLE_ATTR, decorate.getStyle(), HTML.STYLE_ATTR);
}
writer.writeAttribute("id", decorate.getClientId(context), "id");
}
UIComponent aroundDecoration = decorate.getDecoration("aroundField");
UIComponent aroundInvalidDecoration = decorate.getDecoration("aroundInvalidField");
if (aroundDecoration != null && !hasMessage)
{
aroundDecoration.setParent(decorate);
aroundDecoration.encodeBegin(context);
}