1 /* 2 * Copyright 1999-2004 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.apache.cocoon.taglib; 17 18 import org.xml.sax.SAXException; 19 20 /** 21 * The IterationTag interface extends Tag by defining one additional 22 * method that controls the reevaluation of its body. 23 * 24 * <p> A tag handler that implements IterationTag is treated as one that 25 * implements Tag regarding the doStartTag() and doEndTag() methods. 26 * IterationTag provides a new method: <code>doAfterBody()</code>. 27 * 28 * <p> The doAfterBody() method is invoked after every body evaluation 29 * to control whether the body will be reevaluated or not. If doAfterBody() 30 * returns IterationTag.EVAL_BODY_AGAIN, then the body will be reevaluated. 31 * If doAfterBody() returns Tag.SKIP_BODY, then the body will be skipped 32 * and doEndTag() will be evaluated instead. 33 * 34 * @author <a HREF="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a> 35 * @version CVS $Id: IterationTag.java 30932 2004-07-29 17:35:38Z vgritsenko $ 36 */ 37 public interface IterationTag extends Tag { 38 39 /** 40 * Request the reevaluation of some body. 41 * Returned from doAfterBody. 42 */ 43 public final static int EVAL_BODY_AGAIN = 2; 44 45 /** 46 * Process body (re)evaluation. This method is invoked by the 47 * Taglib implementation object after every evaluation of 48 * the body into the BodyEvaluation object. The method is 49 * not invoked if there is no body evaluation. 50 * 51 * <p> 52 * If doAfterBody returns EVAL_BODY_AGAIN, a new evaluation of the 53 * body will happen (followed by another invocation of doAfterBody). 54 * If doAfterBody returns SKIP_BODY no more body evaluations will 55 * occur and then doEndTag will be invoked. 56 * 57 * <p> 58 * The method re-invocations may be lead to different actions because 59 * there might have been some changes to shared state, or because 60 * of external computation. 61 * 62 * @return whether additional evaluations of the body are desired 63 * @throws SAXException 64 */ 65 int doAfterBody() throws SAXException; 66 } 67