Package javax.faces.event

Examples of javax.faces.event.ValueChangeListener


                                    ((EditableValueHolder)innerComponent).addValidator( validator );
                                    mctx.addMethodExpressionTargeted(innerComponent, attributeName, validator);
                                }
                                else if ("valueChangeListener".equals(attributeName))
                                {
                                    ValueChangeListener o = (ValueChangeListener) mctx.removeMethodExpressionTargeted(innerComponent, attributeName);
                                    if (o != null)
                                    {
                                        ((EditableValueHolder)innerComponent).removeValueChangeListener(o);
                                    }
                                   
                                    // target is EditableValueHolder
                                    methodExpression = reWrapMethodExpression(context.getApplication().getExpressionFactory().
                                            createMethodExpression(elContext,
                                                    attributeExpressionString, Void.TYPE,
                                                    VALUE_CHANGE_LISTENER_SIGNATURE), attributeNameValueExpression);
       
                                    methodExpression2 = reWrapMethodExpression(context.getApplication().getExpressionFactory().
                                            createMethodExpression(elContext,
                                                    attributeExpressionString, Void.TYPE,
                                                    EMPTY_CLASS_ARRAY), attributeNameValueExpression);
       
                                    ValueChangeListener valueChangeListener = new MethodExpressionValueChangeListener(methodExpression, methodExpression2);
                                    ((EditableValueHolder)innerComponent).addValueChangeListener( valueChangeListener );
                                    mctx.addMethodExpressionTargeted(innerComponent, attributeName, valueChangeListener);
                                }
                            }
                        }
View Full Code Here


                                    ((EditableValueHolder) innerComponent).addValidator(validator);
                                    mctx.addMethodExpressionTargeted(innerComponent, attributeName, validator);
                                }
                                else if ("valueChangeListener".equals(attributeName))
                                {
                                    ValueChangeListener o = (ValueChangeListener) mctx.removeMethodExpressionTargeted(innerComponent, attributeName);
                                    if (o != null)
                                    {
                                        ((EditableValueHolder)innerComponent).removeValueChangeListener(o);
                                    }

                                    // target is EditableValueHolder
                                    ValueChangeListener valueChangeListener = null;
                                    // If it is a redirection, a wrapper is used to locate the right instance and call it properly.
                                    if (ccAttrMeRedirection)
                                    {
                                        valueChangeListener = new RedirectMethodExpressionValueExpressionValueChangeListener(attributeNameValueExpression);
                                    }
View Full Code Here

                                    ((EditableValueHolder) innerComponent).addValidator(validator);
                                    mctx.addMethodExpressionTargeted(innerComponent, attributeName, validator);
                                }
                                else if ("valueChangeListener".equals(attributeName))
                                {
                                    ValueChangeListener o = (ValueChangeListener) mctx.removeMethodExpressionTargeted(innerComponent, attributeName);
                                    if (o != null)
                                    {
                                        ((EditableValueHolder)innerComponent).removeValueChangeListener(o);
                                    }

                                    // target is EditableValueHolder
                                    ValueChangeListener valueChangeListener = null;
                                    // If it is a redirection, a wrapper is used to locate the right instance and call it properly.
                                    if (ccAttrMeRedirection)
                                    {
                                        valueChangeListener = new RedirectMethodExpressionValueExpressionValueChangeListener(attributeNameValueExpression);
                                    }
View Full Code Here

            String targetAttributeName,
            String attributeExpressionString,
            ValueExpression attributeNameValueExpression,
            boolean ccAttrMeRedirection)
    {
        ValueChangeListener o = (ValueChangeListener) mctx.removeMethodExpressionTargeted(
                innerComponent, targetAttributeName);
        if (o != null)
        {
            ((EditableValueHolder) innerComponent).removeValueChangeListener(o);
        }

        // target is EditableValueHolder
        ValueChangeListener valueChangeListener = null;
        // If it is a redirection, a wrapper is used to locate the right instance and call it properly.
        if (ccAttrMeRedirection)
        {
            valueChangeListener = new RedirectMethodExpressionValueExpressionValueChangeListener(
                    attributeNameValueExpression);
View Full Code Here

        ValueExpression b = null;
        if (this.binding != null)
        {
            b = this.binding.getValueExpression(faceletContext, ValueChangeListener.class);
        }
        ValueChangeListener listener = new LazyValueChangeListener(this.listenerType, b);
        evh.addValueChangeListener(listener);
    }
View Full Code Here

            this.binding = binding;
        }

        public void processValueChange(ValueChangeEvent event) throws AbortProcessingException
        {
            ValueChangeListener instance = null;
            FacesContext faces = FacesContext.getCurrentInstance();
            if (faces == null)
            {
                return;
            }
            if (this.binding != null)
            {
                instance = (ValueChangeListener) binding.getValue(faces.getELContext());
            }
            if (instance == null && this.type != null)
            {
                try
                {
                    instance = (ValueChangeListener) ReflectionUtil.forName(this.type).newInstance();
                }
                catch (Exception e)
                {
                    throw new AbortProcessingException("Couldn't Lazily instantiate ValueChangeListener", e);
                }
                if (this.binding != null)
                {
                    binding.setValue(faces.getELContext(), instance);
                }
            }
            if (instance != null)
            {
                instance.processValueChange(event);
            }
        }
View Full Code Here

        ValueExpression b = null;
        if (this.binding != null)
        {
            b = this.binding.getValueExpression(faceletContext, ValueChangeListener.class);
        }
        ValueChangeListener listener = new LazyValueChangeListener(this.listenerType, b);
        evh.addValueChangeListener(listener);
    }
View Full Code Here

            this.binding = binding;
        }

        public void processValueChange(ValueChangeEvent event) throws AbortProcessingException
        {
            ValueChangeListener instance = null;
            FacesContext faces = FacesContext.getCurrentInstance();
            if (faces == null)
            {
                return;
            }
            if (this.binding != null)
            {
                instance = (ValueChangeListener) binding.getValue(faces.getELContext());
            }
            if (instance == null && this.type != null)
            {
                try
                {
                    instance = (ValueChangeListener) ReflectionUtil.forName(this.type).newInstance();
                }
                catch (Exception e)
                {
                    throw new AbortProcessingException("Couldn't Lazily instantiate ValueChangeListener", e);
                }
                if (this.binding != null)
                {
                    binding.setValue(faces.getELContext(), instance);
                }
            }
            if (instance != null)
            {
                instance.processValueChange(event);
            }
        }
View Full Code Here

   
    Mock mockValidator = mock(Validator.class);
    Validator validator = (Validator) mockValidator.proxy();
   
    Mock mockListener = mock(ValueChangeListener.class);
    ValueChangeListener listener = (ValueChangeListener) mockListener.proxy();
   
    setCurrentContext(facesContext);

    // if the component is an EditableValueHolder, then the submitted value
    // must be converted and validated before this phase completes.
View Full Code Here

            throw new SAXException("Parent tag <" + tag.getClass().getName() + "> has no component instance");
        }

        if (component instanceof EditableValueHolder) {
            String clazz = (String) FacesUtils.evaluate(tag.getFacesContext(), this.type);
            ValueChangeListener handler = null;
            try {
                handler = (ValueChangeListener) Class.forName(clazz).newInstance();
            } catch (Exception e) {
                throw new SAXException("Tag <" + tag.getClass().getName() + "> could not create action listener <" + clazz + ">", e);
            }
View Full Code Here

TOP

Related Classes of javax.faces.event.ValueChangeListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.