Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ValueChangeListenerTag |
|
| 0.0;0 |
1 | /* | |
2 | * Licensed to the Apache Software Foundation (ASF) under one | |
3 | * or more contributor license agreements. See the NOTICE file | |
4 | * distributed with this work for additional information | |
5 | * regarding copyright ownership. The ASF licenses this file | |
6 | * to you under the Apache License, Version 2.0 (the | |
7 | * "License"); you may not use this file except in compliance | |
8 | * with the License. You may obtain a copy of the License at | |
9 | * | |
10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
11 | * | |
12 | * Unless required by applicable law or agreed to in writing, | |
13 | * software distributed under the License is distributed on an | |
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
15 | * KIND, either express or implied. See the License for the | |
16 | * specific language governing permissions and limitations | |
17 | * under the License. | |
18 | */ | |
19 | package org.apache.myfaces.taglib.core; | |
20 | ||
21 | import javax.el.ValueExpression; | |
22 | import javax.faces.component.EditableValueHolder; | |
23 | import javax.faces.event.ActionListener; | |
24 | import javax.faces.event.ValueChangeListener; | |
25 | ||
26 | import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFJspAttribute; | |
27 | import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFJspTag; | |
28 | ||
29 | /** | |
30 | * Adds the specified ValueChangeListener to the nearest parent UIComponent | |
31 | * (which is expected to be a UIInput component). | |
32 | * <p> | |
33 | * Whenever the form containing the parent UIComponent is submitted, | |
34 | * an instance of the specified type is created. If the submitted | |
35 | * value from the component is different from the component's current | |
36 | * value then a ValueChangeEvent is queued. When the ValueChangeEvent | |
37 | * is processed (at end of the validate phase for non-immediate components, | |
38 | * or at end of the apply-request-values phase for immediate components) | |
39 | * the object's processValueChange method is invoked. | |
40 | * </p> | |
41 | * <p> | |
42 | * Unless otherwise specified, all attributes accept static values | |
43 | * or EL expressions. | |
44 | * </p> | |
45 | * @author Manfred Geiler (latest modification by $Author: lu4242 $) | |
46 | * @version $Revision: 693358 $ $Date: 2008-09-08 22:54:29 -0500 (Mon, 08 Sep 2008) $ | |
47 | */ | |
48 | 0 | @JSFJspTag(name="f:valueChangeListener",bodyContent="empty") |
49 | public class ValueChangeListenerTag | |
50 | extends GenericListenerTag<EditableValueHolder, ValueChangeListener> | |
51 | { | |
52 | private static final long serialVersionUID = 2155190261951046892L; | |
53 | ||
54 | public ValueChangeListenerTag() | |
55 | { | |
56 | 0 | super(EditableValueHolder.class); |
57 | 0 | } |
58 | ||
59 | protected void addListener(EditableValueHolder editableValueHolder, ValueChangeListener valueChangeListener) | |
60 | { | |
61 | 0 | editableValueHolder.addValueChangeListener(valueChangeListener); |
62 | 0 | } |
63 | ||
64 | protected ValueChangeListener createDelegateListener(ValueExpression type, | |
65 | ValueExpression binding) | |
66 | { | |
67 | 0 | return new DelegateValueChangeListener(type,binding); |
68 | } | |
69 | ||
70 | /** | |
71 | * The name of a Java class that implements ValueChangeListener. | |
72 | */ | |
73 | @JSFJspAttribute( | |
74 | className="java.lang.String", | |
75 | rtexprvalue=true) | |
76 | public void setType(ValueExpression type) | |
77 | { | |
78 | 0 | super.setType(type); |
79 | 0 | } |
80 | ||
81 | /** | |
82 | * Value binding expression that evaluates to an implementation of | |
83 | * the javax.faces.event.ValueChangeListener interface. | |
84 | */ | |
85 | @JSFJspAttribute( | |
86 | className="javax.faces.event.ValueChangeListener", | |
87 | rtexprvalue=true) | |
88 | public void setBinding(ValueExpression binding) | |
89 | { | |
90 | 0 | super.setBinding(binding); |
91 | 0 | } |
92 | } |