KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > webapp > taglib > PanelTag


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * Initial developer(s): Michel-Ange ANTON
22  * --------------------------------------------------------------------------
23  * $Id: PanelTag.java,v 1.3 2003/06/20 17:15:42 antonma Exp $
24  * --------------------------------------------------------------------------
25  */

26
27 package org.objectweb.jonas.webapp.taglib;
28
29 import javax.servlet.jsp.JspException JavaDoc;
30 import javax.servlet.jsp.tagext.BodyTagSupport JavaDoc;
31 import javax.servlet.jsp.tagext.Tag JavaDoc;
32
33 public class PanelTag extends BodyTagSupport JavaDoc {
34
35 // ----------------------------------------------------- Instance Variables
36

37     /**
38      * The databody that will be rendered for this table row.
39      */

40     private String JavaDoc body = null;
41
42 // --------------------------------------------------------- Public Methods
43

44     /**
45      * Process the start of this tag.
46      *
47      * @exception JspException if a JSP exception has occurred
48      */

49     public int doStartTag()
50         throws JspException JavaDoc {
51         // Initialize the holder for our databody text
52
this.body = null;
53         // Do no further processing for now
54
return (EVAL_BODY_BUFFERED);
55     }
56
57     /**
58      * Process the body text of this tag (if any).
59      *
60      * @exception JspException if a JSP exception has occurred
61      */

62     public int doAfterBody()
63         throws JspException JavaDoc {
64         String JavaDoc data = bodyContent.getString();
65         if (data != null) {
66             data = data.trim();
67             if (data.length() > 0) {
68                 this.body = data;
69             }
70         }
71         return (SKIP_BODY);
72     }
73
74     /**
75      * .
76      *
77      * @exception JspException if a processing error occurs
78      */

79     public int doEndTag()
80         throws JspException JavaDoc {
81         // Find our parent TabsTag instance
82
Tag JavaDoc parent = findAncestorWithClass(this, TabsTag.class);
83         if ((parent == null) || !(parent instanceof TabsTag)) {
84             throw new JspException JavaDoc("Must be nested in a TabsTag instance");
85         }
86         TabsTag oTabsTag = (TabsTag) parent;
87
88         // Register the information for the action represented by
89
// this action
90
//HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
91
oTabsTag.setBody(body);
92
93         return (EVAL_PAGE);
94     }
95
96     /**
97      * Release all state information set by this tag.
98      */

99     public void release() {
100         this.body = null;
101     }
102
103 }
104
Popular Tags