KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > faces > component > UIOutput


1 /*
2  * Copyright 2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package javax.faces.component;
17
18 import javax.faces.context.FacesContext;
19 import javax.faces.convert.Converter;
20 import javax.faces.el.ValueBinding;
21
22 /**
23  * @author Manfred Geiler (latest modification by $Author: mwessendorf $)
24  * @version $Revision: 1.7 $ $Date: 2004/07/01 22:00:49 $
25  */

26 public class UIOutput
27         extends UIComponentBase
28         implements ValueHolder
29 {
30     public Object JavaDoc getLocalValue()
31     {
32         return _value;
33     }
34
35     //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
36

37     public static final String JavaDoc COMPONENT_TYPE = "javax.faces.Output";
38     public static final String JavaDoc COMPONENT_FAMILY = "javax.faces.Output";
39     private static final String JavaDoc DEFAULT_RENDERER_TYPE = "javax.faces.Text";
40
41     private Converter _converter = null;
42     private Object JavaDoc _value = null;
43
44     public UIOutput()
45     {
46         setRendererType(DEFAULT_RENDERER_TYPE);
47     }
48
49     public String JavaDoc getFamily()
50     {
51         return COMPONENT_FAMILY;
52     }
53
54     public void setConverter(Converter converter)
55     {
56         _converter = converter;
57     }
58
59     public Converter getConverter()
60     {
61         if (_converter != null) return _converter;
62         ValueBinding vb = getValueBinding("converter");
63         return vb != null ? (Converter)vb.getValue(getFacesContext()) : null;
64     }
65
66     public void setValue(Object JavaDoc value)
67     {
68         _value = value;
69     }
70
71     public Object JavaDoc getValue()
72     {
73         if (_value != null) return _value;
74         ValueBinding vb = getValueBinding("value");
75         return vb != null ? (Object JavaDoc)vb.getValue(getFacesContext()) : null;
76     }
77
78
79     public Object JavaDoc saveState(FacesContext context)
80     {
81         Object JavaDoc values[] = new Object JavaDoc[3];
82         values[0] = super.saveState(context);
83         values[1] = saveAttachedState(context, _converter);
84         values[2] = _value;
85         return ((Object JavaDoc) (values));
86     }
87
88     public void restoreState(FacesContext context, Object JavaDoc state)
89     {
90         Object JavaDoc values[] = (Object JavaDoc[])state;
91         super.restoreState(context, values[0]);
92         _converter = (Converter)restoreAttachedState(context, values[1]);
93         _value = (Object JavaDoc)values[2];
94     }
95     //------------------ GENERATED CODE END ---------------------------------------
96
}
97
Popular Tags