KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > bridge > jsp > taglib > tree > OnShrinkTag


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.tree;
11 import java.util.Stack JavaDoc;
12
13 import javax.servlet.jsp.*;
14
15 import org.mmbase.util.logging.*;
16 /**
17  * @author Michiel Meeuwissen
18  * @since MMBase-1.7
19  * @version $Id: OnShrinkTag.java,v 1.2 2004/02/11 20:40:13 keesj Exp $
20  */

21 public class OnShrinkTag extends TreeReferrerTag implements DepthProvider {
22     private static final Logger log = Logging.getLoggerInstance(OnShrinkTag.class);
23     private int depth;
24
25     public int getDepth() {
26         return depth;
27     }
28
29     public int doStartTag() throws JspTagException {
30         DepthProvider dp = (DepthProvider) findParentTag(DepthProvider.class, (String JavaDoc) parentTreeId.getValue(this));
31         depth = dp.getDepth();
32         return EVAL_BODY_BUFFERED;
33     }
34
35
36     public int doAfterBody() throws JspException {
37         TreeProvider tp = findTreeProvider();
38         Stack JavaDoc stack = tp.getShrinkStack();
39         String JavaDoc body = bodyContent != null ? bodyContent.getString() : "";
40         stack.push(new ShrinkTag.Entry(depth, body));
41         if (log.isDebugEnabled()) {
42             log.debug("onshrink " + depth + " " + body);
43         }
44         return super.doAfterBody();
45     }
46
47
48 }
49
50
Popular Tags