Author: jjamrich
Date: 2011-12-05 11:13:21 -0500 (Mon, 05 Dec 2011)
New Revision: 23041
Added:
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
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichDropDownMenuBean.java
Log:
RF-11730: simple simulaiton, but error appears not as expected
Problem is that JS error mentioned in appopriate JIRA appears in second case: when using
c:if instead of ui:fragment to conditional render menu group.
Another difference is that there is no dynamic list of menu groups, just conditionally
rendered menu group.
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:04 UTC (rev 23040)
+++
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)
@@ -22,9 +22,11 @@
package org.richfaces.tests.metamer.bean.rich;
import java.io.Serializable;
+
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
+
import org.richfaces.component.UIDropDownMenu;
import org.richfaces.tests.metamer.Attributes;
import org.slf4j.Logger;
@@ -44,7 +46,10 @@
private static Logger logger;
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;
+
/**
* Initializes the managed bean.
*/
@@ -57,9 +62,8 @@
attributes.setAttribute("mode", "ajax");
attributes.setAttribute("rendered", true);
-
}
-
+
public Attributes getAttributes() {
return attributes;
}
@@ -105,4 +109,13 @@
this.current = "Exit";
return null;
}
+
+ public Boolean getShowClose() {
+ return showClose;
+ }
+
+ public void setShowClose(Boolean showClose) {
+ this.showClose = showClose;
+ }
+
}
Added:
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
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/RF-11730_1.xhtml 2011-12-05
16:13:21 UTC (rev 23041)
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:c="http://java.sun.com/jsp/jstl/core"
+
xmlns:metamer="http://java.sun.com/jsf/composite/metamer">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010-2011, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="view">
+ <f:metadata>
+ <f:viewParam name="templates"
value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="head">
+ <style type="text/css">
+ .rf-ddm-lbl-unsel {
+ border:1px solid #{a4jSkin.panelBorderColor} !important;
+ }
+
+ .optionList {
+ height: 22px;
+ }
+
+ .vertical-menu-cell {
+ padding: 0px 4px 0px 4px;
+ }
+ </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>
+ <br/>
+ <br/>
+
+ <!-- component -->
+ <rich:toolbar id="toolbar" height="26px">
+ <rich:toolbarGroup id="openedTabs"
location="left">
+ <rich:dropDownMenu id="menu-opened-tabs">
+ <f:facet name="label">
+ <h:graphicImage library="images/icons"
name="copy.gif" styleClass="pic" />
+ </f:facet>
+
+ <rich:menuItem id="menuItem1" label="New"
action="#{richDropDownMenuBean.doNew}"
icon="/resources/images/icons/create_doc.gif"/>
+
+ <rich:menuItem id="menuItem2" label="Open"
action="#{richDropDownMenuBean.doOpen}"
icon="/resources/images/icons/open.gif" />
+
+ <rich:menuGroup id="menuGroup3" label="Open
Recent..." disabled="true">
+ <rich:menuItem id="menuItem31"
label="Save" action="#{richDropDownMenuBean.doSave}"
icon="/resources/images/icons/save.gif" />
+ <rich:menuItem id="menuItem32" label="Save
All" action="#{richDropDownMenuBean.doSaveAll}">
+ <f:facet name="icon">
+ <h:graphicImage library="images/icons"
name="save_all.gif" />
+ </f:facet>
+ </rich:menuItem>
+ </rich:menuGroup>
+
+ <rich:menuSeparator id="menuSeparator11" />
+
+ <rich:menuGroup id="menuGroup4" label="Save
As...">
+ <rich:menuItem id="menuItem41"
label="Save" action="#{richDropDownMenuBean.doSave}"
icon="/resources/images/icons/save.gif" />
+ <rich:menuItem id="menuItem42" label="Save
All" action="#{richDropDownMenuBean.doSaveAll}">
+ <f:facet name="icon">
+ <h:graphicImage library="images/icons"
name="save_all.gif" />
+ </f:facet>
+ </rich:menuItem>
+ <rich:menuItem id="menuItem43" label="Send
Online" icon="/resources/images/icons/save.gif" disabled="true"
/>
+ </rich:menuGroup>
+
+ <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>
+
+ <rich:menuSeparator id="menuSeparator12" />
+ <rich:menuItem id="menuItem7" label="Exit"
action="#{richDropDownMenuBean.doExit}" />
+
+ </rich:dropDownMenu>
+ </rich:toolbarGroup>
+ </rich:toolbar>
+
+ <br/>
+ <h:commandButton id="hButton" value="[h] Submit" />
+ <a4j:commandButton id="a4jButton" value="[a4j] Submit"
render="output" />
+
+
+ <br/><br/>
+
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Added:
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
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richDropDownMenu/RF-11730_2.xhtml 2011-12-05
16:13:21 UTC (rev 23041)
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:c="http://java.sun.com/jsp/jstl/core"
+
xmlns:metamer="http://java.sun.com/jsf/composite/metamer">
+
+ <!--
+JBoss, Home of Professional Open Source
+Copyright 2010-2011, Red Hat, Inc. and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ -->
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="view">
+ <f:metadata>
+ <f:viewParam name="templates"
value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="head">
+ <style type="text/css">
+ .rf-ddm-lbl-unsel {
+ border:1px solid #{a4jSkin.panelBorderColor} !important;
+ }
+
+ .optionList {
+ height: 22px;
+ }
+
+ .vertical-menu-cell {
+ padding: 0px 4px 0px 4px;
+ }
+ </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>
+ <br/>
+ <br/>
+
+ <!-- component -->
+ <rich:toolbar id="toolbar" height="26px">
+ <rich:toolbarGroup id="openedTabs"
location="left">
+ <rich:dropDownMenu id="menu-opened-tabs">
+ <f:facet name="label">
+ <h:graphicImage library="images/icons"
name="copy.gif" styleClass="pic" />
+ </f:facet>
+
+ <rich:menuItem id="menuItem1" label="New"
action="#{richDropDownMenuBean.doNew}"
icon="/resources/images/icons/create_doc.gif"/>
+
+ <rich:menuItem id="menuItem2" label="Open"
action="#{richDropDownMenuBean.doOpen}"
icon="/resources/images/icons/open.gif" />
+
+ <rich:menuGroup id="menuGroup3" label="Open
Recent..." disabled="true">
+ <rich:menuItem id="menuItem31"
label="Save" action="#{richDropDownMenuBean.doSave}"
icon="/resources/images/icons/save.gif" />
+ <rich:menuItem id="menuItem32" label="Save
All" action="#{richDropDownMenuBean.doSaveAll}">
+ <f:facet name="icon">
+ <h:graphicImage library="images/icons"
name="save_all.gif" />
+ </f:facet>
+ </rich:menuItem>
+ </rich:menuGroup>
+
+ <rich:menuSeparator id="menuSeparator11" />
+
+ <rich:menuGroup id="menuGroup4" label="Save
As...">
+ <rich:menuItem id="menuItem41"
label="Save" action="#{richDropDownMenuBean.doSave}"
icon="/resources/images/icons/save.gif" />
+ <rich:menuItem id="menuItem42" label="Save
All" action="#{richDropDownMenuBean.doSaveAll}">
+ <f:facet name="icon">
+ <h:graphicImage library="images/icons"
name="save_all.gif" />
+ </f:facet>
+ </rich:menuItem>
+ <rich:menuItem id="menuItem43" label="Send
Online" icon="/resources/images/icons/save.gif" disabled="true"
/>
+ </rich:menuGroup>
+
+ <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>
+
+ <rich:menuSeparator id="menuSeparator12" />
+ <rich:menuItem id="menuItem7" label="Exit"
action="#{richDropDownMenuBean.doExit}" />
+
+ </rich:dropDownMenu>
+ </rich:toolbarGroup>
+ </rich:toolbar>
+
+ <br/>
+ <h:commandButton id="hButton" value="[h] Submit" />
+ <a4j:commandButton id="a4jButton" value="[a4j] Submit"
render="output" />
+
+
+ <br/><br/>
+
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file