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

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


     * Checks that the correct class of separator renderer is returned for the
     * vertical menu item separator.
     */
    public void testSelectMenuItemSeparatorVertical() throws Exception {
        MenuSeparatorRendererSelector selector = createSelector();
        Menu menu;

        menu = createMenu(StylesBuilder.getCompleteStyles(
                "mcs-menu-item-orientation: vertical"), null);

        checkSeparator("selectMenuItemSeparator(vertical)",
View Full Code Here


        assertNull("menu model should be null",
                   getMenuModel());

        builder.startMenu();

        Menu menu = getMenuModel();

        // Demonstrate that a new menu is created
        assertNotNull("menu model should not be null",
                      getMenuModel());

        assertSame("Menu should be the current entity",
                   menu,
                   getCurrentEntity());

        builder.startMenu();

        assertTrue("current entity should be a menu",
                   getCurrentEntity() instanceof Menu);

        Menu subMenu = (Menu)getCurrentEntity();

        assertNotSame("subMenu should be different from menu",
                      menu,
                      subMenu);

        assertEquals("menu child should have been added",
                     1,
                     menu.getSize());

        assertEquals("menu child's container should have been set",
                     menu,
                     subMenu.getContainer());
    }
View Full Code Here

     * and the menu model for a top-level one.
     */
    public void testEndMenuSuccess() throws Exception {
        builder.startMenu();

        Menu menu = getMenuModel();

        builder.startMenu();

        Object subMenu = getCurrentEntity();

View Full Code Here

     * Menu groups may appear in (top-level or nested) menus.
     */
    public void testStartMenuGroupSuccess() throws Exception {
        builder.startMenu();

        Menu menu = (Menu)getCurrentEntity();

        builder.startMenuGroup();

        MenuItemGroup group1 = (MenuItemGroup)getCurrentEntity();

View Full Code Here

     * Helper method returning the current menu model for the {@link #builder}.
     *
     * @return the current menu model
     */
    protected Menu getMenuModel() {
        Menu menu = null;

        try {
            Stack entities =
                (Stack)PrivateAccessor.getField(builder, "entities");

View Full Code Here

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

        // retrieve the menu that was just added to the menuBuilder
        final Menu menu = (Menu)PrivateAccessor.getField(
                pageContext.getMenuBuilder(), "currentEntity");

        assertNotNull("Menu should not be null", menu);
        assertEquals("PAPI and Protocol pane names should match",
                testPane.getName(), menu.getPane().getStem());

        ElementDetails menuElementDetails = menu.getElementDetails();
        assertNotNull("Menu ElementDetails should not be null",
                menuElementDetails);
        assertNotNull("Menu styles should not be null",
                menuElementDetails.getStyles());
    }
View Full Code Here

        pageContext.popElement(this);

        MenuModelBuilder builder = pageContext.getMenuBuilder();

        try {
            Menu menu = builder.endMenu();

            // If a menu is completed (i.e. this is not nested) then need to
            // process it and output against specific renderer and markup.
            if (menu != null) {
                // Obtain a suitable renderer
                MenuRendererSelectorLocator rendererLocator =
                        pageContext.getRendererLocator();
                MenuRendererSelector rendererSelector =
                        rendererLocator.getMenuRendererSelector(pageContext);
                if (rendererSelector == null) {
                    logger.error("selector-rendering-error", "menu");
                    throw new PAPIException(exceptionLocalizer.format(
                            "missing-renderer-selector", "menu"));
                }

                MenuRenderer renderer =
                        rendererSelector.selectMenuRenderer(menu);

                final ShortcutProperties shortcutProperties =
                        menu.getShortcutProperties();
                if (null != shortcutProperties) {
                    // If the device cannot support mixed content in the body
                    // of a link, then update the shortcut properties so that
                    // span elements will not be used.
                    String supportsMixedContent = pageContext.
View Full Code Here

        reference = entry.getPane();

        if (reference == null) {
            // Look to see if this entry appears directly within an automatic
            // iteration allocating menu
            Menu menu = getAutoAllocatingMenu(entry);

            if (menu != null) {
                // The menu is automatically allocating iterations. See if this
                // allocation has already been performed
                reference = (FormatReference) getAllocations().get(entry);
View Full Code Here

     * @return the containing menu if it is performing automatic iteration
     *         allocation or null if the entry is not an immediate child of a
     *         menu performing automatic iteration allocation
     */
    private Menu getAutoAllocatingMenu(MenuEntry entry) {
        Menu autoAllocatingMenu = null;

        // Only cover entries that are immediate children of a menu (i.e.
        // ignore menu items within a menu item group - the content of the
        // menu item group will be targeted at the pane allocated to the
        // group)
View Full Code Here

        // a separate menu and that sub-menu labels are not
        // menu items themselves).

        // This code assumes that the buffers contain plain
        // text
        Menu menu = (Menu)group.getContainer();
        MenuEntry entry;
        DOMOutputBuffer buffer;
        Text text;
        int max = 0;
        int len;

        // Determine the maximum length menu item label
        for (int i = 0; i < menu.getSize(); i++) {
            entry = menu.get(i);

            if (entry instanceof MenuItem) {
                buffer = (DOMOutputBuffer)((MenuItem)entry).
                        getLabel().getText().getText();
View Full Code Here

TOP

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

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.