net.windward.tags
Class ForEachTag
net.windward.tags.BaseTag
|
+--net.windward.tags.ForEachTag
- public class ForEachTag
- extends BaseTag
Iterate through a set of nodes. This tag represents a <wr:forEach ...> in the template. The standard usage is
<wr:forEach items="./name"> ... other text ... </wr:forEach> which
will include the template between the forEach the end once for each node that the items. This is by definition,
equivalent to a wr:if for 0 or 1 nodes.
The full list of attributes are:
- select - required - the nodes that will be walked through, one per iteration.
- var - optional - identifies the node being stepped through. This can be used in other tags using ${name}. Each
implementation can also optionally have ${name.item} where item is a way of describing data returned by this node.
- varStatus - optional - returns index, first, last, count for the loop iteration. This can be used in
other tags using ${name.*} as follows:
- ${name.index} - the index in the collection of the item returned. This is 0-based and identifies the underlying
element regardless of begin and step. For example, if begin="3" then the first value of index will be 3.
- ${name.count} - the number of elements returned so far. This is 1-based and only counts elements actually
returned (unlike index which includes all elements including those not returned.)
- ${name.first} - returns true() if on the first element to be returned. Otherwise returns false().
- ${name.last} - returns true() if on the last element to be returned. Otherwise returns false().
- begin - optional - Element to start with. 0 based. (default: 0)
- step - optional - process every step element. (default: 1)
- end - optional - Element to end with (processes this element). (default: number of elements)
- restart - optional - if 'true' then any numbered lists inside the loop will be restarted on each iteration.
- break - places a break in the generate report for each iteration of the forEach except the first. Can be set to:
- sheet - a new Worksheet each time. Ignored for non Excel output.
- page - a page break is inserted.
- odd - a page break is inserted if on an odd page.
- even - a page break is inserted if on an even page.
It is an error to enter <wr:forEach select="./name"/>
This tag follows the jstl example of c:forEach and x:forEach.
- Version:
- 2.0 November 1, 2003
| Fields inherited from class net.windward.tags.BaseTag |
CHART, COLUMN, DISPLAY_ALWAYS, DISPLAY_NOT_EMPTY, DISPLAY_NOT_NULL, ELSE, END_FOREACH, END_IF, END_LINK, END_MATRIX, ESCAPE, FOREACH, FUNCTION, HTML, IF, IMPORT, LINK, MATRIX, OUT, PROP_COMMENT, PROP_DATASOURCE, PROP_DEFAULT, PROP_DISPLAY, PROP_ENABLED, PROP_INPUT, PROP_PATTERN, PROP_TITLE, PROP_TYPE, PROP_VAR, PROP_WRAP, QUERY, ROW, SET, TAG_DISPLAY_DEFAULT, TAG_DISPLAY_SELECT, TAG_DISPLAY_TAG, TYPE_BITMAP, TYPE_BOTH, TYPE_CURRENCY, TYPE_DATE, TYPE_NUMBER, TYPE_PERCENT, TYPE_TIME, WRAP_BEHIND, WRAP_FRONT, WRAP_INLINE, WRAP_SQUARE |
|
Constructor Summary |
ForEachTag(ForEachTag src)
|
ForEachTag(java.util.Map map,
boolean selfContained,
int nestLevel,
boolean ignoreErrors)
Create a forEach element using the passed in map values. |
|
Method Summary |
net.windward.document.Element |
dup(boolean sameRefId)
Makes a duplicate of this object. |
int |
getXmlType()
Returns which type of xml element this is. |
java.lang.String |
toDisplay(int type)
How this node is displayed on the page when in a field. |
java.lang.String |
toString()
This object as a string in the format "forEach[1]..." where the number is it's level. |
java.lang.String |
toText()
Converts this node back in to it's string representation in the document |
| Methods inherited from class net.windward.tags.BaseTag |
containsAttribute, factory, factory, getAttribute, getAttributes, getBean, getDatasource, getIntAttribute, getLevel, getMode, getNode, getType, setLevel, setNode, toTagText |
PROP_VAR_STATUS
public static final java.lang.String PROP_VAR_STATUS
PROP_BEGIN
public static final java.lang.String PROP_BEGIN
PROP_STEP
public static final java.lang.String PROP_STEP
PROP_END
public static final java.lang.String PROP_END
PROP_RESTART
public static final java.lang.String PROP_RESTART
PROP_BREAK
public static final java.lang.String PROP_BREAK
PROP_NAME
public static final java.lang.String PROP_NAME
PROP_BREAK_SHEET
public static final java.lang.String PROP_BREAK_SHEET
PROP_BREAK_PAGE
public static final java.lang.String PROP_BREAK_PAGE
PROP_BREAK_ODD
public static final java.lang.String PROP_BREAK_ODD
PROP_BREAK_EVEN
public static final java.lang.String PROP_BREAK_EVEN
ForEachTag
public ForEachTag(ForEachTag src)
ForEachTag
public ForEachTag(java.util.Map map,
boolean selfContained,
int nestLevel,
boolean ignoreErrors)
throws TagException
- Create a forEach element using the passed in map values.
- Parameters:
map - Must have a select entry. All other attributes are optionalselfContained - Must be false.nestLevel - The nest level for this while. A matching if/while will have the same level.ignoreErrors - create the tag even if some required attributes are missing.- Throws:
TagException - thrown if illegal parameters passed in.
toText
public java.lang.String toText()
throws TagException
- Converts this node back in to it's string representation in the document
- Overrides:
toText in class BaseTag
- Returns:
- <wr:forEach ... > type string.
toDisplay
public java.lang.String toDisplay(int type)
- How this node is displayed on the page when in a field.
- Overrides:
toDisplay in class BaseTag
- Parameters:
type - One of the DISPLAY_* constants- Returns:
- title, end of select, or <cmd> type string.
dup
public net.windward.document.Element dup(boolean sameRefId)
- Makes a duplicate of this object. A deep clone is done so the new object shares nothing
with the original object.
- Parameters:
sameRefId - if true do not assing a new reference ID.- Returns:
- The new duplicate of this object
getXmlType
public int getXmlType()
- Returns which type of xml element this is.
- Overrides:
getXmlType in class BaseTag
- Returns:
- FOREACH
toString
public java.lang.String toString()
- This object as a string in the format "forEach[1]..." where the number is it's level.
- Returns:
- A String listing this element.
Copyright © 2002 - 2008 Windward Reports - All Rights Reserved. java reporting software