KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jresearch > gossip > tags > navbar > NavBarTag


1 /*
2  * $$Id$$
3  *
4  * ***** BEGIN LICENSE BLOCK *****
5  * The contents of this file are subject to the Mozilla Public License
6  * Version 1.1 (the "License"); you may not use this file except in
7  * compliance with the License. You may obtain a copy of the License
8  * at http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS"
11  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
12  * the License for the specific language governing rights and
13  * limitations under the License.
14  *
15  * The Original Code is JGossip forum code.
16  *
17  * The Initial Developer of the Original Code is the JResearch, Org.
18  * Portions created by the Initial Developer are Copyright (C) 2004
19  * the Initial Developer. All Rights Reserved.
20  *
21  * Contributor(s):
22  * Dmitry Belov <bel@jresearch.org>
23  *
24  * ***** END LICENSE BLOCK ***** */

25 /*
26  * Created on Oct 6, 2003
27  *
28  */

29 package org.jresearch.gossip.tags.navbar;
30
31 import java.util.ArrayList JavaDoc;
32
33 import javax.servlet.jsp.JspException JavaDoc;
34 import javax.servlet.jsp.tagext.TagSupport JavaDoc;
35
36 /**
37  * DOCUMENT ME!
38  *
39  * @author Bel
40  */

41 public class NavBarTag extends TagSupport JavaDoc {
42     private String JavaDoc id;
43
44     private ArrayList JavaDoc navElements;
45
46     /**
47      * DOCUMENT ME!
48      *
49      * @return DOCUMENT ME!
50      *
51      * @throws JspException
52      * DOCUMENT ME!
53      */

54     public int doStartTag() throws JspException JavaDoc {
55         try {
56             this.navElements = new ArrayList JavaDoc();
57         } catch (Exception JavaDoc ex) {
58             throw new JspException JavaDoc("error in BlockOptionsTag tag:", ex);
59         }
60
61         return (super.EVAL_BODY_INCLUDE);
62     }
63
64     /**
65      * DOCUMENT ME!
66      *
67      * @return DOCUMENT ME!
68      *
69      * @throws JspException
70      * DOCUMENT ME!
71      */

72     public int doEndTag() throws JspException JavaDoc {
73         try {
74             pageContext.setAttribute(id, this.navElements);
75         } catch (Exception JavaDoc ex) {
76             throw new JspException JavaDoc("error in BlockOptionsTag tag:", ex);
77         }
78
79         return (super.EVAL_PAGE);
80     }
81
82     /**
83      * DOCUMENT ME!
84      *
85      * @param nav
86      * DOCUMENT ME!
87      */

88     public void addNavElement(NavElement nav) {
89         this.navElements.add(nav);
90     }
91
92     /**
93      * DOCUMENT ME!
94      *
95      * @return
96      */

97     public String JavaDoc getId() {
98         return id;
99     }
100
101     /**
102      * DOCUMENT ME!
103      *
104      * @param string
105      */

106     public void setId(String JavaDoc string) {
107         id = string;
108     }
109 }
110
Popular Tags