// javadoc inherited
protected int exprElementStart(
MarinerRequestContext context,
PAPIAttributes papiAttributes)
throws PAPIException {
LabelAttributes attributes = (LabelAttributes) papiAttributes;
// A new output buffer is required to capture the content of the label
// element (the content model indicates the use of "phrase" group
// elements and text)
// NB: The allocation mechanism must be compatible with the
// de-allocation mechanism used in
// {@link MenuElement#releaseLabelOutputBuffers}
MarinerPageContext pageContext =
ContextInternals.getMarinerPageContext(context);
content = pageContext.getProtocol().
getOutputBufferFactory().createOutputBuffer();
pageContext.pushOutputBuffer(content);
try {
MenuModelBuilder builder = pageContext.getMenuBuilder();
String title = attributes.getTitle();
// Action the builder to construct the label in the menu model
builder.startLabel();
// Set the stylistic information in the model for this element.
MenuInternals.setElementDetails(builder, attributes,
pageContext.getStylingEngine().getStyles());
// The label has events, style and pane, so handle these
MenuInternals.setEvents(builder, attributes, pageContext);
// Set the pane attribute
MenuInternals.setPane(builder, attributes.getPane(), pageContext);
// Handle the title
if (title != null) {
builder.setTitle(title);
}