When using <x:navigationMenuItems> in jsCookMenu, only top-level is displayed
-----------------------------------------------------------------------------

         Key: MYFACES-392
         URL: http://issues.apache.org/jira/browse/MYFACES-392
     Project: MyFaces
        Type: Bug
  Components: Tomahawk  
    Versions: 1.0.9 beta    
 Environment: Microsoft Windows XP
JDeveloper 10.0.2
Oracle OC4J 10.0.2
MyFaces 1.0.9
    Reporter: Lee Smith


When programmatically builing a menu for jscookmenu using the following syntax:

<x:jscookMenu layout="hbr" theme="ThemeOffice">
   <x:navigationMenuItems value="#{menuBean.menu}"/>
</x:jscookMenu>

only the top-level of items in the specified bean are rendered. For example, if 
the menuBean was defined as:

public class MenuBean
{
   public List getMenu()
   {
      NavigationMenuItem menu1 = new NavigationMenuItem("label1","action1", 
null, false);
      menu1.setNavigationMenuItems(new NavigationMenuItem[] {
         new NavigationMenuItem("label1.1", "action1.1", null, false),
         new NavigationMenuItem("label1.2", "action1.2", null, false)
      });

      NavigationMenuItem menu2 = new NavigationMenuItem("label2", "action2", 
null, false);
      menu2.setNavigationMenuitems(new NavigationMenuItem[] {
        new NavigationMenuItem("label2.1", "action2.1", null, false),
        new NavigationMenuItem("label2.2", "action2.2", null, false)
      });

      List menu = new ArrayList();
      menu.add(menu1);
      menu.add(menu2);

      return menu;
   }
}

then only the root options 'label1' and 'label2' are rendered.

This appears to be cause by 
org.apache.myfaces.custom.navmenu.jscookmenu.HtmlJSCookMenuRenderer, in the 
method encodeNavigationMenuItems.

The following changes seem to fix the problem (not sure if the fix is 
appropriate, given I'm not entirely sure what uiNavMenuItemList is used for :) 
):

199a200
> 
201a203,204
>                               if (uiNavMenuItemList != null)
>                               {
202a206
>                               }
267a272,276
>                                       else
>                                       {
>                                               
> encodeNavigationMenuItems(context, writer, menuItems,
>                                                               null, menuId);
>                                       }

Cheers,

Lee


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to