KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > bridge > jsp > taglib > NodeProviderTEI


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.bridge.jsp.taglib;
11
12 import javax.servlet.jsp.tagext.VariableInfo JavaDoc;
13 import javax.servlet.jsp.tagext.TagData JavaDoc;
14 import javax.servlet.jsp.tagext.TagExtraInfo JavaDoc;
15
16 /**
17  * The TEI class for NodeProviders. A NodeProvider can export one or more
18  * 'Nodes', and it also can export fields (if the `fields' attribute is
19  * given).
20  *
21  * @author Michiel Meeuwissen
22  * @version $Id: NodeProviderTEI.java,v 1.13 2005/06/20 16:03:38 michiel Exp $
23  */

24
25 public class NodeProviderTEI extends TagExtraInfo JavaDoc {
26
27     public NodeProviderTEI() {
28         super();
29     }
30
31     /**
32      * implementation of TagExtraInfo return values declared here
33      * should be filled at one point, currently function fillVars is responsible for
34      * that and gets called before every iteration
35      **/

36     public VariableInfo JavaDoc[] getVariableInfo(TagData JavaDoc data){
37         //this method is called /before/ the values are set
38
//so we can not use the data members in this class
39
//but the TagData provides the necessary data
40
//in effect we have to parse the data twice
41
//once here and onces specific attributes are set
42
//maybe this can be done better I do not know
43

44         int nodeVariable = 0;
45         // Number of node-variables to be defined.
46
// is 0 or 1 now, but will become more for multi-level lists (not yet ready)
47

48         
49         String JavaDoc id = "";
50         Object JavaDoc idObject = data.getAttribute("jspvar");
51         if (idObject != null){
52                 id = "" + idObject;
53                 nodeVariable = 1;
54         }
55         VariableInfo JavaDoc[] variableInfo = new VariableInfo JavaDoc[nodeVariable];
56
57         if (nodeVariable == 1) {
58             variableInfo[0] = new VariableInfo JavaDoc(id,
59                 "org.mmbase.bridge.Node",
60                 true,
61                 VariableInfo.NESTED);
62         }
63         return variableInfo;
64     }
65         
66 }
67
Popular Tags