Examples of NavBarControl


Examples of org.primefaces.touch.component.navbarcontrol.NavBarControl

    writer.endElement("div");
  }
 
  private void encodeNavBarControls(FacesContext facesContext, View view) throws IOException {
    ResponseWriter writer = facesContext.getResponseWriter();
    NavBarControl leftControl = (NavBarControl) view.getFacet("leftNavBar");
    NavBarControl rightControl = (NavBarControl) view.getFacet("rightNavBar");

    if(leftControl != null) {
      String href="#";
      String viewId = leftControl.getView();
      String styleClass = leftControl.getType() != null ? leftControl.getType() : "";
      if(leftControl.getEffect() != null) {
        styleClass = styleClass + " " + leftControl.getEffect();
      }
     
      writer.startElement("a", null);
      writer.writeAttribute("class", styleClass, null);   
      if(viewId != null) {
        if(viewId.equals("home"))
          href = href + "home";
        else
          href = href + ComponentUtils.findComponentById(facesContext, facesContext.getViewRoot(), leftControl.getView()).getClientId(facesContext);
      }
     
      writer.writeAttribute("href", href, null);
     
      if(leftControl.getLabel() != null) {
        writer.write(leftControl.getLabel());
      }
     
      writer.endElement("a");
    }
   
    if(rightControl != null) {
      String href="#";
      String viewId = rightControl.getView();
      String styleClass = rightControl.getType() != null ? rightControl.getType() : "";
      if(rightControl.getEffect() != null) {
        styleClass = styleClass + " " + rightControl.getEffect();
      }
     
      writer.startElement("a", null);
      writer.writeAttribute("class", styleClass, null);
      if(viewId != null) {
        if(viewId.equals("home"))
          href = href + "home";
        else
          href = href + ComponentUtils.findComponentById(facesContext, facesContext.getViewRoot(), rightControl.getView()).getClientId(facesContext);
      }
     
      writer.writeAttribute("href", href, null);
     
      if(rightControl.getLabel() != null) {
        writer.write(rightControl.getLabel());
      }
     
      writer.endElement("a");
    }
  }
View Full Code Here

Examples of org.primefaces.touch.component.navbarcontrol.NavBarControl

    writer.endElement("div");
  }
 
  private void encodeNavBarControls(FacesContext facesContext, View view) throws IOException {
    ResponseWriter writer = facesContext.getResponseWriter();
    NavBarControl leftControl = (NavBarControl) view.getFacet("leftNavBar");
    NavBarControl rightControl = (NavBarControl) view.getFacet("rightNavBar");

    //TODO: Fix the code duplication here
    if(leftControl != null && leftControl.isRendered()) {
      String href="#";
      String viewId = leftControl.getView();
      String styleClass = leftControl.getType() != null ? leftControl.getType() : "";
      if(leftControl.getEffect() != null) {
        styleClass = styleClass + " " + leftControl.getEffect();
      }
     
      writer.startElement("a", null);
      writer.writeAttribute("class", styleClass, null);   
      if(viewId != null) {
        if(viewId.equals("home"))
          href = href + "home";
        else {
          UIComponent viewComponent = leftControl.findComponent(leftControl.getView());
          if(viewComponent == null)
            throw new FacesException("Cannot find component \"" + leftControl.getView() + "\" in view.");
         
          href = href + viewComponent.getClientId(facesContext)
        }
      }
     
      writer.writeAttribute("href", href, null);
     
      if(leftControl.getLabel() != null) {
        writer.write(leftControl.getLabel());
      }
     
      writer.endElement("a");
    }
   
    if(rightControl != null && rightControl.isRendered()) {
      String href="#";
      String viewId = rightControl.getView();
      String styleClass = rightControl.getType() != null ? rightControl.getType() : "";
      if(rightControl.getEffect() != null) {
        styleClass = styleClass + " " + rightControl.getEffect();
      }
     
      writer.startElement("a", null);
      writer.writeAttribute("class", styleClass, null);
      if(viewId != null) {
        if(viewId.equals("home"))
          href = href + "home";
        else {
          UIComponent viewComponent = rightControl.findComponent(rightControl.getView());
          if(viewComponent == null)
            throw new FacesException("Cannot find component \"" + rightControl.getView() + "\" in view.");
         
          href = href + viewComponent.getClientId(facesContext)
        }
      }
     
      writer.writeAttribute("href", href, null);
     
      if(rightControl.getLabel() != null) {
        writer.write(rightControl.getLabel());
      }
     
      writer.endElement("a");
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.