You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2014/02/13 22:35:02 UTC
svn commit: r1568045 -
/myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/SectionUniqueIdCounter.java
Author: lu4242
Date: Thu Feb 13 21:35:01 2014
New Revision: 1568045
URL: http://svn.apache.org/r1568045
Log:
MYFACES-3853 ui:include not working inside c:forEach
Modified:
myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/SectionUniqueIdCounter.java
Modified: myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/SectionUniqueIdCounter.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/SectionUniqueIdCounter.java?rev=1568045&r1=1568044&r2=1568045&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/SectionUniqueIdCounter.java (original)
+++ myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/view/facelets/impl/SectionUniqueIdCounter.java Thu Feb 13 21:35:01 2014
@@ -114,16 +114,17 @@ public class SectionUniqueIdCounter
{
//1. Calculate prefix
_builder.delete(0, _builder.length());
- boolean added = false;
- for (int i = 0; i < _counterStack.size(); i++)
+
+ if (!_counterStack.isEmpty())
{
- if (added)
+ String lastPrefix = _counterStack.get(_counterStack.size()-1).getPrefix();
+ if (lastPrefix != null)
{
+ _builder.append(lastPrefix);
_builder.append('_');
}
- //_builder.append(Long.toString(_counterStack.get(i).getCounter(), _radix));
- appendToBuilder(_counterStack.get(i).getCounter(), _radix, _builder, _bufferConversion);
- added = true;
+ appendToBuilder(_counterStack.get(_counterStack.size()-1).getCounter(),
+ _radix, _builder, _bufferConversion);
}
_counterStack.add(new Section(_builder.toString(),1,_radix));
@@ -135,17 +136,19 @@ public class SectionUniqueIdCounter
{
//1. Calculate prefix
_builder.delete(0, _builder.length());
- boolean added = false;
- for (int i = 0; i < _counterStack.size(); i++)
+
+ if (!_counterStack.isEmpty())
{
- if (added)
+ String lastPrefix = _counterStack.get(_counterStack.size()-1).getPrefix();
+ if (lastPrefix != null)
{
+ _builder.append(lastPrefix);
_builder.append('_');
}
- //_builder.append(Long.toString(_counterStack.get(i).getCounter(), _radix));
- appendToBuilder(_counterStack.get(i).getCounter(), _radix, _builder, _bufferConversion);
- added = true;
+ appendToBuilder(_counterStack.get(_counterStack.size()-1).getCounter(),
+ _radix, _builder, _bufferConversion);
}
+
if (base != null && base.length() > 0)
{
_builder.append('_');
@@ -202,6 +205,19 @@ public class SectionUniqueIdCounter
}
}
+ public void endUniqueIdSection(String base)
+ {
+ if (_activeSection <= 0)
+ {
+ return;
+ }
+ else
+ {
+ _counterStack.remove(_activeSection);
+ _activeSection--;
+ }
+ }
+
private static class Section
{
@@ -272,6 +288,14 @@ public class SectionUniqueIdCounter
appendToBuilder(i, _radix, _builder, _bufferConversion);
return _builder.toString();
}
+
+ /**
+ * @return the prefix
+ */
+ public String getPrefix()
+ {
+ return prefix;
+ }
}
//From Harmony Long.toString(l,radix)