Source code: renderkits/taglib/svg/LineTag.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.svg;
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 LineTag extends UIComponentELTag {
34
35
36 // PROPERTY: onclick
37 private javax.el.ValueExpression onclick;
38
39 public void setOnclick(javax.el.ValueExpression onclick) {
40 this.onclick = onclick;
41 }
42
43 // PROPERTY: onfocusin
44 private javax.el.ValueExpression onfocusin;
45
46 public void setOnfocusin(javax.el.ValueExpression onfocusin) {
47 this.onfocusin = onfocusin;
48 }
49
50 // PROPERTY: onfocusout
51 private javax.el.ValueExpression onfocusout;
52
53 public void setOnfocusout(javax.el.ValueExpression onfocusout) {
54 this.onfocusout = onfocusout;
55 }
56
57 // PROPERTY: onmousedown
58 private javax.el.ValueExpression onmousedown;
59
60 public void setOnmousedown(javax.el.ValueExpression onmousedown) {
61 this.onmousedown = onmousedown;
62 }
63
64 // PROPERTY: onmousemove
65 private javax.el.ValueExpression onmousemove;
66
67 public void setOnmousemove(javax.el.ValueExpression onmousemove) {
68 this.onmousemove = onmousemove;
69 }
70
71 // PROPERTY: onmouseout
72 private javax.el.ValueExpression onmouseout;
73
74 public void setOnmouseout(javax.el.ValueExpression onmouseout) {
75 this.onmouseout = onmouseout;
76 }
77
78 // PROPERTY: onmouseover
79 private javax.el.ValueExpression onmouseover;
80
81 public void setOnmouseover(javax.el.ValueExpression onmouseover) {
82 this.onmouseover = onmouseover;
83 }
84
85 // PROPERTY: onmouseup
86 private javax.el.ValueExpression onmouseup;
87
88 public void setOnmouseup(javax.el.ValueExpression onmouseup) {
89 this.onmouseup = onmouseup;
90 }
91
92 // PROPERTY: style
93 private javax.el.ValueExpression style;
94
95 public void setStyle(javax.el.ValueExpression style) {
96 this.style = style;
97 }
98
99 // PROPERTY: x1
100 private javax.el.ValueExpression x1;
101
102 public void setX1(javax.el.ValueExpression x1) {
103 this.x1 = x1;
104 }
105
106 // PROPERTY: y1
107 private javax.el.ValueExpression y1;
108
109 public void setY1(javax.el.ValueExpression y1) {
110 this.y1 = y1;
111 }
112
113 // PROPERTY: x2
114 private javax.el.ValueExpression x2;
115
116 public void setX2(javax.el.ValueExpression x2) {
117 this.x2 = x2;
118 }
119
120 // PROPERTY: y2
121 private javax.el.ValueExpression y2;
122
123 public void setY2(javax.el.ValueExpression y2) {
124 this.y2 = y2;
125 }
126
127 // General Methods
128 public String getRendererType() {
129 return "renderkit.svg.Line";
130 }
131
132 public String getComponentType() {
133 return "Line";
134 }
135
136 protected void setProperties(UIComponent component) {
137 super.setProperties(component);
138 renderkits.components.svg.Line line = null;
139 try {
140 line = (renderkits.components.svg.Line) component;
141 } catch (ClassCastException cce) {
142 throw new IllegalStateException("Component "
143 + component.toString()
144 + " not expected type. Expected: renderkits.components.svg.Line. Perhaps you're missing a tag?");
145 }
146
147 if (onclick != null) {
148 if (!onclick.isLiteralText()) {
149 line.setValueExpression("onclick", onclick);
150 } else {
151 line.getAttributes()
152 .put("onclick", onclick.getExpressionString());
153 }
154 }
155 if (onfocusin != null) {
156 if (!onfocusin.isLiteralText()) {
157 line.setValueExpression("onfocusin", onfocusin);
158 } else {
159 line.getAttributes()
160 .put("onfocusin", onfocusin.getExpressionString());
161 }
162 }
163 if (onfocusout != null) {
164 if (!onfocusout.isLiteralText()) {
165 line.setValueExpression("onfocusout", onfocusout);
166 } else {
167 line.getAttributes()
168 .put("onfocusout", onfocusout.getExpressionString());
169 }
170 }
171 if (onmousedown != null) {
172 if (!onmousedown.isLiteralText()) {
173 line.setValueExpression("onmousedown", onmousedown);
174 } else {
175 line.getAttributes()
176 .put("onmousedown", onmousedown.getExpressionString());
177 }
178 }
179 if (onmousemove != null) {
180 if (!onmousemove.isLiteralText()) {
181 line.setValueExpression("onmousemove", onmousemove);
182 } else {
183 line.getAttributes()
184 .put("onmousemove", onmousemove.getExpressionString());
185 }
186 }
187 if (onmouseout != null) {
188 if (!onmouseout.isLiteralText()) {
189 line.setValueExpression("onmouseout", onmouseout);
190 } else {
191 line.getAttributes()
192 .put("onmouseout", onmouseout.getExpressionString());
193 }
194 }
195 if (onmouseover != null) {
196 if (!onmouseover.isLiteralText()) {
197 line.setValueExpression("onmouseover", onmouseover);
198 } else {
199 line.getAttributes()
200 .put("onmouseover", onmouseover.getExpressionString());
201 }
202 }
203 if (onmouseup != null) {
204 if (!onmouseup.isLiteralText()) {
205 line.setValueExpression("onmouseup", onmouseup);
206 } else {
207 line.getAttributes()
208 .put("onmouseup", onmouseup.getExpressionString());
209 }
210 }
211 if (style != null) {
212 if (!style.isLiteralText()) {
213 line.setValueExpression("style", style);
214 } else {
215 line.getAttributes().put("style", style.getExpressionString());
216 }
217 }
218 if (x1 != null) {
219 if (!x1.isLiteralText()) {
220 line.setValueExpression("x1", x1);
221 } else {
222 line.getAttributes().put("x1", x1.getExpressionString());
223 }
224 }
225 if (y1 != null) {
226 if (!y1.isLiteralText()) {
227 line.setValueExpression("y1", y1);
228 } else {
229 line.getAttributes().put("y1", y1.getExpressionString());
230 }
231 }
232 if (x2 != null) {
233 if (!x2.isLiteralText()) {
234 line.setValueExpression("x2", x2);
235 } else {
236 line.getAttributes().put("x2", x2.getExpressionString());
237 }
238 }
239 if (y2 != null) {
240 if (!y2.isLiteralText()) {
241 line.setValueExpression("y2", y2);
242 } else {
243 line.getAttributes().put("y2", y2.getExpressionString());
244 }
245 }
246 }
247
248 // Methods From TagSupport
249 public int doStartTag() throws JspException {
250 try {
251 return super.doStartTag();
252 } catch (Exception e) {
253 Throwable root = e;
254 while (root.getCause() != null) {
255 root = root.getCause();
256 }
257 throw new JspException(root);
258 }
259 }
260
261 public int doEndTag() throws JspException {
262 try {
263 return super.doEndTag();
264 } catch (Exception e) {
265 Throwable root = e;
266 while (root.getCause() != null) {
267 root = root.getCause();
268 }
269 throw new JspException(root);
270 }
271 }
272
273 // RELEASE
274 public void release() {
275 super.release();
276
277 // rendered attributes
278 this.onclick = null;
279 this.onfocusin = null;
280 this.onfocusout = null;
281 this.onmousedown = null;
282 this.onmousemove = null;
283 this.onmouseout = null;
284 this.onmouseover = null;
285 this.onmouseup = null;
286 this.style = null;
287 this.x1 = null;
288 this.y1 = null;
289 this.x2 = null;
290 this.y2 = null;
291 }
292
293 public String getDebugString() {
294 String result =
295 "id: " + this.getId() + " class: " + this.getClass().getName();
296 return result;
297 }
298
299 }