org.apache.tapestry.components
Class Foreach
java.lang.Object
|
+--org.apache.tapestry.spec.BaseLocatable
|
+--org.apache.tapestry.AbstractComponent
|
+--org.apache.tapestry.components.Foreach
- All Implemented Interfaces:
- IComponent, ILocatable, ILocationHolder, IRender
- public abstract class Foreach
- extends AbstractComponent
Repeatedly renders its wrapped contents while iterating through
a list of values.
[Component Reference]
While the component is rendering, the property
value
(accessed as
components.foreach.value
is set to each successive value from the source,
and the property
index
is set to each successive index
into the source (starting with zero).
- Version:
- $Id: Foreach.java,v 1.3 2003/04/16 16:43:18 hlship Exp $
- Author:
- Howard Lewis Ship
Methods inherited from class org.apache.tapestry.AbstractComponent |
addAsset, addBody, addComponent, cleanupAfterRender, finishLoad, finishLoad, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, fireObservedChange, format, format, format, format, formatString, formatString, formatString, formatString, generateAttributes, getAsset, getAssets, getBeans, getBinding, getBindingNames, getBindings, getBody, getBodyCount, getChangeObserver, getComponent, getComponents, getContainer, getExtendedId, getId, getIdPath, getListeners, getMessage, getMessages, getNamespace, getPage, getProperty, getSpecification, getString, pageEndRender, prepareForRender, render, renderBody, renderInformalParameters, setBinding, setContainer, setId, setNamespace, setPage, setProperty, setSpecification, toString |
Foreach
public Foreach()
getIndexBinding
public abstract IBinding getIndexBinding()
getSourceData
protected Iterator getSourceData()
- Gets the source binding and returns an
Iterator
representing
the values identified by the source. Returns an empty Iterator
if the binding, or the binding value, is null.
Invokes Tapestry.coerceToIterator(Object)
to perform
the actual conversion.
getValueBinding
public abstract IBinding getValueBinding()
renderComponent
protected void renderComponent(IMarkupWriter writer,
IRequestCycle cycle)
- Gets the source binding and iterates through
its values. For each, it updates the value binding and render's its wrapped elements.
- Overrides:
renderComponent
in class AbstractComponent
getValue
public Object getValue()
- Returns the most recent value extracted from the source parameter.
- Throws:
RenderOnlyPropertyException
- if the Foreach is not currently rendering.
getElement
public abstract String getElement()
getSource
public abstract Object getSource()
getIndex
public int getIndex()
- The index number, within the
source
, of the
the current value.
- Throws:
RenderOnlyPropertyException
- if the Foreach is not currently rendering.- Since:
- 2.2