View Javadoc

1   /*
2    * $Id: ELCancelTag.java 376779 2006-02-10 18:08:58Z husted $
3    *
4    * Copyright 1999-2004 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.strutsel.taglib.html;
19  
20  import org.apache.struts.taglib.html.CancelTag;
21  import org.apache.strutsel.taglib.utils.EvalHelper;
22  
23  import javax.servlet.jsp.JspException;
24  
25  /***
26   * Tag for input fields of type "cancel". <p> This class is a subclass of the
27   * class <code>org.apache.struts.taglib.html.CancelTag</code> which provides
28   * most of the described functionality.  This subclass allows all attribute
29   * values to be specified as expressions utilizing the JavaServer Pages
30   * Standard Library expression language.
31   *
32   * @version $Rev: 376779 $
33   */
34  public class ELCancelTag extends CancelTag {
35      /***
36       * Instance variable mapped to "accesskey" tag attribute. (Mapping set in
37       * associated BeanInfo class.)
38       */
39      private String accesskeyExpr;
40  
41      /***
42       * Instance variable mapped to "alt" tag attribute. (Mapping set in
43       * associated BeanInfo class.)
44       */
45      private String altExpr;
46  
47      /***
48       * Instance variable mapped to "altKey" tag attribute. (Mapping set in
49       * associated BeanInfo class.)
50       */
51      private String altKeyExpr;
52  
53      /***
54       * Instance variable mapped to "bundle" tag attribute. (Mapping set in
55       * associated BeanInfo class.)
56       */
57      private String bundleExpr;
58  
59      /***
60       * Instance variable mapped to "disabled" tag attribute. (Mapping set in
61       * associated BeanInfo class.)
62       */
63      private String disabledExpr;
64  
65      /***
66       * Instance variable mapped to "onblur" tag attribute. (Mapping set in
67       * associated BeanInfo class.)
68       */
69      private String onblurExpr;
70  
71      /***
72       * Instance variable mapped to "onchange" tag attribute. (Mapping set in
73       * associated BeanInfo class.)
74       */
75      private String onchangeExpr;
76  
77      /***
78       * Instance variable mapped to "onclick" tag attribute. (Mapping set in
79       * associated BeanInfo class.)
80       */
81      private String onclickExpr;
82  
83      /***
84       * Instance variable mapped to "ondblclick" tag attribute. (Mapping set in
85       * associated BeanInfo class.)
86       */
87      private String ondblclickExpr;
88  
89      /***
90       * Instance variable mapped to "onfocus" tag attribute. (Mapping set in
91       * associated BeanInfo class.)
92       */
93      private String onfocusExpr;
94  
95      /***
96       * Instance variable mapped to "onkeydown" tag attribute. (Mapping set in
97       * associated BeanInfo class.)
98       */
99      private String onkeydownExpr;
100 
101     /***
102      * Instance variable mapped to "onkeypress" tag attribute. (Mapping set in
103      * associated BeanInfo class.)
104      */
105     private String onkeypressExpr;
106 
107     /***
108      * Instance variable mapped to "onkeyup" tag attribute. (Mapping set in
109      * associated BeanInfo class.)
110      */
111     private String onkeyupExpr;
112 
113     /***
114      * Instance variable mapped to "onmousedown" tag attribute. (Mapping set
115      * in associated BeanInfo class.)
116      */
117     private String onmousedownExpr;
118 
119     /***
120      * Instance variable mapped to "onmousemove" tag attribute. (Mapping set
121      * in associated BeanInfo class.)
122      */
123     private String onmousemoveExpr;
124 
125     /***
126      * Instance variable mapped to "onmouseout" tag attribute. (Mapping set in
127      * associated BeanInfo class.)
128      */
129     private String onmouseoutExpr;
130 
131     /***
132      * Instance variable mapped to "onmouseover" tag attribute. (Mapping set
133      * in associated BeanInfo class.)
134      */
135     private String onmouseoverExpr;
136 
137     /***
138      * Instance variable mapped to "onmouseup" tag attribute. (Mapping set in
139      * associated BeanInfo class.)
140      */
141     private String onmouseupExpr;
142 
143     /***
144      * Instance variable mapped to "property" tag attribute. (Mapping set in
145      * associated BeanInfo class.)
146      */
147     private String propertyExpr;
148 
149     /***
150      * Instance variable mapped to "style" tag attribute. (Mapping set in
151      * associated BeanInfo class.)
152      */
153     private String styleExpr;
154 
155     /***
156      * Instance variable mapped to "styleClass" tag attribute. (Mapping set in
157      * associated BeanInfo class.)
158      */
159     private String styleClassExpr;
160 
161     /***
162      * Instance variable mapped to "styleId" tag attribute. (Mapping set in
163      * associated BeanInfo class.)
164      */
165     private String styleIdExpr;
166 
167     /***
168      * Instance variable mapped to "tabindex" tag attribute. (Mapping set in
169      * associated BeanInfo class.)
170      */
171     private String tabindexExpr;
172 
173     /***
174      * Instance variable mapped to "title" tag attribute. (Mapping set in
175      * associated BeanInfo class.)
176      */
177     private String titleExpr;
178 
179     /***
180      * Instance variable mapped to "titleKey" tag attribute. (Mapping set in
181      * associated BeanInfo class.)
182      */
183     private String titleKeyExpr;
184 
185     /***
186      * Instance variable mapped to "value" tag attribute. (Mapping set in
187      * associated BeanInfo class.)
188      */
189     private String valueExpr;
190 
191     /***
192      * Getter method for "accesskey" tag attribute. (Mapping set in associated
193      * BeanInfo class.)
194      */
195     public String getAccesskeyExpr() {
196         return (accesskeyExpr);
197     }
198 
199     /***
200      * Getter method for "alt" tag attribute. (Mapping set in associated
201      * BeanInfo class.)
202      */
203     public String getAltExpr() {
204         return (altExpr);
205     }
206 
207     /***
208      * Getter method for "altKey" tag attribute. (Mapping set in associated
209      * BeanInfo class.)
210      */
211     public String getAltKeyExpr() {
212         return (altKeyExpr);
213     }
214 
215     /***
216      * Getter method for "bundle" tag attribute. (Mapping set in associated
217      * BeanInfo class.)
218      */
219     public String getBundleExpr() {
220         return (bundleExpr);
221     }
222 
223     /***
224      * Getter method for "disabled" tag attribute. (Mapping set in associated
225      * BeanInfo class.)
226      */
227     public String getDisabledExpr() {
228         return (disabledExpr);
229     }
230 
231     /***
232      * Getter method for "onblur" tag attribute. (Mapping set in associated
233      * BeanInfo class.)
234      */
235     public String getOnblurExpr() {
236         return (onblurExpr);
237     }
238 
239     /***
240      * Getter method for "onchange" tag attribute. (Mapping set in associated
241      * BeanInfo class.)
242      */
243     public String getOnchangeExpr() {
244         return (onchangeExpr);
245     }
246 
247     /***
248      * Getter method for "onclick" tag attribute. (Mapping set in associated
249      * BeanInfo class.)
250      */
251     public String getOnclickExpr() {
252         return (onclickExpr);
253     }
254 
255     /***
256      * Getter method for "ondblclick" tag attribute. (Mapping set in
257      * associated BeanInfo class.)
258      */
259     public String getOndblclickExpr() {
260         return (ondblclickExpr);
261     }
262 
263     /***
264      * Getter method for "onfocus" tag attribute. (Mapping set in associated
265      * BeanInfo class.)
266      */
267     public String getOnfocusExpr() {
268         return (onfocusExpr);
269     }
270 
271     /***
272      * Getter method for "onkeydown" tag attribute. (Mapping set in associated
273      * BeanInfo class.)
274      */
275     public String getOnkeydownExpr() {
276         return (onkeydownExpr);
277     }
278 
279     /***
280      * Getter method for "onkeypress" tag attribute. (Mapping set in
281      * associated BeanInfo class.)
282      */
283     public String getOnkeypressExpr() {
284         return (onkeypressExpr);
285     }
286 
287     /***
288      * Getter method for "onkeyup" tag attribute. (Mapping set in associated
289      * BeanInfo class.)
290      */
291     public String getOnkeyupExpr() {
292         return (onkeyupExpr);
293     }
294 
295     /***
296      * Getter method for "onmousedown" tag attribute. (Mapping set in
297      * associated BeanInfo class.)
298      */
299     public String getOnmousedownExpr() {
300         return (onmousedownExpr);
301     }
302 
303     /***
304      * Getter method for "onmousemove" tag attribute. (Mapping set in
305      * associated BeanInfo class.)
306      */
307     public String getOnmousemoveExpr() {
308         return (onmousemoveExpr);
309     }
310 
311     /***
312      * Getter method for "onmouseout" tag attribute. (Mapping set in
313      * associated BeanInfo class.)
314      */
315     public String getOnmouseoutExpr() {
316         return (onmouseoutExpr);
317     }
318 
319     /***
320      * Getter method for "onmouseover" tag attribute. (Mapping set in
321      * associated BeanInfo class.)
322      */
323     public String getOnmouseoverExpr() {
324         return (onmouseoverExpr);
325     }
326 
327     /***
328      * Getter method for "onmouseup" tag attribute. (Mapping set in associated
329      * BeanInfo class.)
330      */
331     public String getOnmouseupExpr() {
332         return (onmouseupExpr);
333     }
334 
335     /***
336      * Getter method for "property" tag attribute. (Mapping set in associated
337      * BeanInfo class.)
338      */
339     public String getPropertyExpr() {
340         return (propertyExpr);
341     }
342 
343     /***
344      * Getter method for "style" tag attribute. (Mapping set in associated
345      * BeanInfo class.)
346      */
347     public String getStyleExpr() {
348         return (styleExpr);
349     }
350 
351     /***
352      * Getter method for "styleClass" tag attribute. (Mapping set in
353      * associated BeanInfo class.)
354      */
355     public String getStyleClassExpr() {
356         return (styleClassExpr);
357     }
358 
359     /***
360      * Getter method for "styleId" tag attribute. (Mapping set in associated
361      * BeanInfo class.)
362      */
363     public String getStyleIdExpr() {
364         return (styleIdExpr);
365     }
366 
367     /***
368      * Getter method for "tabindex" tag attribute. (Mapping set in associated
369      * BeanInfo class.)
370      */
371     public String getTabindexExpr() {
372         return (tabindexExpr);
373     }
374 
375     /***
376      * Getter method for "title" tag attribute. (Mapping set in associated
377      * BeanInfo class.)
378      */
379     public String getTitleExpr() {
380         return (titleExpr);
381     }
382 
383     /***
384      * Getter method for "titleKey" tag attribute. (Mapping set in associated
385      * BeanInfo class.)
386      */
387     public String getTitleKeyExpr() {
388         return (titleKeyExpr);
389     }
390 
391     /***
392      * Getter method for "value" tag attribute. (Mapping set in associated
393      * BeanInfo class.)
394      */
395     public String getValueExpr() {
396         return (valueExpr);
397     }
398 
399     /***
400      * Setter method for "accesskey" tag attribute. (Mapping set in associated
401      * BeanInfo class.)
402      */
403     public void setAccesskeyExpr(String accesskeyExpr) {
404         this.accesskeyExpr = accesskeyExpr;
405     }
406 
407     /***
408      * Setter method for "alt" tag attribute. (Mapping set in associated
409      * BeanInfo class.)
410      */
411     public void setAltExpr(String altExpr) {
412         this.altExpr = altExpr;
413     }
414 
415     /***
416      * Setter method for "altKey" tag attribute. (Mapping set in associated
417      * BeanInfo class.)
418      */
419     public void setAltKeyExpr(String altKeyExpr) {
420         this.altKeyExpr = altKeyExpr;
421     }
422 
423     /***
424      * Setter method for "bundle" tag attribute. (Mapping set in associated
425      * BeanInfo class.)
426      */
427     public void setBundleExpr(String bundleExpr) {
428         this.bundleExpr = bundleExpr;
429     }
430 
431     /***
432      * Setter method for "disabled" tag attribute. (Mapping set in associated
433      * BeanInfo class.)
434      */
435     public void setDisabledExpr(String disabledExpr) {
436         this.disabledExpr = disabledExpr;
437     }
438 
439     /***
440      * Setter method for "onblur" tag attribute. (Mapping set in associated
441      * BeanInfo class.)
442      */
443     public void setOnblurExpr(String onblurExpr) {
444         this.onblurExpr = onblurExpr;
445     }
446 
447     /***
448      * Setter method for "onchange" tag attribute. (Mapping set in associated
449      * BeanInfo class.)
450      */
451     public void setOnchangeExpr(String onchangeExpr) {
452         this.onchangeExpr = onchangeExpr;
453     }
454 
455     /***
456      * Setter method for "onclick" tag attribute. (Mapping set in associated
457      * BeanInfo class.)
458      */
459     public void setOnclickExpr(String onclickExpr) {
460         this.onclickExpr = onclickExpr;
461     }
462 
463     /***
464      * Setter method for "ondblclick" tag attribute. (Mapping set in
465      * associated BeanInfo class.)
466      */
467     public void setOndblclickExpr(String ondblclickExpr) {
468         this.ondblclickExpr = ondblclickExpr;
469     }
470 
471     /***
472      * Setter method for "onfocus" tag attribute. (Mapping set in associated
473      * BeanInfo class.)
474      */
475     public void setOnfocusExpr(String onfocusExpr) {
476         this.onfocusExpr = onfocusExpr;
477     }
478 
479     /***
480      * Setter method for "onkeydown" tag attribute. (Mapping set in associated
481      * BeanInfo class.)
482      */
483     public void setOnkeydownExpr(String onkeydownExpr) {
484         this.onkeydownExpr = onkeydownExpr;
485     }
486 
487     /***
488      * Setter method for "onkeypress" tag attribute. (Mapping set in
489      * associated BeanInfo class.)
490      */
491     public void setOnkeypressExpr(String onkeypressExpr) {
492         this.onkeypressExpr = onkeypressExpr;
493     }
494 
495     /***
496      * Setter method for "onkeyup" tag attribute. (Mapping set in associated
497      * BeanInfo class.)
498      */
499     public void setOnkeyupExpr(String onkeyupExpr) {
500         this.onkeyupExpr = onkeyupExpr;
501     }
502 
503     /***
504      * Setter method for "onmousedown" tag attribute. (Mapping set in
505      * associated BeanInfo class.)
506      */
507     public void setOnmousedownExpr(String onmousedownExpr) {
508         this.onmousedownExpr = onmousedownExpr;
509     }
510 
511     /***
512      * Setter method for "onmousemove" tag attribute. (Mapping set in
513      * associated BeanInfo class.)
514      */
515     public void setOnmousemoveExpr(String onmousemoveExpr) {
516         this.onmousemoveExpr = onmousemoveExpr;
517     }
518 
519     /***
520      * Setter method for "onmouseout" tag attribute. (Mapping set in
521      * associated BeanInfo class.)
522      */
523     public void setOnmouseoutExpr(String onmouseoutExpr) {
524         this.onmouseoutExpr = onmouseoutExpr;
525     }
526 
527     /***
528      * Setter method for "onmouseover" tag attribute. (Mapping set in
529      * associated BeanInfo class.)
530      */
531     public void setOnmouseoverExpr(String onmouseoverExpr) {
532         this.onmouseoverExpr = onmouseoverExpr;
533     }
534 
535     /***
536      * Setter method for "onmouseup" tag attribute. (Mapping set in associated
537      * BeanInfo class.)
538      */
539     public void setOnmouseupExpr(String onmouseupExpr) {
540         this.onmouseupExpr = onmouseupExpr;
541     }
542 
543     /***
544      * Setter method for "property" tag attribute. (Mapping set in associated
545      * BeanInfo class.)
546      */
547     public void setPropertyExpr(String propertyExpr) {
548         this.propertyExpr = propertyExpr;
549     }
550 
551     /***
552      * Setter method for "style" tag attribute. (Mapping set in associated
553      * BeanInfo class.)
554      */
555     public void setStyleExpr(String styleExpr) {
556         this.styleExpr = styleExpr;
557     }
558 
559     /***
560      * Setter method for "styleClass" tag attribute. (Mapping set in
561      * associated BeanInfo class.)
562      */
563     public void setStyleClassExpr(String styleClassExpr) {
564         this.styleClassExpr = styleClassExpr;
565     }
566 
567     /***
568      * Setter method for "styleId" tag attribute. (Mapping set in associated
569      * BeanInfo class.)
570      */
571     public void setStyleIdExpr(String styleIdExpr) {
572         this.styleIdExpr = styleIdExpr;
573     }
574 
575     /***
576      * Setter method for "tabindex" tag attribute. (Mapping set in associated
577      * BeanInfo class.)
578      */
579     public void setTabindexExpr(String tabindexExpr) {
580         this.tabindexExpr = tabindexExpr;
581     }
582 
583     /***
584      * Setter method for "title" tag attribute. (Mapping set in associated
585      * BeanInfo class.)
586      */
587     public void setTitleExpr(String titleExpr) {
588         this.titleExpr = titleExpr;
589     }
590 
591     /***
592      * Setter method for "titleKey" tag attribute. (Mapping set in associated
593      * BeanInfo class.)
594      */
595     public void setTitleKeyExpr(String titleKeyExpr) {
596         this.titleKeyExpr = titleKeyExpr;
597     }
598 
599     /***
600      * Setter method for "value" tag attribute. (Mapping set in associated
601      * BeanInfo class.)
602      */
603     public void setValueExpr(String valueExpr) {
604         this.valueExpr = valueExpr;
605     }
606 
607     /***
608      * Resets attribute values for tag reuse.
609      */
610     public void release() {
611         super.release();
612         setAccesskeyExpr(null);
613         setAltExpr(null);
614         setAltKeyExpr(null);
615         setBundleExpr(null);
616         setDisabledExpr(null);
617         setOnblurExpr(null);
618         setOnchangeExpr(null);
619         setOnclickExpr(null);
620         setOndblclickExpr(null);
621         setOnfocusExpr(null);
622         setOnkeydownExpr(null);
623         setOnkeypressExpr(null);
624         setOnkeyupExpr(null);
625         setOnmousedownExpr(null);
626         setOnmousemoveExpr(null);
627         setOnmouseoutExpr(null);
628         setOnmouseoverExpr(null);
629         setOnmouseupExpr(null);
630         setPropertyExpr(null);
631         setStyleExpr(null);
632         setStyleClassExpr(null);
633         setStyleIdExpr(null);
634         setTabindexExpr(null);
635         setTitleExpr(null);
636         setTitleKeyExpr(null);
637         setValueExpr(null);
638     }
639 
640     /***
641      * Process the start tag.
642      *
643      * @throws JspException if a JSP exception has occurred
644      */
645     public int doStartTag() throws JspException {
646         evaluateExpressions();
647 
648         return (super.doStartTag());
649     }
650 
651     /***
652      * Processes all attribute values which use the JSTL expression evaluation
653      * engine to determine their values.
654      *
655      * @throws JspException if a JSP exception has occurred
656      */
657     private void evaluateExpressions()
658         throws JspException {
659         String string = null;
660         Boolean bool = null;
661 
662         if ((string =
663                 EvalHelper.evalString("accesskey", getAccesskeyExpr(), this,
664                     pageContext)) != null) {
665             setAccesskey(string);
666         }
667 
668         if ((string =
669                 EvalHelper.evalString("alt", getAltExpr(), this, pageContext)) != null) {
670             setAlt(string);
671         }
672 
673         if ((string =
674                 EvalHelper.evalString("altKey", getAltKeyExpr(), this,
675                     pageContext)) != null) {
676             setAltKey(string);
677         }
678 
679         if ((string =
680                 EvalHelper.evalString("bundle", getBundleExpr(), this,
681                     pageContext)) != null) {
682             setBundle(string);
683         }
684 
685         if ((bool =
686                 EvalHelper.evalBoolean("disabled", getDisabledExpr(), this,
687                     pageContext)) != null) {
688             setDisabled(bool.booleanValue());
689         }
690 
691         if ((string =
692                 EvalHelper.evalString("onblur", getOnblurExpr(), this,
693                     pageContext)) != null) {
694             setOnblur(string);
695         }
696 
697         if ((string =
698                 EvalHelper.evalString("onchange", getOnchangeExpr(), this,
699                     pageContext)) != null) {
700             setOnchange(string);
701         }
702 
703         if ((string =
704                 EvalHelper.evalString("onclick", getOnclickExpr(), this,
705                     pageContext)) != null) {
706             setOnclick(string);
707         }
708 
709         if ((string =
710                 EvalHelper.evalString("ondblclick", getOndblclickExpr(), this,
711                     pageContext)) != null) {
712             setOndblclick(string);
713         }
714 
715         if ((string =
716                 EvalHelper.evalString("onfocus", getOnfocusExpr(), this,
717                     pageContext)) != null) {
718             setOnfocus(string);
719         }
720 
721         if ((string =
722                 EvalHelper.evalString("onkeydown", getOnkeydownExpr(), this,
723                     pageContext)) != null) {
724             setOnkeydown(string);
725         }
726 
727         if ((string =
728                 EvalHelper.evalString("onkeypress", getOnkeypressExpr(), this,
729                     pageContext)) != null) {
730             setOnkeypress(string);
731         }
732 
733         if ((string =
734                 EvalHelper.evalString("onkeyup", getOnkeyupExpr(), this,
735                     pageContext)) != null) {
736             setOnkeyup(string);
737         }
738 
739         if ((string =
740                 EvalHelper.evalString("onmousedown", getOnmousedownExpr(),
741                     this, pageContext)) != null) {
742             setOnmousedown(string);
743         }
744 
745         if ((string =
746                 EvalHelper.evalString("onmousemove", getOnmousemoveExpr(),
747                     this, pageContext)) != null) {
748             setOnmousemove(string);
749         }
750 
751         if ((string =
752                 EvalHelper.evalString("onmouseout", getOnmouseoutExpr(), this,
753                     pageContext)) != null) {
754             setOnmouseout(string);
755         }
756 
757         if ((string =
758                 EvalHelper.evalString("onmouseover", getOnmouseoverExpr(),
759                     this, pageContext)) != null) {
760             setOnmouseover(string);
761         }
762 
763         if ((string =
764                 EvalHelper.evalString("onmouseup", getOnmouseupExpr(), this,
765                     pageContext)) != null) {
766             setOnmouseup(string);
767         }
768 
769         if ((string =
770                 EvalHelper.evalString("property", getPropertyExpr(), this,
771                     pageContext)) != null) {
772             setProperty(string);
773         }
774 
775         if ((string =
776                 EvalHelper.evalString("style", getStyleExpr(), this, pageContext)) != null) {
777             setStyle(string);
778         }
779 
780         if ((string =
781                 EvalHelper.evalString("styleClass", getStyleClassExpr(), this,
782                     pageContext)) != null) {
783             setStyleClass(string);
784         }
785 
786         if ((string =
787                 EvalHelper.evalString("styleId", getStyleIdExpr(), this,
788                     pageContext)) != null) {
789             setStyleId(string);
790         }
791 
792         if ((string =
793                 EvalHelper.evalString("tabindex", getTabindexExpr(), this,
794                     pageContext)) != null) {
795             setTabindex(string);
796         }
797 
798         if ((string =
799                 EvalHelper.evalString("title", getTitleExpr(), this, pageContext)) != null) {
800             setTitle(string);
801         }
802 
803         if ((string =
804                 EvalHelper.evalString("titleKey", getTitleKeyExpr(), this,
805                     pageContext)) != null) {
806             setTitleKey(string);
807         }
808 
809         if ((string =
810                 EvalHelper.evalString("value", getValueExpr(), this, pageContext)) != null) {
811             setValue(string);
812         }
813     }
814 }