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

Quick Search    Search Deep

Source code: renderkits/taglib/svg/CommandButtonTag.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.event.MethodExpressionActionListener;
30  import javax.faces.webapp.UIComponentELTag;
31  import javax.servlet.jsp.JspException;
32  
33  
34  public final class CommandButtonTag extends UIComponentELTag {
35  
36  
37      // Setter Methods
38      // PROPERTY: action
39      private javax.el.MethodExpression action;
40  
41      public void setAction(javax.el.MethodExpression action) {
42          this.action = action;
43      }
44  
45      // PROPERTY: actionListener
46      private javax.el.MethodExpression actionListener;
47  
48      public void setActionListener(javax.el.MethodExpression actionListener) {
49          this.actionListener = actionListener;
50      }
51  
52      // PROPERTY: x
53      private javax.el.ValueExpression x;
54  
55      public void setX(javax.el.ValueExpression x) {
56          this.x = x;
57      }
58  
59      // PROPERTY: y
60      private javax.el.ValueExpression y;
61  
62      public void setY(javax.el.ValueExpression y) {
63          this.y = y;
64      }
65  
66      // PROPERTY: dx 
67      private javax.el.ValueExpression dx;
68  
69      public void setDx(javax.el.ValueExpression dx) {
70          this.dx = dx;
71      }
72  
73      // PROPERTY: dy 
74      private javax.el.ValueExpression dy;
75  
76      public void setDy(javax.el.ValueExpression dy) {
77          this.dy = dy;
78      }
79  
80      // PROPERTY: height 
81      private javax.el.ValueExpression height;
82  
83      public void setHeight(javax.el.ValueExpression height) {
84          this.height = height;
85      }
86  
87      // PROPERTY: immediate
88      private javax.el.ValueExpression immediate;
89  
90      public void setImmediate(javax.el.ValueExpression immediate) {
91          this.immediate = immediate;
92      }
93  
94      // PROPERTY: label 
95      private javax.el.ValueExpression label;
96  
97      public void setLabel(javax.el.ValueExpression label) {
98          this.label = label;
99      }
100 
101     // PROPERTY: onactivate
102     private javax.el.ValueExpression onactivate;
103 
104     public void setOnactivate(javax.el.ValueExpression onactivate) {
105         this.onactivate = onactivate;
106     }
107 
108     // PROPERTY: onclick
109     private javax.el.ValueExpression onclick;
110 
111     public void setOnclick(javax.el.ValueExpression onclick) {
112         this.onclick = onclick;
113     }
114 
115     // PROPERTY: onfocusin
116     private javax.el.ValueExpression onfocusin;
117 
118     public void setOnfocusin(javax.el.ValueExpression onfocusin) {
119         this.onfocusin = onfocusin;
120     }
121 
122     // PROPERTY: onfocusout
123     private javax.el.ValueExpression onfocusout;
124 
125     public void setOnfocusout(javax.el.ValueExpression onfocusout) {
126         this.onfocusout = onfocusout;
127     }
128 
129     // PROPERTY: onmousedown
130     private javax.el.ValueExpression onmousedown;
131 
132     public void setOnmousedown(javax.el.ValueExpression onmousedown) {
133         this.onmousedown = onmousedown;
134     }
135 
136     // PROPERTY: onmousemove
137     private javax.el.ValueExpression onmousemove;
138 
139     public void setOnmousemove(javax.el.ValueExpression onmousemove) {
140         this.onmousemove = onmousemove;
141     }
142 
143     // PROPERTY: onmouseout
144     private javax.el.ValueExpression onmouseout;
145 
146     public void setOnmouseout(javax.el.ValueExpression onmouseout) {
147         this.onmouseout = onmouseout;
148     }
149 
150     // PROPERTY: onmouseover
151     private javax.el.ValueExpression onmouseover;
152 
153     public void setOnmouseover(javax.el.ValueExpression onmouseover) {
154         this.onmouseover = onmouseover;
155     }
156 
157     // PROPERTY: onmouseup
158     private javax.el.ValueExpression onmouseup;
159 
160     public void setOnmouseup(javax.el.ValueExpression onmouseup) {
161         this.onmouseup = onmouseup;
162     }
163 
164     // PROPERTY: rx 
165     private javax.el.ValueExpression rx;
166 
167     public void setRx(javax.el.ValueExpression rx) {
168         this.rx = rx;
169     }
170 
171     // PROPERTY: ry 
172     private javax.el.ValueExpression ry;
173 
174     public void setRy(javax.el.ValueExpression ry) {
175         this.ry = ry;
176     }
177 
178     // PROPERTY: style
179     private javax.el.ValueExpression style;
180 
181     public void setStyle(javax.el.ValueExpression style) {
182         this.style = style;
183     }
184 
185     // PROPERTY: styleClass
186     private javax.el.ValueExpression styleClass;
187 
188     public void setStyleClass(javax.el.ValueExpression styleClass) {
189         this.styleClass = styleClass;
190     }
191 
192     // PROPERTY: labelStyle
193     private javax.el.ValueExpression labelStyle;
194 
195     public void setLabelStyle(javax.el.ValueExpression labelStyle) {
196         this.labelStyle = labelStyle;
197     }
198 
199     // PROPERTY: type
200     private javax.el.ValueExpression type;
201 
202     public void setType(javax.el.ValueExpression type) {
203         this.type = type;
204     }
205 
206     // PROPERTY: value
207     private javax.el.ValueExpression value;
208 
209     public void setValue(javax.el.ValueExpression value) {
210         this.value = value;
211     }
212 
213     // PROPERTY: width 
214     private javax.el.ValueExpression width;
215 
216     public void setWidth(javax.el.ValueExpression width) {
217         this.width = width;
218     }
219 
220     // General Methods
221     public String getRendererType() {
222         return "renderkit.svg.Button";
223     }
224 
225     public String getComponentType() {
226         return "javax.faces.Command";
227     }
228 
229     protected void setProperties(UIComponent component) {
230         super.setProperties(component);
231         javax.faces.component.UICommand command = null;
232         try {
233             command = (javax.faces.component.UICommand) component;
234         } catch (ClassCastException cce) {
235             throw new IllegalStateException("Component "
236                                             + component.toString()
237                                             + " not expected type.  Expected: javax.faces.component.UICommand.  Perhaps you're missing a tag?");
238         }
239 
240         if (action != null) {
241             command.setActionExpression(action);
242         }
243         if (actionListener != null) {
244             command.addActionListener(new MethodExpressionActionListener(
245                   actionListener));
246         }
247         if (x != null) {
248             if (!x.isLiteralText()) {
249                 command.setValueExpression("x", x);
250             } else {
251                 command.getAttributes().put("x", x.getExpressionString());
252             }
253         }
254         if (y != null) {
255             if (!y.isLiteralText()) {
256                 command.setValueExpression("y", y);
257             } else {
258                 command.getAttributes().put("y", y.getExpressionString());
259             }
260         }
261         if (dx != null) {
262             if (!dx.isLiteralText()) {
263                 command.setValueExpression("dx", dx);
264             } else {
265                 command.getAttributes().put("dx", dx.getExpressionString());
266             }
267         }
268         if (dy != null) {
269             if (!dy.isLiteralText()) {
270                 command.setValueExpression("dy", dy);
271             } else {
272                 command.getAttributes().put("dy", dy.getExpressionString());
273             }
274         }
275         if (height != null) {
276             if (!height.isLiteralText()) {
277                 command.setValueExpression("height", height);
278             } else {
279                 command.getAttributes()
280                       .put("height", height.getExpressionString());
281             }
282         }
283         if (immediate != null) {
284             if (!immediate.isLiteralText()) {
285                 command.setValueExpression("immediate", immediate);
286             } else {
287                 command.setImmediate(java.lang.Boolean
288                       .valueOf(immediate.getExpressionString()).booleanValue());
289             }
290         }
291         if (label != null) {
292             if (!label.isLiteralText()) {
293                 command.setValueExpression("label", label);
294             } else {
295                 command.getAttributes()
296                       .put("label", label.getExpressionString());
297             }
298         }
299         if (onactivate != null) {
300             if (!onactivate.isLiteralText()) {
301                 command.setValueExpression("onactivate", onactivate);
302             } else {
303                 command.getAttributes()
304                       .put("onactivate", onactivate.getExpressionString());
305             }
306         }
307         if (onclick != null) {
308             if (!onclick.isLiteralText()) {
309                 command.setValueExpression("onclick", onclick);
310             } else {
311                 command.getAttributes()
312                       .put("onclick", onclick.getExpressionString());
313             }
314         }
315         if (onfocusin != null) {
316             if (!onfocusin.isLiteralText()) {
317                 command.setValueExpression("onfocusin", onfocusin);
318             } else {
319                 command.getAttributes()
320                       .put("onfocusin", onfocusin.getExpressionString());
321             }
322         }
323         if (onfocusout != null) {
324             if (!onfocusout.isLiteralText()) {
325                 command.setValueExpression("onfocusout", onfocusout);
326             } else {
327                 command.getAttributes()
328                       .put("onfocusout", onfocusout.getExpressionString());
329             }
330         }
331         if (onmousedown != null) {
332             if (!onmousedown.isLiteralText()) {
333                 command.setValueExpression("onmousedown", onmousedown);
334             } else {
335                 command.getAttributes()
336                       .put("onmousedown", onmousedown.getExpressionString());
337             }
338         }
339         if (onmousemove != null) {
340             if (!onmousemove.isLiteralText()) {
341                 command.setValueExpression("onmousemove", onmousemove);
342             } else {
343                 command.getAttributes()
344                       .put("onmousemove", onmousemove.getExpressionString());
345             }
346         }
347         if (onmouseout != null) {
348             if (!onmouseout.isLiteralText()) {
349                 command.setValueExpression("onmouseout", onmouseout);
350             } else {
351                 command.getAttributes()
352                       .put("onmouseout", onmouseout.getExpressionString());
353             }
354         }
355         if (onmouseover != null) {
356             if (!onmouseover.isLiteralText()) {
357                 command.setValueExpression("onmouseover", onmouseover);
358             } else {
359                 command.getAttributes()
360                       .put("onmouseover", onmouseover.getExpressionString());
361             }
362         }
363         if (onmouseup != null) {
364             if (!onmouseup.isLiteralText()) {
365                 command.setValueExpression("onmouseup", onmouseup);
366             } else {
367                 command.getAttributes()
368                       .put("onmouseup", onmouseup.getExpressionString());
369             }
370         }
371         if (rx != null) {
372             if (!rx.isLiteralText()) {
373                 command.setValueExpression("rx", rx);
374             } else {
375                 command.getAttributes().put("rx", rx.getExpressionString());
376             }
377         }
378         if (ry != null) {
379             if (!ry.isLiteralText()) {
380                 command.setValueExpression("ry", ry);
381             } else {
382                 command.getAttributes().put("ry", ry.getExpressionString());
383             }
384         }
385         if (style != null) {
386             if (!style.isLiteralText()) {
387                 command.setValueExpression("style", style);
388             } else {
389                 command.getAttributes()
390                       .put("style", style.getExpressionString());
391             }
392         }
393         if (styleClass != null) {
394             if (!styleClass.isLiteralText()) {
395                 command.setValueExpression("styleClass", styleClass);
396             } else {
397                 command.getAttributes()
398                       .put("styleClass", styleClass.getExpressionString());
399             }
400         }
401         if (labelStyle != null) {
402             if (!labelStyle.isLiteralText()) {
403                 command.setValueExpression("labelStyle", labelStyle);
404             } else {
405                 command.getAttributes()
406                       .put("labelStyle", labelStyle.getExpressionString());
407             }
408         }
409         if (type != null) {
410             if (!type.isLiteralText()) {
411                 command.setValueExpression("type", type);
412             } else {
413                 command.getAttributes().put("type", type.getExpressionString());
414             }
415         }
416         if (value != null) {
417             if (!value.isLiteralText()) {
418                 command.setValueExpression("value", value);
419             } else {
420                 command.setValue(value.getExpressionString());
421             }
422         }
423         if (width != null) {
424             if (!width.isLiteralText()) {
425                 command.setValueExpression("width", width);
426             } else {
427                 command.getAttributes()
428                       .put("width", width.getExpressionString());
429             }
430         }
431     }
432 
433     // Methods From TagSupport
434     public int doStartTag() throws JspException {
435         try {
436             return super.doStartTag();
437         } catch (Exception e) {
438             Throwable root = e;
439             while (root.getCause() != null) {
440                 root = root.getCause();
441             }
442             throw new JspException(root);
443         }
444     }
445 
446     public int doEndTag() throws JspException {
447         try {
448             return super.doEndTag();
449         } catch (Exception e) {
450             Throwable root = e;
451             while (root.getCause() != null) {
452                 root = root.getCause();
453             }
454             throw new JspException(root);
455         }
456     }
457 
458     // RELEASE
459     public void release() {
460         super.release();
461 
462         // component properties
463         this.action = null;
464         this.actionListener = null;
465         this.immediate = null;
466         this.value = null;
467 
468         // rendered attributes
469         this.x = null;
470         this.y = null;
471         this.dx = null;
472         this.dy = null;
473         this.height = null;
474         this.label = null;
475         this.onactivate = null;
476         this.onclick = null;
477         this.onfocusin = null;
478         this.onfocusout = null;
479         this.onmousedown = null;
480         this.onmousemove = null;
481         this.onmouseout = null;
482         this.onmouseover = null;
483         this.onmouseup = null;
484         this.rx = null;
485         this.ry = null;
486         this.style = null;
487         this.styleClass = null;
488         this.labelStyle = null;
489         this.type = null;
490         this.width = null;
491     }
492 
493     public String getDebugString() {
494         String result =
495               "id: " + this.getId() + " class: " + this.getClass().getName();
496         return result;
497     }
498 
499 }