[richfaces-svn-commits] JBoss Rich Faces SVN: r18585 - in modules/tests/metamer/trunk/application/src/main: webapp/components and 1 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Thu Aug 12 08:08:35 EDT 2010


Author: ppitonak at redhat.com
Date: 2010-08-12 08:08:35 -0400 (Thu, 12 Aug 2010)
New Revision: 18585

Added:
   modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JStatusBean.java
   modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/
   modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/list.xhtml
   modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/referencedUsage.xhtml
   modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/simple.xhtml
   modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/viewUsage.xhtml
Modified:
   modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
RFPL-735

* added three pages for a4j:status testing status outside form, inside form and named statuses


Added: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JStatusBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JStatusBean.java	                        (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JStatusBean.java	2010-08-12 12:08:35 UTC (rev 18585)
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * 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.application.FacesMessage;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+import javax.faces.validator.ValidatorException;
+import org.richfaces.component.UIStatus;
+
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for a4j:status.
+ *
+ * @author <a href="mailto:ppitonak at redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+ at ManagedBean(name = "a4jStatusBean")
+ at ViewScoped
+public class A4JStatusBean implements Serializable {
+
+    private static final long serialVersionUID = -1L;
+    private static Logger logger;
+    private Attributes attributes;
+
+    /**
+     * Initializes the managed bean.
+     */
+    @PostConstruct
+    public void init() {
+        logger = LoggerFactory.getLogger(getClass());
+        logger.debug("initializing bean " + getClass().getName());
+
+        attributes = Attributes.getUIComponentAttributes(UIStatus.class, getClass());
+        attributes.setAttribute("rendered", true);
+    }
+
+    public Attributes getAttributes() {
+        return attributes;
+    }
+
+    public void setAttributes(Attributes attributes) {
+        this.attributes = attributes;
+    }
+
+    /**
+     * Action that causes an error. Suitable for testing 'onerror' attribute.
+     * 
+     * @return method never returns any value
+     * @throws ValidationException thrown always
+     */
+    public String causeError() {
+        throw new ValidatorException(new FacesMessage("Ajax request caused an error."));
+    }
+
+    /**
+     * Action that creates a 2-second delay.
+     * 
+     * @throws InterruptedException if any thread has interrupted the current thread. The interrupted
+     * status of the current thread is cleared when this exception is thrown.
+     */
+    public void delay() throws InterruptedException {
+        Thread.sleep(2000);
+    }
+}


Property changes on: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JStatusBean.java
___________________________________________________________________
Name: svn:keywords
   + Revision

Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java	2010-08-12 10:11:17 UTC (rev 18584)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java	2010-08-12 12:08:35 UTC (rev 18585)
@@ -105,6 +105,7 @@
         components.put("a4jQueue", "A4J Queue");
         components.put("a4jRegion", "A4J Region");
         components.put("a4jRepeat", "A4J Repeat");
+        components.put("a4jStatus", "A4J Status");
         components.put("commandButton", "JSF Command Button");
         components.put("hDataTable", "JSF Data Table");
         components.put("richComponentControl", "Rich Component Control");

Added: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/list.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/list.xhtml	                        (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/list.xhtml	2010-08-12 12:08:35 UTC (rev 18585)
@@ -0,0 +1,49 @@
+<!--
+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:ui="http://java.sun.com/jsf/facelets"
+      xmlns:metamer="http://java.sun.com/jsf/composite/metamer">
+
+    <ui:composition template="/templates/list.xhtml">
+
+        <ui:define name="pageTitle">A4J Status</ui:define>
+
+        <ui:define name="links">
+
+            <metamer:testPageLink id="simple" outcome="simple" value="Simple">
+                Page that contains an <b>a4j:status</b> placed inside a form and input boxes for all its attributes.
+            </metamer:testPageLink>
+
+            <metamer:testPageLink id="viewUsage" outcome="viewUsage" value="Common Status for View">
+                Page that contains an <b>a4j:status</b> placed ouside of form so that it is common for whole view.
+            </metamer:testPageLink>
+
+            <metamer:testPageLink id="referencedUsage" outcome="referencedUsage" value="Referenced Usage">
+                Page that contains two text inputs and two <b>a4j:status</b>es (one for each input).
+            </metamer:testPageLink>
+
+        </ui:define>
+
+    </ui:composition>
+
+</html>

Added: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/referencedUsage.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/referencedUsage.xhtml	                        (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/referencedUsage.xhtml	2010-08-12 12:08:35 UTC (rev 18585)
@@ -0,0 +1,69 @@
+<!--
+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:metamer="http://java.sun.com/jsf/composite/metamer"
+      xmlns:c="http://java.sun.com/jsp/jstl/core">
+
+    <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>
+        </ui:define>
+
+        <ui:define name="outOfTemplateBefore">
+        </ui:define>
+
+        <ui:define name="component">
+            <a4j:jsFunction name="statusFunction1" status="status1" action="#{a4jStatusBean.delay}" />
+            <a4j:jsFunction name="statusFunction2" status="status2" action="#{a4jStatusBean.delay}" />
+
+            <h:panelGrid columns="2">
+
+                <h:commandButton id="button1" value="Named status 1" onclick="statusFunction1(); return false;" />
+                <a4j:status name="status1">
+                    <f:facet name="start">
+                        <h:outputText id="statusText1" style="color: red;" value="WORKING"/>
+                    </f:facet>
+                </a4j:status>
+
+                <h:commandButton id="button2" value="Named status 2" onclick="statusFunction2(); return false;" />
+                <a4j:status name="status2">
+                    <f:facet name="start">
+                        <h:outputText id="statusText2" style="color: red;" value="WORKING"/>
+                    </f:facet>
+                </a4j:status>
+            </h:panelGrid>
+
+        </ui:define>
+
+        <ui:define name="outOfTemplateAfter">
+        </ui:define>
+
+    </ui:composition>
+</html>
\ No newline at end of file

Added: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/simple.xhtml	                        (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/simple.xhtml	2010-08-12 12:08:35 UTC (rev 18585)
@@ -0,0 +1,74 @@
+<!--
+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:metamer="http://java.sun.com/jsf/composite/metamer"
+      xmlns:c="http://java.sun.com/jsp/jstl/core">
+
+    <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>
+        </ui:define>
+
+        <ui:define name="outOfTemplateBefore">
+        </ui:define>
+
+        <ui:define name="component">
+            <fieldset style="height: 3em">
+                <legend>status (inside form)</legend>
+                <a4j:status id="status"
+                            converter="#{a4jStatusBean.attributes['converter'].value}"
+                            localValue="#{a4jStatusBean.attributes['localValue'].value}"
+                            onerror="#{a4jStatusBean.attributes['onerror'].value}"
+                            onstart="#{a4jStatusBean.attributes['onstart'].value}"
+                            onstop="#{a4jStatusBean.attributes['onstop'].value}"
+                            onsuccess="#{a4jStatusBean.attributes['onsuccess'].value}"
+                            rendered="#{a4jStatusBean.attributes['rendered'].value}"
+                            value="#{a4jStatusBean.attributes['value'].value}">
+                    <f:facet name="start">
+                        <h:outputText id="statusText" style="font-size: large; color: red;" value="WORKING"/>
+                    </f:facet>
+                </a4j:status>
+            </fieldset>
+
+            <br/>
+            <a4j:commandButton id="button1" value="Send Ajax Request"/>
+            <br/>
+            <a4j:commandButton id="button2" value="Send Ajax Request"/>
+            <br/>
+            <a4j:commandButton id="button3" value="Send Ajax Request Causing Error" action="#{a4jStatusBean.causeError}"/>
+
+        </ui:define>
+
+        <ui:define name="outOfTemplateAfter">
+            <metamer:attributes value="#{a4jStatusBean.attributes}" id="attributes" />
+        </ui:define>
+
+    </ui:composition>
+</html>
\ No newline at end of file

Added: modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/viewUsage.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/viewUsage.xhtml	                        (rev 0)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/a4jStatus/viewUsage.xhtml	2010-08-12 12:08:35 UTC (rev 18585)
@@ -0,0 +1,91 @@
+<!--
+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:metamer="http://java.sun.com/jsf/composite/metamer"
+      xmlns:c="http://java.sun.com/jsp/jstl/core">
+
+    <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>
+                <c:set var="dontRenderForm" value="#{true}"/>
+            </f:metadata>
+        </ui:define>
+
+        <ui:define name="outOfTemplateBefore">
+        </ui:define>
+
+        <ui:define name="component">
+            <fieldset style="height: 3em">
+                <legend>status (outside form)</legend>
+                <a4j:status id="status"
+                            converter="#{a4jStatusBean.attributes['converter'].value}"
+                            localValue="#{a4jStatusBean.attributes['localValue'].value}"
+                            onerror="#{a4jStatusBean.attributes['onerror'].value}"
+                            onstart="#{a4jStatusBean.attributes['onstart'].value}"
+                            onstop="#{a4jStatusBean.attributes['onstop'].value}"
+                            onsuccess="#{a4jStatusBean.attributes['onsuccess'].value}"
+                            rendered="#{a4jStatusBean.attributes['rendered'].value}"
+                            value="#{a4jStatusBean.attributes['value'].value}">
+                    <f:facet name="start">
+                        <h:outputText id="statusText" style="font-size: large; color: red;" value="WORKING"/>
+                    </f:facet>
+                </a4j:status>
+            </fieldset>
+
+            <fieldset>
+                <legend>form1</legend>
+                <h:form id="form1">
+                    <a4j:commandButton id="button1" value="Send Ajax Request"/>
+                </h:form>
+            </fieldset>
+
+            <fieldset>
+                <legend>form2</legend>
+                <h:form id="form2">
+                    <a4j:commandButton id="button2" value="Send Ajax Request"/>
+                </h:form>
+            </fieldset>
+
+            <fieldset>
+                <legend>form3</legend>
+                <h:form id="form3">
+                    <a4j:commandButton id="button3" value="Send Ajax Request Causing Error" action="#{a4jStatusBean.causeError}"/>
+                </h:form>
+            </fieldset>
+
+        </ui:define>
+
+        <ui:define name="outOfTemplateAfter">
+            <h:form id="attributesForm">
+                <metamer:attributes value="#{a4jStatusBean.attributes}" id="attributes" />
+            </h:form>
+        </ui:define>
+
+    </ui:composition>
+</html>
\ No newline at end of file



More information about the richfaces-svn-commits mailing list