Package com.volantis.mcs.protocols

Examples of com.volantis.mcs.protocols.EventAttributes


        CanvasAttributes canvasAttributes = new CanvasAttributes();
        protocol.addEnterEvents(buffer, canvasAttributes);
        assertEquals("", DOMUtilities.toString(
                buffer.getRoot(), protocol.getCharacterEncoder()));

        EventAttributes events = canvasAttributes.getEventAttributes (false);
        events.reset();
        events.setEvent(EventConstants.ON_ENTER_BACKWARD, "eventBackward");
        events.setEvent(EventConstants.ON_ENTER_FORWARD, "eventForward");
        protocol.addEnterEvents(buffer, canvasAttributes);
        assertEquals("<onevent type=\"onenterforward\">eventForward</onevent>" +
                     "<onevent type=\"onenterbackward\">eventBackward</onevent>",
                     DOMUtilities.toString(
                             buffer.getRoot(), protocol.getCharacterEncoder()));
View Full Code Here


        CanvasAttributes canvasAttributes = new CanvasAttributes();
        protocol.addEnterEvents(buffer, canvasAttributes);
        assertEquals("", DOMUtilities.toString(
                buffer.getRoot(), protocol.getCharacterEncoder()));

        EventAttributes events = canvasAttributes.getEventAttributes (false);
        events.reset();
        events.setEvent(EventConstants.ON_ENTER_BACKWARD, "eventBackward");
        protocol.addEnterEvents(buffer, canvasAttributes);
        assertEquals("<onevent type=\"onenterbackward\">eventBackward</onevent>",
                     DOMUtilities.toString(
                             buffer.getRoot(), protocol.getCharacterEncoder()));
View Full Code Here

     */
    public void testAddEnterEventsUseOnEnterOnly() throws Exception {
        privateSetUp();

        CanvasAttributes canvasAttributes = new CanvasAttributes();
        EventAttributes events = canvasAttributes.getEventAttributes (false);
        events.reset();
        events.setEvent(EventConstants.ON_ENTER_BACKWARD, "Script");
        events.setEvent(EventConstants.ON_ENTER_FORWARD, "Script");
        protocol.addEnterEvents(buffer, canvasAttributes);
        assertEquals("<onevent type=\"onenter\">Script</onevent>",
                     DOMUtilities.toString(
                             buffer.getRoot(), protocol.getCharacterEncoder()));
    }
View Full Code Here

    // Javadoc inherited.
    public void outputImage(DOMOutputBuffer dom,
            ImageAttributes attributes) {
        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());
                }
            }
        }
View Full Code Here

                        "protocol");
            }

            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
                                  + " is " + scriptObject);
                }
                if (scriptObject != null) {
                    script = scriptObject.stringValue();
                }
            }

            if (internalScript != null) {
                if (logger.isDebugEnabled ()) {
                    logger.debug ("Internal script for " + attributeName
                                  + " is " + internalScript);
                }
                if (script == null) {
                    script = internalScript;
                } else {
                    script = scriptHandler.joinScripts (this, script,
                                                        internalScript);

                    if (logger.isDebugEnabled ()) {
                        logger.debug ("Joined script " + attributeName
                                      + " is " + script);
                    }
                }
            }
            if (script != null) {
                eventAttributes.setEvent(eventIndex, script);
            }

        } catch (ProtocolException e) {
            throw new RendererException(e);
        }
View Full Code Here

        attributes = new XDIMEAttributesImpl(XFormElements.SETVALUE);
        attributes.setValue(XDIMESchemata.XML_EVENTS_NAMESPACE, "event", eventName);
        attributes.setValue("", XDIMEAttribute.REF.toString(), referencedSubmission);
        attributes.setValue("", XDIMEAttribute.VALUE.toString(), VALUE_FROM_ATTRIBUTE);
        xFormBuilder.registerControl(attributes);
        xFormBuilder.addSubmission(submissionID, new EventAttributes(), action,
                method);

        return context;
    }
View Full Code Here

                expectations);
        psf = new ProtocolSupportFactoryMock("psf", expectations);
        psf.expects.getDOMFactory().returns(null);
        protocol = new DOMProtocolMock("protocol", expectations, psf,
                protocolConfig);
        events = new EventAttributes();
        TEST_FD = new EmulatedXFormDescriptor();
        TEST_FD.setContainingFormName(MODEL_ID);
        TEST_FD2 = new EmulatedXFormDescriptor();
        TEST_FD2.setContainingFormName(MODEL_ID2);
        TEST_FD_DEFAULT = new EmulatedXFormDescriptor();
View Full Code Here

     * @param attributes the protocol attributes that need to have the event
     *                   attributes populated
     */
    public static void setEvents(EventTarget target,
                                 MCSAttributes attributes) {
        EventAttributes events = attributes.getEventAttributes(true);

        for (int event = 0; event < eventMapping.length; event++) {
            EventType type = eventMapping[event];

            // Not all protocol events map to an equivalent menu model event
            if (type != null) {
                events.setEvent(event, target.getEventHandler(type));
            }
        }
    }
View Full Code Here

            initialiseAttributes(context, attributes);

            // Move any events from the the div to the canvas.
            // This means that the body specific events such as onload work.
            // todo: later: avoid writing out a div in xdime-2 mode
            EventAttributes events =
                    protocolAttributes.getEventAttributes(false);
            canvasAttributes.setEventAttributes(events);

            openCanvas(context, attributes);
        }
View Full Code Here

    protected void addTableCellEvents(
            DOMOutputBuffer dom,
            TableCellAttributes attributes) throws ProtocolException {

        EventAttributes events = attributes.getEventAttributes(false);
        if (events == null) {
            return;
        }

        addOnEventElement(dom, attributes, "onfocus",
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.EventAttributes

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.