public void applyMetadata(FaceletContext ctx, Object instance) { ((ActionSource2) instance) .addActionListener(new MethodExpressionActionListener( this.attr.getMethodExpression(ctx, null, ActionSourceRule.ACTION_LISTENER_SIG))); }
/** * @since 1.2 */ public static void addActionListenerProperty(FacesContext context, UIComponent component, MethodExpression actionListener) { if (actionListener != null) { if (!(component instanceof ActionSource2)) { throw new IllegalArgumentException("Component " + component.getClientId(context) + " is no ActionSource"); } ((ActionSource2)component).addActionListener(new MethodExpressionActionListener(actionListener)); } }
/** * @since 1.2 */ public static void addActionListenerProperty(FacesContext context, UIComponent component, MethodExpression actionListener) { if (actionListener != null) { if (!(component instanceof ActionSource2)) { throw new IllegalArgumentException("Component " + component.getClientId(context) + " is no ActionSource"); } ((ActionSource2)component).addActionListener(new MethodExpressionActionListener(actionListener)); } }
/** * @since 1.2 */ public static void addActionListenerProperty(FacesContext context, UIComponent component, MethodExpression actionListener) { if (actionListener != null) { if (!(component instanceof ActionSource2)) { throw new IllegalArgumentException("Component " + component.getClientId(context) + " is no ActionSource"); } ((ActionSource2)component).addActionListener(new MethodExpressionActionListener(actionListener)); } }
/** * @since 1.2 */ public static void addActionListenerProperty(FacesContext context, UIComponent component, MethodExpression actionListener) { if (actionListener != null) { if (!(component instanceof ActionSource2)) { throw new IllegalArgumentException("Component " + component.getClientId(context) + " is no ActionSource"); } ((ActionSource2) component) .addActionListener(new MethodExpressionActionListener( actionListener)); } }
/** * @since 1.2 */ public static void addActionListenerProperty(FacesContext context, UIComponent component, MethodExpression actionListener) { if (actionListener != null) { if (!(component instanceof ActionSource2)) { throw new IllegalArgumentException("Component " + component.getClientId(context) + " is no ActionSource"); } ((ActionSource2) component) .addActionListener(new MethodExpressionActionListener( actionListener)); } }
protected void setActionListenerProperty(UIComponent component, MethodExpression actionListener) { if (actionListener != null) { if (component instanceof ActionSource2) { ActionSource2 actionSource2 = (ActionSource2) component; actionSource2.addActionListener(new MethodExpressionActionListener(actionListener)); } else { throw new IllegalArgumentException(Messages.getMessage(Messages.NO_ACTION_SOURCE2_ERROR, component.getClientId(getFacesContext()))); } } }
public void applyMetadata(FaceletContext ctx, Object instance) { // From JSF 2.0 it is possible to have actionListener method without ActionEvent parameter. // It seems that MethodExpressionActionListener from API contains support for it but there is one big // problem - one-arg constructor will not preserve the current VariableMapper. // This is a problem when using facelets and <ui:decorate/> with EL params (see MYFACES-2541 for details). // So we must create two MethodExpressions here - both are created from the current // facelets context and thus varibale mapping will work. final MethodExpression methodExpressionOneArg = _attr.getMethodExpression(ctx, null, ActionSourceRule.ACTION_LISTENER_SIG); final MethodExpression methodExpressionZeroArg = _attr.getMethodExpression(ctx, null, ActionSourceRule.ACTION_SIG); if (FaceletCompositionContext.getCurrentInstance(ctx).isUsingPSSOnThisView()) { ((ActionSource2) instance).addActionListener( new PartialMethodExpressionActionListener(methodExpressionOneArg, methodExpressionZeroArg)); } else { ((ActionSource2) instance).addActionListener( new MethodExpressionActionListener(methodExpressionOneArg, methodExpressionZeroArg)); } } }
public void applyMetadata(FaceletContext ctx, Object instance) { // From JSF 2.0 it is possible to have actionListener method without ActionEvent parameter. // It seems that MethodExpressionActionListener from API contains support for it but there is one big // problem - one-arg constructor will not preserve the current VariableMapper. // This is a problem when using facelets and <ui:decorate/> with EL params (see MYFACES-2541 for details). // So we must create two MethodExpressions here - both are created from the current // facelets context and thus varibale mapping will work. final MethodExpression methodExpressionOneArg = _attr.getMethodExpression(ctx, null, ActionSourceRule.ACTION_LISTENER_SIG); final MethodExpression methodExpressionZeroArg = _attr.getMethodExpression(ctx, null, ActionSourceRule.ACTION_SIG); if (FaceletCompositionContext.getCurrentInstance(ctx).isUsingPSSOnThisView()) { ((ActionSource2) instance).addActionListener( new PartialMethodExpressionActionListener(methodExpressionOneArg, methodExpressionZeroArg)); } else { ((ActionSource2) instance).addActionListener( new MethodExpressionActionListener(methodExpressionOneArg, methodExpressionZeroArg)); } } }
public void applyMetadata(FaceletContext ctx, Object instance) { // From JSF 2.0 it is possible to have actionListener method without ActionEvent parameter. // It seems that MethodExpressionActionListener from API contains support for it but there is one big // problem - one-arg constructor will not preserve the current VariableMapper. // This is a problem when using facelets and <ui:decorate/> with EL params (see MYFACES-2541 for details). // So we must create two MethodExpressions here - both are created from the current // facelets context and thus varibale mapping will work. final MethodExpression methodExpressionOneArg = _attr.getMethodExpression(ctx, null, ActionSourceRule.ACTION_LISTENER_SIG); final MethodExpression methodExpressionZeroArg = _attr.getMethodExpression(ctx, null, ActionSourceRule.ACTION_SIG); if (FaceletCompositionContext.getCurrentInstance(ctx).isUsingPSSOnThisView()) { ((ActionSource2) instance).addActionListener( new PartialMethodExpressionActionListener(methodExpressionOneArg, methodExpressionZeroArg)); } else { ((ActionSource2) instance).addActionListener( new MethodExpressionActionListener(methodExpressionOneArg, methodExpressionZeroArg)); } } }
public void applyMetadata(FaceletContext ctx, Object instance) { ExpressionFactory expressionFactory = ctx.getExpressionFactory(); MethodExpression methodExpressionOneArg = attr.getMethodExpression( ctx, null, ActionSourceRule.ACTION_LISTENER_SIG); MethodExpression methodExpressionZeroArg = expressionFactory.createMethodExpression( ctx, methodExpressionOneArg.getExpressionString(), Void.class, ActionSourceRule.ACTION_LISTENER_ZEROARG_SIG); ((ActionSource2) instance) .addActionListener(new MethodExpressionActionListener( methodExpressionOneArg, methodExpressionZeroArg)); }
@Override public void applyMetadata(FaceletContext ctx, Object instance) { ExpressionFactory expressionFactory = ctx.getExpressionFactory(); MethodExpression methodExpressionOneArg = attr.getMethodExpression( ctx, null, ActionSourceRule.ACTION_LISTENER_SIG); MethodExpression methodExpressionZeroArg = expressionFactory.createMethodExpression( ctx, methodExpressionOneArg.getExpressionString(), Void.class, ActionSourceRule.ACTION_LISTENER_ZEROARG_SIG); ((ActionSource2) instance) .addActionListener(new MethodExpressionActionListener( methodExpressionOneArg, methodExpressionZeroArg)); }
@Override public void applyMetadata(FaceletContext ctx, Object instance) { ExpressionFactory expressionFactory = ctx.getExpressionFactory(); MethodExpression methodExpressionOneArg = attr.getMethodExpression( ctx, null, ActionSourceRule.ACTION_LISTENER_SIG); MethodExpression methodExpressionZeroArg = expressionFactory.createMethodExpression( ctx, methodExpressionOneArg.getExpressionString(), Void.class, ActionSourceRule.ACTION_LISTENER_ZEROARG_SIG); ((ActionSource2) instance) .addActionListener(new MethodExpressionActionListener( methodExpressionOneArg, methodExpressionZeroArg)); }
@Override public void applyMetadata(FaceletContext ctx, Object instance) { ExpressionFactory expressionFactory = ctx.getExpressionFactory(); MethodExpression methodExpressionOneArg = attr.getMethodExpression( ctx, null, ActionSourceRule.ACTION_LISTENER_SIG); MethodExpression methodExpressionZeroArg = expressionFactory.createMethodExpression( ctx, methodExpressionOneArg.getExpressionString(), Void.class, ActionSourceRule.ACTION_LISTENER_ZEROARG_SIG); ((ActionSource2) instance) .addActionListener(new MethodExpressionActionListener( methodExpressionOneArg, methodExpressionZeroArg)); }
@Override public void retarget(FacesContext ctx, CompCompInterfaceMethodMetadata metadata, Object sourceValue, UIComponent target) { ValueExpression ve = (ValueExpression) sourceValue; ExpressionFactory f = ctx.getApplication().getExpressionFactory(); MethodExpression me = f.createMethodExpression(ctx.getELContext(), ve.getExpressionString(), Void.TYPE, ACTION_LISTENER_ARGS); MethodExpression noArg = f.createMethodExpression(ctx.getELContext(), ve.getExpressionString(), Void.TYPE, NO_ARGS); ((ActionSource2) target).addActionListener( new MethodExpressionActionListener( new ContextualCompositeMethodExpression(ve, me), new ContextualCompositeMethodExpression(ve, noArg))); }
@Override public void retarget(FacesContext ctx, CompCompInterfaceMethodMetadata metadata, Object sourceValue, UIComponent target) { ValueExpression ve = (ValueExpression) sourceValue; ExpressionFactory f = ctx.getApplication().getExpressionFactory(); MethodExpression me = f.createMethodExpression(ctx.getELContext(), ve.getExpressionString(), Void.TYPE, ACTION_LISTENER_ARGS); MethodExpression noArg = f.createMethodExpression(ctx.getELContext(), ve.getExpressionString(), Void.TYPE, NO_ARGS); ((ActionSource2) target).addActionListener( new MethodExpressionActionListener( new ContextualCompositeMethodExpression(ve, me), new ContextualCompositeMethodExpression(ve, noArg))); }
public void retarget(FacesContext ctx, CompCompInterfaceMethodMetadata metadata, Object sourceValue, UIComponent target) { ValueExpression ve = (ValueExpression) sourceValue; ExpressionFactory f = ctx.getApplication().getExpressionFactory(); MethodExpression me = f.createMethodExpression(ctx.getELContext(), ve.getExpressionString(), Void.TYPE, ACTION_LISTENER_ARGS); MethodExpression noArg = f.createMethodExpression(ctx.getELContext(), ve.getExpressionString(), Void.TYPE, NO_ARGS); ((ActionSource2) target).addActionListener( new MethodExpressionActionListener( new ContextualCompositeMethodExpression(ve, me), new ContextualCompositeMethodExpression(ve, noArg))); }
@Override public void retarget(FacesContext ctx, CompCompInterfaceMethodMetadata metadata, Object sourceValue, UIComponent target) { ValueExpression ve = (ValueExpression) sourceValue; ExpressionFactory f = ctx.getApplication().getExpressionFactory(); MethodExpression me = f.createMethodExpression(ctx.getELContext(), ve.getExpressionString(), Void.TYPE, ACTION_LISTENER_ARGS); MethodExpression noArg = f.createMethodExpression(ctx.getELContext(), ve.getExpressionString(), Void.TYPE, NO_ARGS); ((ActionSource2) target).addActionListener( new MethodExpressionActionListener( new ContextualCompositeMethodExpression(ve, me), new ContextualCompositeMethodExpression(ve, noArg))); }
((ActionSource2)innerComponent).addActionListener(actionListener); mctx.addMethodExpressionTargeted(innerComponent, attributeName, actionListener);
((ActionSource2) innerComponent).addActionListener(actionListener); mctx.addMethodExpressionTargeted(innerComponent, targetAttributeName, actionListener);