Examples of XFFormAttributes


Examples of com.volantis.mcs.protocols.XFFormAttributes

        // Create test objects
        domFactory = DOMFactory.getDefaultInstance();
        final String action1 = "http://www.volantis.com";
        default_FD = new EmulatedXFormDescriptor(action1, "get", "s1");
        default_FD.setContainingFormName("__DEFAULT__");
        XFFormAttributes formAttributes1 = new XFFormAttributes();
        final FragmentableFormData form =
                new FragmentableFormData(default_FD, -1, false, new ArrayList());
        formAttributes1.setFormData(form);
        formAttributes1.setAction(new LiteralLinkAssetReference(action1));
        default_FD.setFormAttributes(formAttributes1);

        final String action2 = "http://www.smudge.com";
        FD2 = new EmulatedXFormDescriptor(action2, "get", "s2");
        FD2.setContainingFormName("model2");
        XFFormAttributes formAttributes2 = new XFFormAttributes();
        final FragmentableFormData form2 =
                new FragmentableFormData(FD2, -1, false, new ArrayList());
        formAttributes2.setFormData(form2);
        formAttributes2.setAction(new LiteralLinkAssetReference(action2));
        FD2.setFormAttributes(formAttributes2);

        final String action3 = "http://www.volantis.com/delivery";
        FD3 = new EmulatedXFormDescriptor(action3, "get", "s3");
        FD3.setContainingFormName("model3");
        XFFormAttributes formAttributes3 = new XFFormAttributes();
        final FragmentableFormData form3 =
                new FragmentableFormData(FD3, -1, false, new ArrayList());
        formAttributes3.setFormData(form3);
        formAttributes3.setAction(new LiteralLinkAssetReference(action3));
        FD3.setFormAttributes(formAttributes3);

        // set expectations
        psf.expects.getDOMFactory().returns(domFactory);
        pageContext.expects.getEmulatedXFormDescriptor("__DEFAULT__").returns(default_FD);
View Full Code Here

Examples of com.volantis.mcs.protocols.XFFormAttributes

    public void testDoImplicitValue() throws Exception {
        final XFImplicitAttributes attributes =
                (XFImplicitAttributes) ProtocolIntegrationTestHelper.
                provideAttributes(XFImplicitAttributes.class);

        XFFormAttributes formAttributes = new XFFormAttributes();
        Form form = new Form(new CanvasLayout());
        attributes.setFormAttributes(formAttributes);

        final VolantisProtocol protocol = getProtocol();
View Full Code Here

Examples of com.volantis.mcs.protocols.XFFormAttributes

        xdimeAttributes.expects.getValue("", XDIMEAttribute.SUBMISSION.toString()).
                returns(null);

        builder.registerControl(xdimeAttributes);

        XFFormAttributes attributes = model.getXFFormAttributes();
        EmulatedXFormDescriptor fd = model.getXFormDescriptor();

        assertNotNull(attributes);
        assertEquals(MODEL_ID, attributes.getId());
        assertEquals(MODEL_ID, attributes.getName());
        assertTrue(attributes.getFields().isEmpty());
        assertNotNull(fd);
        assertEquals(MODEL_ID, fd.getContainingFormName());
        assertTrue(fd.getFields().isEmpty());

        FieldDescriptor fieldDescriptor = new FieldDescriptor();
        XFFormFieldAttributesMock fieldAttributes =
                new XFFormFieldAttributesMock("fieldAttributes", expectations);
        builder.updateControl(fieldDescriptor, fieldAttributes);

        final List attFields = attributes.getFields();
        assertFalse(attFields.isEmpty());
        assertEquals(1, attFields.size());
        assertEquals(fieldAttributes, attFields.get(0));

        final List fdFields = fd.getFields();
View Full Code Here

Examples of com.volantis.mcs.protocols.XFFormAttributes

        // Create test objects.
        DOMFactory domFactory = DOMFactory.getDefaultInstance();
        Element emulatedXFormElement =
                domFactory.createElement("EMULATED_XFORM_ELEMENT");
        Element vFormElement = domFactory.createElement("VFORM_ELEMENT");
        XFFormAttributes attributes = new XFFormAttributes();
        Element firstControl = selectNamedElement(dom, "FIRST_CONTROL");
        Element lastControl = selectNamedElement(dom, "SECOND_CONTROL");
        Element div = selectNamedElement(dom, "div");

        // Create Mocks.
View Full Code Here

Examples of com.volantis.mcs.protocols.XFFormAttributes

        // Create test objects.
        DOMFactory domFactory = DOMFactory.getDefaultInstance();
        Element emulatedXFormElement =
                domFactory.createElement("EMULATED_XFORM_ELEMENT");
        Element vFormElement = domFactory.createElement("VFORM_ELEMENT");
        XFFormAttributes attributes = new XFFormAttributes();
        Element firstControl = selectNamedElement(dom, "FIRST_CONTROL");
        Element lastControl = selectNamedElement(dom, "SECOND_CONTROL");
        Element b = selectNamedElement(dom, "b");

        // Create Mocks.
View Full Code Here

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

Examples of com.volantis.mcs.protocols.XFFormAttributes

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

Examples of com.volantis.mcs.protocols.XFFormAttributes

     * 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

Examples of com.volantis.mcs.protocols.XFFormAttributes

                                     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

Examples of com.volantis.mcs.protocols.XFFormAttributes

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