Package com.volantis.mcs.protocols.assets

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


     * @throws com.volantis.mcs.protocols.ProtocolException
     */
    public void testAddEventAttributeUserScript() throws ProtocolException {
        Element element = domFactory.createElement();
        String attributeName = "event";
        ScriptAssetReference userScript =
                new LiteralScriptAssetReference("userscript");
        String internalScript = null;
        protocol.addEventAttribute(element, attributeName, userScript,
                internalScript);
        String attributeValue = element.getAttributeValue(attributeName);
        assertEquals("script attribute", userScript.getScript(), attributeValue);
    }
View Full Code Here


        EventType blur = EventType.ON_BLUR;
        EventType click = EventType.ON_CLICK;
        EventType mouse = EventType.ON_MOUSE_OVER;
        EventType focus = EventType.ON_FOCUS;

        ScriptAssetReference handlerOne =
                new LiteralScriptAssetReference("Handle blurrred things");
        ScriptAssetReference handlerTwo =
                new LiteralScriptAssetReference("Handle clicked things");
        ScriptAssetReference handlerThree =
                new LiteralScriptAssetReference("Handle mouse over things");
        ScriptAssetReference handlerFour =
                new LiteralScriptAssetReference("Handle focus things");

        Object handler;

        // Test retrieval with nothing set
View Full Code Here

        EventType blur = EventType.ON_BLUR;
        EventType click = EventType.ON_CLICK;
        EventType mouse = EventType.ON_MOUSE_OVER;

        ScriptAssetReference handlerOne =
                new LiteralScriptAssetReference("Handle blurrred things");
        ScriptAssetReference handlerTwo =
                new LiteralScriptAssetReference("Handle clicked things");
        ScriptAssetReference handlerThree =
                new LiteralScriptAssetReference("Handle mouse over things");

        Object handler;

        // Test retrieval with nothing set
View Full Code Here

     */
    public void testAppendTo() throws ProtocolException {
        DOMOutputBuffer buffer = new DOMOutputBuffer();
        buffer.initialise();
        TestMarinerPageContext context = new TestMarinerPageContext();
        ScriptAssetReference scriptObject = getDefaultScriptValue();
        Script script = createScript(context, scriptObject);
        script.appendTo(buffer);
        Node node = buffer.getRoot().getHead();
        checkAppendToResult(node);
    }
View Full Code Here

        papiAttributes.setOnLoad(ON_LOAD);
        papiAttributes.setOnUnload(ON_UNLOAD);
        CanvasAttributes attributes = new CanvasAttributes();

        EventAttributes events = attributes.getEventAttributes(false);
        ScriptAssetReference event = events.getEvent(EventConstants.ON_LOAD);
        assertNull(event);
        PAPIInternals.initialisePageEventAttributes(pageContext,
                                                    papiAttributes,
                                                    attributes);
        event = events.getEvent(EventConstants.ON_LOAD);
        assertNotNull(event);
        assertEquals(ON_LOAD, event.getScript());

        event = events.getEvent(EventConstants.ON_UNLOAD);
        assertNotNull(event);
        assertEquals(ON_UNLOAD, event.getScript());

        // Other events should not have been set.
        event = events.getEvent(EventConstants.ON_CLICK);
        assertNull(event);
    }
View Full Code Here

        papiAttributes.setOnReset(ON_RESET);

        CanvasAttributes attributes = new CanvasAttributes();

        EventAttributes events = attributes.getEventAttributes(false);
        ScriptAssetReference event = events.getEvent(EventConstants.ON_LOAD);
        assertNull(event);
        PAPIInternals.initialiseFormEventAttributes(pageContext,
                                                    papiAttributes,
                                                    attributes);
        event = events.getEvent(EventConstants.ON_SUBMIT);
        assertNotNull(event);
        assertEquals(ON_SUBMIT, event.getScript());

        event = events.getEvent(EventConstants.ON_RESET);
        assertNotNull(event);
        assertEquals(ON_RESET, event.getScript());

        // Other events should not have been set.
        event = events.getEvent(EventConstants.ON_CLICK);
        assertNull(event);
    }
View Full Code Here

        addScriptExpressionExpectations(expected);

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

     *
     * @throws ProtocolException
     */
    public void testCreateSimpleXmlInvalid() throws ProtocolException {
        TestMarinerPageContext context = new TestMarinerPageContext();
        ScriptAssetReference expected = new LiteralScriptAssetReference(
                "<unbalanced-tag>");
        try {
            createScript(context, expected);
            fail("Unbalanced XML tag should fail to parse");
        } catch (ProtocolException e) {
View Full Code Here

        addScriptExpressionExpectations(expected);

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

        addScriptExpressionExpectations(expected);

        CanvasAttributes attributes = new CanvasAttributes();
        EventAttributes events = attributes.getEventAttributes(false);
        ScriptAssetReference event = events.getEvent(constant);
        assertNull(event);
        PAPIInternals.initialiseGeneralEventAttributes(pageContext,
                                                       papiAttributes,
                                                       attributes);
        event = events.getEvent(constant);
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.