Examples of XFFormFieldAttributes


Examples of com.volantis.mcs.papi.XFFormFieldAttributes

    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
View Full Code Here

Examples of com.volantis.mcs.protocols.XFFormFieldAttributes

        pageContext.expects.getProtocol().returns(null);

        PrivateAccessor.setField(context, "xformBuilder", builderMock);
        assertTrue(element.getProtocolAttributes() instanceof
                XFFormFieldAttributes);
        XFFormFieldAttributes attributes =
                (XFFormFieldAttributes) element.getProtocolAttributes();
        builderMock.expects.updateControl(element.fieldDescriptor, attributes);
        fieldType.expects.doField(null, attributes);

        element.callCloseOnProtocol(context);
View Full Code Here

Examples of com.volantis.mcs.protocols.XFFormFieldAttributes

    protected XDIMEResult callOpenOnProtocol(
            XDIMEContextInternal context, XDIMEAttributes attributes)
            throws XDIMEException {
   

        XFFormFieldAttributes pattributes =
            (XFFormFieldAttributes) protocolAttributes;

        pattributes.setEntryContainerInstance(
                getPageContext(context).getCurrentContainerInstance());

        // If this element is controlled by Field Expander,
        // render the markup required by the widget
        if (parent instanceof FieldExpanderElement) {
View Full Code Here

Examples of com.volantis.mcs.protocols.XFFormFieldAttributes

    protected void callCloseOnProtocol(XDIMEContextInternal context)
            throws XDIMEException {

        // update the form and field descriptors
        XFormBuilder builder = context.getXFormBuilder();
        final XFFormFieldAttributes fieldAttributes =
                (XFFormFieldAttributes) protocolAttributes;
        builder.updateControl(fieldDescriptor, fieldAttributes);

        // effectively all xform controls are inline, so render it immediately
        FieldType fieldType = getFieldType();
View Full Code Here

Examples of com.volantis.mcs.protocols.XFFormFieldAttributes

        // 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);
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.XFFormFieldAttributes

        // process this attribute as well.
        List fields = formAttributes.getFields();
        int count = fields.size();
        for (int i = 0; i < count; i += 1) {

            XFFormFieldAttributes field
                = (XFFormFieldAttributes)fields.get(i);

            // Ignore other action fields when generating the field names.
            if (field instanceof XFActionAttributes) {
                if (field == attributes) {
                    doneThis = true;
                } else {
                    continue;
                }
            }

            // Ignore any non implicit fields which do not have an entry
            // pane set.
            if (!(field instanceof XFImplicitAttributes)
                && field.getEntryContainerInstance() == null) {
                continue;
            }

            // Add a post field entry for the field.
            addPostField(dom, field);
View Full Code Here

Examples of com.volantis.mcs.protocols.XFFormFieldAttributes

            List fields = formAttributes.getFields();
            int count = fields.size();

            for (int i = 0; i < count; i += 1) {

                XFFormFieldAttributes field
                    = (XFFormFieldAttributes)fields.get(i);

                // Ignore fields which do not have variables associated with
                // them, this includes action and implicit fields, fields which
                // have no names or which are not generated for the current page.
                String fieldName;
                if (field instanceof XFActionAttributes
                    || field instanceof XFImplicitAttributes
                    || field.getEntryContainerInstance() == null
                    || (fieldName = field.getName()) == null) {
                    continue;
                }

                // Get the initial value, if it is null then change it to an
                // empty string.
                String initialValue = getPlainText(field.getInitial());
                if (initialValue == null) {
                    initialValue = "";
                }
                Element element = dom.addElement("setvar");
                element.setAttribute("name", fieldName);
View Full Code Here

Examples of com.volantis.mcs.protocols.XFFormFieldAttributes

        List fields = attributes.getFields ();
        int count = fields.size ();

        for (int i = 0; i < count; i += 1) {
          XFFormFieldAttributes fieldAttributes
              = (XFFormFieldAttributes) fields.get (i);
          FieldDescriptor fieldDescriptor
              = fieldAttributes.getFieldDescriptor ();

          //
          // We are only interested in action fields with names
          //
          if (fieldDescriptor.getType().equals(
              ActionFieldType.getSingleton()) &&
              fieldDescriptor.getName()!=null) {
            //
            // We only want to map fields that have an initial value, otherwise
            // we should default to caption (this is the default behaviour for
            // all protocols).
            //
            if (fieldDescriptor.getInitialValue()!=null) {
                TextAssetReference caption = fieldAttributes.getCaption();
                String captionString = getPlainText(caption);
                fieldDescriptor.setFieldTag(captionString);
              fieldAttributes.setFieldDescriptor(fieldDescriptor);
            }
          }
        }
        //
        // We have done our magic for HTML so lets call the superclass tp
View Full Code Here

Examples of com.volantis.mcs.protocols.XFFormFieldAttributes

            // Set the namelist attribute to the fields defined in the
            // form attributes.
            StringBuffer buffer = new StringBuffer(URLConstants.FORM_PARAMETER);
            for (Iterator i = formAttributes.getFields().iterator(); i.hasNext();) {

                XFFormFieldAttributes field = (XFFormFieldAttributes) i.next();

                // Ignore other action fields when generating the field names.
                if (field != attributes && field instanceof XFActionAttributes) {
                    continue;
                }

                // Ignore any non implicit fields which do not have an entry pane
                // set.
                if (!(field instanceof XFImplicitAttributes)
                        && field.getEntryContainerInstance() == null) {
                    continue;
                }

                // Action fields don't have to have a name so make sure that the name
                // is set before adding to the name list.
                fieldName = field.getName();
                if (fieldName != null) {
                    buffer.append(" ").append(fieldName);
                }
            }
            element.setAttribute("namelist", buffer.toString());
View Full Code Here

Examples of com.volantis.mcs.protocols.XFFormFieldAttributes

     *
     * @param id The ID if the attributes.
     * @return The form field attributes.
     */
    public XFFormFieldAttributes getFormFieldAttributes(String id) {
        XFFormFieldAttributes attributes = null;
       
        if (formFieldRegistryMap != null) {
            attributes = (XFFormFieldAttributes)formFieldRegistryMap.get(id);
        }
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.