Package org.primefaces.component.menuitem

Examples of org.primefaces.component.menuitem.MenuItem


   
    writer.write(var + ".addItems([");
   
    for(UIComponent child : menu.getChildren()) {
      if(child instanceof MenuItem && child.isRendered()) {
        MenuItem item = (MenuItem) child;
        String menuItemClientId = item.getClientId(facesContext);
        String onclick = item.getOnclick();
       
        if(!firstMenuitem)
          writer.write(",");
        else
          firstMenuitem = false;
       
        writer.write("{");
        writer.write("text:'" + (String) item.getValue() + "'");
       
        if(item.getUrl() != null) {
          writer.write(",url:'" + getResourceURL(facesContext, item.getUrl() + "'"));
          if(item.getTarget() != null) writer.write(",target:'"+ item.getTarget() + "'");
          if(onclick != null) writer.write(",onclick:{fn:function() {" + onclick + "}}");
        } else {
          String command = item.isAjax() ? buildAjaxRequest(facesContext, item, formClientId, menuItemClientId) : buildNonAjaxRequest(facesContext, item, formClientId, menuItemClientId);
          command = onclick == null ? command : onclick + ";" + command;
         
          writer.write(",onclick:{fn: function() {" + command + "}}");
        }
       
View Full Code Here


   
    boolean firstFn = true;
    writer.write("commands:[");
    for(UIComponent child : button.getChildren()) {
      if(child instanceof MenuItem && child.isRendered()) {
        MenuItem menuItem = (MenuItem) child;
        String menuItemClientId = menuItem.getClientId(facesContext);
        String command = null;
       
        if(menuItem.getUrl() != null) {
          command = "window.location.href = '" + menuItem.getUrl() + "'";
        } else {
          command = menuItem.isAjax() ? buildAjaxRequest(facesContext, menuItem, formClientId, menuItemClientId) : buildNonAjaxRequest(facesContext, menuItem, formClientId, menuItemClientId);
        }
       
        if(!firstFn) {
          writer.write(",");
        } else {
View Full Code Here

    writer.writeAttribute("id", selectId, null);
    writer.writeAttribute("name", selectId, null);
   
    for(UIComponent kid : button.getChildren()) {
      if(kid instanceof MenuItem && kid.isRendered()) {
        MenuItem menuItem = (MenuItem) kid;
       
        writer.startElement("option", null);
        writer.writeAttribute("value", menuItem.getClientId(facesContext), null);
        writer.write((String) menuItem.getValue());
        writer.endElement("option");
      }
    }
   
    writer.endElement("select");
View Full Code Here

   
    try{
      List<MenuAplicacao> menusPrincipais = usuarioService.obterMenusPrincipais();
      for(MenuAplicacao menuPrincipal:menusPrincipais){
        if(menuPrincipal.getFilhos().isEmpty()){
          MenuItem menuItem = new MenuItem();
          menuItem.setValue(menuPrincipal.getLabel());
          menuItem.setUrl(menuPrincipal.getUrl());
          menuItem.setIcon(menuPrincipal.getIcon());
          this.menuModel.addMenuItem(menuItem);
        }else{
          Submenu submenu = new Submenu();
          submenu.setLabel(menuPrincipal.getLabel());
          submenu.setIcon(menuPrincipal.getIcon());
View Full Code Here

  }
 
  private void loadSubmenu(MenuAplicacao menu, Submenu submenu){
    if(menu.getFilhos().isEmpty()){
      if(!menu.getSeparador().booleanValue()){
        MenuItem menuItem = new MenuItem();
        menuItem.setValue(menu.getLabel());
        menuItem.setUrl(menu.getUrl());
        menuItem.setIcon(menu.getIcon());
        submenu.getChildren().add(menuItem);
      }else{
        Separator separator = new Separator();
        submenu.getChildren().add(separator);
      }
View Full Code Here

TOP

Related Classes of org.primefaces.component.menuitem.MenuItem

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.