Author: nbelaevski
Date: 2010-02-01 10:17:28 -0500 (Mon, 01 Feb 2010)
New Revision: 16386
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-composite.xsd
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-jstl-core.xsd
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy.template.xml
Log:
https://jira.jboss.org/jira/browse/RF-7732
https://jira.jboss.org/jira/browse/RFPL-364
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-02-01
14:39:56 UTC (rev 16385)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/RendererTemplateParser.java 2010-02-01
15:17:28 UTC (rev 16386)
@@ -153,6 +153,11 @@
renderer.setRendererClass(new
ClassDescription(compositeInterface.getJavaClass()));
renderer.setTemplate(template);
+ Boolean rendersChildren = compositeInterface.getRendersChildren();
+ if (rendersChildren != null) {
+ renderer.setRendersChildren(rendersChildren.booleanValue());
+ }
+
Map<String, Property> rendererAttributes = renderer.getAttributes();
List<ImportAttributes> attributesImports =
compositeInterface.getAttributesImports();
Modified:
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java 2010-02-01
14:39:56 UTC (rev 16385)
+++
root/cdk/trunk/plugins/generator/src/main/java/org/richfaces/cdk/templatecompiler/model/CompositeInterface.java 2010-02-01
15:17:28 UTC (rev 16386)
@@ -57,7 +57,7 @@
private String rendererType;
- private boolean rendersChildren = true;
+ private Boolean rendersChildren = null;
/**
* <p class="changed_added_4_0"></p>
@@ -199,16 +199,15 @@
*
* @return the rendersChildren
*/
- //TODO: add handling
@XmlElement(name = "renders-children", namespace = Template.CDK_NAMESPACE)
- public boolean isRendersChildren() {
+ public Boolean getRendersChildren() {
return rendersChildren;
}
/**
* @param rendersChildren the rendersChildren to set
*/
- public void setRendersChildren(boolean rendersChildren) {
+ public void setRendersChildren(Boolean rendersChildren) {
this.rendersChildren = rendersChildren;
}
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-composite.xsd
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-composite.xsd 2010-02-01
14:39:56 UTC (rev 16385)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-composite.xsd 2010-02-01
15:17:28 UTC (rev 16386)
@@ -34,36 +34,48 @@
<xs:attribute name="displayName">
<xs:annotation>
<xs:documentation>
+ <p>
The name to display in a tool palette containing
this component. The
value of this attribute will be set as the value
for this property
on the composite component bean descriptor.
+ </p>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="preferred" type="xs:boolean"
default="false">
<xs:annotation>
- <xs:documentation>Is this a "preferred" component. The value of this
+ <xs:documentation>
+ <p>
+ Is this a "preferred" component. The value of this
attribute will be set as the value for this property on the
- composite component bean descriptor.</xs:documentation>
+ composite component bean descriptor.
+ </p>
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="expert" type="xs:boolean"
default="false">
<xs:annotation>
- <xs:documentation>Is this component only for expert users? The value
+ <xs:documentation>
+ <p>
+ Is this component only for expert users? The value
of this attribute will be set as the value for this property on the
- composite component bean descriptor.</xs:documentation>
+ composite component bean descriptor.
+ </p>
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="shortDescription">
<xs:annotation>
<xs:documentation>
+ <p>
A short description of the purpose of this
component. The value of
this attribute will be set as the value for
this property on the
composite component bean descriptor.
+ </p>
</xs:documentation>
</xs:annotation>
</xs:attribute>
@@ -74,6 +86,7 @@
<xs:attribute name="name" use="required">
<xs:annotation>
<xs:documentation>
+ <p>
The name of the attribute as it must appear on the
composite component
tag in the using page. If the value of the name
@@ -89,12 +102,14 @@
present, must be ignored as its value is derived as
described in
retargetMethodExpressions().
+ </p>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="targets">
<xs:annotation>
<xs:documentation>
+ <p>
If this element has a method-signature attribute, the value of the
targets attribute must be interpreted as a space (not tab)
separated list of client ids (relative to the top level
@@ -112,25 +127,30 @@
of the special values listed in the description of the name
attribute, targets (or its derived value) need not correspond to
the id of an inner component.
- </xs:documentation>
+ </p>
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="default">
<xs:annotation>
<xs:documentation>
+ <p>
If this attribute is not required, and a value is
not supplied by the
page author, use this as the default value.
- </xs:documentation>
+ </p>
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="required" type="xs:boolean"
default="false">
<xs:annotation>
<xs:documentation>
+ <p>
True if the page author must supply a value for
this attribute.
- </xs:documentation>
+ </p>
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="method-signature">
@@ -195,18 +215,15 @@
<xs:attribute name="type">
<xs:annotation>
<xs:documentation>
- Declares that this attribute must be a ValueExpression whose
- expected type
- is given by the value of this attribute. If not
- specified, and no
- "method-signature" attribute is present,
- java.lang.Object is
- assumed. This attribute is mutually exclusive
- with the "type"
- attribute. If both attributes are present, the
- "method-signature"
- attribute is ignored.
- </xs:documentation>
+ <p>
+ Declares that this attribute must be a <code>ValueExpression</code>
whose expected type
+ is given by the value of this attribute. If not specified, and no
+ "method-signature" attribute is present,
<code>java.lang.Object</code> is
+ assumed. This attribute is mutually exclusive with the "type"
+ attribute. If both attributes are present, the "method-signature"
+ attribute is ignored.
+ </p>
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup ref="cc:beanDescriptorAttributes" />
@@ -216,7 +233,9 @@
<xs:attribute name="event">
<xs:annotation>
<xs:documentation>
+ <p>
Names of the logical event supported by the component
+ </p>
</xs:documentation>
</xs:annotation>
</xs:attribute>
@@ -224,8 +243,10 @@
<xs:attribute name="default" type="xs:boolean">
<xs:annotation>
<xs:documentation>
- Boolean attribute defining whether the specified logical event is the
- default component event
+ <p>
+ Boolean attribute defining whether the specified logical event is the
+ default component event
+ </p>
</xs:documentation>
</xs:annotation>
</xs:attribute>
@@ -261,26 +282,23 @@
<xs:attribute type="xs:string" name="name">
<xs:annotation>
<xs:documentation>
- The name of this composite component. Advisory
- only. The real name is
- taken from the filename. The value of this
- attribute will be set as
- the value for this property on the
- composite component bean
- descriptor.
+ <p>
+ The name of this composite component. Advisory only. The real name is
+ taken from the filename. The value of this attribute will be set as
+ the value for this property on the composite component bean descriptor.
+ </p>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute type="xs:string" name="componentType">
<xs:annotation>
<xs:documentation>
- The component-type of the UIComponent that will
- serve as the composite
- component root for this composite
- component.
- The declared
- component-family for this component must be
- javax.faces.NamingContainer.
+ <p>
+ The <code>component-type</code> of the
<code>UIComponent</code> that will serve
+ as the composite component root for this composite component.
+ The declared <code>component-family</code> for this component must be
+ <code>javax.faces.NamingContainer</code>.
+ </p>
</xs:documentation>
</xs:annotation>
</xs:attribute>
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-jstl-core.xsd
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-jstl-core.xsd 2010-02-01
14:39:56 UTC (rev 16385)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-jstl-core.xsd 2010-02-01
15:17:28 UTC (rev 16386)
@@ -31,7 +31,7 @@
<xs:annotation>
<xs:documentation>
- Subset of JSTL core tags supported by RichFaces CDK.
+ Subset of JSTL 1.2 core library supported by RichFaces CDK.
</xs:documentation>
</xs:annotation>
@@ -39,7 +39,13 @@
<xs:attributeGroup name="testGroup">
<xs:attribute name="test" form="unqualified"
use="required"
- type="cdk:elStrictExpression" />
+ type="cdk:elStrictExpression">
+ <xs:annotation>
+ <xs:documentation>
+ <p>The test condition that determines whether or not the body content should
be processed.</p>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
</xs:attributeGroup>
<xs:complexType name="arbitraryContent" mixed="true">
@@ -56,22 +62,75 @@
</xs:complexContent>
</xs:complexType>
- <xs:element name="if" type="arbitraryConditionalContent" />
+ <xs:element name="if" type="arbitraryConditionalContent">
+ <xs:annotation>
+ <xs:documentation>
+ <p>Simple conditional tag, which evalutes its body if the supplied condition is
true
+ and optionally exposes a Boolean scripting variable representing the evaluation of
+ this condition</p>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
<xs:element name="choose">
+ <xs:annotation>
+ <xs:documentation>
+ <p>Simple conditional tag that establishes a context for mutually exclusive
conditional
+ operations, marked by <code><![CDATA[<c:when>]]></code> and
<code><![CDATA[<c:otherwise>]]></code>
+ tags.</p>
+ </xs:documentation>
+ </xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="when"
- type="arbitraryConditionalContent" />
- <xs:element minOccurs="0" name="otherwise"
type="arbitraryContent" />
+ type="arbitraryConditionalContent">
+ <xs:annotation>
+ <xs:documentation>
+ <p>Subtag of <code><![CDATA[<c:choose>]]></code>
that includes its body if its condition
+ evaluates to 'true'.</p>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element minOccurs="0" name="otherwise"
type="arbitraryContent">
+ <xs:annotation>
+ <xs:documentation>
+ <p>Subtag of <code><![CDATA[<c:choose>]]></code>
that follows tags and runs only if
+ all of the prior conditions evaluated to 'false'.</p>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="forEach">
+ <xs:annotation>
+ <xs:documentation>
+ <p>The basic iteration tag, accepting many different collection types and
supporting subsetting
+ and other functionality.</p>
+ <p>
+ <span class="warning">Support for this tag is not currently
implemented.</span>
+ </p>
+ </xs:documentation>
+ </xs:annotation>
+
<xs:complexType>
<xs:complexContent>
<xs:extension base="arbitraryContent">
- <xs:attribute name="items" type="cdk:elStrictExpression"
/>
- <xs:attribute name="var" type="cdk:literalExpression" />
+ <xs:attribute name="items" type="cdk:elStrictExpression">
+ <xs:annotation>
+ <xs:documentation>
+ <p>Collection of items to iterate over.</p>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="var" type="cdk:literalExpression">
+ <xs:annotation>
+ <xs:documentation>
+ <p>Name of the exported scoped variable for the current item of the
iteration.
+ This scoped variable has nested visibility. Its type depends on the object
+ of the underlying collection.</p>
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
<!--
<xs:attribute name="begin" type="cdk:elFreeformExpression"
default="0" />
Modified:
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd
===================================================================
---
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd 2010-02-01
14:39:56 UTC (rev 16385)
+++
root/cdk/trunk/plugins/generator/src/main/resources/META-INF/schema/cdk-template.xsd 2010-02-01
15:17:28 UTC (rev 16386)
@@ -216,6 +216,8 @@
<xs:element name="renders-children" type="xs:boolean">
<xs:annotation>
<xs:documentation>
+ <p>Indicating whether generated renderer is responsible for rendering the
children of the component
+ it is asked to render.</p>
<p><span class="usage">Should be used within cc:interface
element.</span></p>
</xs:documentation>
</xs:annotation>
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2010-02-01
14:39:56 UTC (rev 16385)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/RendererTemplateParserTest.java 2010-02-01
15:17:28 UTC (rev 16386)
@@ -270,6 +270,7 @@
assertEquals(new
ClassDescription("org.richfaces.renderkit.html.BasicRendererImpl"), renderer
.getRendererClass());
+ assertFalse(renderer.isRendersChildren());
}
@Test
@@ -285,6 +286,7 @@
assertEquals(new
ClassDescription("org.richfaces.renderkit.html.DummyRendererImpl"), renderer
.getRendererClass());
+ assertTrue(renderer.isRendersChildren());
assertEquals("org.richfaces.Dummy", renderer.getFamily());
assertSame(template, renderer.getTemplate());
Modified:
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java 2010-02-01
14:39:56 UTC (rev 16385)
+++
root/cdk/trunk/plugins/generator/src/test/java/org/richfaces/cdk/templatecompiler/model/TemplateTest.java 2010-02-01
15:17:28 UTC (rev 16386)
@@ -173,13 +173,14 @@
assertEquals("org.richfaces.TreeFamily",
interfaceSection.getComponentFamily());
assertEquals("org.richfaces.TreeRenderer",
interfaceSection.getRendererType());
assertEquals("RF4_XHTML", interfaceSection.getRenderKitId());
- assertFalse(interfaceSection.isRendersChildren());
+ assertEquals(Boolean.FALSE, interfaceSection.getRendersChildren());
}
@Test
public void testAttributes() throws Exception {
Template template = unmarshal(Template.class, TEMPLATE_PROLOG +
+ "<cdk:renders-children>true</cdk:renders-children>"
+
"<cc:attribute name=\"onclick\" />" +
"<cc:attribute name=\"mode\" default=\"ajax\"
/>" +
"<cc:attribute name=\"action\" method-signature=\"void
action()\" />" +
@@ -325,6 +326,8 @@
assertNotNull(clientBehavior);
assertEquals("valueChange", clientBehavior.getEvent());
assertTrue(clientBehavior.isDefaultEvent());
+
+ assertEquals(Boolean.TRUE, interfaceSection.getRendersChildren());
}
@Test
@@ -341,6 +344,8 @@
CompositeInterface interfaceSection = template.getInterface();
assertNotNull(interfaceSection);
+ assertNull(interfaceSection.getRendersChildren());
+
List<ResourceDependency> resourceDependencies =
interfaceSection.getResourceDependencies();
assertNotNull(resourceDependencies);
assertEquals(3, resourceDependencies.size());
Modified:
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy.template.xml
===================================================================
---
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy.template.xml 2010-02-01
14:39:56 UTC (rev 16385)
+++
root/cdk/trunk/plugins/generator/src/test/resources/org/richfaces/cdk/templatecompiler/dummy.template.xml 2010-02-01
15:17:28 UTC (rev 16386)
@@ -8,6 +8,7 @@
<cdk:class>org.richfaces.renderkit.html.DummyRendererImpl</cdk:class>
<cdk:component-family>org.richfaces.Dummy</cdk:component-family>
<cdk:renderkit-id>org.richfaces.CUSTOM_RENDERKIT</cdk:renderkit-id>
+ <cdk:renders-children>true</cdk:renders-children>
<cc:attribute name="onclick">
<cc:clientBehavior event="click" />