Examples of MenuAttributes


Examples of com.volantis.mcs.papi.MenuAttributes

                .returns(null).any();

        pageContext.setPolicyReferenceResolver(referenceResolverMock);

        // set up menu atttributes
        MenuAttributes menuAttrs = new MenuAttributes();
        final String styleClass = "styleClass";
        menuAttrs.setStyleClass(styleClass);
        final String id = "id";
        menuAttrs.setId(id);
        menuAttrs.setPane(pane);

        int result = element.elementStart(requestContext, menuAttrs);

        assertTrue("Unexpected value returned from MenuElement.  Should have" +
                "been PROCESS_ELEMENT_BODY.",
View Full Code Here

Examples of com.volantis.mcs.papi.MenuAttributes

        MenuItemGroupElementImpl group = new MenuItemGroupElementImpl();
        MenuItemElementImpl epsilon = new MenuItemElementImpl();
        MenuItemElementImpl zeta = new MenuItemElementImpl();

        // Set up some attributes to pass in to the builder
        MenuAttributes menuAttributes = new MenuAttributes();
        MenuItemGroupAttributes menuItemGroupAttributes =
                                            new MenuItemGroupAttributes();


        // Test the elements - these must be called in the order expected in
View Full Code Here

Examples of com.volantis.mcs.papi.MenuAttributes

            throws PAPIException {

        MarinerPageContext pageContext =
                ContextInternals.getMarinerPageContext(context);

        MenuAttributes attributes = (MenuAttributes) blockAttributes;

        // Get hold of the menu builder - this will be initialised if needed
        MenuModelBuilder builder = pageContext.getMenuBuilder();

        try {
            // Starting a new menu
            builder.startMenu();

            // Setting attributes on the menu

            // Set the pane attribute
            MenuInternals.setPane(builder, attributes.getPane(), pageContext);

            // Get the styling property values for the current element
            Styles styles = pageContext.getStylingEngine().getStyles();

            // Emulate deprecated menu styles if necessary
            useDeprecatedMenuTypes(styles, attributes.getType());

            // Store the propertyvalues for any child use
            menuProperties = styles.getPropertyValues();

            // Set the stylistic information in the model for this element.
            MenuInternals.setElementDetails(builder, attributes, styles);

            // Set the event handling
            MenuInternals.setEvents(builder, attributes, pageContext);

            PolicyReferenceResolver resolver =
                    pageContext.getPolicyReferenceResolver();

            // Set the prompt
            builder.setPrompt(resolver.resolveQuotedTextExpression(
                    attributes.getPrompt()));

            // Set the error message
            builder.setErrorMessage(resolver.resolveQuotedTextExpression(
                    attributes.getErrmsg()));

            // Set the help
            builder.setHelp(resolver.resolveQuotedTextExpression(
                    attributes.getHelp()));

            // Set the title
            builder.setTitle(attributes.getTitle());

            // Set the Shortcut properties.
            setShortcutPropertiesOnBuilder(pageContext, builder, styles);

            // Push this element
View Full Code Here

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

Examples of com.volantis.mcs.protocols.MenuAttributes

        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

Examples of com.volantis.mcs.protocols.MenuAttributes

    }

    // javadoc inherited
    protected MenuAttributes createMenuAttributes() {
        MenuAttributes menuAttributes = super.createMenuAttributes();
        menuAttributes.setPane(new Pane(new CanvasLayout()));
        return menuAttributes;
    }
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.