Author: awiner
Date: Fri Jan 26 17:12:29 2007
New Revision: 500443
URL: http://svn.apache.org/viewvc?view=rev&rev=500443
Log:
ADFFACES-365: JSF 1.2: forEach "first" and "last" varStatus doesn't work
Modified:
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java
Modified:
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java
URL:
http://svn.apache.org/viewvc/incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java?view=diff&rev=500443&r1=500442&r2=500443
==============================================================================
---
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java
(original)
+++
incubator/adffaces/branches/faces-1_2-070102/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/taglib/ForEachTag.java
Fri Jan 26 17:12:29 2007
@@ -101,6 +101,7 @@
FacesContext context = FacesContext.getCurrentInstance();
_currentBegin = (_begin == null) ? 0 : _begin.intValue();
+ _isFirst = true;
int length;
if (null != _items)
@@ -162,10 +163,13 @@
_currentStep = (_step == null) ? 1 : _step.intValue();
//pu: Now check the valid relation between 'begin','end' and validity of
'step'
_validateRangeAndStep();
+
// If we can bail, do it now
if (_currentEnd < _currentIndex)
return SKIP_BODY;
+ _isLast = _currentIndex == _currentEnd;
+
// Save off the previous deferred variables
VariableMapper vm =
pageContext.getELContext().getVariableMapper();
@@ -209,12 +213,13 @@
// variables updated.
if (null != _varStatus)
{
- //pu: _isFirst is not yet updated after first iteration
- boolean isSecondIteration = (_isFirst)? true:false;
- if (isSecondIteration)
+ if (_isFirst)
{
- _propertyReplacementMap.put("first", _isFirst);
+ _propertyReplacementMap.put("first", Boolean.FALSE);
+ _isFirst = false;
}
+
+ _isLast = (_currentIndex == _currentEnd);
if (_isLast)
{
_propertyReplacementMap.put("last", _isLast);