Source code: renderkits/taglib/xul/FormTag.java
1 /*
2 * The contents of this file are subject to the terms
3 * of the Common Development and Distribution License
4 * (the License). You may not use this file except in
5 * compliance with the License.
6 *
7 * You can obtain a copy of the License at
8 * https://javaserverfaces.dev.java.net/CDDL.html or
9 * legal/CDDLv1.0.txt.
10 * See the License for the specific language governing
11 * permission and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL
14 * Header Notice in each file and include the License file
15 * at legal/CDDLv1.0.txt.
16 * If applicable, add the following below the CDDL Header,
17 * with the fields enclosed by brackets [] replaced by
18 * your own identifying information:
19 * "Portions Copyrighted [year] [name of copyright owner]"
20 *
21 * [Name of File] [ver.__] [Date]
22 *
23 * Copyright 2005 Sun Microsystems Inc. All Rights Reserved
24 */
25
26 package renderkits.taglib.xul;
27
28 import javax.faces.component.UIComponent;
29 import javax.faces.webapp.UIComponentELTag;
30 import javax.servlet.jsp.JspException;
31
32
33 public final class FormTag extends UIComponentELTag {
34
35
36 // Setter Methods
37 // PROPERTY: prependId
38 private javax.el.ValueExpression prependId;
39
40 public void setPrependId(javax.el.ValueExpression prependId) {
41 this.prependId = prependId;
42 }
43
44 // PROPERTY: accept
45 private javax.el.ValueExpression accept;
46
47 public void setAccept(javax.el.ValueExpression accept) {
48 this.accept = accept;
49 }
50
51 // PROPERTY: acceptcharset
52 private javax.el.ValueExpression acceptcharset;
53
54 public void setAcceptcharset(javax.el.ValueExpression acceptcharset) {
55 this.acceptcharset = acceptcharset;
56 }
57
58 // PROPERTY: enctype
59 private javax.el.ValueExpression enctype;
60
61 public void setEnctype(javax.el.ValueExpression enctype) {
62 this.enctype = enctype;
63 }
64
65 // PROPERTY: onclick
66 private javax.el.ValueExpression onclick;
67
68 public void setOnclick(javax.el.ValueExpression onclick) {
69 this.onclick = onclick;
70 }
71
72 // PROPERTY: onmousedown
73 private javax.el.ValueExpression onmousedown;
74
75 public void setOnmousedown(javax.el.ValueExpression onmousedown) {
76 this.onmousedown = onmousedown;
77 }
78
79 // PROPERTY: onmousemove
80 private javax.el.ValueExpression onmousemove;
81
82 public void setOnmousemove(javax.el.ValueExpression onmousemove) {
83 this.onmousemove = onmousemove;
84 }
85
86 // PROPERTY: onmouseout
87 private javax.el.ValueExpression onmouseout;
88
89 public void setOnmouseout(javax.el.ValueExpression onmouseout) {
90 this.onmouseout = onmouseout;
91 }
92
93 // PROPERTY: onmouseover
94 private javax.el.ValueExpression onmouseover;
95
96 public void setOnmouseover(javax.el.ValueExpression onmouseover) {
97 this.onmouseover = onmouseover;
98 }
99
100 // PROPERTY: onmouseup
101 private javax.el.ValueExpression onmouseup;
102
103 public void setOnmouseup(javax.el.ValueExpression onmouseup) {
104 this.onmouseup = onmouseup;
105 }
106
107 // PROPERTY: style
108 private javax.el.ValueExpression style;
109
110 public void setStyle(javax.el.ValueExpression style) {
111 this.style = style;
112 }
113
114 // General Methods
115 public String getRendererType() {
116 return "renderkit.xul.Form";
117 }
118
119 public String getComponentType() {
120 return "javax.faces.Form";
121 }
122
123 protected void setProperties(UIComponent component) {
124 super.setProperties(component);
125 javax.faces.component.UIForm form = null;
126 try {
127 form = (javax.faces.component.UIForm) component;
128 } catch (ClassCastException cce) {
129 throw new IllegalStateException("Component "
130 + component.toString()
131 + " not expected type. Expected: javax.faces.component.UIForm. Perhaps you're missing a tag?");
132 }
133
134 if (prependId != null) {
135 if (!prependId.isLiteralText()) {
136 form.setValueExpression("prependId", prependId);
137 } else {
138 form.setPrependId(java.lang.Boolean
139 .valueOf(prependId.getExpressionString()).booleanValue());
140 }
141 }
142
143 if (accept != null) {
144 if (!accept.isLiteralText()) {
145 form.setValueExpression("accept", accept);
146 } else {
147 form.getAttributes()
148 .put("accept", accept.getExpressionString());
149 }
150 }
151 if (acceptcharset != null) {
152 if (!acceptcharset.isLiteralText()) {
153 form.setValueExpression("acceptcharset", acceptcharset);
154 } else {
155 form.getAttributes().put("acceptcharset",
156 acceptcharset.getExpressionString());
157 }
158 }
159 if (enctype != null) {
160 if (!enctype.isLiteralText()) {
161 form.setValueExpression("enctype", enctype);
162 } else {
163 form.getAttributes()
164 .put("enctype", enctype.getExpressionString());
165 }
166 }
167 if (onclick != null) {
168 if (!onclick.isLiteralText()) {
169 form.setValueExpression("onclick", onclick);
170 } else {
171 form.getAttributes()
172 .put("onclick", onclick.getExpressionString());
173 }
174 }
175 if (onmousedown != null) {
176 if (!onmousedown.isLiteralText()) {
177 form.setValueExpression("onmousedown", onmousedown);
178 } else {
179 form.getAttributes()
180 .put("onmousedown", onmousedown.getExpressionString());
181 }
182 }
183 if (onmousemove != null) {
184 if (!onmousemove.isLiteralText()) {
185 form.setValueExpression("onmousemove", onmousemove);
186 } else {
187 form.getAttributes()
188 .put("onmousemove", onmousemove.getExpressionString());
189 }
190 }
191 if (onmouseout != null) {
192 if (!onmouseout.isLiteralText()) {
193 form.setValueExpression("onmouseout", onmouseout);
194 } else {
195 form.getAttributes()
196 .put("onmouseout", onmouseout.getExpressionString());
197 }
198 }
199 if (onmouseover != null) {
200 if (!onmouseover.isLiteralText()) {
201 form.setValueExpression("onmouseover", onmouseover);
202 } else {
203 form.getAttributes()
204 .put("onmouseover", onmouseover.getExpressionString());
205 }
206 }
207 if (onmouseup != null) {
208 if (!onmouseup.isLiteralText()) {
209 form.setValueExpression("onmouseup", onmouseup);
210 } else {
211 form.getAttributes()
212 .put("onmouseup", onmouseup.getExpressionString());
213 }
214 }
215 if (style != null) {
216 if (!style.isLiteralText()) {
217 form.setValueExpression("style", style);
218 } else {
219 form.getAttributes().put("style", style.getExpressionString());
220 }
221 }
222 }
223
224 // Methods From TagSupport
225 public int doStartTag() throws JspException {
226 try {
227 return super.doStartTag();
228 } catch (Exception e) {
229 Throwable root = e;
230 while (root.getCause() != null) {
231 root = root.getCause();
232 }
233 throw new JspException(root);
234 }
235 }
236
237 public int doEndTag() throws JspException {
238 try {
239 return super.doEndTag();
240 } catch (Exception e) {
241 Throwable root = e;
242 while (root.getCause() != null) {
243 root = root.getCause();
244 }
245 throw new JspException(root);
246 }
247 }
248
249 // RELEASE
250 public void release() {
251 super.release();
252
253 // component properties
254 this.prependId = null;
255
256 // rendered attributes
257 this.accept = null;
258 this.acceptcharset = null;
259 this.enctype = null;
260 this.onclick = null;
261 this.onmousedown = null;
262 this.onmousemove = null;
263 this.onmouseout = null;
264 this.onmouseover = null;
265 this.onmouseup = null;
266 this.style = null;
267 }
268
269 public String getDebugString() {
270 String result =
271 "id: " + this.getId() + " class: " + this.getClass().getName();
272 return result;
273 }
274
275 }