KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > fr > improve > struts > taglib > layout > field > AbstractUniqueSelectTag


1 package fr.improve.struts.taglib.layout.field;
2
3 import javax.servlet.jsp.JspException JavaDoc;
4
5 import fr.improve.struts.taglib.layout.util.LayoutUtils;
6 /**
7  * Base clas for unique value select tag.
8  * @author: Jean-Noël Ribette
9  */

10 public abstract class AbstractUniqueSelectTag extends AbstractSelectTag {
11     protected String JavaDoc match;
12     private String JavaDoc value;
13     
14 /**
15  * Insert the method's description here.
16  * Creation date: (01/12/2001 22:32:19)
17  * @return java.lang.String
18  */

19 public java.lang.String JavaDoc getMatch() {
20     return match;
21 }
22 /**
23  * Return the value to display.
24  * Note that this value will be test to check if the field should be displayed or not.
25  */

26 protected Object JavaDoc getFieldValue() throws JspException JavaDoc {
27     Object JavaDoc lc_value;
28     if (match!=null) {
29         lc_value = match;
30     } else if (value!=null) {
31         lc_value = value;
32         match = value;
33     } else {
34         lc_value = LayoutUtils.getBeanFromPageContext(pageContext, name, property);
35         if (lc_value==null) match = ""; else match = lc_value.toString();
36     }
37     if (lc_value!=null && lc_value.toString().length()==0) return null;
38     return lc_value;
39 }
40     protected void reset() {
41         super.reset();
42         match = null;
43     }
44     
45     public void release() {
46         super.release();
47         value = null;
48     }
49     
50     /**
51      * Insert the method's description here.
52      * Creation date: (01/12/2001 22:32:19)
53      * @param newMatch java.lang.String
54      */

55     public void setMatch(java.lang.String JavaDoc newMatch) {
56         match = newMatch;
57     }
58     
59     /**
60      * Returns the value.
61      * @return String
62      */

63     public final String JavaDoc getValue() {
64         return value;
65     }
66
67     /**
68      * Sets the value.
69      * @param value The value to set
70      */

71     public final void setValue(String JavaDoc value) {
72         this.value = value;
73     }
74
75 }
76
Popular Tags