1 33 34 package com.icesoft.faces.renderkit.dom_html_basic; 35 36 import com.icesoft.faces.component.UIXhtmlComponent; 37 38 import javax.faces.component.UIComponent; 39 import javax.faces.context.FacesContext; 40 import javax.faces.context.ResponseWriter; 41 import javax.faces.render.Renderer; 42 import java.io.IOException ; 43 import java.util.Iterator ; 44 import java.util.Map ; 45 46 public class XMLRenderer extends Renderer { 47 public void encodeBegin(FacesContext facesContext, UIComponent uiComponent) 48 throws IOException { 49 UIXhtmlComponent xhtmlComponent = (UIXhtmlComponent) uiComponent; 50 ResponseWriter writer = facesContext.getResponseWriter(); 51 writer.startElement(xhtmlComponent.getTag(), xhtmlComponent); 52 53 Iterator attributeIterator = 54 xhtmlComponent.getTagAttributes().entrySet().iterator(); 55 while (attributeIterator.hasNext()) { 56 Map.Entry attribute = (Map.Entry ) attributeIterator.next(); 57 writer.writeAttribute((String ) attribute.getKey(), 58 attribute.getValue(), null); 59 } 60 } 61 62 public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) 63 throws IOException { 64 UIXhtmlComponent xhtmlComponent = (UIXhtmlComponent) uiComponent; 65 facesContext.getResponseWriter().endElement(xhtmlComponent.getTag()); 66 } 67 } 68 69 | Popular Tags |