1 5 package org.exoplatform.portlets.nav.renderer.html; 6 7 import java.io.IOException ; 8 import java.util.ResourceBundle ; 9 10 import javax.faces.component.UIComponent; 11 import javax.faces.context.FacesContext; 12 import javax.faces.context.ResponseWriter; 13 import org.exoplatform.portlets.nav.component.UIMenu; 14 import org.exoplatform.portlets.nav.component.UINavigation; 15 import org.exoplatform.services.portal.model.Node; 16 22 public class ExoEditPortalModeMenuRenderer extends ExoMenuRenderer { 23 24 protected void renderNode(ResponseWriter w, UIMenu uiMenu, ResourceBundle res, 25 Node node, String ownerURI) throws IOException { 26 int childrenSize = node.getChildrenSize(); 27 if (childrenSize == 0) return; 28 w.write("<ul>"); 29 for (int i = 0; i < childrenSize; i++) { 30 Node child = node.getChild(i); 31 if(!child.isVisible()) continue ; 32 if (child.getChildrenSize() > 0) { 33 if (child.isSelectedPath()) { 34 w.write("<li class='expanded-child'>"); 35 } else { 36 w.write("<li class='collapsed-child'>"); 37 } 38 } else { 39 w.write("<li class='leaf'>"); 40 } 41 w. write("<a HREF='"); w.write(ownerURI); w.write(child.getUri()); w.write("'>") ; 42 w. write(child.getResolvedLabel()) ; 43 w. write("</a>") ; 44 if (child.isSelectedPath()) { 45 renderNode(w, uiMenu, res, child, ownerURI); 46 } 47 w.write("</li>"); 48 } 49 w.write("</ul>"); 50 } 51 52 protected void renderAdmin(ResourceBundle res, ResponseWriter w, UIMenu uiMenu) throws IOException { 53 UIComponent uiChild = uiMenu.getUIToolbarPortal(); 54 uiChild.encodeBegin(FacesContext.getCurrentInstance()); 55 uiChild.encodeChildren(FacesContext.getCurrentInstance()); 56 uiChild.encodeEnd(FacesContext.getCurrentInstance()); 57 } 58 } | Popular Tags |