Search in sources :

Example 1 with MenuOption

use of org.jaffa.components.navigation.domain.MenuOption in project jaffa-framework by jaffa-projects.

the class NavAccessor method parseMenuOptions.

/**
 * @return the number of menu items added under this option
 */
int parseMenuOptions(List menuOptions, List navOptions) {
    int counter = 0;
    for (Iterator it = menuOptions.iterator(); it.hasNext(); ) {
        MenuOption mOpt = (MenuOption) it.next();
        try {
            NavOption nOpt = new NavOption(this, mOpt);
            navOptions.add(nOpt);
            counter++;
            if (log.isDebugEnabled())
                log.debug("Added Option - " + nOpt.getLabel());
        } catch (SecurityException se) {
            if (log.isDebugEnabled())
                log.debug("Access Denied to Menu Option " + mOpt.getLabel());
        }
    }
    return counter;
}
Also used : MenuOption(org.jaffa.components.navigation.domain.MenuOption) Iterator(java.util.Iterator)

Example 2 with MenuOption

use of org.jaffa.components.navigation.domain.MenuOption in project jaffa-framework by jaffa-projects.

the class NavigationXmlLoadTest method testNavigationRegistration.

/**
 * testNavigationRegistration - Verifies that the navigation.xml has been loaded correctly into the NavigationManager.
 */
@Test
public void testNavigationRegistration() {
    NavigationManager navigationManager = xmlLoaderConfig.getBean(NavigationManager.class);
    ContextKey key = new ContextKey("CONTRACTOR", "roles.xml", "DEF", "100-Highest");
    assertNull(navigationManager.getNavigationRepository().query(key));
    GlobalMenu globalMenu = new GlobalMenu();
    MenuOption menuOption = new MenuOption();
    menuOption.setLabel("Label 1");
    globalMenu.getMenuOption().add(menuOption);
    navigationManager.registerGlobalMenu(key, globalMenu);
    assertNotNull(navigationManager.getNavigationRepository().query(key));
    navigationManager.unregisterGlobalMenu(key);
    assertNull(navigationManager.getNavigationRepository().query(key));
}
Also used : ContextKey(org.jaffa.loader.ContextKey) MenuOption(org.jaffa.components.navigation.domain.MenuOption) GlobalMenu(org.jaffa.components.navigation.domain.GlobalMenu) Test(org.junit.Test)

Aggregations

MenuOption (org.jaffa.components.navigation.domain.MenuOption)2 Iterator (java.util.Iterator)1 GlobalMenu (org.jaffa.components.navigation.domain.GlobalMenu)1 ContextKey (org.jaffa.loader.ContextKey)1 Test (org.junit.Test)1