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

Examples of com.volantis.mcs.protocols.menu.model.MenuItem


            throws Exception {

        // Create the menu item.
        String text = "item text";
        Menu menu = createSimpleMenu(title, href, text);
        MenuItem item = (MenuItem) menu.get(0);
       
        // Render the menu item.
        OpenwaveOptionMenuItemRenderer renderer =
                new OpenwaveOptionMenuItemRenderer();
View Full Code Here


    public void testGet() {
        ConcreteMenuItemGroup itemGroup = createBasicMenuItemGroup(true);
        int maxItems = itemGroup.getSize();

        // Test get within bounds
        MenuItem item = itemGroup.get(1);
        assertNotNull("Menu item should not be null", item);

        // Test get out of bounds
        try {
            item = itemGroup.get(maxItems + 1);
View Full Code Here

        // Create a test menu
        ConcreteMenu menu = MenuModelHelper.createMenu(false, title);
        menu.setLabel(menuLabel);

        // Test getting a null menu item
        MenuItem response = menu.getAsMenuItem();
        assertNull("The menu should be top level", response);

        // Set a parent container to force a submenu
        menu.setContainer((MenuEntry)createTestInstance(
                MenuModelHelper.createElementDetails()));

        // Test getting a valid menu item
        response = menu.getAsMenuItem();
        assertNotNull("The menu should be a sub menu", response);

        // Check the labels are the same
        assertSame("Labels should be the same", menuLabel, response.getLabel());

        // Check the title
        assertEquals("Titles should match", title, response.getTitle());
    }
View Full Code Here

        // Create the test renderer
        MenuItemBracketingRenderer renderer = createTestRenderer();

        MenuBuffer buffer = createMenuBuffer();
        MenuBufferLocator locator = createLocator(buffer);
        MenuItem item = createMenuItem();

        String output = getRenderOutputAsString(renderer, item);
        String expected = DOMUtilities.
                             provideDOMNormalizedString(getExpectedString());
View Full Code Here

        textBuffer.addElement(b);

        // Create the test text, label, and then the menu item
        MenuText text = entity.createTestMenuText(textBuffer);
        MenuLabel label = entity.createTestMenuLabel(text);
        MenuItem item = entity.createTestMenuItem(label);

        // Create test renderer object
        DefaultPlainTextMenuItemRenderer renderer =
                new DefaultPlainTextMenuItemRenderer();
View Full Code Here

        assertTrue("Unexpected value returned from MenuItemElement.  Should " +
                "have been PROCESS_ELEMENT_BODY.",
                result == PAPIElement.PROCESS_ELEMENT_BODY);

        final MenuItem menuItem = (MenuItem) PrivateAccessor.getField(
                menuModelBuilder, "currentEntity");

        ElementDetails elementDetails = menuItem.getElementDetails();
        assertNotNull("MenuItem ElementDetails should not be null",
                elementDetails);

        assertNotNull("MenuItem Styles should not be null after elementStart",
                elementDetails.getStyles());
View Full Code Here

     */
    public void startMenuItemSuccess() throws Exception {
        builder.startMenu();

        Object container = getCurrentEntity();
        MenuItem item;
        Object menu;

        builder.startMenuItem();

        item = (MenuItem)getCurrentEntity();

        assertSame("container (1) not as",
                   container,
                   item.getContainer());

        assertSame("menu (1) not as",
                   container,
                   item.getMenu());

        configureMinimalItem();

        builder.endMenuItem();

        builder.startMenu();

        // This menu will be the menu for items in this menu or in menu groups
        // that are children of this menu
        menu = container = getCurrentEntity();

        builder.startMenuItem();

        item = (MenuItem)getCurrentEntity();

        assertSame("container (2) not as",
                   container,
                   item.getContainer());

        assertSame("menu (2) not as",
                   container,
                   item.getMenu());

        configureMinimalItem();

        builder.endMenuItem();

        builder.startMenuGroup();

        container = getCurrentEntity();

        builder.startMenuItem();

        item = (MenuItem)getCurrentEntity();

        assertSame("container (3) not as",
                   container,
                   item.getContainer());

        assertSame("menu (3) not as",
                   menu,
                   item.getMenu());
    }
View Full Code Here

                if (max < len) {
                    max = len;
                }
            } else if (entry instanceof MenuItemGroup) {
                MenuItemGroup mig = (MenuItemGroup)entry;
                MenuItem item;
                for (int j = 0; j < mig.getSize(); j++) {
                    item = mig.get(j);

                    buffer = (DOMOutputBuffer)item.
                            getLabel().getText().getText();

                    // Assumes that there is just a single text node
                    text = (Text)buffer.getRoot().getHead();
View Full Code Here

            // only for rendering the labels of those sub-menus. The original
            // menu is rendered in the render method, and contained menus
            // get their own menu renderer as shown below.

            // Render a menu item that represents this sub-menu
            MenuItem item = menu.getAsMenuItem();
            // Check for whether it should be rendered.  The check for
            // auto-iterating is necessary because for pane targeted
            // (which this menu has become if its parent automatically
            // spatially iterates) then the label should not be output.
            if (item != null &&
View Full Code Here

     * visting the children.
     */
    protected void renderChildren(MenuItemGroup group) throws RendererException {
        int numChildren = group.getSize();
        for (int i = 0; i < numChildren; i++) {
            MenuItem menuItem = group.get(i);
            accept(menuItem);
        }
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.menu.model.MenuItem

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.