Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

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