Source code: javax/faces/component/UIMessages.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 * @author Manfred Geiler (latest modification by $Author: mwessendorf $)
25 * @version $Revision: 166994 $ $Date: 2004-07-01 18:12:40 -0400 (Thu, 01 Jul 2004) $
26 */
27 public class UIMessages
28 extends UIComponentBase
29 {
30 //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
31
32 public static final String COMPONENT_TYPE = "javax.faces.Messages";
33 public static final String COMPONENT_FAMILY = "javax.faces.Messages";
34 private static final String 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 _globalOnly = null;
40 private Boolean _showDetail = null;
41 private Boolean _showSummary = null;
42
43 public UIMessages()
44 {
45 setRendererType(DEFAULT_RENDERER_TYPE);
46 }
47
48 public String 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 v = vb != null ? (Boolean)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 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] = _globalOnly;
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 _globalOnly = (Boolean)values[1];
108 _showDetail = (Boolean)values[2];
109 _showSummary = (Boolean)values[3];
110 }
111 //------------------ GENERATED CODE END ---------------------------------------
112 }