}
if (iterateOverDataModel) {
// Get the first child and use it as a prototype.
DataItem prototypeChildDataItem = getFirstChildDataItem(dataList);
if (prototypeChildDataItem == null) {
logger.warn("Unable to iterate because alloy:dataList does not have an alloy:dataItem child element.");
}
else {
int rowCount = dataList.getRowCount();
for (int i = 0; i < rowCount; i++) {
dataList.setRowIndex(i);
// Encode the starting element that represents the specified child's content.
responseWriter.startElement(itemTag, prototypeChildDataItem);
responseWriter.writeAttribute(StringPool.CLASS, styleClass + StringPool.DASH + ITEM,
StringPool.CLASS);
// Encode the children of the specified child as the actual content.
prototypeChildDataItem.encodeAll(facesContext);
// Encode the closing element for the specified child.
responseWriter.endElement(itemTag);
if (facet != null) {
responseWriter.startElement("dd", uiComponent);
responseWriter.writeAttribute(StringPool.CLASS, styleClass + StringPool.DASH + DESCRIPTION,
StringPool.CLASS);
facet.encodeAll(facesContext);
responseWriter.endElement("dd");
}
}
dataList.setRowIndex(-1);
}
}
// Otherwise, encode content for each child of the specified dataList.
else {
List<UIComponent> children = uiComponent.getChildren();
int childCount = children.size();
for (int i = 0; i < childCount; i++) {
UIComponent child = children.get(i);
if (child.isRendered() && (child instanceof DataItem)) {
DataItem childDataItem = (DataItem) child;
// Encode the starting element that represents the specified child's content.
responseWriter.startElement(itemTag, childDataItem);
RendererUtil.encodeStyleable(responseWriter, childDataItem);
// Encode the children of the specified child as the actual content.
childDataItem.encodeAll(facesContext);
// Encode the closing element for the specified child.
responseWriter.endElement(itemTag);
}
else {