Beispiel #1
0
 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 (this.binding != null) {
     ve = this.binding.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(this.tag, "No Converter was created");
   }
   this.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));
   }
 }