Examples of VolantisProtocol


Examples of com.volantis.mcs.protocols.VolantisProtocol

        // enable to informally test the claim in the comment above.
        // enableLog4jDebug();
       
        TestMarinerPageContext pageContext = new TestMarinerPageContext();
        MarinerRequestContext requestContext = new TestMarinerRequestContext();
        VolantisProtocol protocol = new VolantisProtocolStub() {
            public void writeOpenAnchor (
                    com.volantis.mcs.protocols.AnchorAttributes attributes) {
                assertEquals( "", value, attributes.getId());
            }
        };
        pageContext.pushRequestContext(requestContext);
        pageContext.setProtocol(protocol);
        ContextInternals.setMarinerPageContext(requestContext, pageContext);
        protocol.setMarinerPageContext(pageContext);
       
        AnchorElementImpl element = new AnchorElementImpl();
        element.elementStartImpl(requestContext, papiAttrs);
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.VolantisProtocol

        if (protocolName == null) {
            throw new IllegalStateException("Device protocol policy missing");
        }

        // Create a configured protocol.
        VolantisProtocol protocol = protocolBuilder.build(protocolName, device);

        // Complete initialization of the application context
        applicationContext.setDevice(device);
        applicationContext.setProtocol(protocol);
        applicationContext.setPackager(new DefaultPackager());
View Full Code Here

