KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > strutsel > taglib > html > ELFrameTag


1 /*
2  * $Id: ELFrameTag.java 123585 2004-12-29 00:43:33Z martinc $
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
19 package org.apache.strutsel.taglib.html;
20
21 import org.apache.struts.taglib.html.FrameTag;
22 import javax.servlet.jsp.JspException JavaDoc;
23 import org.apache.strutsel.taglib.utils.EvalHelper;
24
25 /**
26  * Generate an HTML <code>&lt;frame&gt;</code> tag with similar capabilities as
27  * those the <code>&lt;html:link&gt;</code> tag provides for hyperlink
28  * elements. The <code>src</code> element is rendered using the same technique
29  * that {@link org.apache.struts.taglib.html.LinkTag LinkTag} uses to render
30  * the <code>href</code> attribute of a hyperlink. Additionally, the HTML 4.0
31  * frame tag attributes <code>noresize</code>, <code>scrolling</code>,
32  * <code>marginheight</code>, <code>marginwidth</code>,
33  * <code>frameborder</code>, and <code>longdesc</code> are supported. The
34  * frame <code>name</code> attribute is rendered based on the
35  * <code>frameName</code> property.
36  *<p>
37  * Note that the value of <code>longdesc</code> is intended to be a URI, but
38  * currently no rewriting is supported. The attribute is set directly from
39  * the property value.
40  *<p>
41  * This class is a subclass of the class
42  * <code>org.apache.struts.taglib.html.FrameTag</code> which provides most of
43  * the described functionality. This subclass allows all attribute values to
44  * be specified as expressions utilizing the JavaServer Pages Standard Library
45  * expression language.
46  *
47  * @version $Rev: 123585 $
48  */

