KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > myfaces > custom > jslistener > JsValueChangeListener


1 /*
2  * Copyright (c) 2004 Your Corporation. All Rights Reserved.
3  */

4 package org.apache.myfaces.custom.jslistener;
5
6 import javax.faces.component.UIOutput;
7 import javax.faces.context.FacesContext;
8 import javax.faces.el.ValueBinding;
9
10 /**
11  * @author Martin Marinschek (latest modification by $Author: mmarinschek $)
12  * @version $Revision: 1.3 $ $Date: 2005/01/04 16:09:57 $
13  * $Log: JsValueChangeListener.java,v $
14  * Revision 1.3 2005/01/04 16:09:57 mmarinschek
15  * ChangeListener now uses renderer
16  *
17  * Revision 1.1 2004/12/17 13:19:10 mmarinschek
18  * new component jsValueChangeListener
19  *
20  */

21 public class JsValueChangeListener extends UIOutput
22 {
23     //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
24

25     public static final String JavaDoc COMPONENT_TYPE = "org.apache.myfaces.JsValueChangeListener";
26     public static final String JavaDoc COMPONENT_FAMILY = "javax.faces.Output";
27     private static final String JavaDoc DEFAULT_RENDERER_TYPE = "org.apache.myfaces.JsValueChangeListener";
28
29     private String JavaDoc _for = null;
30     private String JavaDoc _expressionValue = null;
31     private String JavaDoc _property = null;
32
33     public JsValueChangeListener()
34     {
35         setRendererType(DEFAULT_RENDERER_TYPE);
36     }
37
38     public String JavaDoc getFamily()
39     {
40         return COMPONENT_FAMILY;
41     }
42
43     public void setFor(String JavaDoc forValue)
44     {
45         _for = forValue;
46     }
47
48     public String JavaDoc getFor()
49     {
50         if (_for != null) return _for;
51         ValueBinding vb = getValueBinding("for");
52         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
53     }
54
55     public void setExpressionValue(String JavaDoc expressionValue)
56     {
57         _expressionValue = expressionValue;
58     }
59
60     public String JavaDoc getExpressionValue()
61     {
62         if (_expressionValue != null) return _expressionValue;
63         ValueBinding vb = getValueBinding("expressionValue");
64         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
65     }
66
67     public void setProperty(String JavaDoc property)
68     {
69         _property = property;
70     }
71
72     public String JavaDoc getProperty()
73     {
74         if (_property != null) return _property;
75         ValueBinding vb = getValueBinding("property");
76         return vb != null ? (String JavaDoc)vb.getValue(getFacesContext()) : null;
77     }
78
79
80
81     public Object JavaDoc saveState(FacesContext context)
82     {
83         Object JavaDoc values[] = new Object JavaDoc[4];
84         values[0] = super.saveState(context);
85         values[1] = _for;
86         values[2] = _expressionValue;
87         values[3] = _property;
88         return ((Object JavaDoc) (values));
89     }
90
91     public void restoreState(FacesContext context, Object JavaDoc state)
92     {
93         Object JavaDoc values[] = (Object JavaDoc[])state;
94         super.restoreState(context, values[0]);
95         _for = (String JavaDoc)values[1];
96         _expressionValue = (String JavaDoc)values[2];
97         _property = (String JavaDoc)values[3];
98     }
99     //------------------ GENERATED CODE END ---------------------------------------
100
}
101
Popular Tags