Package com.volantis.mcs.protocols.assets

Examples of com.volantis.mcs.protocols.assets.ScriptAssetReference


            addScriptExpressionExpectations(expected);
        }

        CanvasAttributes attributes = new CanvasAttributes();
        EventAttributes events = attributes.getEventAttributes(false);
        ScriptAssetReference event = events.getEvent(constant);
        assertNull(event);
        PAPIInternals.initialiseCanvasEventAttributes(pageContext,
                                                       papiAttributes,
                                                       attributes);
        event = events.getEvent(constant);
View Full Code Here


        Element e = domFactory.createStyledElement(attributes.getStyles());
        e.setName("test-image");
        EventAttributes events = attributes.getEventAttributes(false);
        if (events != null) {
            for (int i=0; i < EventConstants.MAX_EVENTS; i++) {
                ScriptAssetReference event = events.getEvent(i);
                if (event != null) {
                    e.setAttribute("event-" + i, event.getScript());
                }
            }
        }
        if (attributes.getSrc() != null) {
            e.setAttribute("src", attributes.getSrc());
View Full Code Here

     * Also doubles as a test of stringValue().
     *
     * @throws ProtocolException
     */
    public void testCreateSimple() throws ProtocolException {
        ScriptAssetReference expected = getDefaultScriptValue();
        TestMarinerPageContext context = new TestMarinerPageContext();
        Script script = createScript(context, expected);
        String actual = script.stringValue();
        assertEquals(expected.getScript(), actual);
    }
View Full Code Here

     *
     * @throws ProtocolException
     */
    public void testEquals() throws ProtocolException {
        TestMarinerPageContext context = new TestMarinerPageContext();
        ScriptAssetReference scriptObject = getDefaultScriptValue();
        Script script = createScript(context, scriptObject);
        assertTrue(! script.equals(null));
        assertTrue(! script.equals("dummy object"));
       
        Script script2 = createScript(context, scriptObject);
View Full Code Here

        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;
            }
View Full Code Here

                                String value, EventType type)
                                                    throws BuilderException {

        PolicyReferenceResolver resolver =
                pageContext.getPolicyReferenceResolver();
        ScriptAssetReference handler =
                resolver.resolveQuotedScriptExpression(value);
        builder.setEventHandler(type, handler);
    }
View Full Code Here

                    getReferencableModules(new HashSet<ScriptModule>(depList));

            for (ScriptModule sm : depList) {

                loadProject(pageContext);
                ScriptAssetReference scriptAssetReference =
                        loadAssetReference(sm.getAssetName(), pageContext);
                sm.setScriptAssetReference(scriptAssetReference);

                // collect the attributes
                final ScriptAttributes attributes =
View Full Code Here

     */
    public static void requireLibrary(String libraryName, VolantisProtocol protocol)
            throws ProtocolException {
        try {
            loadProject(protocol.getMarinerPageContext());
            ScriptAssetReference scriptAssetReference = loadAssetReference(libraryName, protocol
                    .getMarinerPageContext());
           
            ScriptLibraryManager libraryManager =
                protocol.getMarinerPageContext().getScriptLibraryManager();
            libraryManager.addScript(scriptAssetReference);
View Full Code Here

            String script = null;

            EventAttributes eventAttributes
                = attributes.getEventAttributes (true);

            ScriptAssetReference userScript = eventAttributes.getEvent (eventIndex);

            if (userScript != null) {
                Script scriptObject = Script.createScript(userScript);
                if (logger.isDebugEnabled ()) {
                    logger.debug ("User script for " + attributeName
View Full Code Here

        final String type = attributes.getType();
        if (type != null) {
            scriptElement.setAttribute ("type", type);
        }

        final ScriptAssetReference scriptReference =
            attributes.getScriptReference();
        if (scriptReference.isURL()) {
            if (attributes.isEmbeddable()) {
                File filename = attributes.getScriptFilePath();
                final String literalScript =  getScriptContents(filename);
                scriptElement.addText(literalScript);
            } else {
                scriptElement.setAttribute("src", scriptReference.getURL());
            }
           
        } else {
            scriptElement.addText(scriptReference.getScript());
        }
        return scriptElement;
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.assets.ScriptAssetReference

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.