49 public class ELFrameTag extends FrameTag {
50
51     /**
52      * Instance variable mapped to "action" tag attribute.
53      * (Mapping set in associated BeanInfo class.)
54      */

55     private String JavaDoc actionExpr;
56     /**
57      * Instance variable mapped to "module" tag attribute.
58      * (Mapping set in associated BeanInfo class.)
59      */

60     private String JavaDoc moduleExpr;
61     /**
62      * Instance variable mapped to "anchor" tag attribute.
63      * (Mapping set in associated BeanInfo class.)
64      */

65     private String JavaDoc anchorExpr;
66     /**
67      * Instance variable mapped to "bundle" tag attribute.
68      * (Mapping set in associated BeanInfo class.)
69      */

70     private String JavaDoc bundleExpr;
71     /**
72      * Instance variable mapped to "forward" tag attribute.
73      * (Mapping set in associated BeanInfo class.)
74      */

75     private String JavaDoc forwardExpr;
76     /**
77      * Instance variable mapped to "frameborder" tag attribute.
78      * (Mapping set in associated BeanInfo class.)
79      */

80     private String JavaDoc frameborderExpr;
81     /**
82      * Instance variable mapped to "frameName" tag attribute.
83      * (Mapping set in associated BeanInfo class.)
84      */

85     private String JavaDoc frameNameExpr;
86     /**
87      * Instance variable mapped to "href" tag attribute.
88      * (Mapping set in associated BeanInfo class.)
89      */

90     private String JavaDoc hrefExpr;
91     /**
92      * Instance variable mapped to "longdesc" tag attribute.
93      * (Mapping set in associated BeanInfo class.)
94      */

95     private String JavaDoc longdescExpr;
96     /**
97      * Instance variable mapped to "marginheight" tag attribute.
98      * (Mapping set in associated BeanInfo class.)
99      */

100     private String JavaDoc marginheightExpr;
101     /**
102      * Instance variable mapped to "marginwidth" tag attribute.
103      * (Mapping set in associated BeanInfo class.)
104      */

105     private String JavaDoc marginwidthExpr;
106     /**
107      * Instance variable mapped to "name" tag attribute.
108      * (Mapping set in associated BeanInfo class.)
109      */

110     private String JavaDoc nameExpr;
111     /**
112      * Instance variable mapped to "noresize" tag attribute.
113      * (Mapping set in associated BeanInfo class.)
114      */

115     private String JavaDoc noresizeExpr;
116     /**
117      * Instance variable mapped to "page" tag attribute.
118      * (Mapping set in associated BeanInfo class.)
119      */

120     private String JavaDoc pageExpr;
121     /**
122      * Instance variable mapped to "paramId" tag attribute.
123      * (Mapping set in associated BeanInfo class.)
124      */

125     private String JavaDoc paramIdExpr;
126     /**
127      * Instance variable mapped to "paramName" tag attribute.
128      * (Mapping set in associated BeanInfo class.)
129      */

130     private String JavaDoc paramNameExpr;
131     /**
132      * Instance variable mapped to "paramProperty" tag attribute.
133      * (Mapping set in associated BeanInfo class.)
134      */

135     private String JavaDoc paramPropertyExpr;
136     /**
137      * Instance variable mapped to "paramScope" tag attribute.
138      * (Mapping set in associated BeanInfo class.)
139      */

140     private String JavaDoc paramScopeExpr;
141     /**
142      * Instance variable mapped to "property" tag attribute.
143      * (Mapping set in associated BeanInfo class.)
144      */

145     private String JavaDoc propertyExpr;
146     /**
147      * Instance variable mapped to "scope" tag attribute.
148      * (Mapping set in associated BeanInfo class.)
149      */

150     private String JavaDoc scopeExpr;
151     /**
152      * Instance variable mapped to "scrolling" tag attribute.
153      * (Mapping set in associated BeanInfo class.)
154      */

155     private String JavaDoc scrollingExpr;
156     /**
157      * Instance variable mapped to "style" tag attribute.
158      * (Mapping set in associated BeanInfo class.)
159      */

160     private String JavaDoc styleExpr;
161     /**
162      * Instance variable mapped to "styleClass" tag attribute.
163      * (Mapping set in associated BeanInfo class.)
164      */

165     private String JavaDoc styleClassExpr;
166     /**
167      * Instance variable mapped to "styleId" tag attribute.
168      * (Mapping set in associated BeanInfo class.)
169      */

170     private String JavaDoc styleIdExpr;
171     /**
172      * Instance variable mapped to "title" tag attribute.
173      * (Mapping set in associated BeanInfo class.)
174      */

175     private String JavaDoc titleExpr;
176     /**
177      * Instance variable mapped to "titleKey" tag attribute.
178      * (Mapping set in associated BeanInfo class.)
179      */

180     private String JavaDoc titleKeyExpr;
181     /**
182      * Instance variable mapped to "transaction" tag attribute.
183      * (Mapping set in associated BeanInfo class.)
184      */

185     private String JavaDoc transactionExpr;
186
187     /**
188      * Getter method for "action" tag attribute.
189      * (Mapping set in associated BeanInfo class.)
190      */

191     public String JavaDoc getActionExpr() { return (actionExpr); }
192     /**
193      * Getter method for "module" tag attribute.
194      * (Mapping set in associated BeanInfo class.)
195      */

196     public String JavaDoc getModuleExpr() { return (moduleExpr); }
197     /**
198      * Getter method for "anchor" tag attribute.
199      * (Mapping set in associated BeanInfo class.)
200      */

201     public String JavaDoc getAnchorExpr() { return (anchorExpr); }
202     /**
203      * Getter method for "bundle" tag attribute.
204      * (Mapping set in associated BeanInfo class.)
205      */

206     public String JavaDoc getBundleExpr() { return (bundleExpr); }
207     /**
208      * Getter method for "forward" tag attribute.
209      * (Mapping set in associated BeanInfo class.)
210      */

211     public String JavaDoc getForwardExpr() { return (forwardExpr); }
212     /**
213      * Getter method for "frameborder" tag attribute.
214      * (Mapping set in associated BeanInfo class.)
215      */

216     public String JavaDoc getFrameborderExpr() { return (frameborderExpr); }
217     /**
218      * Getter method for "frameName" tag attribute.
219      * (Mapping set in associated BeanInfo class.)
220      */

221     public String JavaDoc getFrameNameExpr() { return (frameNameExpr); }
222     /**
223      * Getter method for "href" tag attribute.
224      * (Mapping set in associated BeanInfo class.)
225      */

226     public String JavaDoc getHrefExpr() { return (hrefExpr); }
227     /**
228      * Getter method for "longdesc" tag attribute.
229      * (Mapping set in associated BeanInfo class.)
230      */

231     public String JavaDoc getLongdescExpr() { return (longdescExpr); }
232     /**
233      * Getter method for "marginheight" tag attribute.
234      * (Mapping set in associated BeanInfo class.)
235      */

236     public String JavaDoc getMarginheightExpr() { return (marginheightExpr); }
237     /**
238      * Getter method for "marginwidth" tag attribute.
239      * (Mapping set in associated BeanInfo class.)
240      */

241     public String JavaDoc getMarginwidthExpr() { return (marginwidthExpr); }
242     /**
243      * Getter method for "name" tag attribute.
244      * (Mapping set in associated BeanInfo class.)
245      */

246     public String JavaDoc getNameExpr() { return (nameExpr); }
247     /**
248      * Getter method for "noresize" tag attribute.
249      * (Mapping set in associated BeanInfo class.)
250      */

251     public String JavaDoc getNoresizeExpr() { return (noresizeExpr); }
252     /**
253      * Getter method for "page" tag attribute.
254      * (Mapping set in associated BeanInfo class.)
255      */

256     public String JavaDoc getPageExpr() { return (pageExpr); }
257     /**
258      * Getter method for "paramId" tag attribute.
259      * (Mapping set in associated BeanInfo class.)
260      */

261     public String JavaDoc getParamIdExpr() { return (paramIdExpr); }
262     /**
263      * Getter method for "paramName" tag attribute.
264      * (Mapping set in associated BeanInfo class.)
265      */

266     public String JavaDoc getParamNameExpr() { return (paramNameExpr); }
267     /**
268      * Getter method for "paramProperty" tag attribute.
269      * (Mapping set in associated BeanInfo class.)
270      */

271     public String JavaDoc getParamPropertyExpr() { return (paramPropertyExpr); }
272     /**
273      * Getter method for "paramScope" tag attribute.
274      * (Mapping set in associated BeanInfo class.)
275      */

276     public String JavaDoc getParamScopeExpr() { return (paramScopeExpr); }
277     /**
278      * Getter method for "property" tag attribute.
279      * (Mapping set in associated BeanInfo class.)
280      */

281     public String JavaDoc getPropertyExpr() { return (propertyExpr); }
282     /**
283      * Getter method for "scope" tag attribute.
284      * (Mapping set in associated BeanInfo class.)
285      */

286     public String JavaDoc getScopeExpr() { return (scopeExpr); }
287     /**
288      * Getter method for "scrolling" tag attribute.
289      * (Mapping set in associated BeanInfo class.)
290      */

291     public String JavaDoc getScrollingExpr() { return (scrollingExpr); }
292     /**
293      * Getter method for "style" tag attribute.
294      * (Mapping set in associated BeanInfo class.)
295      */

296     public String JavaDoc getStyleExpr() { return (styleExpr); }
297     /**
298      * Getter method for "styleClass" tag attribute.
299      * (Mapping set in associated BeanInfo class.)
300      */

301     public String JavaDoc getStyleClassExpr() { return (styleClassExpr); }
302     /**
303      * Getter method for "styleId" tag attribute.
304      * (Mapping set in associated BeanInfo class.)
305      */

306     public String JavaDoc getStyleIdExpr() { return (styleIdExpr); }
307     /**
308      * Getter method for "title" tag attribute.
309      * (Mapping set in associated BeanInfo class.)
310      */

311     public String JavaDoc getTitleExpr() { return (titleExpr); }
312     /**
313      * Getter method for "titleKey" tag attribute.
314      * (Mapping set in associated BeanInfo class.)
315      */

316     public String JavaDoc getTitleKeyExpr() { return (titleKeyExpr); }
317     /**
318      * Getter method for "transaction" tag attribute.
319      * (Mapping set in associated BeanInfo class.)
320      */

321     public String JavaDoc getTransactionExpr() { return (transactionExpr); }
322
323     /**
324      * Setter method for "action" tag attribute.
325      * (Mapping set in associated BeanInfo class.)
326      */

327     public void setActionExpr(String JavaDoc actionExpr) { this.actionExpr = actionExpr; }
328     /**
329      * Setter method for "module" tag attribute.
330      * (Mapping set in associated BeanInfo class.)
331      */

332     public void setModuleExpr(String JavaDoc moduleExpr) { this.moduleExpr = moduleExpr; }
333     /**
334      * Setter method for "anchor" tag attribute.
335      * (Mapping set in associated BeanInfo class.)
336      */

337     public void setAnchorExpr(String JavaDoc anchorExpr) { this.anchorExpr = anchorExpr; }
338     /**
339      * Setter method for "bundle" tag attribute.
340      * (Mapping set in associated BeanInfo class.)
341      */

342     public void setBundleExpr(String JavaDoc bundleExpr) { this.bundleExpr = bundleExpr; }
343     /**
344      * Setter method for "forward" tag attribute.
345      * (Mapping set in associated BeanInfo class.)
346      */

347     public void setForwardExpr(String JavaDoc forwardExpr) { this.forwardExpr = forwardExpr; }
348     /**
349      * Setter method for "frameborder" tag attribute.
350      * (Mapping set in associated BeanInfo class.)
351      */

352     public void setFrameborderExpr(String JavaDoc frameborderExpr) { this.frameborderExpr = frameborderExpr; }
353     /**
354      * Setter method for "frameName" tag attribute.
355      * (Mapping set in associated BeanInfo class.)
356      */

357     public void setFrameNameExpr(String JavaDoc frameNameExpr) { this.frameNameExpr = frameNameExpr; }
358     /**
359      * Setter method for "href" tag attribute.
360      * (Mapping set in associated BeanInfo class.)
361      */

362     public void setHrefExpr(String JavaDoc hrefExpr) { this.hrefExpr = hrefExpr; }
363     /**
364      * Setter method for "longdesc" tag attribute.
365      * (Mapping set in associated BeanInfo class.)
366      */

367     public void setLongdescExpr(String JavaDoc longdescExpr) { this.longdescExpr = longdescExpr; }
368     /**
369      * Setter method for "marginheight" tag attribute.
370      * (Mapping set in associated BeanInfo class.)
371      */

372     public void setMarginheightExpr(String JavaDoc marginheightExpr) { this.marginheightExpr = marginheightExpr; }
373     /**
374      * Setter method for "marginwidth" tag attribute.
375      * (Mapping set in associated BeanInfo class.)
376      */

377     public void setMarginwidthExpr(String JavaDoc marginwidthExpr) { this.marginwidthExpr = marginwidthExpr; }
378     /**
379      * Setter method for "name" tag attribute.
380      * (Mapping set in associated BeanInfo class.)
381      */

382     public void setNameExpr(String JavaDoc nameExpr) { this.nameExpr = nameExpr; }
383     /**
384      * Setter method for "noresize" tag attribute.
385      * (Mapping set in associated BeanInfo class.)
386      */

387     public void setNoresizeExpr(String JavaDoc noresizeExpr) { this.noresizeExpr = noresizeExpr; }
388     /**
389      * Setter method for "page" tag attribute.
390      * (Mapping set in associated BeanInfo class.)
391      */

392     public void setPageExpr(String JavaDoc pageExpr) { this.pageExpr = pageExpr; }
393     /**
394      * Setter method for "paramId" tag attribute.
395      * (Mapping set in associated BeanInfo class.)
396      */

397     public void setParamIdExpr(String JavaDoc paramIdExpr) { this.paramIdExpr = paramIdExpr; }
398     /**
399      * Setter method for "paramName" tag attribute.
400      * (Mapping set in associated BeanInfo class.)
401      */

402     public void setParamNameExpr(String JavaDoc paramNameExpr) { this.paramNameExpr = paramNameExpr; }
403     /**
404      * Setter method for "paramProperty" tag attribute.
405      * (Mapping set in associated BeanInfo class.)
406      */

407     public void setParamPropertyExpr(String JavaDoc paramPropertyExpr) { this.paramPropertyExpr = paramPropertyExpr; }
408     /**
409      * Setter method for "paramScope" tag attribute.
410      * (Mapping set in associated BeanInfo class.)
411      */

412     public void setParamScopeExpr(String JavaDoc paramScopeExpr) { this.paramScopeExpr = paramScopeExpr; }
413     /**
414      * Setter method for "property" tag attribute.
415      * (Mapping set in associated BeanInfo class.)
416      */

417     public void setPropertyExpr(String JavaDoc propertyExpr) { this.propertyExpr = propertyExpr; }
418     /**
419      * Setter method for "scope" tag attribute.
420      * (Mapping set in associated BeanInfo class.)
421      */

422     public void setScopeExpr(String JavaDoc scopeExpr) { this.scopeExpr = scopeExpr; }
423     /**
424      * Setter method for "scrolling" tag attribute.
425      * (Mapping set in associated BeanInfo class.)
426      */

427     public void setScrollingExpr(String JavaDoc scrollingExpr) { this.scrollingExpr = scrollingExpr; }
428     /**
429      * Setter method for "style" tag attribute.
430      * (Mapping set in associated BeanInfo class.)
431      */

432     public void setStyleExpr(String JavaDoc styleExpr) { this.styleExpr = styleExpr; }
433     /**
434      * Setter method for "styleClass" tag attribute.
435      * (Mapping set in associated BeanInfo class.)
436      */

437     public void setStyleClassExpr(String JavaDoc styleClassExpr) { this.styleClassExpr = styleClassExpr; }
438     /**
439      * Setter method for "styleId" tag attribute.
440      * (Mapping set in associated BeanInfo class.)
441      */

442     public void setStyleIdExpr(String JavaDoc styleIdExpr) { this.styleIdExpr = styleIdExpr; }
443     /**
444      * Setter method for "title" tag attribute.
445      * (Mapping set in associated BeanInfo class.)
446      */

447     public void setTitleExpr(String JavaDoc titleExpr) { this.titleExpr = titleExpr; }
448     /**
449      * Setter method for "titleKey" tag attribute.
450      * (Mapping set in associated BeanInfo class.)
451      */

452     public void setTitleKeyExpr(String JavaDoc titleKeyExpr) { this.titleKeyExpr = titleKeyExpr; }
453     /**
454      * Setter method for "transaction" tag attribute.
455      * (Mapping set in associated BeanInfo class.)
456      */

457     public void setTransactionExpr(String JavaDoc transactionExpr) { this.transactionExpr = transactionExpr; }
458
459     /**
460      * Resets attribute values for tag reuse.
461      */

462     public void release()
463     {
464         super.release();
465         setActionExpr(null);
466         setModuleExpr(null);
467         setAnchorExpr(null);
468         setBundleExpr(null);
469         setForwardExpr(null);
470         setFrameborderExpr(null);
471         setFrameNameExpr(null);
472         setHrefExpr(null);
473         setLongdescExpr(null);
474         setMarginheightExpr(null);
475         setMarginwidthExpr(null);
476         setNameExpr(null);
477         setNoresizeExpr(null);
478         setPageExpr(null);
479         setParamIdExpr(null);
480         setParamNameExpr(null);
481         setParamPropertyExpr(null);
482         setParamScopeExpr(null);
483         setPropertyExpr(null);
484         setScopeExpr(null);
485         setScrollingExpr(null);
486         setStyleExpr(null);
487         setStyleClassExpr(null);
488         setStyleIdExpr(null);
489         setTitleExpr(null);
490         setTitleKeyExpr(null);
491         setTransactionExpr(null);
492     }
493
494     /**
495      * Process the start tag.
496      *
497      * @exception JspException if a JSP exception has occurred
498      */

499     public int doStartTag() throws JspException JavaDoc {
500         evaluateExpressions();
501         return (super.doStartTag());
502     }
503
504     /**
505      * Processes all attribute values which use the JSTL expression evaluation
506      * engine to determine their values.
507      *
508      * @exception JspException if a JSP exception has occurred
509      */

510     private void evaluateExpressions() throws JspException JavaDoc {
511         String JavaDoc string = null;
512         Integer JavaDoc integer = null;
513         Boolean JavaDoc bool = null;
514
515         if ((string = EvalHelper.evalString("action", getActionExpr(),
516                                             this, pageContext)) != null)
517             setAction(string);
518
519         if ((string = EvalHelper.evalString("module", getModuleExpr(),
520                                             this, pageContext)) != null)
521             setModule(string);
522
523         if ((string = EvalHelper.evalString("anchor", getAnchorExpr(),
524                                             this, pageContext)) != null)
525             setAnchor(string);
526
527         if ((string = EvalHelper.evalString("bundle", getBundleExpr(),
528                                             this, pageContext)) != null)
529             setBundle(string);
530
531         if ((string = EvalHelper.evalString("forward", getForwardExpr(),
532                                             this, pageContext)) != null)
533             setForward(string);
534
535         if ((string = EvalHelper.evalString("frameborder", getFrameborderExpr(),
536                                             this, pageContext)) != null)
537             setFrameborder(string);
538
539         if ((string = EvalHelper.evalString("frameName", getFrameNameExpr(),
540                                             this, pageContext)) != null)
541             setFrameName(string);
542
543         if ((string = EvalHelper.evalString("href", getHrefExpr(),
544                                             this, pageContext)) != null)
545             setHref(string);
546
547         if ((string = EvalHelper.evalString("longdesc", getLongdescExpr(),
548                                             this, pageContext)) != null)
549             setLongdesc(string);
550
551         if ((integer = EvalHelper.evalInteger("marginheight", getMarginheightExpr(),
552                                               this, pageContext)) != null)
553             setMarginheight(integer);
554
555         if ((integer = EvalHelper.evalInteger("marginwidth", getMarginwidthExpr(),
556                                               this, pageContext)) != null)
557             setMarginwidth(integer);
558
559         if ((string = EvalHelper.evalString("name", getNameExpr(),
560                                             this, pageContext)) != null)
561             setName(string);
562
563         if ((bool = EvalHelper.evalBoolean("noresize", getNoresizeExpr(),
564                                            this, pageContext)) != null)
565             setNoresize(bool.booleanValue());
566
567         if ((string = EvalHelper.evalString("page", getPageExpr(),
568                                             this, pageContext)) != null)
569             setPage(string);
570
571         if ((string = EvalHelper.evalString("paramId", getParamIdExpr(),
572                                             this, pageContext)) != null)
573             setParamId(string);
574
575         if ((string = EvalHelper.evalString("paramName", getParamNameExpr(),
576                                             this, pageContext)) != null)
577             setParamName(string);
578
579         if ((string = EvalHelper.evalString("paramProperty", getParamPropertyExpr(),
580                                             this, pageContext)) != null)
581             setParamProperty(string);
582
583         if ((string = EvalHelper.evalString("paramScope", getParamScopeExpr(),
584                                             this, pageContext)) != null)
585             setParamScope(string);
586
587         if ((string = EvalHelper.evalString("property", getPropertyExpr(),
588                                             this, pageContext)) != null)
589             setProperty(string);
590
591         if ((string = EvalHelper.evalString("scope", getScopeExpr(),
592                                             this, pageContext)) != null)
593             setScope(string);
594
595         if ((string = EvalHelper.evalString("scrolling", getScrollingExpr(),
596                                             this, pageContext)) != null)
597             setScrolling(string);
598
599         if ((string = EvalHelper.evalString("style", getStyleExpr(),
600                                             this, pageContext)) != null)
601             setStyle(string);
602
603         if ((string = EvalHelper.evalString("styleClass", getStyleClassExpr(),
604                                             this, pageContext)) != null)
605             setStyleClass(string);
606
607         if ((string = EvalHelper.evalString("styleId", getStyleIdExpr(),
608                                             this, pageContext)) != null)
609             setStyleId(string);
610
611         if ((string = EvalHelper.evalString("title", getTitleExpr(),
612                                             this, pageContext)) != null)
613             setTitle(string);
614
615         if ((string = EvalHelper.evalString("titleKey", getTitleKeyExpr(),
616                                             this, pageContext)) != null)
617             setTitleKey(string);
618
619         if ((bool = EvalHelper.evalBoolean("transaction", getTransactionExpr(),
620                                            this, pageContext)) != null)
621             setTransaction(bool.booleanValue());
622     }
623 }
624
Popular Tags