PAPIAttributes papiAttributes) throws PAPIException {
XFContentAttributes attributes = (XFContentAttributes) papiAttributes;
// Get the page context.
MarinerPageContext pageContext
= ContextInternals.getMarinerPageContext(context);
// Get the enclosing form element's attributes.
XFFormElementImpl formElement
= (XFFormElementImpl) pageContext.getCurrentElement();
com.volantis.mcs.protocols.XFFormAttributes formAttributes =
formElement.getProtocolAttributes();
String paneName = attributes.getPane();
Pane pane = null;
if (null == paneName) {
FormInstance form = (FormInstance) formAttributes.getFormData();
pane = ((Form) form.getFormat()).getDefaultPane();
paneName = pane.getName();
}
FormatReference formatRef =
FormatReferenceParser.parsePane(paneName, pageContext);
NDimensionalIndex paneIndex = formatRef.getIndex();
if (null == pane) {
// get hold of the Pane via it's FormatReference
pane = pageContext.getPane(formatRef.getStem());
if (null == pane) {
// nothing to do, skip both the content and the end tag
skipEndTag = true;
return SKIP_ELEMENT_BODY;
}
}
paneInstance = (AbstractPaneInstance)
pageContext.getFormatInstance(pane, paneIndex);
if (paneInstance.ignore()) {
skipEndTag = true;
return SKIP_ELEMENT_BODY;
}
VolantisProtocol protocol = pageContext.getProtocol();
buffer = protocol.getOutputBufferFactory().createOutputBuffer();
if (buffer == null) {
throw new PAPIException(exceptionLocalizer.format(
"output-buffer-allocation-failure"));
}
pattributes = new com.volantis.mcs.protocols.XFContentAttributes();
pattributes.setPane(pane);
pattributes.setOutputBuffer(buffer);
pattributes.setStyles(pageContext.getStylingEngine().getStyles());
// Create the field descriptor.
FieldDescriptor fieldDescriptor = new FieldDescriptor();
fieldDescriptor.setType(ContentFieldType.getSingleton());
// Add a reference to the field descriptor into the attributes.
pattributes.setFieldDescriptor(fieldDescriptor);
// Add the attributes to the list.
formAttributes.addField(pattributes);
pageContext.pushContainerInstance(paneInstance);
pageContext.pushOutputBuffer(buffer);
return PROCESS_ELEMENT_BODY;
}