Package com.volantis.mcs.protocols.menu.shared.model

Examples of com.volantis.mcs.protocols.menu.shared.model.ConcreteMenu


        elementDetails.setStyles(StylesBuilder.getCompleteStyles(
                "mcs-menu-link-style: numeric-shortcut"));

        // Create a test menu
        ConcreteMenu testMenu = new ConcreteMenu(elementDetails);

        // Test renderer returned
        MenuRenderer renderer = selector.selectMenuRenderer(testMenu);

        // Check the renderer exists.  JavaDoc on MenuRendererSelector
        // says it may not be null.
        assertNotNull("Should be a renderer here (1)", renderer);

        // Check appropriate renderer returned
        assertTrue("Wrong renderer returned (1)",
                   renderer instanceof OpenwaveMenuRenderer);

        // Set styles to force WML
        elementDetails = new ConcreteElementDetails();
        elementDetails.setStyles(StylesBuilder.getCompleteStyles(
                "mcs-menu-link-style: default"));

        // Create a test menu
        testMenu = new ConcreteMenu(elementDetails);

        // Test renderer returned
        renderer = selector.selectMenuRenderer(testMenu);

        // Check the renderer exists.  JavaDoc on MenuRendererSelector
View Full Code Here


                new FormatReference("test-pane",
                                    NDimensionalIndex.ZERO_DIMENSIONS);

        // Build a one level menu
        MenuEntityCreation entities = new MenuEntityCreation();
        ConcreteMenu menu =
                new ConcreteMenu(entities.createTestElementDetails());
        menu.setTitle("Top Level Menu");
        menu.setPane(pane);
        boolean result = false;
        try {
            PrivateAccessor.setField(builder, "menu", menu);
            // Test success
            Boolean objectResult =
                    (Boolean) PrivateAccessor.invoke(builder,
                                                     "checkNestedPanes",
                                                     new Class[] {
                                                         FormatReference.class
                                                     },
                                                     new Object[] {pane});
            result = objectResult.booleanValue();
        } catch (Throwable t) {
            fail("Test infrastructure failed (1)");
        }
        assertTrue("Should have returned true for the check", result);

        // Build a two level menu
        ConcreteMenu menuTwo =
                new ConcreteMenu(entities.createTestElementDetails());
        menuTwo.setTitle("Sub Menu");
        menuTwo.setPane(pane);
        menu.add(menuTwo);
        try {
            PrivateAccessor.setField(builder, "menu", menuTwo);
            // Test failure
            Boolean objectResult =
View Full Code Here

     * null otherwise.
     *
     * @return the current entity or null if not of the required class
     */
    private ConcreteMenu getCurrentMenu() {
        ConcreteMenu current = null;

        if (currentEntity instanceof ConcreteMenu) {
            current = (ConcreteMenu) currentEntity;
        }

View Full Code Here

        return menu;
    }

    // javadoc inherited
    public void startMenu() throws BuilderException {
        ConcreteMenu parent = getCurrentMenu();

        if (currentEntity == null) {
            push(new ConcreteMenu(new ConcreteElementDetails()));
        } else if (parent != null) {
            ConcreteMenu menu = new ConcreteMenu(new ConcreteElementDetails());
            parent.add(menu);
            push(menu);
        } else {
            reportBadParent(Menu.class);
        }
View Full Code Here

        return menu;
    }

    // javadoc inherited
    public void startMenuGroup() throws BuilderException {
        ConcreteMenu parentMenu = getCurrentMenu();

        if (parentMenu != null) {
            ConcreteMenuItemGroup group = new ConcreteMenuItemGroup(
                    new ConcreteElementDetails());
            parentMenu.add(group);
            push(group);
        } else {
            reportBadParent(MenuItemGroup.class);
        }
    }
View Full Code Here

        }
    }

    // javadoc inherited
    public void startMenuItem() throws BuilderException {
        ConcreteMenu parentMenu = getCurrentMenu();

        // May appear in menus or menu groups.
        // @todo later could use an interface common to the two target classes
        if (parentMenu != null) {
            ConcreteMenuItem item = new ConcreteMenuItem(
                    new ConcreteElementDetails(),
                    new ConcreteMenuLabel(
                            null,
                            new ConcreteMenuText()));
            parentMenu.add(item);
            push(item);
        } else {
            ConcreteMenuItemGroup parentGroup = getCurrentMenuItemGroup();

            if (parentGroup != null) {
View Full Code Here

        }
    }

    // javadoc inherited
    public void startLabel() throws BuilderException {
        ConcreteMenu parentMenu = getCurrentMenu();

        // May appear in menus or menu items (the latter always has one)
        // @todo later could use an interface common to the two target classes
        if (parentMenu != null) {
            ConcreteMenuLabel label = new ConcreteMenuLabel(
                    new ConcreteElementDetails(), new ConcreteMenuText());

            parentMenu.setLabel(label);
            push(label);
        } else {
            ConcreteMenuItem item = getCurrentMenuItem();

            if (item != null) {
View Full Code Here

                item.setPrompt(prompt);
            } catch (Exception e) {
                throw new BuilderException(e);
            }
        } else {
            ConcreteMenu menu = getCurrentMenu();

            if (menu != null) {
                try {
                    menu.setPrompt(prompt);
                } catch (Exception e) {
                    throw new BuilderException(e);
                }
            } else {
                reportBadParent("prompt");
View Full Code Here

        }
    }

    // javadoc inherited
    public void setErrorMessage(TextAssetReference message) throws BuilderException {
        ConcreteMenu menu = getCurrentMenu();

        if (menu != null) {
            try {
                menu.setErrorMessage(message);
            } catch (Exception e) {
                throw new BuilderException(e);
            }
        } else {
            reportBadParent("error message");
View Full Code Here

        }
    }

    // javadoc inherited
    public void setHelp(TextAssetReference help) throws BuilderException {
        ConcreteMenu menu = getCurrentMenu();

        if (menu != null) {
            try {
                menu.setHelp(help);
            } catch (Exception e) {
                throw new BuilderException(e);
            }
        } else {
            reportBadParent("help");
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.menu.shared.model.ConcreteMenu

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.