1 14 15 package com.sun.facelets.tag.jsf.core; 16 17 import javax.el.ELException; 18 import javax.faces.FacesException; 19 import javax.faces.convert.Converter; 20 import javax.faces.convert.NumberConverter; 21 22 import com.sun.facelets.FaceletContext; 23 import com.sun.facelets.FaceletException; 24 import com.sun.facelets.tag.TagAttribute; 25 import com.sun.facelets.tag.MetaRuleset; 26 import com.sun.facelets.tag.jsf.ComponentSupport; 27 import com.sun.facelets.tag.jsf.ConvertHandler; 28 import com.sun.facelets.tag.jsf.ConverterConfig; 29 30 39 public final class ConvertNumberHandler extends ConvertHandler { 40 41 private final TagAttribute locale; 42 43 46 public ConvertNumberHandler(ConverterConfig config) { 47 super(config); 48 this.locale = this.getAttribute("locale"); 49 } 50 51 57 protected Converter createConverter(FaceletContext ctx) 58 throws FacesException, ELException, FaceletException { 59 return ctx.getFacesContext().getApplication().createConverter(NumberConverter.CONVERTER_ID); 60 } 61 62 65 protected void setAttributes(FaceletContext ctx, Object obj) { 66 super.setAttributes(ctx, obj); 67 NumberConverter c = (NumberConverter) obj; 68 if (this.locale != null) { 69 c.setLocale(ComponentSupport.getLocale(ctx, this.locale)); 70 } 71 } 72 73 protected MetaRuleset createMetaRuleset(Class type) { 74 return super.createMetaRuleset(type).ignore("locale"); 75 } 76 77 } 78 | Popular Tags |