public String getConverterId(FaceletContext ctx) { if (converterId == null) { TagAttribute idAttr = getAttribute("converterId"); if (idAttr == null) { return null; } else { return idAttr.getValue(ctx); } } return converterId; }
@Override public MetaRuleset createMetaRuleset(Class type) { return super.createMetaRuleset(type).ignoreAll(); } }
/** * Create a Converter instance * * @param ctx * FaceletContext to use * @return Converter instance, cannot be null */ private Converter createConverter(FaceletContext ctx) { if (owner.getConverterId(ctx) == null) { throw new TagException( owner.getTag(), "Default behavior invoked of requiring a converter-id passed in the constructor, must override ConvertHandler(ConverterConfig)"); } return ctx.getFacesContext().getApplication().createConverter(owner.getConverterId(ctx)); }
public void applyAttachedObject(FacesContext context, UIComponent parent) { FaceletContext ctx = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY); // cast to a ValueHolder ValueHolder vh = (ValueHolder) parent; ValueExpression ve = null; Converter c = null; if (owner.getBinding() != null) { ve = owner.getBinding().getValueExpression(ctx, Converter.class); c = (Converter) ve.getValue(ctx); } if (c == null) { c = this.createConverter(ctx); if (ve != null) { ve.setValue(ctx, c); } } if (c == null) { throw new TagException(owner.getTag(), "No Converter was created"); } owner.setAttributes(ctx, c); vh.setConverter(c); Object lv = vh.getLocalValue(); FacesContext faces = ctx.getFacesContext(); if (lv instanceof String) { vh.setValue(c.getAsObject(faces, parent, (String) lv)); } }
@Override public void apply(FaceletContext ctx, UIComponent parent) throws IOException { // only process if it's been created if (parent == null || !(parent.getParent() == null)) { return; } ComponentSupport.copyPassthroughAttributes(ctx, parent, owner.getTag()); if (parent instanceof ValueHolder) { owner.applyAttachedObject(ctx.getFacesContext(), parent); } else if (UIComponent.isCompositeComponent(parent)) { if (null == owner.getFor()) { // PENDING(): I18N throw new TagException(owner.getTag(), "converter tags nested within composite components must have a non-null \"for\" attribute"); } // Allow the composite component to know about the target // component. CompositeComponentTagHandler.getAttachedObjectHandlers(parent).add(owner); } else { throw new TagException(owner.getTag(), "Parent not an instance of ValueHolder: " + parent); } }
@Override public MetaRuleset createMetaRuleset(Class type) { return new MetaRulesetImpl(_delegate.getTag(), type).ignore("binding"); }
@Override public void setAttributes(FaceletContext ctx, Object obj) { super.setAttributes(ctx, obj); NumberConverter c = (NumberConverter) obj; if (this.locale != null) { c.setLocale(ComponentSupport.getLocale(ctx, this.locale)); } }
public TagHandler createHandler(TagConfig cfg) throws FacesException, ELException { return new ConverterHandler(new ConverterConfigWrapper(cfg, this.converterId)); } }
public String getFor() { TagAttribute forAttribute = _delegate.getTagAttribute("for"); if (forAttribute == null) { return null; } else { return forAttribute.getValue(); } } }
@Override public void applyAttachedObject(FacesContext context, UIComponent parent) { FaceletContext ctx = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY); // cast to a ValueHolder ValueHolder vh = (ValueHolder) parent; ValueExpression ve = null; Converter c = null; if (owner.getBinding() != null) { ve = owner.getBinding().getValueExpression(ctx, Converter.class); c = (Converter) ve.getValue(ctx); } if (c == null) { c = this.createConverter(ctx); if (ve != null) { ve.setValue(ctx, c); } } if (c == null) { throw new TagException(owner.getTag(), "No Converter was created"); } owner.setAttributes(ctx, c); vh.setConverter(c); Object lv = vh.getLocalValue(); FacesContext faces = ctx.getFacesContext(); if (lv instanceof String) { vh.setValue(c.getAsObject(faces, parent, (String) lv)); } }
@Override public void apply(FaceletContext ctx, UIComponent parent) throws IOException { // only process if it's been created if (parent == null || !(parent.getParent() == null)) { return; } ComponentSupport.copyPassthroughAttributes(ctx, parent, owner.getTag()); if (parent instanceof ValueHolder) { owner.applyAttachedObject(ctx.getFacesContext(), parent); } else if (UIComponent.isCompositeComponent(parent)) { if (null == owner.getFor()) { // PENDING(): I18N throw new TagException(owner.getTag(), "converter tags nested within composite components must have a non-null \"for\" attribute"); } // Allow the composite component to know about the target // component. CompositeComponentTagHandler.getAttachedObjectHandlers(parent).add(owner); } else { throw new TagException(owner.getTag(), "Parent not an instance of ValueHolder: " + parent); } }
@Override public MetaRuleset createMetaRuleset(Class type) { return new MetaRulesetImpl(_delegate.getTag(), type).ignore("binding"); }
public void setAttributes(FaceletContext ctx, Object obj) { super.setAttributes(ctx, obj); NumberConverter c = (NumberConverter) obj; if (this.locale != null) { c.setLocale(ComponentSupport.getLocale(ctx, this.locale)); } }
@Override public TagHandler createHandler(TagConfig cfg) throws FacesException, ELException { return new ConverterHandler(new ConverterConfigWrapper(cfg, this.converterId)); } }
public String getFor() { TagAttribute forAttribute = _delegate.getTagAttribute("for"); if (forAttribute == null) { return null; } else { return forAttribute.getValue(); } } }
@Override public void applyAttachedObject(FacesContext context, UIComponent parent) { FaceletContext ctx = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY); // cast to a ValueHolder ValueHolder vh = (ValueHolder) parent; ValueExpression ve = null; Converter c = null; if (owner.getBinding() != null) { ve = owner.getBinding().getValueExpression(ctx, Converter.class); c = (Converter) ve.getValue(ctx); } if (c == null) { c = this.createConverter(ctx); if (ve != null) { ve.setValue(ctx, c); } } if (c == null) { throw new TagException(owner.getTag(), "No Converter was created"); } owner.setAttributes(ctx, c); vh.setConverter(c); Object lv = vh.getLocalValue(); FacesContext faces = ctx.getFacesContext(); if (lv instanceof String) { vh.setValue(c.getAsObject(faces, parent, (String) lv)); } }
/** * Create a Converter instance * * @param ctx * FaceletContext to use * @return Converter instance, cannot be null */ private Converter createConverter(FaceletContext ctx) { if (owner.getConverterId(ctx) == null) { throw new TagException( owner.getTag(), "Default behavior invoked of requiring a converter-id passed in the constructor, must override ConvertHandler(ConverterConfig)"); } return ctx.getFacesContext().getApplication().createConverter(owner.getConverterId(ctx)); }
protected MetaRuleset createMetaRuleset(Class type) { return super.createMetaRuleset(type).ignoreAll(); } }
@Override public void apply(FaceletContext ctx, UIComponent parent) throws IOException { // only process if it's been created if (parent == null || !(parent.getParent() == null)) { return; } ComponentSupport.copyPassthroughAttributes(ctx, parent, owner.getTag()); if (parent instanceof ValueHolder) { owner.applyAttachedObject(ctx.getFacesContext(), parent); } else if (UIComponent.isCompositeComponent(parent)) { if (null == owner.getFor()) { // PENDING(): I18N throw new TagException(owner.getTag(), "converter tags nested within composite components must have a non-null \"for\" attribute"); } // Allow the composite component to know about the target // component. CompositeComponentTagHandler.getAttachedObjectHandlers(parent).add(owner); } else { throw new TagException(owner.getTag(), "Parent not an instance of ValueHolder: " + parent); } }
public String getConverterId(FaceletContext ctx) { if (converterId == null) { TagAttribute idAttr = getAttribute("converterId"); if (idAttr == null) { return null; } else { return idAttr.getValue(ctx); } } return converterId; }