Author: ppitonak(a)redhat.com
Date: 2010-07-27 09:01:36 -0400 (Tue, 27 Jul 2010)
New Revision: 18245
Added:
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JRegionBean.java
root/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/
root/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/list.xhtml
root/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/nested.xhtml
root/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/simple.xhtml
root/tests/metamer/trunk/application/src/main/webapp/resources/css/a4jRegion.css
Modified:
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
* added a4j:region (two pages)
Added:
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JRegionBean.java
===================================================================
---
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JRegionBean.java
(rev 0)
+++
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JRegionBean.java 2010-07-27
13:01:36 UTC (rev 18245)
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * 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.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.bean;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import javax.faces.event.AjaxBehaviorEvent;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.model.SelectItem;
+
+import org.richfaces.component.UIRegion;
+import org.richfaces.tests.metamer.Attributes;
+import org.richfaces.tests.metamer.model.Employee;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for a4j:region.
+ *
+ * @author Exadel, Nick Belaevski, <a
href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "a4jRegionBean")
+@SessionScoped
+public class A4JRegionBean implements Serializable {
+
+ private static final long serialVersionUID = -1L;
+ private static final SelectItem[] AVAILABLE_EXECUTE_OPTIONS = new SelectItem[]{
+ new SelectItem(null, "default"), new SelectItem("@region"),
new SelectItem("@all"), new SelectItem("@this")
+ };
+ private static Logger logger;
+ // for page simple.xhtml
+ private Attributes attributes;
+ private Employee user1;
+ private Employee user2;
+ // for page nested.xhtml
+ private String execute;
+ private String nestedExecute;
+ private String outerExecute;
+ private String outerValue;
+ private String regionValue;
+ private String nestedRegionValue;
+ private String lastExecutedLinkValue;
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.info("initializing bean " + getClass().getName());
+
+ user1 = new Employee();
+ user2 = new Employee();
+
+ attributes = Attributes.getUIComponentAttributes(UIRegion.class, getClass());
+ attributes.setAttribute("rendered", true);
+
+ }
+
+ // getters and setters for page simple.xhtml
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+ public Employee getUser1() {
+ return user1;
+ }
+
+ public void setUser1(Employee user1) {
+ this.user1 = user1;
+ }
+
+ public Employee getUser2() {
+ return user2;
+ }
+
+ public void setUser2(Employee user2) {
+ this.user2 = user2;
+ }
+
+ // getters and setters for page nested.xhtml
+ public SelectItem[] getExecuteOptions() {
+ return AVAILABLE_EXECUTE_OPTIONS;
+ }
+
+ public String getOuterValue() {
+ return outerValue;
+ }
+
+ public void setOuterValue(String outerValue) {
+ this.outerValue = outerValue;
+ }
+
+ public String getRegionValue() {
+ return regionValue;
+ }
+
+ public void setRegionValue(String value) {
+ this.regionValue = value;
+ }
+
+ public String getNestedRegionValue() {
+ return nestedRegionValue;
+ }
+
+ public void setNestedRegionValue(String nestedValue) {
+ this.nestedRegionValue = nestedValue;
+ }
+
+ public String getExecute() {
+ return execute;
+ }
+
+ public void setExecute(String execute) {
+ this.execute = execute;
+ }
+
+ public String getNestedExecute() {
+ return nestedExecute;
+ }
+
+ public void setNestedExecute(String nestedExecute) {
+ this.nestedExecute = nestedExecute;
+ }
+
+ public String getOuterExecute() {
+ logger.error("getOuterExecute " + outerExecute);
+ return outerExecute;
+ }
+
+ public void setOuterExecute(String outerExecute) {
+ logger.error("setOuterExecute " + outerExecute);
+ this.outerExecute = outerExecute;
+ }
+
+ public void handleBehavior(AjaxBehaviorEvent event) {
+ lastExecutedLinkValue = (String)
event.getComponent().getAttributes().get("value");
+ }
+
+ public String getLastExecutedLinkValue() {
+ return lastExecutedLinkValue;
+ }
+
+ public void handleDefaultsValueChange(ValueChangeEvent event) {
+ String newValue = (String) event.getNewValue();
+
+ setOuterExecute(newValue);
+ setExecute(newValue);
+ setNestedExecute(newValue);
+ }
+}
Property changes on:
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JRegionBean.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Modified:
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
===================================================================
---
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-07-27
12:10:43 UTC (rev 18244)
+++
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-07-27
13:01:36 UTC (rev 18245)
@@ -101,6 +101,7 @@
components.put("a4jParam", "A4J Action Parameter");
components.put("a4jPoll", "A4J Poll");
components.put("a4jPush", "A4J Push");
+ components.put("a4jRegion", "A4J Region");
components.put("a4jRepeat", "A4J Repeat");
components.put("commandButton", "JSF Command Button");
components.put("richDataGrid", "Rich Data Grid");
Added:
root/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/list.xhtml
===================================================================
--- root/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/list.xhtml
(rev 0)
+++
root/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/list.xhtml 2010-07-27
13:01:36 UTC (rev 18245)
@@ -0,0 +1,44 @@
+<!--
+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"
+
xmlns:c="http://java.sun.com/jsp/jstl/core">
+
+ <h:head>
+ <title>A4J Region</title>
+ <meta http-equiv="Content-Type" content="text/xhtml;
charset=UTF-8" />
+ <h:outputStylesheet library="css" name="list.css" />
+ </h:head>
+
+ <h:body>
+
+ <h:link outcome="simple" value="Simple"
styleClass="link" />
+ <div class="description">Simple page that contains
<b>a4j:region</b> and
+ input boxes for all its attributes.</div>
+
+ <h:link outcome="nested" value="Nested regions"
styleClass="link" />
+ <div class="description">Simple page that contains nested
<b>a4j:region</b>s.</div>
+
+ </h:body>
+</html>
\ No newline at end of file
Added:
root/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/nested.xhtml
===================================================================
---
root/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/nested.xhtml
(rev 0)
+++
root/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/nested.xhtml 2010-07-27
13:01:36 UTC (rev 18245)
@@ -0,0 +1,143 @@
+<!--
+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"
+
xmlns:ta="http://java.sun.com/jsf/composite/testapp"
xmlns:rich="http://richfaces.org/rich">
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates"
value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+
+ <h:outputStylesheet library="css" name="a4jRegion.css"
/>
+
+ <script type="text/javascript">/*<![CDATA[*/
+ function randomize() {
+
jQuery("input[type='text']").each(function() {
+ var letters =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ var val = "";
+
+ for (var i = 0; i < 8; i++) {
+ var letter =
letters.charAt(Math.floor(letters.length * Math.random()));
+ val += letter;
+ }
+
+ this.value = val;
+ });
+ }
+ /*]]>*/</script>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+
+ <h:panelGrid columns="2">
+ <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"/>
+ </h:selectOneMenu>
+
+ <h:outputLabel id="outerSelectLabel" value="Out of
region" for="outerSelect"/>
+ <h:selectOneMenu id="outerSelect"
value="#{a4jRegionBean.outerExecute}" onchange="submit()">
+ <f:selectItems value="#{a4jRegionBean.executeOptions}"
/>
+ </h:selectOneMenu>
+
+ <h:outputLabel id="regionSelectLabel"
value="Region" for="regionSelect"/>
+ <h:selectOneMenu id="regionSelect"
value="#{a4jRegionBean.execute}" onchange="submit()">
+ <f:selectItems value="#{a4jRegionBean.executeOptions}"
/>
+ </h:selectOneMenu>
+
+ <h:outputLabel id="nestedRegionSelectLabel"
value="Nested region" for="nestedRegionSelect" />
+ <h:selectOneMenu id="nestedRegionSelect"
value="#{a4jRegionBean.nestedExecute}" onchange="submit()">
+ <f:selectItems value="#{a4jRegionBean.executeOptions}"
/>
+ </h:selectOneMenu>
+ </h:panelGrid>
+
+
+ <br/>
+
+ <fieldset>
+ <legend>outputs</legend>
+
+ <h:panelGroup layout="block"
id="outputValues">
+ <h:panelGrid columns="2" >
+ Outer: <h:outputText id="outerValueOutput"
value="#{a4jRegionBean.outerValue}" />
+ Region: <h:outputText id="regionValueOutput"
value="#{a4jRegionBean.regionValue}" />
+ Nested region: <h:outputText
id="nestedRegionValueOutput"
value="#{a4jRegionBean.nestedRegionValue}" />
+ Last executed link value: <h:outputText
id="lastLinkOutput" value="#{a4jRegionBean.lastExecutedLinkValue}"
/>
+ </h:panelGrid>
+ </h:panelGroup>
+ </fieldset>
+
+ <br/>
+ <button id="generateValuesButton" type="button"
onclick="randomize()">Generate random values</button>
+ <br/>
+ <br/>
+
+ <h:inputText id="outerValueInput"
value="#{a4jRegionBean.outerValue}" />
+
+ <h:commandLink id="outerValueLink" value="Out of
region">
+ <a4j:ajax id="outerValueAjax"
listener="#{a4jRegionBean.handleBehavior}"
execute="#{a4jRegionBean.outerExecute}" render="outputValues" />
+ </h:commandLink>
+
+ <fieldset>
+ <legend>Region</legend>
+
+ <a4j:region id="outerRegion">
+ <h:inputText id="regionValueInput"
value="#{a4jRegionBean.regionValue}" />
+
+ <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">
+ <a4j:ajax id="nestedRegionValueAjax"
listener="#{a4jRegionBean.handleBehavior}"
execute="#{a4jRegionBean.nestedExecute}" render="outputValues" />
+ </h:commandLink>
+
+ </a4j:region>
+ </fieldset>
+ </a4j:region>
+ </fieldset>
+
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Added:
root/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/simple.xhtml
===================================================================
---
root/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/simple.xhtml
(rev 0)
+++
root/tests/metamer/trunk/application/src/main/webapp/components/a4jRegion/simple.xhtml 2010-07-27
13:01:36 UTC (rev 18245)
@@ -0,0 +1,105 @@
+<!--
+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"
+
xmlns:ta="http://java.sun.com/jsf/composite/testapp"
xmlns:rich="http://richfaces.org/rich">
+
+ <ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="head">
+ <f:metadata>
+ <f:viewParam name="templates"
value="#{templateBean.templates}">
+ <f:converter converterId="templatesListConverter" />
+ </f:viewParam>
+ </f:metadata>
+ <h:outputStylesheet library="css" name="a4jRegion.css"
/>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+
+ <fieldset>
+ <legend>User info panel explicitly executed by ID</legend>
+
+ <h:panelGrid columns="2">
+ <h:panelGrid columns="2" id="inputPanel1">
+ <h:outputText value="Name: " />
+ <h:inputText id="user1NameInput"
value="#{a4jRegionBean.user1.name}">
+ <a4j:ajax render="outputPanel1"
event="keyup" execute="inputPanel1" />
+ </h:inputText>
+ <h:outputText value="Email: " />
+ <h:inputText id="user1EmailInput"
value="#{a4jRegionBean.user1.email}">
+ <a4j:ajax render="outputPanel1"
event="keyup" execute="inputPanel1" />
+ </h:inputText>
+ </h:panelGrid>
+
+ <h:panelGrid columns="2"
id="outputPanel1">
+ <h:outputText value="Entered name:" />
+ <h:outputText id="user1NameOutput"
value="#{a4jRegionBean.user1.name}" />
+ <h:outputText value="Entered email:" />
+ <h:outputText id="user1EmailOutput"
value="#{a4jRegionBean.user1.email}" />
+ </h:panelGrid>
+ </h:panelGrid>
+
+ </fieldset>
+
+ <br/>
+
+ <fieldset>
+ <legend>User info panel with a4j:region</legend>
+
+ <h:panelGrid columns="2">
+ <a4j:region id="a4jRegion"
+
rendered="#{a4jRegionBean.attributes['rendered'].value}">
+ <h:panelGrid columns="2"
id="inputPanel2">
+ <h:outputText value="Name: " />
+ <h:inputText id="user2NameInput"
value="#{a4jRegionBean.user2.name}">
+ <a4j:ajax render="outputPanel2"
event="keyup" />
+ </h:inputText>
+ <h:outputText value="Email: " />
+ <h:inputText id="user2EmailInput"
value="#{a4jRegionBean.user2.email}">
+ <a4j:ajax render="outputPanel2"
event="keyup" />
+ </h:inputText>
+ </h:panelGrid>
+ </a4j:region>
+
+ <h:panelGrid columns="2"
id="outputPanel2">
+ <h:outputText value="Entered name:" />
+ <h:outputText id="user2NameOutput"
value="#{a4jRegionBean.user2.name}" />
+ <h:outputText value="Entered email:" />
+ <h:outputText id="user2EmailOutput"
value="#{a4jRegionBean.user2.email}" />
+ </h:panelGrid>
+
+ </h:panelGrid>
+ </fieldset>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <ta:attributes value="#{a4jRegionBean.attributes}"
id="attributes" />
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/application/src/main/webapp/resources/css/a4jRegion.css
===================================================================