Author: alexsmirnov
Date: 2010-06-21 19:53:25 -0400 (Mon, 21 Jun 2010)
New Revision: 17657
Modified:
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java
root/cdk/branches/RF8755/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/templates/testComponent.xml
Log:
put loop variable into context
Modified:
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java
===================================================================
---
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-06-21
22:38:29 UTC (rev 17656)
+++
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererClassVisitor.java 2010-06-21
23:53:25 UTC (rev 17657)
@@ -769,6 +769,7 @@
pushStatement(new ForEachStatement(itemsExpression, cdkForEachElement.getVar(),
collectionElementClass
.getName()));
+ localsTypesMap.put(cdkForEachElement.getVar(),
lastCompiledExpressionType.getContainerType());
}
/*
@@ -780,6 +781,7 @@
@Override
public void endElement(CdkForEachElement cdkForEachElement) {
+ localsTypesMap.remove(cdkForEachElement.getVar());
popStatement();
}
Modified:
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java
===================================================================
---
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java 2010-06-21
22:38:29 UTC (rev 17656)
+++
root/cdk/branches/RF8755/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java 2010-06-21
23:53:25 UTC (rev 17657)
@@ -29,7 +29,6 @@
import javax.faces.render.RenderKitFactory;
import javax.faces.render.Renderer;
import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
/**
@@ -103,7 +102,7 @@
*
* @return the resourceDependencies
*/
- @XmlElementWrapper(name = "resource-dependencies", namespace =
Template.CDK_NAMESPACE)
+// @XmlElementWrapper(name = "resource-dependencies", namespace =
Template.CDK_NAMESPACE)
@XmlElement(name = "resource-dependency", namespace =
Template.CDK_NAMESPACE)
public List<ResourceDependency> getResourceDependencies() {
return resourceDependencies;
Modified:
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java
===================================================================
---
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java 2010-06-21
22:38:29 UTC (rev 17656)
+++
root/cdk/branches/RF8755/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java 2010-06-21
23:53:25 UTC (rev 17657)
@@ -353,13 +353,11 @@
@Test
public void testResourceDependencies() throws Exception {
Template template =
- unmarshal(Template.class, TEMPLATE_PROLOG +
"<cdk:resource-dependencies>"
- + "<cdk:resource-dependency name=\"jquery.js\"
/>"
+ unmarshal(Template.class, TEMPLATE_PROLOG + "<cdk:resource-dependency
name=\"jquery.js\" />"
+ "<cdk:resource-dependency name=\"richfaces.css\"
library=\"org.richfaces\" />"
+ "<cdk:resource-dependency name=\"richfaces.js\"
library=\"org.richfaces\" target=\"body\" /> "
- + "</cdk:resource-dependencies> " +
- TEMPLATE_MIDDLE + TEMPLATE_EPILOG);
+ + TEMPLATE_MIDDLE + TEMPLATE_EPILOG);
CompositeInterface interfaceSection = template.getInterface();
assertNotNull(interfaceSection);
Modified:
root/cdk/branches/RF8755/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/templates/testComponent.xml
===================================================================
---
root/cdk/branches/RF8755/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/templates/testComponent.xml 2010-06-21
22:38:29 UTC (rev 17656)
+++
root/cdk/branches/RF8755/plugins/maven-cdk-plugin/src/it/annotated-component/src/main/templates/testComponent.xml 2010-06-21
23:53:25 UTC (rev 17657)
@@ -2,10 +2,13 @@
<cdk:root
xmlns="http://www.w3.org/1999/xhtml"
xmlns:cdk="http://richfaces.org/cdk/core"
xmlns:c="http://richfaces.org/cdk/jstl/core"
xmlns:cc="http://richfaces.org/cdk/jsf/composite">
<cc:interface>
- <cdk:class>org.richfaces.cdk.test.renderkit.rf4_xhtml.TestRenderer</cdk:class>
+ <cdk:class>org.richfaces.cdk.test.renderkit.rf4_xhtml.TestRenderer
+ </cdk:class>
<cdk:superclass>javax.faces.render.Renderer</cdk:superclass>
- <cdk:component-family>org.richfaces.cdk.test.Test</cdk:component-family>
- <cdk:component-type>org.richfaces.cdk.test.TestComponent</cdk:component-type>
+ <cdk:component-family>org.richfaces.cdk.test.Test
+ </cdk:component-family>
+ <cdk:component-type>org.richfaces.cdk.test.TestComponent
+ </cdk:component-type>
<cdk:renderer-type>org.richfaces.TestRenderer</cdk:renderer-type>
<cdk:renderkit-id>RF4_XHTML</cdk:renderkit-id>
<cdk:renders-children>false</cdk:renders-children>
@@ -21,28 +24,28 @@
displayName="Expert attribute" expert="true" />
<cc:attribute name="preferred" shortDescription="It's a preferred
attribute"
displayName="Preferred attribute" preferred="true" />
- <cdk:resource-dependencies>
- <cdk:resource-dependency name="jquery.js" />
- <cdk:resource-dependency name="richfaces.css"
- library="org.richfaces" />
- <cdk:resource-dependency name="richfaces.js"
- library="org.richfaces" target="body" />
- </cdk:resource-dependencies>
+ <cdk:resource-dependency name="jquery.js" />
+ <cdk:resource-dependency name="richfaces.css"
+ library="org.richfaces" />
+ <cdk:resource-dependency name="richfaces.js"
+ library="org.richfaces" target="body" />
</cc:interface>
<cc:implementation>
- start
- <c:if test="#{component.attributes['ifTest'] !=
null}">if content</c:if>
- <c:choose>
- <c:when test="#{component.attributes['anotherTest']
!= null}">when content</c:when>
- <c:when test="#{component.attributes['coolTest'] !=
null}">
- <c:if
test="#{component.attributes['nestedIfTest'] != null}">nested if
content</c:if>
- </c:when>
- <c:otherwise>otherwise content</c:otherwise>
- </c:choose>
- <c:forEach items="#{component.children}"
var="iterationVar">
- forEach content
+ <div id="#{clientId}" style="#{component.style}"
class="#{component.styleClass}">
+ <c:if test="#{component.attributes['ifTest'] != null}">if
content</c:if>
+ <c:choose>
+ <c:when test="#{component.attributes['anotherTest'] !=
null}">when content</c:when>
+ <c:when test="#{component.attributes['coolTest'] != null}">
+ <c:if test="#{component.attributes['nestedIfTest'] !=
null}">nested if content</c:if>
+ </c:when>
+ <c:otherwise>otherwise content</c:otherwise>
+ </c:choose>
+ <ul>
+ <c:forEach items="#{component.children}" var="iterationVar">
+ <li>forEach content #{iterationVar.encodeAll(facesContext)}</li>
</c:forEach>
- finish
+ </ul>
+ </div>
</cc:implementation>
</cdk:root>
\ No newline at end of file