public Object saveState(FacesContext context) { if (initialStateMarked()) { return null; } return super.saveState(context); } }
public void applyMetadata(FaceletContext ctx, Object instance) { // From JSF 2.0 it is possible to have valueChangeListener method without ValueChangeEvent parameter. // It seems that MethodExpressionValueChangeListener 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 variable mapping will work. final MethodExpression methodExpressionOneArg = attr.getMethodExpression(ctx, null, VALUECHANGE_SIG); final MethodExpression methodExpressionZeroArg = attr.getMethodExpression(ctx, null, EMPTY_CLASS_ARRAY); if (FaceletCompositionContext.getCurrentInstance(ctx).isUsingPSSOnThisView()) { ((EditableValueHolder) instance).addValueChangeListener( new PartialMethodExpressionValueChangeListener(methodExpressionOneArg, methodExpressionZeroArg)); } else { ((EditableValueHolder) instance).addValueChangeListener( new MethodExpressionValueChangeListener(methodExpressionOneArg, methodExpressionZeroArg)); } } }
public void applyMetadata(FaceletContext ctx, Object instance) { // From JSF 2.0 it is possible to have valueChangeListener method without ValueChangeEvent parameter. // It seems that MethodExpressionValueChangeListener 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 variable mapping will work. final MethodExpression methodExpressionOneArg = attr.getMethodExpression(ctx, null, VALUECHANGE_SIG); final MethodExpression methodExpressionZeroArg = attr.getMethodExpression(ctx, null, EMPTY_CLASS_ARRAY); if (FaceletCompositionContext.getCurrentInstance(ctx).isUsingPSSOnThisView()) { ((EditableValueHolder) instance).addValueChangeListener( new PartialMethodExpressionValueChangeListener(methodExpressionOneArg, methodExpressionZeroArg)); } else { ((EditableValueHolder) instance).addValueChangeListener( new MethodExpressionValueChangeListener(methodExpressionOneArg, methodExpressionZeroArg)); } } }
public void applyMetadata(FaceletContext ctx, Object instance) { // From JSF 2.0 it is possible to have valueChangeListener method without ValueChangeEvent parameter. // It seems that MethodExpressionValueChangeListener 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 variable mapping will work. final MethodExpression methodExpressionOneArg = attr.getMethodExpression(ctx, null, VALUECHANGE_SIG); final MethodExpression methodExpressionZeroArg = attr.getMethodExpression(ctx, null, EMPTY_CLASS_ARRAY); if (FaceletCompositionContext.getCurrentInstance(ctx).isUsingPSSOnThisView()) { ((EditableValueHolder) instance).addValueChangeListener( new PartialMethodExpressionValueChangeListener(methodExpressionOneArg, methodExpressionZeroArg)); } else { ((EditableValueHolder) instance).addValueChangeListener( new MethodExpressionValueChangeListener(methodExpressionOneArg, methodExpressionZeroArg)); } } }
public Object saveState(FacesContext context) { if (initialStateMarked()) { return null; } return super.saveState(context); } }
valueChangeListener = new PartialMethodExpressionValueChangeListener( methodExpression, methodExpression2);
public Object saveState(FacesContext context) { if (initialStateMarked()) { return null; } return super.saveState(context); } }