protected int exprElementStart(
MarinerRequestContext context,
PAPIAttributes papiAttributes)
throws PAPIException {
XFFormFieldAttributes attributes =
(XFFormFieldAttributes) papiAttributes;
// If this field is not active then do nothing, the default active state
// is true.
String value = attributes.getActive();
boolean active = (value == null || "true".equalsIgnoreCase(value));
if (!active) {
if (logger.isDebugEnabled()) {
logger.debug("Ignoring element as it is inactive");
}
skipped = true;
return SKIP_ELEMENT_BODY;
}
// Get the page context.
MarinerPageContext pageContext
= ContextInternals.getMarinerPageContext(context);
// Some XFFormField elements do not have to be inside a form.
PAPIElement enclosingElement = pageContext.getCurrentElement();
XFFormElementImpl formElement;
if (enclosingElement instanceof XFFormElementImpl) {
formElement = (XFFormElementImpl) enclosingElement;
} else {
if (allowedInline) {
formElement = null;
} else {
throw new PAPIException(exceptionLocalizer.format(
"element-parent-not-form"));
}
}
// Check to make sure that we are not working inline.
if (formElement != null) {
// Get the enclosing form element's attributes.
formAttributes = formElement.getProtocolAttributes();
// Get the enclosing form element's descriptor.
formDescriptor = formElement.getFormDescriptor();
// If the current form is fragmented then we may not have to output
// anything for this field in the current fragment but we still need to
// create its descriptor.
fieldDescriptor = new FieldDescriptor();
fieldDescriptor.setName(attributes.getName());
fieldDescriptor.setInitialValue(getInitialValue(pageContext,
attributes));
fieldDescriptor.setType(getFieldType(attributes));
// Add the field descriptor to the form's descriptor.
formDescriptor.addField(fieldDescriptor);
}
// Check the panes to see whether we actually have to output anything.
if (checkPaneInstances(pageContext,
attributes.getCaptionPane(),
attributes.getEntryPane()) == SKIP_ELEMENT_BODY) {
skipped = true;
return SKIP_ELEMENT_BODY;
}
// At this point at least one of the panes will be non null and for those