KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > dlog4j > tags > BaseTEI


1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU Library General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15  */

16 package dlog4j.tags;
17
18 import java.util.Enumeration JavaDoc;
19 import java.util.Properties JavaDoc;
20
21 import javax.servlet.jsp.tagext.TagData JavaDoc;
22 import javax.servlet.jsp.tagext.TagExtraInfo JavaDoc;
23 import javax.servlet.jsp.tagext.VariableInfo JavaDoc;
24
25 /**
26  * TEI类的基类
27  * @author Winter Lau
28  */

29 public abstract class BaseTEI extends TagExtraInfo JavaDoc {
30
31     public VariableInfo JavaDoc[] getVariableInfo(TagData JavaDoc data) {
32         Properties JavaDoc p_vars = getExportVars(data);
33         VariableInfo JavaDoc[] vars = new VariableInfo JavaDoc[p_vars.size()];
34         Enumeration JavaDoc keys = p_vars.keys();
35         int v_idx = 0;
36         while(keys.hasMoreElements()){
37             String JavaDoc name = (String JavaDoc)keys.nextElement();
38             String JavaDoc className = p_vars.getProperty(name);
39             vars[v_idx++] = new VariableInfo JavaDoc(name,
40                                              className,
41                                              true,
42                                              VariableInfo.AT_END);
43         }
44         
45         return vars;
46     }
47     
48     /**
49      * 返回变量名对应类名的集合
50      * @param data
51      * @return
52      */

53     protected abstract Properties JavaDoc getExportVars(TagData JavaDoc data);
54 }
55
Popular Tags