1 5 package org.exoplatform.faces.core.renderer.xhtmlmp; 6 7 import java.io.IOException ; 8 import java.util.List ; 9 10 import javax.faces.component.UIComponent; 11 import javax.faces.context.ExternalContext; 12 import javax.faces.context.FacesContext; 13 import javax.faces.context.ResponseWriter; 14 import org.exoplatform.faces.core.component.Node; 15 import org.exoplatform.faces.core.component.UINode; 16 import org.exoplatform.faces.core.component.model.Parameter; 17 18 19 public class NodeTabbedPaneRenderer 20 extends org.exoplatform.faces.core.renderer.html.NodeTabbedPaneRenderer { 21 22 public void encodeChildren( FacesContext context, UIComponent component ) throws IOException { 23 UINode uiNode = (UINode) component ; 24 Parameter tabIdParam = new Parameter("tabId" , ""); 25 Parameter[] params = {SELECT_TAB , tabIdParam} ; 26 27 List children = uiNode.getChildren() ; 28 if(children.size() == 0 ) return ; 29 UIComponent uiSelectTab = null ; 30 ExternalContext eContext = context.getExternalContext() ; 31 String baseURL = eContext.encodeActionURL(null) ; 32 ResponseWriter w = context.getResponseWriter() ; 33 String clazz = uiNode.getClazz() ; 34 if (children.size() > 1) { 36 for (int i = 0; i < children.size(); i++) { 38 UIComponent child = (UIComponent) children.get(i) ; 39 Node tab = (Node) child ; 40 tabIdParam.setValue(child.getId()) ; 41 if (child.isRendered()) { 42 uiSelectTab = child ; 43 appendLink(w, tab.getName(), baseURL, params, "") ; 44 } else { 45 appendLink(w, tab.getName(), baseURL, params, "") ; 46 } 47 } 48 } else { 50 uiSelectTab = (UIComponent) children.get(0) ; 51 } 52 uiSelectTab.encodeBegin(context) ; 53 uiSelectTab.encodeChildren(context) ; 54 uiSelectTab.encodeEnd(context) ; 55 } 57 } | Popular Tags |