Author: lfryc(a)redhat.com
Date: 2010-12-07 08:08:57 -0500 (Tue, 07 Dec 2010)
New Revision: 20435
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Template.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/TemplateBean.java
modules/tests/metamer/trunk/application/src/main/webapp/templates/header.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/templates/template.xhtml
Log:
inferring nested component ID (RFPL-952)
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Template.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Template.java 2010-12-07
13:04:34 UTC (rev 20434)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Template.java 2010-12-07
13:08:57 UTC (rev 20435)
@@ -30,17 +30,17 @@
* @version $Revision$
*/
public enum Template {
- PLAIN ("plain", "Plain"),
- REDDIV ("redDiv", "Red div"),
- BLUEDIV ("blueDiv", "Blue div"),
- RICHDATATABLE1 ("richDataTable1", "Rich Data Table Row 1"),
- RICHDATATABLE2 ("richDataTable2", "Rich Data Table Row 2"),
- HDATATABLE1 ("hDataTable1", "JSF Data Table Row 1"),
- HDATATABLE2 ("hDataTable2", "JSF Data Table Row 2"),
- UIREPEAT1 ("uiRepeat1", "UI Repeat Row 1"),
- UIREPEAT2 ("uiRepeat2", "UI Repeat Row 2"),
- A4JREPEAT1 ("a4jRepeat1", "A4J Repeat Row 1"),
- A4JREPEAT2 ("a4jRepeat2", "A4J Repeat Row 2");
+ PLAIN ("plain", "Plain", ""),
+ REDDIV ("redDiv", "Red div", ""),
+ BLUEDIV ("blueDiv", "Blue div", ""),
+ RICHDATATABLE1 ("richDataTable1", "Rich Data Table Row 1",
"containerRichDataTable1:0:"),
+ RICHDATATABLE2 ("richDataTable2", "Rich Data Table Row 2",
"containerRichDataTable1:1:"),
+ HDATATABLE1 ("hDataTable1", "JSF Data Table Row 1",
"containerHDataTable1:0:"),
+ HDATATABLE2 ("hDataTable2", "JSF Data Table Row 2",
"containerHDataTable1:1:"),
+ UIREPEAT1 ("uiRepeat1", "UI Repeat Row 1",
"containerUiRepeat1:0:"),
+ UIREPEAT2 ("uiRepeat2", "UI Repeat Row 2",
"containerUiRepeat1:1:"),
+ A4JREPEAT1 ("a4jRepeat1", "A4J Repeat Row 1",
"containerA4JRepeat1:0:"),
+ A4JREPEAT2 ("a4jRepeat2", "A4J Repeat Row 2",
"containerA4JRepeat1:0:");
/**
* identifier of a template
@@ -51,6 +51,11 @@
* human-readable name of the template
*/
private String desc;
+
+ /**
+ * prefix of the component nested in this template
+ */
+ private String nestedComponentPrefix;
/**
* Private constructor.
@@ -58,9 +63,10 @@
* @param name
* @param prefix
*/
- private Template(String name, String desc) {
+ private Template(String name, String desc, String nestedComponentPrefix) {
this.name = name;
this.desc = desc;
+ this.nestedComponentPrefix = nestedComponentPrefix;
}
/**
@@ -78,6 +84,14 @@
public String getDesc() {
return desc;
}
+
+ /**
+ * Returns the prefix of component nested in this template
+ * @return
+ */
+ public String getNestedComponentPrefix() {
+ return nestedComponentPrefix;
+ }
/* (non-Javadoc)
* @see java.lang.Enum#toString()
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/TemplateBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/TemplateBean.java 2010-12-07
13:04:34 UTC (rev 20434)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/TemplateBean.java 2010-12-07
13:08:57 UTC (rev 20435)
@@ -77,6 +77,14 @@
this.templates.add(t);
}
}
+
+ public String getComponentPrefix() {
+ StringBuffer prefix = new StringBuffer("form:");
+ for (Template template : templates) {
+ prefix.append(template.getNestedComponentPrefix());
+ }
+ return prefix.toString();
+ }
public List<SelectItem> getAvailableTemplates() {
List<SelectItem> retVal = new ArrayList<SelectItem>();
Modified: modules/tests/metamer/trunk/application/src/main/webapp/templates/header.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/templates/header.xhtml 2010-12-07
13:04:34 UTC (rev 20434)
+++
modules/tests/metamer/trunk/application/src/main/webapp/templates/header.xhtml 2010-12-07
13:08:57 UTC (rev 20435)
@@ -44,7 +44,7 @@
</h:commandLink>
<h:graphicImage id="reRenderAllImage"
library="images" name="refresh.png" title="Rerender All"
style="width: 36px;" alt="Rerender
All">
- <a4j:ajax event="click"
render="commonGrid" />
+ <a4j:ajax event="click" render="@all"
/>
</h:graphicImage>
</h:panelGrid>
</h:form>
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/templates/template.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/templates/template.xhtml 2010-12-07
13:04:34 UTC (rev 20434)
+++
modules/tests/metamer/trunk/application/src/main/webapp/templates/template.xhtml 2010-12-07
13:08:57 UTC (rev 20435)
@@ -44,6 +44,10 @@
<div class="messages"><h:messages /></div>
<h:panelGroup id="commonGrid" layout="block"
rendered="#{richBean.reComponent}">
+
+ <c:set var="nestedPrefix"
value="#{templateBean.componentPrefix}" />
+ <c:set var="nestedComponentId"
value="#{templateBean.componentPrefix}#{componentId}" />
+
<c:choose>
<c:when test="#{dontRenderForm}">
<div style="margin-bottom: 20px;"><ui:insert
name="outOfTemplateBefore" /></div>