1 /*
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3 *
4 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
5 *
6 * The contents of this file are subject to the terms of either the GNU
7 * General Public License Version 2 only ("GPL") or the Common Development
8 * and Distribution License("CDDL") (collectively, the "License"). You
9 * may not use this file except in compliance with the License. You can obtain
10 * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
11 * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
12 * language governing permissions and limitations under the License.
13 *
14 * When distributing the software, include this License Header Notice in each
15 * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
16 * Sun designates this particular file as subject to the "Classpath" exception
17 * as provided by Sun in the GPL Version 2 section of the License file that
18 * accompanied this code. If applicable, add the following below the License
19 * Header, with the fields enclosed by brackets [] replaced by your own
20 * identifying information: "Portions Copyrighted [year]
21 * [name of copyright owner]"
22 *
23 * Contributor(s):
24 *
25 * If you wish your version of this file to be governed by only the CDDL or
26 * only the GPL Version 2, indicate your decision by adding "[Contributor]
27 * elects to include this software in this distribution under the [CDDL or GPL
28 * Version 2] license." If you don't indicate a single choice of license, a
29 * recipient has the option to distribute your version of this file under
30 * either the CDDL, the GPL Version 2 or to extend the choice of license to
31 * its licensees as provided above. However, if you add GPL Version 2 code
32 * and therefore, elected the GPL Version 2 license, then the option applies
33 * only if the new code is made subject to such option by the copyright
34 * holder.
35 */
36 package javax.faces.component.html;
37
38 import java.io.IOException;
39 import java.util.List;
40 import java.util.ArrayList;
41 import java.util.Arrays;
42
43 import javax.faces.context.FacesContext;
44 import javax.el.MethodExpression;
45 import javax.el.ValueExpression;
46
47
48 /*
49 * ******* GENERATED CODE - DO NOT EDIT *******
50 */
51
52
53 /**
54 * <p>Causes all child components of this component
55 * to be rendered. This is useful in scenarios
56 * where a parent component is expecting a single
57 * component to be present, but the application
58 * wishes to render more than one.</p>
59 * <p>By default, the <code>rendererType</code> property must be set to "<code>javax.faces.Group</code>".
60 * This value can be changed by calling the <code>setRendererType()</code> method.</p>
61 */
62 public class HtmlPanelGroup extends javax.faces.component.UIPanel {
63
64
65
66 private static final String[] OPTIMIZED_PACKAGES = {
67 "javax.faces.component",
68 "javax.faces.component.html"
69 };
70
71 public HtmlPanelGroup() {
72 super();
73 setRendererType("javax.faces.Group");
74 }
75
76
77 /**
78 * <p>The standard component type for this component.</p>
79 */
80 public static final String COMPONENT_TYPE = "javax.faces.HtmlPanelGroup";
81
82
83 private java.lang.String layout;
84 /**
85 * <p>Return the value of the <code>layout</code> property.</p>
86 * <p>Contents: The type of layout markup to use when rendering this group.
87 * If the value is "block" the renderer must produce an HTML
88 * "div" element. Otherwise HTML "span" element must
89 * be produced.
90 */
91 public java.lang.String getLayout() {
92 if (null != this.layout) {
93 return this.layout;
94 }
95 ValueExpression _ve = getValueExpression("layout");
96 if (_ve != null) {
97 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
98 } else {
99 return null;
100 }
101 }
102
103 /**
104 * <p>Set the value of the <code>layout</code> property.</p>
105 */
106 public void setLayout(java.lang.String layout) {
107 this.layout = layout;
108 }
109
110
111 private java.lang.String style;
112 /**
113 * <p>Return the value of the <code>style</code> property.</p>
114 * <p>Contents: CSS style(s) to be applied when this component is rendered.
115 */
116 public java.lang.String getStyle() {
117 if (null != this.style) {
118 return this.style;
119 }
120 ValueExpression _ve = getValueExpression("style");
121 if (_ve != null) {
122 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
123 } else {
124 return null;
125 }
126 }
127
128 /**
129 * <p>Set the value of the <code>style</code> property.</p>
130 */
131 public void setStyle(java.lang.String style) {
132 this.style = style;
133 handleAttribute("style", style);
134 }
135
136
137 private java.lang.String styleClass;
138 /**
139 * <p>Return the value of the <code>styleClass</code> property.</p>
140 * <p>Contents: Space-separated list of CSS style class(es) to be applied when
141 * this element is rendered. This value must be passed through
142 * as the "class" property on generated markup.
143 */
144 public java.lang.String getStyleClass() {
145 if (null != this.styleClass) {
146 return this.styleClass;
147 }
148 ValueExpression _ve = getValueExpression("styleClass");
149 if (_ve != null) {
150 return (java.lang.String) _ve.getValue(getFacesContext().getELContext());
151 } else {
152 return null;
153 }
154 }
155
156 /**
157 * <p>Set the value of the <code>styleClass</code> property.</p>
158 */
159 public void setStyleClass(java.lang.String styleClass) {
160 this.styleClass = styleClass;
161 }
162
163
164 private Object[] _values;
165
166 public Object saveState(FacesContext _context) {
167 if (_values == null) {
168 _values = new Object[4];
169 }
170 _values[0] = super.saveState(_context);
171 _values[1] = layout;
172 _values[2] = style;
173 _values[3] = styleClass;
174 return _values;
175 }
176
177
178 public void restoreState(FacesContext _context, Object _state) {
179 _values = (Object[]) _state;
180 super.restoreState(_context, _values[0]);
181 this.layout = (java.lang.String) _values[1];
182 this.style = (java.lang.String) _values[2];
183 this.styleClass = (java.lang.String) _values[3];
184 }
185
186
187 private void handleAttribute(String name, Object value) {
188 List<String> setAttributes = null;
189 String pkg = this.getClass().getPackage().getName();
190 if (Arrays.binarySearch(OPTIMIZED_PACKAGES, pkg) >= 0) {
191 setAttributes = (List<String>) this.getAttributes().get("javax.faces.component.UIComponentBase.attributesThatAreSet");
192 if (setAttributes == null) {
193 setAttributes = new ArrayList<String>(6);
194 this.getAttributes().put("javax.faces.component.UIComponentBase.attributesThatAreSet", setAttributes);
195 }
196 if (value == null) {
197 setAttributes.remove(name);
198 } else if (!setAttributes.contains(name)) {
199 setAttributes.add(name);
200 }
201 }
202 }
203
204 }