Package com.volantis.mcs.protocols

Examples of com.volantis.mcs.protocols.XFFormAttributes


                = new com.volantis.mcs.protocols.XFImplicitAttributes();

        // Get the enclosing form element's attributes.
        XFFormElementImpl formElement
                = (XFFormElementImpl) pageContext.getCurrentElement();
        XFFormAttributes formAttributes = formElement.getProtocolAttributes();

        // Get the enclosing form element's descriptor.
        FormDescriptor formDescriptor = formElement.getFormDescriptor();

        // Add a reference back to the form attributes.
        pattributes.setFormAttributes(formAttributes);
        pattributes.setFormData(formAttributes.getFormData());

        // Set the name.
        String name = attributes.getName();
        pattributes.setName(name);

        // Set the value.
        String value = attributes.getValue();
        pattributes.setValue(value);

        PolicyReferenceResolver resolver =
                pageContext.getPolicyReferenceResolver();

        // Set the client variable name
        TextAssetReference reference = resolver.resolveQuotedTextExpression(
                attributes.getClientVariableName());
        String clientVariableName = getPlainText(reference);

        // One of value and clientVariableName must be specified.
        if (value == null && clientVariableName == null) {
            throw new PAPIException(exceptionLocalizer.format(
                    "xfimplicit-value-or-client-variable-name"));
        }

        pattributes.setClientVariableName(clientVariableName);

        // Create the field descriptor.
        FieldDescriptor fieldDescriptor = new FieldDescriptor();
        fieldDescriptor.setName(name);
        fieldDescriptor.setType(ImplicitFieldType.getSingleton());
        fieldDescriptor.setInitialValue(value);

        // Add a reference to the field descriptor into the attributes.
        pattributes.setFieldDescriptor(fieldDescriptor);

        // Add the attributes to the list.
        formAttributes.addField(pattributes);

        // Add the field descriptor to the list.
        formDescriptor.addField(fieldDescriptor);

        return PROCESS_ELEMENT_BODY;
View Full Code Here


     */
    public XFormModelImpl(String id, EmulatedXFormDescriptor fd) {
        this.id = id;

        formDescriptor = fd;
        attributes = new XFFormAttributes();
        attributes.setId(id);
        attributes.setName(id);
        // Create the reciprocal link between the fd and form attributes.
        attributes.setFormDescriptor(formDescriptor);
        formDescriptor.setFormAttributes(attributes);
View Full Code Here

     * This method is responsible for adding a go element for an xfaction.
     */
    private Element addActionGo(DOMOutputBuffer dom,
                                  XFActionAttributes attributes) {

        XFFormAttributes formAttributes = attributes.getFormAttributes();

        Element goElement = dom.openStyledElement("go", attributes);

        // the form attributes will only be null if this is an emulated XForm
        // control, and in this case, these elements will be emulated later.
        if (!attributes.isEulatedXFormFieldAttributes()) {
            setAttribute(goElement, "href", resolveFormAction(formAttributes));
            setAttribute(goElement, "method",
                    formAttributes.getMethod().toLowerCase());
        }

        processPostFields(dom, attributes, formAttributes);

        // Close the go element.
View Full Code Here

                                     XFActionAttributes attributes) {

        // @todo 2005060816 annotate child with style information if it's not inherited from the parent
        Element refreshElement = dom.openStyledElement("refresh", attributes);

        XFFormAttributes formAttributes = attributes.getFormAttributes();
        if (formAttributes != null) {
            // Iterate over the fields in the form resetting any variables
            // associated with them to the default value.
            List fields = formAttributes.getFields();
            int count = fields.size();

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

                XFFormFieldAttributes field
View Full Code Here

    public void registerFormDescriptors(VolantisProtocol protocol) {
        Iterator modelIterator = xformModels.values().iterator();

        while (modelIterator.hasNext()) {
            XFormModel model = (XFormModel) modelIterator.next();
            final XFFormAttributes xfFormAttributes =
                    model.getXFFormAttributes();
            final EmulatedXFormDescriptor fd = model.getXFormDescriptor();

            MarinerPageContext pageContext = protocol.getMarinerPageContext();
            FormDataManager formDataManager = pageContext.getFormDataManager();

            // Store the form data in the XFFormAttributes.
            xfFormAttributes.setFormData(model.getFormData());

            // Get the form data from the session context. The act of
            // retrieving it causes it to be created if it isn't already there.
            SessionFormData formData = formDataManager.getSessionFormData(fd);
            // The fd in the session is built up over requests for subsequent
            // fragments, so add the fields found in this request to it.
            formData.addFieldDescriptors(fd.getFields());

            // Set the form specifier (which identifies the form in the
            // session) on the form descriptor and form attributes.
            String formSpecifier = formData.getFormSpecifier();
            xfFormAttributes.setFormSpecifier(formSpecifier);
            // Store everything else in the form descriptor and store it.
            fd.setFormSpecifier(formSpecifier);
            fd.setFormAttributes(xfFormAttributes);
        }
    }
View Full Code Here

        // appears) varies depending on whether this is an emulated XForm or an
        // actual XFForm. If this is representing an emulated xfform, then the
        // XFFormAttributes will not be set, but the containingXFFormAttribute
        // will be and vice versa.
        String containingXFFormName;
        XFFormAttributes formAttributes = attributes.getFormAttributes();
        if (formAttributes != null) {
            containingXFFormName = formAttributes.getName();
        } else {
            containingXFFormName = attributes.getContainingXFFormName();
        }

        // Generate an id for the sub dialog, it consists of the form id
View Full Code Here

     * @param attributes The attributes to use when generating the mark up.
     */
    public void doActionInput(DOMOutputBuffer dom,
                              XFActionAttributes attributes) {

       XFFormAttributes formAttributes = attributes.getFormAttributes();

        // if this action is being rendered in a form, then only the first
        // action should do anything in VoiceXML, the rest are ignored.
        if (formAttributes != null) {
            if (formAttributes.getActionCount() != 0) {
                if (logger.isDebugEnabled()) {
                    logger.debug("Ignoring action");
                }
                return;
            }

            formAttributes.setActionCount(1);
        }

        String value;
        Element element;

        // Generate the markup.
        // @todo 2005060816 annotate child with style information if it's not inherited from the parent
        element = dom.openStyledElement("filled", attributes);

        // set any attribute values that should be applied for all form fields.
        addFormFieldAttributes(element, attributes);

        // If the field name is set for this action then we need to initialise
        // a variable with the same name so the value will be submitted.
        String fieldName = attributes.getName();
        if (fieldName != null) {
            value = attributes.getValue();
            if (value == null) {
                value = " ";
            }
            element = dom.addElement("var");
            element.setAttribute("name", fieldName);
            element.setAttribute("expr", value);
        }

        element = dom.addElement("submit");

        // Check if processing an emulated XForm or real XFForm markup because
        // we cannot populate the submit element's next and method attributes
        // until later (after XFormEmulationTransformer) if it's emulated.
        if (formAttributes != null) {

            // Set the next and method attributes to those associated
            // with the form
            String resolvedHref = resolveFormAction(formAttributes);
            element.setAttribute("next", resolvedHref);
            element.setAttribute("method", formAttributes.getMethod());

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

TOP

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

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.