net.sf.jett.tag
Class ForTag

java.lang.Object
  extended by net.sf.jett.tag.BaseTag
      extended by net.sf.jett.tag.BaseLoopTag
          extended by net.sf.jett.tag.ForTag
All Implemented Interfaces:
Tag

public class ForTag
extends BaseLoopTag

A ForTag represents a repetitively placed Block of Cells, with each repetition corresponding to an increment of an index.


Attributes:

Author:
Randy Gettman

Field Summary
static java.lang.String ATTR_END
          Attribute for specifying the ending value (included in the range).
static java.lang.String ATTR_START
          Attribute for specifying the starting value.
static java.lang.String ATTR_STEP
          Attribute for specifying how much the value increments per iteration.
static java.lang.String ATTR_VAR
          Attribute for specifying the name of the looping variable.
 
Fields inherited from class net.sf.jett.tag.BaseLoopTag
ATTR_COLLAPSE, ATTR_COPY_RIGHT, ATTR_FIXED, ATTR_GROUP_DIR, ATTR_ON_LOOP_PROCESSED, ATTR_PAST_END_ACTION, GROUP_DIR_COLS, GROUP_DIR_NONE, GROUP_DIR_ROWS, PAST_END_ACTION_CLEAR, PAST_END_ACTION_REMOVE
 
Fields inherited from class net.sf.jett.tag.BaseTag
ATTR_ON_PROCESSED, SPEC_SEP
 
Constructor Summary
ForTag()
           
 
Method Summary
protected  void afterBlockProcessed(TagContext context, Block currBlock, java.lang.Object item, int index)
          Remove the index "item" from the Map of beans.
protected  void beforeBlockProcessed(TagContext context, Block currBlock, java.lang.Object item, int index)
          Place the index "item" into the Map of beans.
protected  java.util.List<java.lang.String> getCollectionNames()
          Returns the names of the Collections that are being used in this ForTag.
protected  int getCollectionSize()
          Returns the number of iterations.
protected  java.util.Iterator<java.lang.Integer> getLoopIterator()
          Returns an Iterator that iterates over the desired values.
 java.lang.String getName()
          Returns this Tag's name.
protected  int getNumIterations()
          Returns the number of iterations.
 java.util.List<java.lang.String> getOptionalAttributes()
          Returns the List of optional attribute names.
 java.util.List<java.lang.String> getRequiredAttributes()
          Returns the List of required attribute names.
 void validateAttributes()
          Validates the attributes for this Tag.
 
Methods inherited from class net.sf.jett.tag.BaseLoopTag
getPastEndAction, process, setCollapsed, setCopyRight, setFixed, setGroupDirection, setOnLoopProcessed, setPastEndAction
 
Methods inherited from class net.sf.jett.tag.BaseTag
checkAttributes, clearBlock, deleteBlock, getAttributes, getContext, getWorkbookContext, isBodiless, processTag, removeBlock, setAttributes, setBodiless, setContext, setWorkbookContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTR_VAR

public static final java.lang.String ATTR_VAR
Attribute for specifying the name of the looping variable.

See Also:
Constant Field Values

ATTR_START

public static final java.lang.String ATTR_START
Attribute for specifying the starting value.

See Also:
Constant Field Values

ATTR_END

public static final java.lang.String ATTR_END
Attribute for specifying the ending value (included in the range).

See Also:
Constant Field Values

ATTR_STEP

public static final java.lang.String ATTR_STEP
Attribute for specifying how much the value increments per iteration.

See Also:
Constant Field Values
Constructor Detail

ForTag

public ForTag()
Method Detail

getName

public java.lang.String getName()
Returns this Tag's name.

Returns:
This Tag's name.

getRequiredAttributes

public java.util.List<java.lang.String> getRequiredAttributes()
Returns the List of required attribute names.

Overrides:
getRequiredAttributes in class BaseLoopTag
Returns:
The List of required attribute names.

getOptionalAttributes

public java.util.List<java.lang.String> getOptionalAttributes()
Returns the List of optional attribute names.

Overrides:
getOptionalAttributes in class BaseLoopTag
Returns:
The List of optional attribute names.

validateAttributes

public void validateAttributes()
                        throws TagParseException
Validates the attributes for this Tag. The "start", "end", and "step" attributes must evaluate to ints. If "step" is not present, then it defaults to 1. The "step" must not be zero. It is possible for no loops to be processed if "step" is positive and "start" is greater than "end", or if "step" is negative and "start" is less than "end".

Overrides:
validateAttributes in class BaseLoopTag
Throws:
TagParseException - If the attribute values are illegal or unacceptable.

getCollectionNames

protected java.util.List<java.lang.String> getCollectionNames()
Returns the names of the Collections that are being used in this ForTag.

Specified by:
getCollectionNames in class BaseLoopTag
Returns:
null, no collections are being used.

getNumIterations

protected int getNumIterations()
Returns the number of iterations. Note that this effectively disables the "limit" attribute for ForTags.

Specified by:
getNumIterations in class BaseLoopTag
Returns:
The number of iterations.

getCollectionSize

protected int getCollectionSize()
Returns the number of iterations.

Specified by:
getCollectionSize in class BaseLoopTag
Returns:
The number of iterations.

getLoopIterator

protected java.util.Iterator<java.lang.Integer> getLoopIterator()
Returns an Iterator that iterates over the desired values.

Specified by:
getLoopIterator in class BaseLoopTag
Returns:
An Iterator.

beforeBlockProcessed

protected void beforeBlockProcessed(TagContext context,
                                    Block currBlock,
                                    java.lang.Object item,
                                    int index)
Place the index "item" into the Map of beans.

Specified by:
beforeBlockProcessed in class BaseLoopTag
Parameters:
context - The TagContext.
currBlock - The Block that is about to processed.
item - The Object that resulted from the iterator.
index - The iteration index (0-based).

afterBlockProcessed

protected void afterBlockProcessed(TagContext context,
                                   Block currBlock,
                                   java.lang.Object item,
                                   int index)
Remove the index "item" from the Map of beans.

Specified by:
afterBlockProcessed in class BaseLoopTag
Parameters:
context - The TagContext.
index - The iteration index (0-based).
item - The Object that resulted from the iterator.
currBlock - The Block that was just processed.


Copyright © 2012-2013 Jett Team. All Rights Reserved.