001: /*
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * Initial developer(s): Michel-Ange ANTON
022: * --------------------------------------------------------------------------
023: * $Id: PanelTag.java 2637 2003-06-20 17:15:42Z antonma $
024: * --------------------------------------------------------------------------
025: */
026:
027: package org.objectweb.jonas.webapp.taglib;
028:
029: import javax.servlet.jsp.JspException;
030: import javax.servlet.jsp.tagext.BodyTagSupport;
031: import javax.servlet.jsp.tagext.Tag;
032:
033: public class PanelTag extends BodyTagSupport {
034:
035: // ----------------------------------------------------- Instance Variables
036:
037: /**
038: * The databody that will be rendered for this table row.
039: */
040: private String body = null;
041:
042: // --------------------------------------------------------- Public Methods
043:
044: /**
045: * Process the start of this tag.
046: *
047: * @exception JspException if a JSP exception has occurred
048: */
049: public int doStartTag() throws JspException {
050: // Initialize the holder for our databody text
051: this .body = null;
052: // Do no further processing for now
053: return (EVAL_BODY_BUFFERED);
054: }
055:
056: /**
057: * Process the body text of this tag (if any).
058: *
059: * @exception JspException if a JSP exception has occurred
060: */
061: public int doAfterBody() throws JspException {
062: String data = bodyContent.getString();
063: if (data != null) {
064: data = data.trim();
065: if (data.length() > 0) {
066: this .body = data;
067: }
068: }
069: return (SKIP_BODY);
070: }
071:
072: /**
073: * .
074: *
075: * @exception JspException if a processing error occurs
076: */
077: public int doEndTag() throws JspException {
078: // Find our parent TabsTag instance
079: Tag parent = findAncestorWithClass(this , TabsTag.class);
080: if ((parent == null) || !(parent instanceof TabsTag)) {
081: throw new JspException(
082: "Must be nested in a TabsTag instance");
083: }
084: TabsTag oTabsTag = (TabsTag) parent;
085:
086: // Register the information for the action represented by
087: // this action
088: //HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
089: oTabsTag.setBody(body);
090:
091: return (EVAL_PAGE);
092: }
093:
094: /**
095: * Release all state information set by this tag.
096: */
097: public void release() {
098: this.body = null;
099: }
100:
101: }
|