Examples of com.volantis.mcs.protocols.VolantisProtocol

        ScriptAttributes attributes = (ScriptAttributes) papiAttributes;

        MarinerPageContext pageContext
                = ContextInternals.getMarinerPageContext(context);

        VolantisProtocol protocol = pageContext.getProtocol();

        // Check if the Policy x-element.script.supported is set to default, via
        // the supportsScriptType() method of protocol. If so, exercise the same
        // behaviour as before VBM 20080131102 ie. check the "protocol"
        // support and followup check on boolean device policy "javascript".
        if ((protocol.supportsScriptType() == null) ||
             ("default".equals(protocol.supportsScriptType())) ) {

            // Check to see whether the protocol supports java script and the
            // device supports JavaScript, if either don't then skip the body.
            //
            // Note: This functionality is copied directly from the ScriptTag.
            if (!protocol.supportsJavaScript ()
              || !pageContext.getBooleanDevicePolicyValue (SUPPORTS_JAVASCRIPT)) {
               return SKIP_ELEMENT_BODY;
            }

        } else if ("full".equals(protocol.supportsScriptType())) {
            // Scripts are supported in an override due to the, so just check
            // on the device javascript policy to enable it fully. If it's not
            // set then return (SKIP), otherwise carry on. NOTE: Here, where are
            // getting the opinion of the actual device, not an inference derived
            // from the protocol.
            if (!pageContext.getBooleanDevicePolicyValue (SUPPORTS_JAVASCRIPT)) {
               return SKIP_ELEMENT_BODY;
            }
           
        } else {
        // If "none" or other is specified, SKIP this entirely irrespective
        // of any other settings.
               return SKIP_ELEMENT_BODY;
        }

        PolicyReferenceResolver resolver =
                pageContext.getPolicyReferenceResolver();

        // Parse the source expression.
        ScriptAssetReference src
                = resolver.resolveQuotedScriptExpression(attributes.getSrc());

        // Set the attributes used in both modes.
        String id = attributes.getId();
        pattributes.setId(id);
        pattributes.setDefer(attributes.getDefer());

        // @todo this code duplicates the functionality of the protocols Script
        // object. we should refactor it away...
        if (src != null && src.isPolicyReference()) {
            ScriptAsset asset = src.getScriptAsset();
            // If no asset was found then there is nothing more to do.
            if (asset == null) {
                return SKIP_ELEMENT_BODY;
            }

            // If an id was specified then we need to remember whether we found a
            // suitable ScriptAsset, or not.
            if (id != null) {
                pageContext.putIdValue(id, asset);
            }

            pattributes.setScriptReference(src);
            pattributes.setCharSet(asset.getCharacterSet());
            pattributes.setType(asset.getMimeType());
            pattributes.setLanguage(asset.getProgrammingLanguage());

            // Write the open script.
            protocol.writeOpenScript(pattributes);
            opened = true;
            return SKIP_ELEMENT_BODY;

        } else {
            // Use the deprecated attributes.
            pattributes.setTitle(attributes.getTitle());

            pattributes.setCharSet(attributes.getCharSet());
            pattributes.setLanguage(attributes.getLanguage());
            pattributes.setScriptReference(src);
            pattributes.setType(attributes.getType());

            protocol.writeOpenScript(pattributes);
            opened = true;

            return PROCESS_ELEMENT_BODY;
        }
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.VolantisProtocol

        }

        MarinerPageContext pageContext
                = ContextInternals.getMarinerPageContext(context);

        VolantisProtocol protocol = pageContext.getProtocol();

        protocol.writeCloseScript(pattributes);

        return CONTINUE_PROCESSING;
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.VolantisProtocol

        }

        pattributes.setSegment(attributes.getSegment());
        pattributes.setTarget(attributes.getTarget());

        VolantisProtocol protocol = pageContext.getProtocol();
        protocol.writeOpenAnchor(pattributes);

        String tabindex = pattributes.getTabindex();
        if (tabindex != null) {
            String initialFocus =
                    protocol.getCanvasAttributes().getInitialFocus();
            if ((initialFocus != null)
                    && (initialFocus.equals(attributes.getId()))) {
                protocol.writeInitialFocus(tabindex);
            }
        }

        return PROCESS_ELEMENT_BODY;
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.VolantisProtocol

            throws PAPIException {

        MarinerPageContext pageContext =
                ContextInternals.getMarinerPageContext(context);

        VolantisProtocol protocol = pageContext.getProtocol();

        try {
            protocol.writeCloseAnchor(pattributes);
        } catch (ProtocolException e) {

            logger.error("rendering-error",
                    new Object[]{pattributes.getTagName()}, e);
            throw new PAPIException(
View Full Code Here

Examples of com.volantis.mcs.protocols.VolantisProtocol

        pattributes.setFieldDescriptor(fieldDescriptor);

        // Update the tab index for this field
        pattributes.setTabindex(attributes.getTabindex());

        VolantisProtocol protocol = pageContext.getProtocol();
        String tabindex = (String) pattributes.getTabindex();
        if (tabindex != null) {
            String initialFocus =
                    protocol.getCanvasAttributes().getInitialFocus();
            if ((initialFocus != null)
                    && (initialFocus.equals(attributes.getId()))) {
                protocol.writeInitialFocus(tabindex);
            }
        }

        // If this field is not inside a form then render it immediately,
        // otherwise delay rendering until the whole form has been processed.
View Full Code Here

Examples of com.volantis.mcs.protocols.VolantisProtocol

    private XHTMLBasicTestable testable;

    protected VolantisProtocol createTestableProtocol(
            InternalDevice internalDevice) {
        ProtocolBuilder builder = new ProtocolBuilder();
        VolantisProtocol protocol = builder.build(
                new TestProtocolRegistry.TestHTML_iModeFactory(),
                internalDevice);
        return protocol;
    }
View Full Code Here

Examples of com.volantis.mcs.protocols.VolantisProtocol

        NoScriptAttributes attributes = (NoScriptAttributes) papiAttributes;

        MarinerPageContext pageContext
                = ContextInternals.getMarinerPageContext(context);

        VolantisProtocol protocol = pageContext.getProtocol();

        try {
            // Check to see whether the protocol supports java script, if it
            // does then check if we have a idRef to a script and if the script
            // asset is invalid, if so then put out plain markup without
            // <noscript></noscript> elements, but wrapped in span elements.
            //
            if (protocol.supportsJavaScript()) {
                // Is there and idref attribute?
                if (attributes.getIdref() != null) {
                    // Is the idref's asset valid?
                    if (pageContext.getIdValue(attributes.getIdref()) == null) {
                        // We need to skip the tags but still send the plain
                        // markup wrapped in a span element.
                        skipped = true;
                        SpanAttributes spanAttributes = new SpanAttributes();
                        spanAttributes.setStyles(pattributes.getStyles());
                        protocol.writeOpenSpan(spanAttributes);
                        return PROCESS_ELEMENT_BODY;
                    }
                }
            }

            // All other cases should put out <noscript></noscript> elements.
            pattributes.setTitle(attributes.getTitle());
            pattributes.setId(attributes.getId());

            // Initialise the general event attributes.
            PAPIInternals.initialiseGeneralEventAttributes(pageContext,
                    attributes, pattributes);

            protocol.writeOpenNoScript(pattributes);

            return PROCESS_ELEMENT_BODY;

        } catch (ProtocolException e) {
View Full Code Here

Examples of com.volantis.mcs.protocols.VolantisProtocol

            throws PAPIException {

        MarinerPageContext pageContext
                = ContextInternals.getMarinerPageContext(context);

        VolantisProtocol protocol = pageContext.getProtocol();

        if (skipped) {
            // span attributes are unused in the close method.
            protocol.writeCloseSpan(null);
        } else {
            protocol.writeCloseNoScript(pattributes);
        }

        return CONTINUE_PROCESSING;
    }
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.