1 16 package org.apache.myfaces.renderkit.html; 17 18 import org.apache.myfaces.renderkit.RendererUtils; 19 20 import javax.faces.component.UIComponent; 21 import javax.faces.component.UIViewRoot; 22 import javax.faces.context.FacesContext; 23 import javax.faces.context.ResponseWriter; 24 import java.io.IOException ; 25 26 31 public class HtmlGroupRenderer 32 extends HtmlRenderer 33 { 34 public boolean getRendersChildren() 35 { 36 return true; 37 } 38 39 public void encodeBegin(FacesContext context, UIComponent component) 40 throws IOException 41 { 42 } 43 44 public void encodeChildren(FacesContext context, UIComponent component) 45 throws IOException 46 { 47 } 48 49 public void encodeEnd(FacesContext context, UIComponent component) 50 throws IOException 51 { 52 ResponseWriter writer = context.getResponseWriter(); 53 boolean span = false; 54 55 if(component.getId()!=null && !component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX)) 56 { 57 span = true; 58 59 writer.startElement(HTML.SPAN_ELEM, component); 60 61 HtmlRendererUtils.writeIdIfNecessary(writer, component, context); 62 63 HtmlRendererUtils.renderHTMLAttributes(writer, component, HTML.COMMON_PASSTROUGH_ATTRIBUTES); 64 } 65 else 66 { 67 span=HtmlRendererUtils.renderHTMLAttributesWithOptionalStartElement(writer, 68 component, 69 HTML.SPAN_ELEM, 70 HTML.COMMON_PASSTROUGH_ATTRIBUTES); 71 } 72 73 RendererUtils.renderChildren(context, component); 74 if (span) 75 { 76 writer.endElement(HTML.SPAN_ELEM); 77 } 78 } 79 } 80 | Popular Tags |