*/
public final void apply(FaceletContext ctx, UIComponent parent)
throws IOException, FacesException, FaceletException, ELException {
if (parent == null || !(parent instanceof EditableValueHolder)) {
throw new TagException(this.tag,
"Parent not an instance of EditableValueHolder: " + parent);
}
// only process if it's been created
if (parent.getParent() == null) {
// cast to a ValueHolder
EditableValueHolder evh = (EditableValueHolder) parent;
ValueExpression ve = null;
Validator v = null;
if (this.binding != null) {
ve = this.binding.getValueExpression(ctx, Validator.class);
v = (Validator) ve.getValue(ctx);
}
if (v == null) {
v = this.createValidator(ctx);
if (ve != null) {
ve.setValue(ctx, v);
}
}
if (v == null) {
throw new TagException(this.tag, "No Validator was created");
}
this.setAttributes(ctx, v);
evh.addValidator(v);
}
}