Tag
public class MultiForEachTag extends BaseLoopTag
A MultiForEachTag
represents a repetitively placed
Block
of Cells
, with each repetition corresponding
to the same index into multiple Collections
.
The vars
attribute represents the variable names corresponding
to what each Collection
's item is known by. The optional
indexVar
attribute is the name of the variable that holds the
iterator index. The optional limit
attribute specifies a limit
to the number of iterations to be run for the Collections
. If
the limit is greater than the number of items in any of the collections,
then blank blocks will result, with the exact result dependent on "past end
action" rules.
BaseTag
.BaseLoopTag
.Collection
String
String
int
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
ATTR_COLLECTIONS |
Attribute for specifying the
Collections over which to
iterate. |
static java.lang.String |
ATTR_INDEXVAR |
Attribute for specifying the name of the variable to be exposed that
indicates the 0-based index position into the
Collection . |
static java.lang.String |
ATTR_LIMIT |
Attribute for specifying the number of iterations to be displayed.
|
static java.lang.String |
ATTR_VARS |
Attribute for specifying the "looping variable" names.
|
ATTR_COLLAPSE, ATTR_COPY_RIGHT, ATTR_FIXED, ATTR_GROUP_DIR, ATTR_ON_LOOP_PROCESSED, ATTR_PAST_END_ACTION, ATTR_REPLACE_VALUE, ATTR_VAR_STATUS, GROUP_DIR_COLS, GROUP_DIR_NONE, GROUP_DIR_ROWS, PAST_END_ACTION_CLEAR, PAST_END_ACTION_REMOVE, PAST_END_ACTION_REPLACE_EXPR
ATTR_ON_PROCESSED, SPEC_SEP
Constructor | Description |
---|---|
MultiForEachTag() |
Modifier and Type | Method | Description |
---|---|---|
protected void |
afterBlockProcessed(TagContext context,
Block currBlock,
java.lang.Object item,
int index) |
Remove the values from the
List of collection item values
from the Map of beans. |
protected void |
beforeBlockProcessed(TagContext context,
Block currBlock,
java.lang.Object item,
int index) |
Place the values from the
List of collection item values
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 MultiForEachTag . |
protected int |
getCollectionSize() |
Returns the maximum size of the collections being iterated.
|
protected java.util.Iterator<java.util.List<java.lang.Object>> |
getLoopIterator() |
Returns an
Iterator that iterates over all the items of all
specified Collections of 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. |
protected java.util.List<java.lang.String> |
getVarNames() |
Returns the names of the variables that are being used in this
MultiForEachTag . |
void |
setCollectionNames(java.util.List<java.lang.String> collExpressions) |
Sets the
List of collection expressions. |
void |
setCollections(java.util.List<java.util.Collection<java.lang.Object>> collections) |
Sets the
List of Collections to be processed. |
void |
setIndexVarName(java.lang.String indexVarName) |
Sets the "looping" variable name.
|
void |
setLimit(int limit) |
Sets the limit on the number of iterations.
|
void |
setVarNames(java.util.List<java.lang.String> varNames) |
Sets the
List of variable names. |
void |
validateAttributes() |
Validates the attributes for this
Tag . |
getLoopTagStatus, getPastEndAction, getReplacementExprValue, process, setCollapsed, setCopyRight, setFixed, setGroupDirection, setOnLoopProcessed, setPastEndAction, setReplaceExprValue
checkAttributes, clearBlock, deleteBlock, getAttributes, getContext, getLocation, getParentTag, getWorkbookContext, isBodiless, processTag, removeBlock, setAttributes, setBodiless, setContext, setParentTag, setWorkbookContext
public static final java.lang.String ATTR_COLLECTIONS
Collections
over which to
iterate.public static final java.lang.String ATTR_VARS
public static final java.lang.String ATTR_INDEXVAR
Collection
.public static final java.lang.String ATTR_LIMIT
public void setCollections(java.util.List<java.util.Collection<java.lang.Object>> collections)
List
of Collections
to be processed.collections
- A List
of Collections
.public void setCollectionNames(java.util.List<java.lang.String> collExpressions)
List
of collection expressions.collExpressions
- A List
of collection expressions.public void setVarNames(java.util.List<java.lang.String> varNames)
List
of variable names.varNames
- The List
of variable names.public void setIndexVarName(java.lang.String indexVarName)
indexVarName
- The "looping" variable name.public void setLimit(int limit)
limit
- The limit on the number of iterations.public java.lang.String getName()
Tag's
name.Tag's
name.public java.util.List<java.lang.String> getRequiredAttributes()
List
of required attribute names.getRequiredAttributes
in class BaseLoopTag
List
of required attribute names.public java.util.List<java.lang.String> getOptionalAttributes()
List
of optional attribute names.getOptionalAttributes
in class BaseLoopTag
List
of optional attribute names.public void validateAttributes() throws TagParseException
Tag
. The "items"
attribute must be a Collection
. The "limit", if present,
must be a non-negative integer.validateAttributes
in class BaseLoopTag
TagParseException
- If the attribute values are illegal or
unacceptable.protected java.util.List<java.lang.String> getCollectionNames()
Collections
that are being used in
this MultiForEachTag
.getCollectionNames
in class BaseLoopTag
List
of multiple collection names.protected java.util.List<java.lang.String> getVarNames()
MultiForEachTag
.getVarNames
in class BaseLoopTag
List
of variable names.protected int getNumIterations()
getNumIterations
in class BaseLoopTag
protected int getCollectionSize()
getCollectionSize
in class BaseLoopTag
protected java.util.Iterator<java.util.List<java.lang.Object>> getLoopIterator()
Iterator
that iterates over all the items of all
specified Collections
of values. Its item is a
List
of items created by pulling values from all
Collections
using the same index for each
Collection
.getLoopIterator
in class BaseLoopTag
Iterator
.protected void beforeBlockProcessed(TagContext context, Block currBlock, java.lang.Object item, int index)
List
of collection item values
into the Map
of beans.beforeBlockProcessed
in class BaseLoopTag
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).protected void afterBlockProcessed(TagContext context, Block currBlock, java.lang.Object item, int index)
List
of collection item values
from the Map
of beans.afterBlockProcessed
in class BaseLoopTag
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–2018 Jett Team. All rights reserved.