Package com.volantis.mcs.protocols

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


    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

    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

        // 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

        // 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

            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

        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

            // 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

     *
     * @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

                FieldAttributes fieldAttributes = (FieldAttributes) fieldsIterator.next();

                // Get attributes of refered input element.
                String inputId = fieldAttributes.getRef();

                XFFormFieldAttributes formFieldAttributes = actualProtocol.getFormFieldAttributes(inputId);

                // If no attributes were found, it means that the refered text
                // input field
                // does not exist. In that case, don't render it.
                if (formFieldAttributes != null) {
                    // Render comma, if this is not the first rendered field.
                    if (!firstField) {
                        scriptWriter.write(", ");
                    }

                    // Get styles of the input element.
                    stylesExtractor.setStyles(formFieldAttributes.getStyles());

                    stylesExtractor.setPseudoClass(null);

                    // Render field name, which equals to ID of the input
                    // element.
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.XFFormFieldAttributes

Copyright © 2018 www.massapicom. 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.