Examples of XFTextInputAttributes


Examples of com.volantis.mcs.papi.XFTextInputAttributes

            }
        };
        PAPIElement element = createTestablePAPIElement();
        TestMarinerRequestContext requestContext = new TestMarinerRequestContext();
        TestMarinerPageContext pageContext = new TestMarinerPageContext();
        XFTextInputAttributes attributes = new XFTextInputAttributes();
        com.volantis.mcs.protocols.XFTextInputAttributes pattributes =
                new com.volantis.mcs.protocols.XFTextInputAttributes();
        attributes.setId("ID");
        attributes.setStyleClass("StyleClass");
        attributes.setTitle("Title");
        attributes.setCaption("Caption");
        attributes.setHelp("Help");
        attributes.setName("Name");
        attributes.setPrompt("Prompt");
        attributes.setShortcut("Shortcut");
        attributes.setTabindex("1");
        XFFormFieldElementImpl xfElement = (XFFormFieldElementImpl) element;

        pageContext.setPolicyReferenceResolver(
                PolicyReferenceResolverTestHelper.getCommonExpectations(
                        expectations, mockFactory));

        MyVolantisProtocolStub protocol = new MyVolantisProtocolStub();
        pageContext.setProtocol(protocol);
        ContextInternals.setMarinerPageContext(requestContext, pageContext);
        pageContext.pushRequestContext(requestContext);

        protocol.setMarinerPageContext(pageContext);

        // Subset of initial values should be null
        assertNotNull(pattributes);
        assertNull(pattributes.getCaptionContainerInstance());
        assertNull(pattributes.getEntryContainerInstance());
        assertNull(pattributes.getId());
        assertNull(pattributes.getTitle());

        assertEquals(protocol.writeInitialFocusCalled, false);
        xfElement.doField(pageContext, attributes, pattributes);
        assertEquals(protocol.writeInitialFocusCalled, true);

        // After some values should be match the values set.
        assertNotNull(pattributes);
        assertNull(pattributes.getCaptionContainerInstance());
        assertNull(pattributes.getEntryContainerInstance());
        assertEquals(pattributes.getId(), attributes.getId());
        assertEquals(pattributes.getTitle(), attributes.getTitle());
        assertEquals(pattributes.getCaption().getText(TextEncoding.PLAIN),
                attributes.getCaption());
        assertEquals(pattributes.getHelp().getText(TextEncoding.PLAIN),
                attributes.getHelp());
        assertEquals(pattributes.getName(), attributes.getName());
        assertEquals(pattributes.getPrompt().getText(TextEncoding.PLAIN),
                attributes.getPrompt());
        assertEquals(pattributes.getShortcut().getText(TextEncoding.PLAIN),
                attributes.getShortcut());
        assertNull(pattributes.getFieldDescriptor());
        assertEquals(pattributes.getTabindex(), attributes.getTabindex());
    }
View Full Code Here

Examples of com.volantis.mcs.papi.XFTextInputAttributes

        pageContext.setPolicyReferenceResolver(
                PolicyReferenceResolverTestHelper.getCommonExpectations(
                        expectations, mockFactory));

        XFTextInputAttributes attributes = new XFTextInputAttributes();
        XFTextInputElementImpl xfElement = (XFTextInputElementImpl)element;
        int result = xfElement.elementStartImpl(requestContext, attributes);
        assertEquals(PAPIConstants.PROCESS_ELEMENT_BODY, result);
        assertNull(attributes.getErrmsg());

        final String errorMsg = "Error msg";
        attributes.setErrmsg(errorMsg);
        result = xfElement.elementStartImpl(requestContext, attributes);
        assertEquals(PAPIConstants.PROCESS_ELEMENT_BODY, result);
        assertEquals(attributes.getErrmsg(), errorMsg);

    }
View Full Code Here

Examples of com.volantis.mcs.papi.XFTextInputAttributes

     * the PAPIAttributes parameter is always assumed to be of the type
     * XFTextInputAttributes.
     */
    public void testGetInitialValue() throws Exception {
        PAPIElement element = createTestablePAPIElement();       
        XFTextInputAttributes attributes = new XFTextInputAttributes();
        assertNull(attributes.getInitial());
        XFTextInputElementImpl xfElement = (XFTextInputElementImpl)element;
        String result = xfElement.getInitialValue(null, attributes);
        assertNull(result);

        final String initialValue = "Initial Value";
        attributes.setInitial(initialValue);
        result = xfElement.getInitialValue(null, attributes);
        assertEquals(result, initialValue);
    }
View Full Code Here

