Author: jjamrich
Date: 2011-12-05 11:13:37 -0500 (Mon, 05 Dec 2011)
New Revision: 23042
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichDropDownMenuBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/RF-11730_1.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/RF-11730_2.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/list.xhtml
Log:
RF-11730: add issue simulation with dynamic menu groups
Added example with issue simulation as similar as possible.
Still doesn't get JS error mentioned in JIRA, but dynamic menu group is not rendered
as reported in this JIRA.
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichDropDownMenuBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichDropDownMenuBean.java 2011-12-05
16:13:21 UTC (rev 23041)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichDropDownMenuBean.java 2011-12-05
16:13:37 UTC (rev 23042)
@@ -22,10 +22,14 @@
package org.richfaces.tests.metamer.bean.rich;
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
+import javax.faces.model.SelectItem;
+import javax.faces.model.SelectItemGroup;
import org.richfaces.component.UIDropDownMenu;
import org.richfaces.tests.metamer.Attributes;
@@ -47,9 +51,8 @@
private Attributes attributes;
private String current;
- // value set to true by default. Used to simulate conditional render issue, using
ui:fragment instead of c:if
- private Boolean showClose = true;
-
+ private List<SelectItemGroup> dynamicMenuGroups = new
ArrayList<SelectItemGroup>();
+
/**
* Initializes the managed bean.
*/
@@ -62,8 +65,25 @@
attributes.setAttribute("mode", "ajax");
attributes.setAttribute("rendered", true);
+ initializeDynamicMenuGroups();
}
+ /**
+ * This method/actionListener change list of available tabs (from empty to
initialized and back)
+ */
+ public void changeTabList() {
+ if (dynamicMenuGroups.isEmpty()) {
+ initializeDynamicMenuGroups();
+ } else {
+ dynamicMenuGroups = new ArrayList<SelectItemGroup>();
+ }
+ }
+
+ private void initializeDynamicMenuGroups() {
+ dynamicMenuGroups.add(new SelectItemGroup("Group1", "Menu Group
1", false, new SelectItem[] {}));
+ dynamicMenuGroups.add(new SelectItemGroup("Group2", "Menu Group
2", false, new SelectItem[] {}));
+ }
+
public Attributes getAttributes() {
return attributes;
}
@@ -109,13 +129,12 @@
this.current = "Exit";
return null;
}
-
- public Boolean getShowClose() {
- return showClose;
+
+ public List<SelectItemGroup> getDynamicMenuGroups() {
+ return dynamicMenuGroups;
}
- public void setShowClose(Boolean showClose) {
- this.showClose = showClose;
+ public void setDynamicMenuGroups(List<SelectItemGroup> dynamicMenuGroups) {
+ this.dynamicMenuGroups = dynamicMenuGroups;
}
-
}
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/RF-11730_1.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/RF-11730_1.xhtml 2011-12-05
16:13:21 UTC (rev 23041)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/RF-11730_1.xhtml 2011-12-05
16:13:37 UTC (rev 23042)
@@ -56,18 +56,11 @@
}
</style>
</ui:define>
-
- <ui:define name="outOfTemplateBefore">
- <br/>
- <h:outputText value="Show 'Close'" />
- <h:selectBooleanCheckbox id="showClose"
value="#{richDropDownMenuBean.showClose}">
- <a4j:ajax render="#{nestedComponentId}
menu-opened-tabs"/>
- </h:selectBooleanCheckbox>
- </ui:define>
-
+
<ui:define name="component">
- <i>This menu contains conditionally rendered menu item (labeled
'Close').<br/>
+ <i>This menu contains conditionally rendered menu item (labeled
'Menu group 1,2 or Empty Menu Group')
+ placed after item labeled 'Print'<br/>
Using ui:fragment with @rendered causes error, and this option is not
displayed, even condition is met.
</i>
<br/>
@@ -108,12 +101,19 @@
<rich:menuItem id="menuItem5"
label="Print" action="#{richDropDownMenuBean.doPrint}"
disabled="true"/>
- <ui:fragment
rendered="${richDropDownMenuBean.showClose}" >
- <rich:menuGroup id="menu-group1"
label="Conditional Menu Group">
- <rich:menuItem id="menuItem6"
label="Close" action="#{richDropDownMenuBean.doClose}" />
- </rich:menuGroup>
+ <ui:fragment rendered="${empty
richDropDownMenuBean.dynamicMenuGroups}" >
+ <rich:menuItem label="Empty Menu Group" />
</ui:fragment>
+ <ui:fragment rendered="${not empty
richDropDownMenuBean.dynamicMenuGroups}" >
+ <c:forEach
items="#{richDropDownMenuBean.dynamicMenuGroups}" var="tab">
+ <rich:menuGroup id="menu-group-#{tab.label}"
label="#{tab.description}">
+ <rich:menuItem label="Sub Item 1"
/>
+ <rich:menuItem label="Sub Item 2"
/>
+ </rich:menuGroup>
+ </c:forEach>
+ </ui:fragment>
+
<rich:menuSeparator id="menuSeparator12" />
<rich:menuItem id="menuItem7" label="Exit"
action="#{richDropDownMenuBean.doExit}" />
@@ -121,11 +121,10 @@
</rich:toolbarGroup>
</rich:toolbar>
- <br/>
- <h:commandButton id="hButton" value="[h] Submit" />
- <a4j:commandButton id="a4jButton" value="[a4j] Submit"
render="output" />
+ <br/>
+ <a4j:commandButton id="a4jButton" value="[a4j] Change list
of tabs" render="menu-opened-tabs"
+ actionListener="${richDropDownMenuBean.changeTabList}" />
-
<br/><br/>
</ui:define>
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/RF-11730_2.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/RF-11730_2.xhtml 2011-12-05
16:13:21 UTC (rev 23041)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/RF-11730_2.xhtml 2011-12-05
16:13:37 UTC (rev 23042)
@@ -57,18 +57,11 @@
</style>
</ui:define>
- <ui:define name="outOfTemplateBefore">
- <br/>
- <h:outputText value="Show 'Close'" />
- <h:selectBooleanCheckbox id="showClose"
value="#{richDropDownMenuBean.showClose}">
- <a4j:ajax render="#{nestedComponentId}
menu-opened-tabs"/>
- </h:selectBooleanCheckbox>
- </ui:define>
-
<ui:define name="component">
- <i>This menu contains conditionally rendered menu item (labeled
'Close').<br/>
- Using ui:fragment with @rendered causes error, and this option is not
displayed, even condition is met.
+ <i>This menu contains conditionally rendered menu item (labeled
'Menu group 1,2 or Empty Menu Group')
+ placed after item labeled 'Print'<br/>
+ In this example is c:if with @test used and everything should work as
expected.
</i>
<br/>
<br/>
@@ -108,12 +101,19 @@
<rich:menuItem id="menuItem5"
label="Print" action="#{richDropDownMenuBean.doPrint}"
disabled="true"/>
- <c:if test="${richDropDownMenuBean.showClose}" >
- <rich:menuGroup id="menu-group1"
label="Conditional Menu Group">
- <rich:menuItem id="menuItem6"
label="Close" action="#{richDropDownMenuBean.doClose}" />
- </rich:menuGroup>
+ <c:if test="${empty
richDropDownMenuBean.dynamicMenuGroups}" >
+ <rich:menuItem label="Empty Menu Item" />
</c:if>
+ <c:if test="${not empty
richDropDownMenuBean.dynamicMenuGroups}" >
+ <c:forEach
items="#{richDropDownMenuBean.dynamicMenuGroups}" var="tab">
+ <rich:menuGroup id="menu-group-#{tab.label}"
label="#{tab.description}">
+ <rich:menuItem label="Sub Item 1"
/>
+ <rich:menuItem label="Sub Item 2"
/>
+ </rich:menuGroup>
+ </c:forEach>
+ </c:if>
+
<rich:menuSeparator id="menuSeparator12" />
<rich:menuItem id="menuItem7" label="Exit"
action="#{richDropDownMenuBean.doExit}" />
@@ -122,10 +122,9 @@
</rich:toolbar>
<br/>
- <h:commandButton id="hButton" value="[h] Submit" />
- <a4j:commandButton id="a4jButton" value="[a4j] Submit"
render="output" />
+ <a4j:commandButton id="a4jButton" value="[a4j] Change list
of tabs" render="menu-opened-tabs"
+ actionListener="${richDropDownMenuBean.changeTabList}" />
-
<br/><br/>
</ui:define>
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/list.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/list.xhtml 2011-12-05
16:13:21 UTC (rev 23041)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/list.xhtml 2011-12-05
16:13:37 UTC (rev 23042)
@@ -38,6 +38,16 @@
<metamer:testPageLink id="sideMenu" outcome="sideMenu"
value="Side Menu">
Page containing several <b>rich:dropDownMenu</b>s and inputs
for all attributes.
</metamer:testPageLink>
+
+ <metamer:testPageLink id="RF-11730_1"
outcome="RF-11730_1" value="RF-11730 with ui:fragment">
+ Page containing <b>rich:dropDownMenu</b> with dynamic menu
groups using ui:fragment and @rendered
+ simulating <a
href="https://issues.jboss.org/browse/RF-11730">RF-11730<...
+ </metamer:testPageLink>
+
+ <metamer:testPageLink id="RF-11730_2"
outcome="RF-11730_2" value="RF-11730 with c:if">
+ Page containing <b>rich:dropDownMenu</b> with dynamic menu
groups using c:if and @test
+ simulating <a
href="https://issues.jboss.org/browse/RF-11730">RF-11730<...
+ </metamer:testPageLink>
</ui:define>