}
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));
}
}