KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > taglibs > standard > tag > rt > core > WhenTag


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.taglibs.standard.tag.rt.core;
18
19 import org.apache.taglibs.standard.tag.common.core.WhenTagSupport;
20
21 /**
22  * <p>Tag handler for &lt;when&gt; in JSTL's rtexprvalue library.</p>
23  *
24  * @author Shawn Bayern
25  */

26
27 public class WhenTag extends WhenTagSupport {
28
29     //*********************************************************************
30
// Constructor and lifecycle management
31

32     // initialize inherited and local state
33
public WhenTag() {
34         super();
35         init();
36     }
37
38     // Releases any resources we may have (or inherit)
39
public void release() {
40         super.release();
41         init();
42     }
43
44
45     //*********************************************************************
46
// Supplied conditional logic
47

48     protected boolean condition() {
49         return test;
50     }
51
52
53     //*********************************************************************
54
// Private state
55

56     private boolean test; // the value of the 'test' attribute
57

58
59     //*********************************************************************
60
// Accessors
61

62     // receives the tag's 'test' attribute
63
public void setTest(boolean test) {
64         this.test = test;
65     }
66
67
68     //*********************************************************************
69
// Private utility methods
70

71     // resets internal state
72
private void init() {
73         test = false;
74     }
75 }
76
Popular Tags