TagForEachTag, ForTag, MultiForEachTagpublic abstract class BaseLoopTag extends BaseTag
The abstract class BaseLoopTag is the base class for all tags
that represent loops.
BaseTag.booleanbooleanStringStringStringbooleanTagLoopListenerString| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
ATTR_COLLAPSE |
Attribute for specifying whether the group should be displayed collapsed.
|
static java.lang.String |
ATTR_COPY_RIGHT |
Attribute for forcing "copy right" behavior.
|
static java.lang.String |
ATTR_FIXED |
Attribute for not shifting other content out of the way; works the same
as "fixed size collections".
|
static java.lang.String |
ATTR_GROUP_DIR |
Attribute for specifying the direction of the grouping.
|
static java.lang.String |
ATTR_ON_LOOP_PROCESSED |
Attribute for specifying a
TagLoopListener to listen for
TagLoopEvents. |
static java.lang.String |
ATTR_PAST_END_ACTION |
Attribute for specifying the "past end action", an action for dealing
with content beyond the range of looping content.
|
static java.lang.String |
ATTR_REPLACE_VALUE |
Attribute for specifying a replacement value for expressions that
reference a collection that is past the end of iteration.
|
static java.lang.String |
ATTR_VAR_STATUS |
Attribute for specifying the name of the
LoopTagStatus
object that will be exposed in the beans map. |
static java.lang.String |
GROUP_DIR_COLS |
The "group dir" value to specify that columns should be grouped.
|
static java.lang.String |
GROUP_DIR_NONE |
The "group dir" value to specify that neither rows nor columns should be
grouped.
|
static java.lang.String |
GROUP_DIR_ROWS |
The "group dir" value to specify that rows should be grouped.
|
static java.lang.String |
PAST_END_ACTION_CLEAR |
The "past end action" value to clear the content of cells.
|
static java.lang.String |
PAST_END_ACTION_REMOVE |
The "past end action" value to remove the cells, including things like
borders and formatting.
|
static java.lang.String |
PAST_END_ACTION_REPLACE_EXPR |
The "past end action" value to replace only the expressions that contain
past-end references.
|
ATTR_ON_PROCESSED, SPEC_SEP| Constructor | Description |
|---|---|
BaseLoopTag() |
| Modifier and Type | Method | Description |
|---|---|---|
protected abstract void |
afterBlockProcessed(TagContext context,
Block currBlock,
java.lang.Object item,
int index) |
This method is called once per iteration loop, immediately after the
given
Block is processed. |
protected abstract void |
beforeBlockProcessed(TagContext context,
Block currBlock,
java.lang.Object item,
int index) |
This method is called once per iteration loop, immediately before the
given
Block is processed. |
protected abstract java.util.List<java.lang.String> |
getCollectionNames() |
Returns the names of the
Collections that are being used in
this BaseLoopTag. |
protected abstract int |
getCollectionSize() |
Returns the size of the collection being iterated.
|
protected abstract java.util.Iterator<?> |
getLoopIterator() |
Returns an
Iterator that iterates over some
Collection of objects. |
protected BaseLoopTagStatus |
getLoopTagStatus() |
Returns a
BaseLoopTagStatus that will be exposed in the
beans map if the appropriate attribute is given. |
protected abstract int |
getNumIterations() |
Returns the number of iterations.
|
protected java.util.List<java.lang.String> |
getOptionalAttributes() |
All
BaseLoopTags support the optional copy down tag. |
protected PastEndAction |
getPastEndAction() |
Returns the
PastEndAction, which is controlled by the
attribute specified by ATTR_PAST_END_ACTION. |
protected java.lang.String |
getReplacementExprValue() |
Returns the replacement expression value, which defaults to am empty
string
"". |
protected java.util.List<java.lang.String> |
getRequiredAttributes() |
There are no required attributes that all
BaseLoopTags
support. |
protected abstract java.util.List<java.lang.String> |
getVarNames() |
Returns the names of the variables that are being used in this
BaseLoopTag. |
boolean |
process() |
Provide a generic way to process a tag that loops, with the Template
Method pattern.
|
void |
setCollapsed(boolean collapsed) |
Sets whether any Excel Group created is collapsed.
|
void |
setCopyRight(boolean copyRight) |
Sets whether the repeated blocks are to be copied to the right (true) or
downward (default, false).
|
void |
setFixed(boolean fixed) |
Sets "fixed" mode, which doesn't shift other content out of the way when
copying repeated blocks of cells.
|
void |
setGroupDirection(Block.Direction direction) |
Sets the directionality of the Excel Group to be created, if any.
|
void |
setOnLoopProcessed(TagLoopListener listener) |
Sets the
TagLoopListener. |
void |
setPastEndAction(PastEndAction pae) |
Sets the
PastEndAction. |
void |
setReplaceExprValue(java.lang.String value) |
Sets the replacement expression value.
|
protected void |
validateAttributes() |
Ensure that the past end action (if specified) is a valid value.
|
checkAttributes, clearBlock, deleteBlock, getAttributes, getContext, getLocation, getParentTag, getWorkbookContext, isBodiless, processTag, removeBlock, setAttributes, setBodiless, setContext, setParentTag, setWorkbookContextpublic static final java.lang.String ATTR_COPY_RIGHT
public static final java.lang.String ATTR_FIXED
public static final java.lang.String ATTR_PAST_END_ACTION
public static final java.lang.String ATTR_GROUP_DIR
GROUP_DIR_ROWS,
GROUP_DIR_COLS,
GROUP_DIR_NONE,
Constant Field Valuespublic static final java.lang.String ATTR_COLLAPSE
false, for not collapsed. It is ignored if
neither rows nor columns are being grouped.public static final java.lang.String ATTR_ON_LOOP_PROCESSED
TagLoopListener to listen for
TagLoopEvents.public static final java.lang.String ATTR_REPLACE_VALUE
"", and is only relevant when the "past
end action" is replaceExpr.ATTR_PAST_END_ACTION,
PAST_END_ACTION_REPLACE_EXPR,
Constant Field Valuespublic static final java.lang.String ATTR_VAR_STATUS
LoopTagStatus
object that will be exposed in the beans map. If this attribute is not
present, or the value is null, then no such object will be
exposed.public static final java.lang.String PAST_END_ACTION_CLEAR
public static final java.lang.String PAST_END_ACTION_REMOVE
public static final java.lang.String PAST_END_ACTION_REPLACE_EXPR
public static final java.lang.String GROUP_DIR_COLS
public static final java.lang.String GROUP_DIR_ROWS
public static final java.lang.String GROUP_DIR_NONE
public void setCopyRight(boolean copyRight)
copyRight - Whether the repeated blocks are to be copied to the right (true) or
downward (default, false).public void setFixed(boolean fixed)
fixed - Whether to execute in "fixed" mode.public void setPastEndAction(PastEndAction pae)
PastEndAction.pae - The PastEndAction.public void setReplaceExprValue(java.lang.String value)
"". This is only relevant if a past end action of
"replaceExpr" is used.value - The replacement expression value.setPastEndAction(net.sf.jett.model.PastEndAction),
PAST_END_ACTION_REPLACE_EXPRpublic void setGroupDirection(Block.Direction direction)
direction - The directionality.public void setCollapsed(boolean collapsed)
collapsed - Whether any Excel group created is collapsed.public void setOnLoopProcessed(TagLoopListener listener)
TagLoopListener.listener - The TagLoopListener.protected java.util.List<java.lang.String> getRequiredAttributes()
BaseLoopTags
support.getRequiredAttributes in class BaseTagList.protected java.util.List<java.lang.String> getOptionalAttributes()
BaseLoopTags support the optional copy down tag.getOptionalAttributes in class BaseTagList of optional attribute names.protected void validateAttributes()
throws TagParseException
validateAttributes in class BaseTagTagParseException - If the attribute values are illegal or
unacceptable.protected PastEndAction getPastEndAction()
PastEndAction, which is controlled by the
attribute specified by ATTR_PAST_END_ACTION. It defaults to
CLEAR_CELL.PastEndAction.PastEndActionprotected java.lang.String getReplacementExprValue()
"". This is only relevant if the past end action is
"replaceExpr".getPastEndAction(),
PAST_END_ACTION_REPLACE_EXPR,
ATTR_REPLACE_VALUEpublic boolean process()
Provide a generic way to process a tag that loops, with the Template Method pattern.
getCollectionNames() to determine if any of the collection
names are "fixed". This also involves calling getVarNames()
to determine which, if any, past end actions, need to be taken.getNumIterations to determine the number of Blocks
needed.getLoopIterator().Block for the iteration.beforeBlockProcessed().Block with a
BlockTransformer.afterBlockProcessed().process in class BaseTagCell in the Block
associated with this Tag was processed.getCollectionNames(),
getVarNames(),
getNumIterations(),
getLoopIterator(),
beforeBlockProcessed(net.sf.jett.tag.TagContext, net.sf.jett.model.Block, java.lang.Object, int),
afterBlockProcessed(net.sf.jett.tag.TagContext, net.sf.jett.model.Block, java.lang.Object, int)protected abstract java.util.List<java.lang.String> getCollectionNames()
Collections that are being used in
this BaseLoopTag.List collection names, or null if
not operating on any Collections.protected abstract java.util.List<java.lang.String> getVarNames()
BaseLoopTag.List of variable names, or null if
there are not any variable names into any Collections.protected abstract int getNumIterations()
protected abstract int getCollectionSize()
protected BaseLoopTagStatus getLoopTagStatus()
BaseLoopTagStatus that will be exposed in the
beans map if the appropriate attribute is given. Subclasses may want to
override this method to return an object that provides more information.BaseLoopTagStatus.protected abstract java.util.Iterator<?> getLoopIterator()
Iterator that iterates over some
Collection of objects. The Iterator doesn't
need to support the remove operation.Iterator.protected abstract void beforeBlockProcessed(TagContext context, Block currBlock, java.lang.Object item, int index)
Block is processed. An iteration index is supplied as
well.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 abstract void afterBlockProcessed(TagContext context, Block currBlock, java.lang.Object item, int index)
Block is processed. An iteration index is supplied as
well.context - The TagContext.currBlock - The Block that was just processed.item - The Object that resulted from the iterator.index - The iteration index (0-based).Copyright © 2012–2018 Jett Team. All rights reserved.