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 23 public class ExoEditPageModeMenuRenderer extends ExoMenuRenderer { 24 25 protected void renderNode(ResponseWriter w, UIMenu uiMenu, ResourceBundle res, 26 Node node, String ownerURI) throws IOException { 27 int childrenSize = node.getChildrenSize(); 28 if (childrenSize == 0) return; 29 w.write("<ul>"); 30 for (int i = 0; i < childrenSize; i++) { 31 Node child = node.getChild(i); 32 if(!child.isVisible()) continue ; 33 if (child.getChildrenSize() > 0) { 34 if (child.isSelectedPath()) { 35 w.write("<li class='expanded-child'>"); 36 } else { 37 w.write("<li class='collapsed-child'>"); 38 } 39 } else { 40 w.write("<li class='leaf'>"); 41 } 42 w. write("<a HREF='"); w.write(ownerURI); w.write(child.getUri()); w.write("'>") ; 43 w. write(child.getResolvedLabel()) ; 44 w. write("</a>") ; 45 if (child.isSelectedPath()) { 46 renderNode(w, uiMenu, res, child, ownerURI); 47 } 48 w.write("</li>"); 49 } 50 w.write("</ul>"); 51 } 52 53 protected void renderAdmin(ResourceBundle res, ResponseWriter w, UIMenu uiMenu) throws IOException { 54 UIComponent uiChild = uiMenu.getUIToolbarPage(); 55 uiChild.encodeBegin(FacesContext.getCurrentInstance()); 56 uiChild.encodeChildren(FacesContext.getCurrentInstance()); 57 uiChild.encodeEnd(FacesContext.getCurrentInstance()); 58 } 59 } | Popular Tags |