/** * Create an action listener method expression based on the given EL expression. The target method must take an * {@link ActionEvent} as argument. * As an example, the following action method example, * <ul> * <li><code>public void actionListener(ActionEvent event)</code></li> * </ul> * <p>can be created as follows: * <ul> * <li><code>createActionListenerMethodExpression("#{bean.actionListener}");</code></li> * </ul> * @param expression The EL expression to create an action listener method expression for. * @return The created action listener method expression, ready to be used as * {@link UICommand#addActionListener(javax.faces.event.ActionListener)}. */ public static MethodExpressionActionListener createActionListenerMethodExpression(String expression) { return new MethodExpressionActionListener(createVoidMethodExpression(expression, ActionEvent.class)); }
public void restoreState(FacesContext context, Object state) { if (state == null) { return; } super.restoreState(context, state); }
public Object saveState(FacesContext context) { if (initialStateMarked()) { return null; } return super.saveState(context); } }
public MethodExpressionActionListener(MethodExpression methodExpressionOneArg) { this.methodExpressionOneArg = methodExpressionOneArg; _createZeroArgsMethodExpression(methodExpressionOneArg); }
public MethodExpressionActionListener(MethodExpression methodExpressionOneArg, MethodExpression methodExpressionZeroArg) { this.methodExpressionOneArg = methodExpressionOneArg; if (methodExpressionZeroArg != null) { this.methodExpressionZeroArg = methodExpressionZeroArg; } else { _createZeroArgsMethodExpression(methodExpressionOneArg); } }
/** * Create an action listener method expression based on the given EL expression. The target method must take an * {@link ActionEvent} as argument. * As an example, the following action method example, * <ul> * <li><code>public void actionListener(ActionEvent event)</code></li> * </ul> * <p>can be created as follows: * <ul> * <li><code>createActionListenerMethodExpression("#{bean.actionListener}");</code></li> * </ul> * @param expression The EL expression to create an action listener method expression for. * @return The created action listener method expression, ready to be used as * {@link UICommand#addActionListener(javax.faces.event.ActionListener)}. */ public static MethodExpressionActionListener createActionListenerMethodExpression(String expression) { return new MethodExpressionActionListener(createVoidMethodExpression(expression, ActionEvent.class)); }
public Object saveState(FacesContext context) { if (initialStateMarked()) { return null; } return super.saveState(context); } }
public void restoreState(FacesContext context, Object state) { if (state == null) { return; } super.restoreState(context, state); }
public void applyMetadata(FaceletContext ctx, Object instance) { ((ActionSource2) instance) .addActionListener(new MethodExpressionActionListener( this.attr.getMethodExpression(ctx, null, ActionSourceRule.ACTION_LISTENER_SIG))); }
public Object saveState(FacesContext context) { if (initialStateMarked()) { return null; } return super.saveState(context); } }
public void restoreState(FacesContext context, Object state) { if (state == null) { return; } super.restoreState(context, state); }
public void applyMetadata(FaceletContext ctx, Object instance) { ActionListener actionListener = new MethodExpressionActionListener(getMethodExpression(ctx)); ((AbstractPoll) instance).addActionListener(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)); } }
/** * @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) { 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)); }