Author: lfryc(a)redhat.com
Date: 2010-09-23 07:19:07 -0400 (Thu, 23 Sep 2010)
New Revision: 19322
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/nested-decoration.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/nested-insertion.xhtml
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JRegionBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/nested.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRegion/NestedRegionModel.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRegion/TestNestedRegion.java
Log:
a4j:region tests in nested ui:decorate and ui:insert (RFPL-724)
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JRegionBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JRegionBean.java 2010-09-23
09:32:03 UTC (rev 19321)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JRegionBean.java 2010-09-23
11:19:07 UTC (rev 19322)
@@ -38,7 +38,7 @@
/**
* Managed bean for a4j:region.
- *
+ *
* @author Exadel, Nick Belaevski, <a
href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
@@ -50,7 +50,8 @@
private static final SelectItem[] AVAILABLE_EXECUTE_OPTIONS = new SelectItem[] { new
SelectItem(null, "default"),
new SelectItem("@all"), new SelectItem("@form"), new
SelectItem("@region"), new SelectItem("@this"),
new SelectItem("outerValueInput", "Outer"), new
SelectItem("regionValueInput", "Region"),
- new SelectItem("nestedRegionValueInput", "Nested region") };
+ new SelectItem("nestedRegionValueInput", "Nested region"),
+ new SelectItem("decorationValueInput", "Decoration"), new
SelectItem("insertionValueInput", "Insertion") };
private static Logger logger;
// for page simple.xhtml
private Attributes attributes;
@@ -60,10 +61,48 @@
private String execute;
private String nestedExecute;
private String outerExecute;
+ private String decorationExecute;
+ private String decorationValue;
+ private String insertionExecute;
+
+ public String getInsertionExecute() {
+ return insertionExecute;
+ }
+
+ public void setInsertionExecute(String insertionExecute) {
+ this.insertionExecute = insertionExecute;
+ }
+
+ public String getInsertionValue() {
+ return insertionValue;
+ }
+
+ public void setInsertionValue(String insertionValue) {
+ this.insertionValue = insertionValue;
+ }
+
+ private String insertionValue;
+
+ public String getDecorationExecute() {
+ return decorationExecute;
+ }
+
+ public void setDecorationExecute(String decorationExecute) {
+ this.decorationExecute = decorationExecute;
+ }
+
+ public String getDecorationValue() {
+ return decorationValue;
+ }
+
+ public void setDecorationValue(String decorationValue) {
+ this.decorationValue = decorationValue;
+ }
+
private String outerValue;
private String regionValue;
private String nestedRegionValue;
- private String lastExecutedLinkValue;
+ private String lastExecutedButtonValue;
/**
* Initializes the managed bean.
@@ -160,11 +199,11 @@
}
public void handleBehavior(AjaxBehaviorEvent event) {
- lastExecutedLinkValue = (String)
event.getComponent().getAttributes().get("value");
+ lastExecutedButtonValue = (String)
event.getComponent().getAttributes().get("value");
}
- public String getLastExecutedLinkValue() {
- return lastExecutedLinkValue;
+ public String getLastExecutedButtonValue() {
+ return lastExecutedButtonValue;
}
public void handleDefaultsValueChange(ValueChangeEvent event) {
@@ -172,6 +211,9 @@
setOuterExecute(newValue);
setExecute(newValue);
+ setDecorationExecute(newValue);
+ setInsertionExecute(newValue);
setNestedExecute(newValue);
+
}
}
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/nested-decoration.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/nested-decoration.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/nested-decoration.xhtml 2010-09-23
11:19:07 UTC (rev 19322)
@@ -0,0 +1,57 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2010, 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.
+-->
+
+<!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:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j">
+
+<ui:composition>
+
+ <fieldset>
+
+ <legend>Decoration</legend>
+
+ <h:panelGrid columns="3">
+ <h:inputText id="decorationValueInput"
+ value="#{a4jRegionBean.decorationValue}" />
+
+ <h:commandButton id="decorationValueButton"
value="Decoration">
+ <a4j:ajax id="decorationValueAjax"
+ listener="#{a4jRegionBean.handleBehavior}"
+ execute="#{a4jRegionBean.decorationExecute}"
render="outputValues" />
+ </h:commandButton>
+ <h:selectOneMenu id="decorationSelect"
+ value="#{a4jRegionBean.decorationExecute}">
+ <f:selectItems value="#{a4jRegionBean.executeOptions}" />
+ <a4j:ajax event="change" render="decorationSelect"
execute="@this" />
+ </h:selectOneMenu>
+ </h:panelGrid>
+
+ </fieldset>
+
+</ui:composition>
+
+
+</html>
\ No newline at end of file
Added:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/nested-insertion.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/nested-insertion.xhtml
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/nested-insertion.xhtml 2010-09-23
11:19:07 UTC (rev 19322)
@@ -0,0 +1,55 @@
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2010, 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.
+-->
+
+<!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:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:a4j="http://richfaces.org/a4j">
+
+<ui:composition>
+
+ <fieldset>
+
+ <legend>Insertion</legend>
+
+ <h:panelGrid columns="3">
+ <h:inputText id="insertionValueInput"
+ value="#{a4jRegionBean.insertionValue}" />
+ <h:commandButton id="insertionValueButton"
value="Insertion">
+ <a4j:ajax id="insertionValueAjax"
+ listener="#{a4jRegionBean.handleBehavior}"
+ execute="#{a4jRegionBean.insertionExecute}"
render="outputValues" />
+ </h:commandButton>
+ <h:selectOneMenu id="insertionSelect"
+ value="#{a4jRegionBean.insertionExecute}">
+ <f:selectItems value="#{a4jRegionBean.executeOptions}" />
+ <a4j:ajax event="change" render="insertionSelect"
execute="@this" />
+ </h:selectOneMenu>
+ </h:panelGrid>
+
+ </fieldset>
+
+</ui:composition>
+
+</html>
\ No newline at end of file
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/nested.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/nested.xhtml 2010-09-23
09:32:03 UTC (rev 19321)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/nested.xhtml 2010-09-23
11:19:07 UTC (rev 19322)
@@ -61,26 +61,8 @@
<h:outputLabel id="defaultSelectLabel" value="Defaults
for all" for="defaultsSelect"/>
<h:selectOneMenu id="defaultsSelect"
valueChangeListener="#{a4jRegionBean.handleDefaultsValueChange}">
<f:selectItems value="#{a4jRegionBean.executeOptions}"
/>
- <a4j:ajax event="change" render="outerSelect,
regionSelect, nestedRegionSelect" execute="@this"/>
+ <a4j:ajax event="change" render="outerSelect,
regionSelect, decorationSelect, insertionSelect, nestedRegionSelect"
execute="@this"/>
</h:selectOneMenu>
-
- <h:outputLabel id="outerSelectLabel" value="Outer"
for="outerSelect"/>
- <h:selectOneMenu id="outerSelect"
value="#{a4jRegionBean.outerExecute}">
- <f:selectItems value="#{a4jRegionBean.executeOptions}"
/>
- <a4j:ajax event="change" render="outerSelect"
execute="@this"/>
- </h:selectOneMenu>
-
- <h:outputLabel id="regionSelectLabel"
value="Region" for="regionSelect"/>
- <h:selectOneMenu id="regionSelect"
value="#{a4jRegionBean.execute}">
- <f:selectItems value="#{a4jRegionBean.executeOptions}"
/>
- <a4j:ajax event="change" render="regionSelect"
execute="@this"/>
- </h:selectOneMenu>
-
- <h:outputLabel id="nestedRegionSelectLabel"
value="Nested region" for="nestedRegionSelect" />
- <h:selectOneMenu id="nestedRegionSelect"
value="#{a4jRegionBean.nestedExecute}">
- <f:selectItems value="#{a4jRegionBean.executeOptions}"
/>
- <a4j:ajax event="change"
render="nestedRegionSelect" execute="@this"/>
- </h:selectOneMenu>
</h:panelGrid>
@@ -93,8 +75,10 @@
<h:panelGrid columns="2" >
Outer: <h:outputText id="outerValueOutput"
value="#{a4jRegionBean.outerValue}" />
Region: <h:outputText id="regionValueOutput"
value="#{a4jRegionBean.regionValue}" />
+ Decoration: <h:outputText id="decorationValueOutput"
value="#{a4jRegionBean.decorationValue}" />
+ Insertion: <h:outputText id="insertionValueOutput"
value="#{a4jRegionBean.insertionValue}" />
Nested region: <h:outputText
id="nestedRegionValueOutput"
value="#{a4jRegionBean.nestedRegionValue}" />
- Last executed link value: <h:outputText
id="lastLinkOutput" value="#{a4jRegionBean.lastExecutedLinkValue}"
/>
+ Last executed button value: <h:outputText
id="lastButtonOutput" value="#{a4jRegionBean.lastExecutedButtonValue}"
/>
</h:panelGrid>
</h:panelGroup>
</fieldset>
@@ -104,32 +88,56 @@
<br/>
<br/>
- <h:inputText id="outerValueInput"
value="#{a4jRegionBean.outerValue}" />
+ <!-- OUTER -->
+ <h:panelGrid columns="3">
+ <h:inputText id="outerValueInput"
value="#{a4jRegionBean.outerValue}" />
+
+ <h:commandButton id="outerValueButton"
value="Outer">
+ <a4j:ajax id="outerValueAjax"
listener="#{a4jRegionBean.handleBehavior}"
execute="#{a4jRegionBean.outerExecute}" render="outputValues" />
+ </h:commandButton>
+
+ <h:selectOneMenu id="outerSelect"
value="#{a4jRegionBean.outerExecute}">
+ <f:selectItems value="#{a4jRegionBean.executeOptions}" />
+ <a4j:ajax event="change" render="outerSelect"
execute="@this"/>
+ </h:selectOneMenu>
+ </h:panelGrid>
- <h:commandLink id="outerValueLink" value="Outer">
- <a4j:ajax id="outerValueAjax"
listener="#{a4jRegionBean.handleBehavior}"
execute="#{a4jRegionBean.outerExecute}" render="outputValues" />
- </h:commandLink>
-
+ <!-- REGION -->
<fieldset>
<legend>Region</legend>
+
<a4j:region id="outerRegion">
- <h:inputText id="regionValueInput"
value="#{a4jRegionBean.regionValue}" />
+ <h:panelGrid columns="3">
+ <h:inputText id="regionValueInput"
value="#{a4jRegionBean.regionValue}" />
+
+ <h:commandButton id="regionValueButton"
value="Region">
+ <a4j:ajax id="regionValueAjax"
listener="#{a4jRegionBean.handleBehavior}"
execute="#{a4jRegionBean.execute}" render="outputValues" />
+ </h:commandButton>
+
+ <h:selectOneMenu id="regionSelect"
value="#{a4jRegionBean.execute}">
+ <f:selectItems value="#{a4jRegionBean.executeOptions}"
/>
+ <a4j:ajax event="change"
render="regionSelect" execute="@this"/>
+ </h:selectOneMenu>
+ </h:panelGrid>
+
+ <ui:decorate template="nested-decoration.xhtml" />
+ <ui:decorate template="nested-insertion.xhtml" />
- <h:commandLink id="regionValueLink"
value="Region">
- <a4j:ajax id="regionValueAjax"
listener="#{a4jRegionBean.handleBehavior}"
execute="#{a4jRegionBean.execute}" render="outputValues" />
- </h:commandLink>
-
<fieldset>
<legend>Nested region</legend>
<a4j:region id="nestedRegion">
<h:inputText id="nestedRegionValueInput"
value="#{a4jRegionBean.nestedRegionValue}" />
- <h:commandLink id="nestedRegionValueLink"
value="Nested region">
+ <h:commandButton id="nestedRegionValueButton"
value="Nested region">
<a4j:ajax id="nestedRegionValueAjax"
listener="#{a4jRegionBean.handleBehavior}"
execute="#{a4jRegionBean.nestedExecute}" render="outputValues" />
- </h:commandLink>
-
+ </h:commandButton>
+
+ <h:selectOneMenu id="nestedRegionSelect"
value="#{a4jRegionBean.nestedExecute}">
+ <f:selectItems
value="#{a4jRegionBean.executeOptions}" />
+ <a4j:ajax event="change"
render="nestedRegionSelect" execute="@this"/>
+ </h:selectOneMenu>
</a4j:region>
</fieldset>
</a4j:region>
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRegion/NestedRegionModel.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRegion/NestedRegionModel.java 2010-09-23
09:32:03 UTC (rev 19321)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRegion/NestedRegionModel.java 2010-09-23
11:19:07 UTC (rev 19322)
@@ -74,7 +74,7 @@
}
public enum Component {
- OUTER("Outer"), REGION("Region"), NESTED("Nested
region");
+ OUTER("Outer"), REGION("Region"), NESTED("Nested
region"), DECORATION("Decoration"), INSERTION("Insertion");
public final JQueryLocator select;
public final JQueryLocator output;
@@ -88,7 +88,7 @@
this.select = pjq("select[id$={0}Select]").format(id);
this.output = pjq("span[id$={0}ValueOutput]").format(id);
this.input = pjq("input:text[id$={0}ValueInput]").format(id);
- this.link = pjq("a[id$={0}ValueLink]").format(id);
+ this.link = pjq("input:submit[id$={0}ValueButton]").format(id);
this.executeOption = optionLabel(name);
}
@@ -105,7 +105,8 @@
public enum Execute {
DEFAULT("default"), ALL("@all"), REGION("@region"),
FORM("@form"), THIS("@this"), COMPONENT_OUTER(
- Component.OUTER), COMPONENT_REGION(Component.REGION),
COMPONENT_NESTED(Component.NESTED);
+ Component.OUTER), COMPONENT_REGION(Component.REGION),
COMPONENT_NESTED(Component.NESTED), COMPONENT_DECORATION(
+ Component.DECORATION), COMPONENT_INSERTION(Component.INSERTION);
public final OptionLocator<?> option;
public final Component componentBase;
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRegion/TestNestedRegion.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRegion/TestNestedRegion.java 2010-09-23
09:32:03 UTC (rev 19321)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jRegion/TestNestedRegion.java 2010-09-23
11:19:07 UTC (rev 19322)
@@ -1,6 +1,3 @@
-package org.richfaces.tests.metamer.ftest.a4jRegion;
-
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
/*******************************************************************************
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat, Inc. and individual contributors
@@ -22,6 +19,9 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*******************************************************************************/
+package org.richfaces.tests.metamer.ftest.a4jRegion;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
import static org.testng.Assert.assertEquals;
@@ -88,9 +88,8 @@
}
if (execute == Execute.REGION) {
- if (component == Component.REGION) {
- expectedChanges.add(Component.REGION);
- expectedChanges.add(Component.NESTED);
+ if (EnumSet.of(Component.REGION, Component.INSERTION,
Component.DECORATION).contains(component)) {
+ expectedChanges = EnumSet.complementOf(EnumSet.of(Component.OUTER));
} else if (component == Component.NESTED) {
expectedChanges.add(Component.NESTED);
}