Source code: javax/faces/component/UIMessage.java
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: grantsmith $)
27 * @version $Revision: 169646 $ $Date: 2005-05-11 11:34:57 -0400 (Wed, 11 May 2005) $
28 */
29 public class UIMessage
30 extends UIComponentBase
31 {
32 //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
33
34 public static final String COMPONENT_TYPE = "javax.faces.Message";
35 public static final String COMPONENT_FAMILY = "javax.faces.Message";
36 private static final String DEFAULT_RENDERER_TYPE = "javax.faces.Message";
37 private static final boolean DEFAULT_SHOWDETAIL = true;
38 private static final boolean DEFAULT_SHOWSUMMARY = false;
39
40 private String _for = null;
41 private Boolean _showDetail = null;
42 private Boolean _showSummary = null;
43
44 public UIMessage()
45 {
46 setRendererType(DEFAULT_RENDERER_TYPE);
47 }
48
49 public String getFamily()
50 {
51 return COMPONENT_FAMILY;
52 }
53
54 public void setFor(String forValue)
55 {
56 _for = forValue;
57 }
58
59 public String getFor()
60 {
61 if (_for != null) return _for;
62 ValueBinding vb = getValueBinding("for");
63 return vb != null ? (String)vb.getValue(getFacesContext()) : null;
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 v = vb != null ? (Boolean)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 v = vb != null ? (Boolean)vb.getValue(getFacesContext()) : null;
89 return v != null ? v.booleanValue() : DEFAULT_SHOWSUMMARY;
90 }
91
92
93 public Object saveState(FacesContext context)
94 {
95 Object values[] = new Object[4];
96 values[0] = super.saveState(context);
97 values[1] = _for;
98 values[2] = _showDetail;
99 values[3] = _showSummary;
100 return ((Object) (values));
101 }
102
103 public void restoreState(FacesContext context, Object state)
104 {
105 Object values[] = (Object[])state;
106 super.restoreState(context, values[0]);
107 _for = (String)values[1];
108 _showDetail = (Boolean)values[2];
109 _showSummary = (Boolean)values[3];
110 }
111 //------------------ GENERATED CODE END ---------------------------------------
112 }