org.eclipse.jet.taglib
Interface IteratingTag

All Superinterfaces:
ContainerTag, CustomTag, EmptyTag
All Known Implementing Classes:
AbstractIteratingTag

public interface IteratingTag
extends ContainerTag

Define the behavior of a JET2 iterating tag. An iterating tag:

  • Must be of the form an open-tag (<myiterate>) and a close-tag (</myiterate>).
  • Control the number of times the body content is written via the methods IteratingTag.doInitializeLoop(TagInfo, JET2Context) and IteratingTag.doEvalLoopCondition(TagInfo, JET2Context).
  • Methods are called in the following sequence:
  • The set*() methods as defined by CustomTag to initialize the tag
  • IteratingTag.doInitializeLoop(TagInfo, JET2Context) is called to allow the tag to determine the loop data.
  • IteratingTag.doEvalLoopCondition(TagInfo, JET2Context) is called multiple times to traverse the loop data.
  • Each time IteratingTag.doEvalLoopCondition(TagInfo, JET2Context) returns true, then the body processing methods are called as described in ContainerTag.

  • Method Summary
     boolean doEvalLoopCondition(TagInfo td, JET2Context context)
              Determine whether the tag should do another iteration, and, if so, setup any data for the iteration.
     void doInitializeLoop(TagInfo td, JET2Context context)
              Initialize any data required to determine how many times the tag should iterate.
     
    Methods inherited from interface org.eclipse.jet.taglib.ContainerTag
    doAfterBody, doBeforeBody, setBodyContent
     
    Methods inherited from interface org.eclipse.jet.taglib.CustomTag
    getAttribute, getKind, getOut, getParent, getRawAttribute, setContext, setOut, setParent, setTagInfo
     
    Methods inherited from interface org.eclipse.jet.taglib.EmptyTag
    doAction
     

    Method Detail

    doEvalLoopCondition

    public boolean doEvalLoopCondition(TagInfo td,
                                       JET2Context context)
                                throws JET2TagException
    Determine whether the tag should do another iteration, and, if so, setup any data for the iteration. This method is called one more more times after the call to IteratingTag.doInitializeLoop(TagInfo, JET2Context).

    Parameters:
    td - the tag information (attribute values, etc)
    context - the JET2 execution context.
    Returns:
    true if another iteration is to be performed, false otherwise.
    Throws:
    JET2TagException - if the method cannot complete successfully. Note that this will terminate the tag loop.

    doInitializeLoop

    public void doInitializeLoop(TagInfo td,
                                 JET2Context context)
                          throws JET2TagException
    Initialize any data required to determine how many times the tag should iterate. This method is called once, and is called prior to any calls to IteratingTag.doEvalLoopCondition(TagInfo, JET2Context).

    Parameters:
    td - the tag data (attribute values, etc)
    context - the JET2 exectuion context
    Throws:
    JET2TagException - if the method cannot execute successfully.

    Copyright 2006 IBM Corporation and others.
    All Rights Reserved.