}
public void apply(FaceletContext ctx, UIComponent parent)
throws IOException, FacesException, FaceletException, ELException {
if (parent instanceof ActionSource) {
ActionSource src = (ActionSource) parent;
if (ComponentSupport.isNew(parent)) {
ValueExpression valueExpr = this.value.getValueExpression(ctx,
Object.class);
ValueExpression targetExpr = this.target.getValueExpression(
ctx, Object.class);
ActionListener listener;
if (FacesAPI.getVersion() >= 12 && src instanceof ActionSource2) {
listener = new SetPropertyListener(valueExpr, targetExpr);
} else {
listener = new LegacySetPropertyListener(
new LegacyValueBinding(valueExpr),
new LegacyValueBinding(targetExpr));
}
src.addActionListener(listener);
}
} else {
throw new TagException(this.tag,
"Parent is not of type ActionSource, type is: " + parent);
}