Examples of com.volantis.mcs.papi.XFTextInputAttributes

            throws PAPIException {

        MarinerPageContext pageContext
                = ContextInternals.getMarinerPageContext(context);

        XFTextInputAttributes attributes =
                (XFTextInputAttributes) papiAttributes;

        // Create a new protocol attributes object every time, as this element
        // could be reused before the attributes have actually been finished with
        // by the protocol.
        com.volantis.mcs.protocols.XFTextInputAttributes pattributes
                = new com.volantis.mcs.protocols.XFTextInputAttributes();

        // Initialise the attributes specific to this field.
        TextAssetReference object;
        String value;

        PolicyReferenceResolver resolver =
                pageContext.getPolicyReferenceResolver();

        // Process the errmsg as a mariner expression.
        object = resolver.resolveQuotedTextExpression(
                attributes.getErrmsg());
        pattributes.setErrmsg(object);

        // Set the initial value attribute.
        object = resolver.resolveQuotedTextExpression(attributes.getInitial());
        pattributes.setInitial(object);

        // Set the max length attribute.
        value = attributes.getMaxLength();
        if (value != null) {
            pattributes.setMaxLength(Integer.parseInt(value));
        }

        // Set the type attribute, the default is "text".
        value = attributes.getType();
        if (value == null) {
            value = "text";
        }
        pattributes.setType(value);

        // Set the inputMode attribute
        value = attributes.getInputMode();
        if (value != null) {
            pattributes.setInputMode(value);
        }

        // Process the validate value as a mariner expression and store the
        // resulting object in the styles. The value if specified always
        // overrides the styles.
        StyleValue validate = resolver.resolveQuotedTextExpressionAsStyleValue(
                attributes.getValidate());
        if (validate != null) {
            MutablePropertyValues propertyValues = styles.getPropertyValues();
            propertyValues.setComputedAndSpecifiedValue(
                    MCS_INPUT_FORMAT, validate);
        }
View Full Code Here

Examples of com.volantis.mcs.papi.XFTextInputAttributes

    String getInitialValue(
            MarinerPageContext pageContext,
            PAPIAttributes papiAttributes)
            throws PAPIException {

        XFTextInputAttributes attributes =
                (XFTextInputAttributes) papiAttributes;

        return attributes.getInitial();
    }
View Full Code Here

Examples of com.volantis.mcs.papi.XFTextInputAttributes

  
    /** Creates new VolantisInputTag */
    public VolantisInputTag()
    {
        super();
        inputAttributes = new XFTextInputAttributes();
    }
View Full Code Here

Examples of com.volantis.mcs.papi.XFTextInputAttributes

            logger.debug ("VolantisSelectTag.renderTag( " + pTagName + " )" );
        }

        if( pTagName.equals("input") )
        {
            XFTextInputAttributes inputAttributes = new XFTextInputAttributes();
           
            try {
                inputAttributes.setName( pAttributes.getProperty( "name" ) );
                inputAttributes.setType( pAttributes.getProperty( "type", "hidden" ) );
                inputAttributes.setInitial( pAttributes.getProperty( "value" ) );
                VolantisInputTagRenderer.renderTag(
                        getMarinerServletRequestContext(), getPageContext(),
                        pTagName, vname, inputAttributes );
            }
            catch (Exception ex)
View Full Code Here

Examples of com.volantis.mcs.papi.XFTextInputAttributes

            logger.debug ("VolantisSelectTag.renderTag( " + pTagName + " )" );
        }

        if( pTagName.equals("input") )
        {
            XFTextInputAttributes inputAttributes = new XFTextInputAttributes();
           
            try {
                inputAttributes.setName( pAttributes.getProperty( "name" ) );
                inputAttributes.setType( pAttributes.getProperty( "type", "hidden" ) );
                inputAttributes.setInitial( pAttributes.getProperty( "value" ) );
                VolantisInputTagRenderer.renderTag( getMarinerServletRequestContext(), getPageContext(),
                                         pTagName, vname, inputAttributes );
            }
            catch (Exception ex)
            {
View Full Code Here

Examples of com.volantis.mcs.papi.XFTextInputAttributes

        // The form always has a hidden input _DARGS field

        }
        if( pTagName.equals("input") )
       {
            XFTextInputAttributes inputAttributes = new XFTextInputAttributes();
           
            try {
                inputAttributes.setName( pAttributes.getProperty( "name", "_DARGS" ) );
                inputAttributes.setType( pAttributes.getProperty( "type", "hidden" ) );
                inputAttributes.setInitial( pAttributes.getProperty( "value" ) );
                VolantisInputTagRenderer.renderTag( getMarinerServletRequestContext(), getPageContext(), pTagName, "_DARGS", inputAttributes );
            }
            catch (Exception ex)
            {
                // Had a problem so log it and throw a JspTagException to report it
View Full Code Here

Examples of com.volantis.mcs.protocols.XFTextInputAttributes

    public void testAddActionResetBasic() throws Exception {
        doTestAddActionReset("<refresh/>", null);
    }

    public void testAddActionResetFormAttributes() throws Exception {
        XFTextInputAttributes field = new XFTextInputAttributes();
        doTestAddActionReset("<refresh/>", field);
    }
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.