2 Replies Latest reply on Dec 11, 2012 11:12 AM by Nick Scavelli

    Hi guys here you have java class to make Custom Menu in your portal

    Edgar Sánchez Newbie

      You can use this class to build custom menu, please check this:

       

      https://community.jboss.org/wiki/PortalNavigationjava

       

       

      Usage:

       

       

        public void render(RenderRequest req, RenderResponse res)
          throws PortletException, IOException
        {
          try
          {
           // this is a pojo XD
           PortalNavigation portalNavigation = new PortalNavigation();
            Collection<UserNode> lstChildren;
            UserNode selectedNode = portalNavigation.getSelectedNode();
            for (UserNode userNode : listUserNode) {
                  lstChildren = userNode.getChildren();
                  for (UserNode childrenNode : lstChildren) {
                      System.out.println(childrenNode.getId());
                      System.out.println(childrenNode.getEncodedResolvedLabel());
                        if(childrenNode.getNavigation() != null){
                            System.out.println(childrenNode.getNavigation().getKey().getName());
                        }
                        System.out.println(childrenNode.getIcon());
                }
            }
      
            PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/menu.jsp");
            //req.setAttribute("listUserMenu", listUserMenu);
            prd.include(req, res);
            
          }
          catch (Exception ex)
          {
               ex.printStackTrace();
          }
        }