KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Javadoc says default for showDetail is false, but Specs say it is true!?
25  *
26  * @author Manfred Geiler (latest modification by $Author: mwessendorf $)
27  * @version $Revision: 1.8 $ $Date: 2004/07/01 22:00:50 $
28  * $Log: UIMessage.java,v $
29  * Revision 1.8 2004/07/01 22:00:50 mwessendorf
30  * ASF switch
31  *
32  * Revision 1.7 2004/03/31 14:51:48 manolito
33  * summaryFormat and detailFormat support
34  *
35  * Revision 1.6 2004/03/30 17:47:33 manolito
36  * Message and Messages refactored
37  *
38  */

39 public class UIMessage
40         extends UIComponentBase
41 {
42     //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
43

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