if (parent instanceof XFormsControlElement ||
parent instanceof XFItemElementImpl) {
// retrieve the parent's attributes... because this is the
// label for a control or item.
CaptionAwareXFFormAttributes attributes =
(CaptionAwareXFFormAttributes)
((StyledXFormsElement)parent).getProtocolAttributes();
final MarinerPageContext pageContext = getPageContext(context);
final Styles labelStyles =
pageContext.getStylingEngine().getStyles();
attributes.setCaptionStyles(labelStyles);
// Process the caption as a mariner expression.
final String labelText = getCharData();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("XForms control|item label: " + labelText);
}
PolicyReferenceResolver resolver =
pageContext.getPolicyReferenceResolver();
TextAssetReference caption =
resolver.resolveQuotedTextExpression(labelText);
attributes.setCaption(caption);
// The caption container instance will have been set to the
// current container as part of initialising the attributes.
final ContainerInstance captionContainer =
pageContext.getCurrentContainerInstance();
attributes.setCaptionContainerInstance(captionContainer);
}
}
}