title: How to implement programmatic menu with panelmenu and defaultmenumodel
body: <p>I tried to implements programmatic <code>panelmenu</code> using <code>defaultmenumodel</code> and <code>panelmenu</code> with PrimeFaces 4.0. The problem is when I implement a simple model, one or more submenus that contains one o more menuitems runs ok. But when I implement submenus that contains menuitmes and more submenus that containts another menuitems, the <code>defaultmenumodel</code> not shows all levels.</p>
  
  <pre><code>Menu level one
  ...MenuItem one.one *
  ...MenuItem one.two *
  ...SubMenu one.one
  ......MenuItem one.one.one
  ......MenuItem one.one.two
  ...SubMenu one.two
  ......MenuItem one.two.one
  Menu lebel two
  ... And so on 
  </code></pre>
  
  <p>The MenuItem with * not shown when page is rendered
  How can I implement these model of menu using DefaultMenuModel and  ??
  I want to use pojo to save the menu structure in DataBase for managing.
  Thanks</p>
  
  <p>(Added / Edited)
  I have run next code suggested but not work using p:panelMenu. With p:menuBAr works well showing an Item and a SubMenu with item inside.</p>
  
  <pre><code>//create the first menu item It is not SubMenu, It's a simple MenuItem
  //This item not shows in &lt;p:panelmenu&gt;
  DefaultMenuItem accueil = new DefaultMenuItem();
  accueil.setStyleClass("only simple menuItem");
  accueil.setUrl("/accueil.jsf");
  this.menumodel.addElement(accueil);
  
  //This work properly ans shows in &lt;p:panelMenu&gt;
  DefaultSubMenu submenu = new DefaultSubMenu();
  submenu.setIcon(null);
  submenu.setLabel("submenu 01");
  this.menumodel.addElement(submenu);
  //Add items to submenu
  DefaultMenuItem item = new DefaultMenuItem();
  item.setValue("Administrar Usuarios");
  item.setUrl("/clientapp/modules/admin/manage_users.xhtml");
  submenu.addElement(item);
  </code></pre>