1 5 package org.exoplatform.portlets.nav.renderer.xhtmlmp; 6 7 import java.io.IOException ; 8 import java.util.ResourceBundle ; 9 import javax.faces.component.UIComponent; 10 import javax.faces.context.FacesContext; 11 import javax.faces.context.ResponseWriter; 12 import org.exoplatform.container.SessionContainer; 13 import org.exoplatform.portal.session.RequestInfo; 14 import org.exoplatform.portlets.nav.component.UINavigation; 15 import org.exoplatform.portlets.nav.renderer.html.ExoMenuRenderer; 16 import org.exoplatform.services.portal.model.Node; 17 import org.exoplatform.services.portal.model.PageReference; 18 25 public class HorizontalMenuRenderer extends ExoMenuRenderer { 26 public void encodeChildren(FacesContext context, UIComponent uiComponent) throws IOException { 27 ResourceBundle res = getApplicationResourceBundle(context.getExternalContext()) ; 28 UINavigation uiMenu = (UINavigation) uiComponent; 29 RequestInfo rinfo = (RequestInfo)SessionContainer.getComponent(RequestInfo.class); 30 String ownerURI = rinfo.getOwnerURI() ; 31 String mimeType = uiMenu.getPreferedMimeType() ; 32 ResponseWriter w = context.getResponseWriter() ; 33 Node selectNode = uiMenu.getSelectedNode() ; 34 w.write(res.getString("UIHorizontalMenu.icon.banner")); 35 w.write("<br/>"); 36 w. write("<a HREF='"); w.write(ownerURI); w.write("/home/sitemap"); w.write("'>") ; 37 w. write(res.getString("UIHorizontalMenu.icon.site-map")) ; 38 w. write("</a>") ; 39 for (int i = 0; i < selectNode.getChildrenSize(); i++) { 40 Node node = selectNode.getChild(i); 41 PageReference pref = node.getPageReference(mimeType) ; 42 if(pref == null || pref.isVisible()) { 43 String label = node.getIcon(); 44 if(label == null) label = node.getResolvedLabel() ; 45 w. write("<a HREF='"); w.write(ownerURI); w.write(node.getUri()); w.write("'>") ; 46 w. write(label) ; 47 w. write("</a>") ; 48 w.write(' ') ; 49 } 50 } 51 } 52 } | Popular Tags |