Examples of XFActionAttributes


Examples of com.volantis.mcs.papi.XFActionAttributes

     */
    public void testInitialiseFieldEventAttributes() throws Exception {
        final String ON_CHANGE = "OnChange";
        final String ON_SELECT = "OnSelect";

        XFActionAttributes papiAttributes = new XFActionAttributes();
        doTestInitialiseFieldEventAttributes(papiAttributes,
                                             EventConstants.ON_CHANGE,
                                             null);

        // Valid on change
        papiAttributes.setOnChange(ON_CHANGE);
        doTestInitialiseFieldEventAttributes(papiAttributes,
                                             EventConstants.ON_CHANGE,
                                             ON_CHANGE);

        // Valid on select
        papiAttributes.setOnSelect(ON_SELECT);
        doTestInitialiseFieldEventAttributes(papiAttributes,
                                             EventConstants.ON_SELECT,
                                             ON_SELECT);

        // Other events should not have been set (choose one, say ON_CLICK).
View Full Code Here

Examples of com.volantis.mcs.papi.XFActionAttributes

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

        XFActionAttributes attributes = (XFActionAttributes) papiAttributes;

        // Set the value attribute, for backward compatability if the value is not
        // set then it defaults to the caption.
        String value = attributes.getValue();
        if (value == null) {
            // This code should be removed when we stop defaulting to the caption
            // value.
            PolicyReferenceResolver resolver =
                    pageContext.getPolicyReferenceResolver();
            TextAssetReference object
                    = resolver.resolveQuotedTextExpression(
                    attributes.getCaption());
            String caption = getPlainText(object);
            if (caption != null) {
                value = caption;
            }
        }
View Full Code Here

Examples of com.volantis.mcs.papi.XFActionAttributes

            throws PAPIException {

        MarinerPageContext pageContext
                = ContextInternals.getMarinerPageContext(context);

        XFActionAttributes attributes = (XFActionAttributes) 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.XFActionAttributes pattributes
                = new com.volantis.mcs.protocols.XFActionAttributes();

        // Validate the type attribute.
        String type = attributes.getType();
        if (type == null) {
            throw new PAPIException(exceptionLocalizer.format("type-required"));
        }

        if (inline()) {
            if (!TYPE_PERFORM.equals(type)) {
                throw new PAPIException(
                        exceptionLocalizer.format("inline-xfaction-type-error",
                                new Object[]{TYPE_PERFORM,
                                        type}));
            }
        } else {
            if (!TYPE_SUBMIT.equals(type) && !TYPE_RESET.equals(type)) {
                // MCSPA0044X="Form xfaction must either be of type '{2}' or '{3}', not '{4}'"
                throw new PAPIException(
                        exceptionLocalizer.format("invalid-xfaction-type",
                                new Object[]{TYPE_SUBMIT,
                                        TYPE_RESET,
                                        type}));
            }
        }

        // Set the type attribute.
        pattributes.setType(type);

        // Set the value attribute, for backward compatability if the value is not
        // set then it defaults to the caption.
        String value = attributes.getValue();
        if (value == null) {
            // This code should be removed when we stop defaulting to the caption
            // value.
            PolicyReferenceResolver resolver =
                    pageContext.getPolicyReferenceResolver();
            TextAssetReference object
                    = resolver.resolveQuotedTextExpression(
                    attributes.getCaption());
            String caption = getPlainText(object);
            if (caption != null) {
                value = caption;
            }
        }
View Full Code Here

Examples of com.volantis.mcs.papi.XFActionAttributes

            }
           
            // Submit button... we need an XFAction instead of an XFInput
            if( ( inputAttributes.getType().equals( "submit" ) ) || ( inputAttributes.getType().equals( "reset" ) ) )
            {                               
                XFActionAttributes actionAttributes = new XFActionAttributes();               
                actionAttributes.setType( inputAttributes.getType() );
                actionAttributes.setStyleClass( inputAttributes.getStyleClass() );
                actionAttributes.setShortcut( inputAttributes.getShortcut() );
                actionAttributes.setCaption( inputAttributes.getCaption() );
                actionAttributes.setName( "i_" + vname );
                actionAttributes.setHelp( inputAttributes.getHelp() );
                actionAttributes.setPrompt( inputAttributes.getPrompt() );
                actionAttributes.setActive( "true" );
                actionAttributes.setCaptionPane( inputAttributes.getCaptionPane() );
                actionAttributes.setEntryPane( inputAttributes.getEntryPane() );

                writer.openElement(actionAttributes);
                writer.closeElement(actionAttributes);

                if (logger.isDebugEnabled()) {
View Full Code Here

Examples of com.volantis.mcs.papi.XFActionAttributes

                if(logger.isDebugEnabled()){
                    logger.debug ( "Submit input. Setting session attribute _V" + vname + " to " + inputAttributes.getName() );
                }  
                session.setAttribute( new String( "_V"+vname ), new String( inputAttributes.getName() ) );
               
                XFActionAttributes actionAttributes = new XFActionAttributes();               
                actionAttributes.setType( inputAttributes.getType() );
                actionAttributes.setShortcut( inputAttributes.getShortcut() );
                actionAttributes.setCaption( inputAttributes.getCaption() );
                actionAttributes.setName( "i_" + vname );
                actionAttributes.setHelp( inputAttributes.getHelp() );
                actionAttributes.setPrompt( inputAttributes.getPrompt() );
                actionAttributes.setActive( "true" );
                actionAttributes.setCaptionPane( inputAttributes.getCaptionPane() );
                actionAttributes.setEntryPane( inputAttributes.getEntryPane() );

                // write the xdime to the page
                writer.openElement(actionAttributes);
                writer.closeElement(actionAttributes);
View Full Code Here

Examples of com.volantis.mcs.protocols.XFActionAttributes

     */
    protected void checkActionInputType() throws ProtocolException {

        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
        XFActionAttributes attributes = new XFActionAttributes();
        attributes.setStyles(StylesBuilder.getInitialValueStyles());

        // Setup test for normal behaviour for input tag generation (submit)
        String name = "My Name";
        String actionType = "submit";
        String caption = "This is my caption";
        String value = "This is my value";

        attributes.setName(name);
        attributes.setType(actionType);
        attributes.setCaption(new LiteralTextAssetReference(caption));
        attributes.setValue(value);

        protocol.doActionInput(buffer, attributes);
        String actualResult = bufferToString(buffer);
        assertEquals("DOM buffer should match",
                     "<input name=\"" + name + "\" " +
                     "type=\"" + actionType + "\" value=\"" + caption  + "\"/>",
                     actualResult);

        // Setup test for normal behaviour for input tag generation (perform)
        buffer = new DOMOutputBuffer();
        buffer.initialise();
        actionType = "perform";
        attributes.setType(actionType);

        protocol.doActionInput(buffer, attributes);
        actualResult = bufferToString(buffer);

        assertEquals("DOM buffer should match",
                     "<input name=\"" + name + "\" " +
                     "type=\"" + "submit" + "\" value=\"" + caption  + "\"/>",
                     actualResult);

        // Setup test for normal behaviour for input tag generation (perform)
        buffer = new DOMOutputBuffer();
        buffer.initialise();
        actionType = "reset";
        attributes.setType(actionType);
        protocol.doActionInput(buffer, attributes);
        actualResult = bufferToString(buffer);
        assertEquals("DOM buffer should match",
                     "<input name=\"" + name + "\" " +
                     "type=\"" + actionType + "\" value=\"" + caption  + "\"/>",
                     actualResult);

        // Setup test for abnormal behaviour - garbage actionType
        buffer = new DOMOutputBuffer();
        buffer.initialise();
        actionType = "GARBAGE";
        attributes.setType(actionType);
        try {
            protocol.doActionInput(buffer, attributes);
            fail("Should have thrown an IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        }

        // Setup test for abnormal behaviour - garbage actionType
        buffer = new DOMOutputBuffer();
        buffer.initialise();
        actionType = "submit";
        attributes.setType(actionType);
        attributes.setTabindex("1");
        protocol.doActionInput(buffer, attributes);
        assertTrue(protocol.supportsTabindex);
        actualResult = bufferToString(buffer);
        assertEquals("DOM buffer should match",
                     "<input name=\"" + name + "\" " +
View Full Code Here

Examples of com.volantis.mcs.protocols.XFActionAttributes

        String value = "This is my value";

        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();

        XFActionAttributes attributes = new XFActionAttributes();
        attributes.setStyles(StylesBuilder.getInitialValueStyles());

        attributes.setName(name);
        attributes.setType(actionType);
        attributes.setCaption(new LiteralTextAssetReference(caption));
        attributes.setValue(value);
        // todo XDIME-CP style forms correctly.
//        attributes.setStyleClass(style);

        // Setup test to ensure that link style form submision fallsback to the
        // default form submision
View Full Code Here

Examples of com.volantis.mcs.protocols.XFActionAttributes

     */
    protected void checkActionInputType() throws ProtocolException {

        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
        XFActionAttributes attributes = new XFActionAttributes();
        attributes.setStyles(StylesBuilder.getInitialValueStyles());

        // Setup test for normal behaviour for input tag generation (submit)
        String name = "My Name";
        String actionType = "submit";
        String caption = "This is my caption";
        String value = "This is my value";

        attributes.setName(name);
        attributes.setType(actionType);
        attributes.setCaption(new LiteralTextAssetReference(caption));
        attributes.setValue(value);

        protocol.doActionInput(buffer, attributes);
        String actualResult = bufferToString(buffer);
        assertEquals("DOM buffer should match",
                "<input name=\"" + name + "\" type=\"submit\" "+
                "value=\"" + caption + "\"/>", actualResult);

        // Setup test for normal behaviour for input tag generation (perform)
        buffer = new DOMOutputBuffer();
        buffer.initialise();
        actionType = "perform";
        attributes.setType(actionType);       
        protocol.doActionInput(buffer, attributes);
        actualResult = bufferToString(buffer);
        assertEquals("DOM buffer should match",
                "<input name=\"" + name + "\" " +
                "type=\"submit\" value=\"" + caption  + "\"/>",
                actualResult);

        // Setup test for normal behaviour for input tag generation (perform)
        buffer = new DOMOutputBuffer();
        buffer.initialise();
        actionType = "reset";
        attributes.setType(actionType);
        protocol.doActionInput(buffer, attributes);
        actualResult = bufferToString(buffer);
        assertEquals("DOM buffer should match",
                "<input name=\"" + name + "\" " +
                "type=\"reset\" value=\"" + caption  + "\"/>",
                actualResult);

        // Setup test for abnormal behaviour - garbage actionType
        buffer = new DOMOutputBuffer();
        buffer.initialise();
        actionType = "GARBAGE";
        attributes.setType(actionType);
        try {
            protocol.doActionInput(buffer, attributes);
            fail("Should have thrown an IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        }

        // Setup test for abnormal behaviour - garbage actionType
        buffer = new DOMOutputBuffer();
        buffer.initialise();
        actionType = "submit";
        attributes.setType(actionType);
        attributes.setTabindex("1");
        protocol.doActionInput(buffer, attributes);
        assertTrue(protocol.supportsTabindex);
        actualResult = bufferToString(buffer);
        assertEquals("DOM buffer should match",
                "<input name=\"" + name + "\" " +
View Full Code Here

Examples of com.volantis.mcs.protocols.XFActionAttributes

        String value = "This is my value";

        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();

        XFActionAttributes attributes = new XFActionAttributes();
        attributes.setStyles(StylesBuilder.getInitialValueStyles());

        attributes.setName(name);
        attributes.setType(actionType);
        attributes.setCaption(new LiteralTextAssetReference(caption));
        attributes.setValue(value);
        // todo XDIME-CP style forms correctly.
//        attributes.setStyleClass(style);

        // Setup test to ensure that link style form submision fallsback to the
        // default form submision
View Full Code Here

Examples of com.volantis.mcs.protocols.XFActionAttributes

    protected void checkActionInputShortcut() throws ProtocolException {

        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
        XFActionAttributes attributes = new XFActionAttributes();
        attributes.setStyles(StylesBuilder.getInitialValueStyles());

        // Setup test for normal behaviour for input tag generation (submit)
        String shortcut = "1";
        String name = "My Name";
        String actionType = "submit";
        String caption = "This is my caption";
//        String value = "This is my value";

        attributes.setShortcut(new LiteralTextAssetReference(shortcut));
        attributes.setName(name);
        attributes.setType(actionType);
        attributes.setCaption(new LiteralTextAssetReference(caption));
//        attributes.setValue(value);

        protocol.doActionInput(buffer, attributes);
        String actualResult = bufferToString(buffer);
        assertEquals("DOM buffer should match",
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.