Package com.volantis.mcs.protocols

Examples of com.volantis.mcs.protocols.MenuAttributes


        TestDeviceLayoutContext layoutContext = new TestDeviceLayoutContext();
        context.pushDeviceLayoutContext(layoutContext);

        protocol.setMarinerPageContext(context);

        MenuAttributes menuAttrs = new MenuAttributes();
        menuAttrs.setStyles(StylesBuilder.getCompleteStyles(
                "mcs-aural-dtmf-allocation: automatic; " +
                "mcs-aural-menu-scope: document"));

        // We use Strings for errmsg, prompt, and help to avoid having to
        // resolve TextComponentIdentity which would require a repository
        menuAttrs.setErrmsg(new LiteralTextAssetReference(
                "<noinput>Sorry I did not hear you</noinput>" +
                            "<nomatch>Sorry I did not understand you</nomatch>"));
        menuAttrs.setHelp(new LiteralTextAssetReference("<help>Please select an option from the menu</help>"));
        menuAttrs.setPrompt(new LiteralTextAssetReference("<prompt>Welcome home.<enumerate>For <value " +
                            "expr=\"_prompt\"/>, press <value expr=\"_dtmf\"/> or say " +
                            "<value expr=\"_prompt\"/></enumerate></prompt>"));

        MenuItem item1 = new MenuItem();
        item1.setText("Sports News");
        item1.setHref("http://www.volantis.com:8080/volantis/sports.jsp");
        menuAttrs.addItem(item1);

        MenuItem item2 = new MenuItem();
        item2.setText("Astrology");
        item2.setHref("http://www.volantis.com:8080/volantis/astrology.jsp");
        item2.setPrompt(new LiteralTextAssetReference("<prompt><audio src=\"rtsp://www.volantis.com/" +
                        "mysticmeg.wav\">Mystic Megs Astrology</audio></prompt>"));
        menuAttrs.addItem(item2);

        MenuItem item3 = new MenuItem();
        item3.setText("Fun and Games");
        item3.setHref("http://www.volantis.com:8080/volantis/games.jsp");
        item3.setShortcut(new LiteralTextAssetReference("9"));
        menuAttrs.addItem(item3);

        protocol.doMenu(menuAttrs);

        String actual = DOMUtilities.toString(
                buffer.getRoot(), protocol.getCharacterEncoder());
View Full Code Here


        MenuItem item1 = new MenuItem();
        item1.setText("Website Index.");
        item1.setHref("http://www.volantis.com/index.jsp");
        item1.setShortcut(new LiteralTextAssetReference("9"));
        MenuAttributes attributes = new MenuAttributes();
        attributes.setManualDTMF(true);
        protocol.doMenuItem(buffer, attributes, item1);
        String actual = DOMUtilities.toString(
                buffer.getRoot(), protocol.getCharacterEncoder());

        String expected = "<choice next=\"http://www.volantis.com/index." +
                "jsp\" dtmf=\"9\">Website Index.</choice>";
        Document expectedDom = DOMUtilities.read(reader, expected);
        String expectedDOMAsString =
                DOMUtilities.toString(
                        expectedDom, protocol.getCharacterEncoder());

        assertEquals("the processed DOM is not as expected.",
                     expectedDOMAsString, actual);


        // Same again but with manualDTMF set to false.
        buffer = getNewDOMOutputBuffer();
        expected = "<choice next=\"http://www.volantis.com/index.jsp\">" +
                "Website Index.</choice>";
        expectedDom = DOMUtilities.read(reader, expected);
        expectedDOMAsString = DOMUtilities.toString(
                expectedDom, protocol.getCharacterEncoder());

        attributes.setManualDTMF(false);
        protocol.doMenuItem(buffer, attributes, item1);
        actual = DOMUtilities.toString(
                buffer.getRoot(), protocol.getCharacterEncoder());

        assertEquals("the processed DOM is not as expected.",
                     expectedDOMAsString, actual);


        // With a prompt in the source this time.  Demonstrates that the text
        // attribute is overriden by the prompt attribute.
        buffer = getNewDOMOutputBuffer();
        MenuItem item2 = new MenuItem();
        item2.setText("Website Index.");
        item2.setHref("http://www.volantis.com/index.jsp");
        item2.setPrompt(new LiteralTextAssetReference("<prompt><audio src=\"rtsp://www.volantis" +
                        ".com/mysticmeg.wav\">Mystic Megs Astrology</audio>" +
                        "</prompt>"));

        expected = "<choice next=\"http://www.volantis.com/index.jsp\">" +
                "<prompt><audio src=\"rtsp://www.volantis.com/mysticmeg" +
                ".wav\">Mystic Megs Astrology</audio></prompt></choice>";
        expectedDom = DOMUtilities.read(reader, expected);
        expectedDOMAsString = DOMUtilities.toString(
                expectedDom, protocol.getCharacterEncoder());

        attributes.setManualDTMF(true);
        protocol.doMenuItem(buffer, attributes, item2);
        actual = DOMUtilities.toString(
                buffer.getRoot(), protocol.getCharacterEncoder());

        assertEquals("the processed DOM is not as expected.",
                     expectedDOMAsString, actual);

        // Null Href - there should be no output from the doMenuItem method.
        buffer = getNewDOMOutputBuffer();
        MenuItem item3 = new MenuItem();
        item3.setText("Some arbitrary text.");
        item3.setShortcut(new LiteralTextAssetReference("5"));

        expectedDOMAsString = "";

        attributes.setManualDTMF(true);
        protocol.doMenuItem(buffer, attributes, item3);
        actual = DOMUtilities.toString(
                buffer.getRoot(), protocol.getCharacterEncoder());

        assertEquals("the processed DOM is not as expected.",
View Full Code Here

    }

    // javadoc inherited
    protected MenuAttributes createMenuAttributes() {
        MenuAttributes menuAttributes = super.createMenuAttributes();
        menuAttributes.setPane(new Pane(new CanvasLayout()));
        return menuAttributes;
    }
View Full Code Here

TOP

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

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.