Package org.primefaces.component.submenu

Examples of org.primefaces.component.submenu.Submenu


  private void renderRegularMenu(FacesContext facesContext, Menu menu) throws IOException{
    ResponseWriter writer = facesContext.getResponseWriter();
    List<UIComponent> submenus = menu.getChildren();
   
    for (int i=0; i < submenus.size(); i++) {
      Submenu submenu = (Submenu) submenus.get(i);
     
      if(submenu.isRendered()) {
        writer.startElement("h6", null);
        String defaultTitleStyleClass = (i == 0) ? "first-of-type" : null;
       
        if(submenu.getStyleClass() != null) {
          if(defaultTitleStyleClass != null)
            writer.writeAttribute("class", defaultTitleStyleClass + " " + submenu.getStyleClass(), null);
          else
            writer.writeAttribute("class", submenu.getStyleClass(), null);
        } else if(defaultTitleStyleClass != null) {
          writer.writeAttribute("class", defaultTitleStyleClass, null);
        }
       
        if(submenu.getStyle() != null) writer.writeAttribute("style", submenu.getStyle(), null);
   
        if(submenu.getLabel() != null)
          writer.write(submenu.getLabel());
         
        writer.endElement("h6");
       
        writer.startElement("ul", null);
        if(i == 0)
View Full Code Here


    writer.startElement("ul", null);
    writer.writeAttribute("class", "first-of-type", null);
   
    List<UIComponent> children = menubar.getChildren();
    for (int i=0; i < children.size(); i++) {
      Submenu submenu = (Submenu) children.get(i);
     
      if(submenu.isRendered()) {
        writer.startElement("li", null);
        if(i == 0)
          writer.writeAttribute("class", "yuimenubaritem first-of-type", null);
        else
          writer.writeAttribute("class", "yuimenubaritem", null);
View Full Code Here

       
        if(child instanceof MenuItem) {
          MenuItem menuItem = (MenuItem) child;
          encodeMenuItem(facesContext, menuItem);
        } else if(child instanceof Submenu) {
          Submenu childSubmenu = (Submenu) child;
          encodeSubmenu(facesContext, childSubmenu);
        }
       
        writer.endElement("li");
      }
View Full Code Here

    @PostConstruct
    protected void initialize() {
        model = new DefaultMenuModel();

        // first submenu
        Submenu submenu = new Submenu();
        submenu.setLabel("JavaScript Libraries");

        // menu items
        MenuItem item = new MenuItem();
        item.setValue("jQuery");
        item.setUrl("http://jquery.com");
        submenu.getChildren().add(item);

        item = new MenuItem();
        item.setValue("Yahoo UI");
        item.setUrl("http://yuilibrary.com");
        submenu.getChildren().add(item);

        item = new MenuItem();
        item.setValue("Prototype");
        item.setUrl("http://prototypejs.org");
        submenu.getChildren().add(item);

        model.addSubmenu(submenu);

        // second submenu
        submenu = new Submenu();
        submenu.setLabel("Operations");

        // menu items
        item = new MenuItem();
        item.setValue("Save");
        item.addActionListener(FacesUtil.createMethodActionListener("#{positionedMenuController.save}", Void.class,
                new Class[] { ActionEvent.class }));
        item.setUpdate("growl");
        submenu.getChildren().add(item);

        item = new MenuItem();
        item.setValue("Update");
        item.addActionListener(FacesUtil.createMethodActionListener("#{positionedMenuController.update}", Void.class,
                new Class[] { ActionEvent.class }));
        item.setUpdate("growl");
        submenu.getChildren().add(item);

        item = new MenuItem();
        item.setValue("Delete");
        item.addActionListener(FacesUtil.createMethodActionListener("#{positionedMenuController.delete}", Void.class,
                new Class[] { ActionEvent.class }));
        item.setUpdate("growl");
        submenu.getChildren().add(item);

        model.addSubmenu(submenu);
    }
View Full Code Here

  protected void encodeRegularMenu(FacesContext facesContext, Menu menu) throws IOException{
    ResponseWriter writer = facesContext.getResponseWriter();
    boolean firstSubMenu = true;
   
    for(UIComponent child : menu.getChildren()) {
      Submenu submenu = (Submenu) child;
     
      if(submenu.isRendered()) {
        //Submenu title
        if(submenu.getLabel() != null) {
          writer.startElement("h6", null);
          String labelStyleClass = submenu.getLabelStyleClass();

          if(firstSubMenu && labelStyleClass == null) {
            writer.writeAttribute("class", "first-of-type", null);
          } else if(firstSubMenu && labelStyleClass != null) {
            writer.writeAttribute("class", "first-of-type " + labelStyleClass, null);
          } else if(!firstSubMenu && labelStyleClass != null) {
            writer.writeAttribute("class", labelStyleClass, null);
          }
           
          if(submenu.getLabelStyle() != null)
            writer.writeAttribute("style", submenu.getLabelStyle(), null);
     
          writer.write(submenu.getLabel());
           
          writer.endElement("h6");
        }
         
        //Submenu content
View Full Code Here

    writer.startElement("ul", null);
    writer.writeAttribute("class", "first-of-type", null);
   
    boolean firstSubmenu = true;
    for(UIComponent child : menubar.getChildren()) {
      Submenu submenu = (Submenu) child;
     
      if(submenu.isRendered()) {
        String styleClass = firstSubmenu ? "yuimenubaritem first-of-type" : "yuimenubaritem";
        writer.startElement("li", null);
        writer.writeAttribute("class", styleClass , null);
       
        encodeSubmenu(facesContext, submenu);
View Full Code Here

       
        if(child instanceof MenuItem) {
          MenuItem menuItem = (MenuItem) child;
          encodeMenuItem(facesContext, menuItem, "yuimenuitemlabel");
        } else if(child instanceof Submenu) {
          Submenu childSubmenu = (Submenu) child;
          encodeSubmenu(facesContext, childSubmenu);
        }
       
        writer.endElement("li");
      }
View Full Code Here

          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());
          for(MenuAplicacao filho:menuPrincipal.getFilhos()){
            this.loadSubmenu(filho, submenu);
          }
          this.menuModel.addSubmenu(submenu);
        }
View Full Code Here

      }else{
        Separator separator = new Separator();
        submenu.getChildren().add(separator);
      }
    }else{
      Submenu submenu2 = new Submenu();
      submenu2.setLabel(menu.getLabel());
      submenu2.setIcon(menu.getIcon());
      for(MenuAplicacao filho:menu.getFilhos()){
        this.loadSubmenu(filho, submenu2);
      }
      submenu.getChildren().add(submenu2);
    }
View Full Code Here

TOP

Related Classes of org.primefaces.component.submenu.Submenu

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.