KickJava   Java API By Example, From Geeks To Geeks.

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


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.el.ValueBinding;
20
21 /**
22  * see Javadoc of JSF Specification
23  *
24  * @author Manfred Geiler (latest modification by $Author: mwessendorf $)
25  * @version $Revision: 1.5 $ $Date: 2004/07/01 22:00:50 $
26  */

27 public class UIMessages
28         extends UIComponentBase
29 {
30     //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
31

32     public static final String JavaDoc COMPONENT_TYPE = "javax.faces.Messages";
33     public static final String JavaDoc COMPONENT_FAMILY = "javax.faces.Messages";
34     private static final String JavaDoc DEFAULT_RENDERER_TYPE = "javax.faces.Messages";
35     private static final boolean DEFAULT_GLOBALONLY = false;
36     private static final boolean DEFAULT_SHOWDETAIL = false;
37     private static final boolean DEFAULT_SHOWSUMMARY = true;
38
39     private Boolean JavaDoc _globalOnly = null;
40     private Boolean JavaDoc _showDetail = null;
41     private Boolean JavaDoc _showSummary = null;
42
43     public UIMessages()
44     {
45         setRendererType(DEFAULT_RENDERER_TYPE);
46     }
47
48     public String JavaDoc getFamily()
49     {
50         return COMPONENT_FAMILY;
51     }
52
53     public void setGlobalOnly(boolean globalOnly)
54     {
55         _globalOnly = Boolean.valueOf(globalOnly);
56     }
57
58     public boolean isGlobalOnly()
59     {
60         if (_globalOnly != null) return _globalOnly.booleanValue();
61         ValueBinding vb = getValueBinding("globalOnly");
62         Boolean JavaDoc v = vb != null ? (Boolean JavaDoc)vb.getValue(getFacesContext()) : null;
63         return v != null ? v.booleanValue() : DEFAULT_GLOBALONLY;
64     }
65
66     public void setShowDetail(boolean showDetail)
67     {
68         _showDetail = Boolean.valueOf(showDetail);
69     }
70
71     public boolean isShowDetail()
72     {
73         if (_showDetail != null) return _showDetail.booleanValue();
74         ValueBinding vb = getValueBinding("showDetail");
75         Boolean JavaDoc v = vb != null ? (Boolean JavaDoc)vb.getValue(getFacesContext()) : null;
76         return v != null ? v.booleanValue() : DEFAULT_SHOWDETAIL;
77     }
78
79     public void setShowSummary(boolean showSummary)
80     {
81         _showSummary = Boolean.valueOf(showSummary);
82     }
83
84     public boolean isShowSummary()
85     {
86         if (_showSummary != null) return _showSummary.booleanValue();
87         ValueBinding vb = getValueBinding("showSummary");
88         Boolean JavaDoc v = vb != null ? (Boolean JavaDoc)vb.getValue(getFacesContext()) : null;
89         return v != null ? v.booleanValue() : DEFAULT_SHOWSUMMARY;
90     }
91
92
93     public Object JavaDoc saveState(FacesContext context)
94     {
95         Object JavaDoc values[] = new Object JavaDoc[4];
96         values[0] = super.saveState(context);
97         values[1] = _globalOnly;
98         values[2] = _showDetail;
99         values[3] = _showSummary;
100         return ((Object JavaDoc) (values));
101     }
102
103     public void restoreState(FacesContext context, Object JavaDoc state)
104     {
105         Object JavaDoc values[] = (Object JavaDoc[])state;
106         super.restoreState(context, values[0]);
107         _globalOnly = (Boolean JavaDoc)values[1];
108         _showDetail = (Boolean JavaDoc)values[2];
109         _showSummary = (Boolean JavaDoc)values[3];
110     }
111     //------------------ GENERATED CODE END ---------------------------------------
112
}
113
Popular Tags