1 10 package org.mmbase.bridge.jsp.taglib.tree; 11 12 import java.io.*; 13 import javax.servlet.jsp.JspTagException ; 14 import javax.servlet.jsp.JspException ; 15 import org.mmbase.bridge.jsp.taglib.TaglibException; 16 17 import org.mmbase.util.logging.*; 18 19 24 public class GrowTag extends AbstractTreeReferrerListTag { 25 26 private static final Logger log = Logging.getLoggerInstance(GrowTag.class); 27 28 protected int startDepth; 29 protected int endDepth ; 30 31 32 33 public int size() { 34 return endDepth - startDepth; 35 } 36 37 public int doStartTag() throws JspException { 38 doStartTagHelper(); 39 40 startDepth = tree.getPreviousDepth(); 41 endDepth = tree.getDepth(); 42 depth = startDepth; 43 44 log.debug("while " + depth + " < " + endDepth); 45 if (depth < endDepth) { 46 return EVAL_BODY_BUFFERED; 47 } else { 48 return SKIP_BODY; 49 } 50 } 51 52 53 protected final int doAfterBodyHelper() throws JspTagException { 54 collector.doAfterBody(); 55 depth++; 56 if (depth < endDepth) { 57 index++; 58 return EVAL_BODY_AGAIN; 59 } else { 60 return SKIP_BODY; 61 } 62 } 63 64 public int doAfterBody() throws JspException { 65 int result = doAfterBodyHelper(); 66 if (result == SKIP_BODY) { 67 if (bodyContent != null) { 68 try { 69 bodyContent.writeOut(bodyContent.getEnclosingWriter()); 70 } catch (IOException ioe){ 71 throw new TaglibException(ioe); 72 } 73 } 74 } 75 return result; 76 77 } 78 79 80 81 82 } 83 84 | Popular Tags |