// initialise the attributes common to all XDIME elements
initialiseCommonAttributes(context, attributes);
// initialise the attributes common to all xforms control elements
XFFormFieldAttributes pattributes =
(XFFormFieldAttributes) protocolAttributes;
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Saving partially complete form control");
}
// the title attribute is used as the prompt
String title = getAttribute(com.volantis.mcs.xdime.XDIMEAttribute.TITLE, attributes);
pattributes.setPrompt(new LiteralTextAssetReference(title));
// Set the entry container (caption will be set by XFLabelElementImpl).
pattributes.setEntryContainerInstance(
getPageContext(context).getCurrentContainerInstance());
// Set the initial value.
final String ref = getAttribute(com.volantis.mcs.xdime.XDIMEAttribute.REF, attributes);
final String modelID = getAttribute(com.volantis.mcs.xdime.XDIMEAttribute.MODEL, attributes);
// Set the name attribute (use the value of the ref or submission
// attribute depending on the element type)
setNameAttribute(attributes);
final XFormBuilder builder = context.getXFormBuilder();
// determine the model that this control should appear in
XFormModel model = builder.registerControl(attributes);
pattributes.setContainingXFFormName(model.getID());
setInitialValue(builder, ref, modelID);
// populate the field descriptor
fieldDescriptor.setType(getFieldType());
// Add a reference to the field descriptor into the attributes.
pattributes.setFieldDescriptor(fieldDescriptor);
// Add a reference to the (incomplete) form data into the attributes.
pattributes.setFormAttributes(model.getXFFormAttributes());
pattributes.setFormData(model.getFormData());
// do any element specific initialisation
initialiseElementSpecificAttributes(context, attributes);
}