JBoss Rich Faces SVN: r18164 - in root/tests/metamer/trunk/application: src/main/java/org/richfaces/tests/metamer and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-07-21 08:07:44 -0400 (Wed, 21 Jul 2010)
New Revision: 18164
Added:
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelBean.java
root/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichPanelBean.properties
root/tests/metamer/trunk/application/src/main/webapp/components/richPanel/
root/tests/metamer/trunk/application/src/main/webapp/components/richPanel/customLook.xhtml
root/tests/metamer/trunk/application/src/main/webapp/components/richPanel/list.xhtml
root/tests/metamer/trunk/application/src/main/webapp/components/richPanel/nested.xhtml
root/tests/metamer/trunk/application/src/main/webapp/components/richPanel/simple.xhtml
root/tests/metamer/trunk/application/src/main/webapp/resources/css/richPanel.css
Modified:
root/tests/metamer/trunk/application/pom.xml
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
root/tests/metamer/trunk/application/src/main/webapp/resources/css/common.css
Log:
* added rich:panel (3 pages)
* header's css update
* class Attributes made serializable
Modified: root/tests/metamer/trunk/application/pom.xml
===================================================================
--- root/tests/metamer/trunk/application/pom.xml 2010-07-20 16:43:58 UTC (rev 18163)
+++ root/tests/metamer/trunk/application/pom.xml 2010-07-21 12:07:44 UTC (rev 18164)
@@ -63,6 +63,11 @@
<artifactId>richfaces-ui-iteration-impl</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.ui.output</groupId>
+ <artifactId>richfaces-ui-output-ui</artifactId>
+ </dependency>
+
<!-- Java Server Faces 2 -->
<dependency>
<groupId>${jsf2.api.groupid}</groupId>
Modified: root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java
===================================================================
--- root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java 2010-07-20 16:43:58 UTC (rev 18163)
+++ root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/Attributes.java 2010-07-21 12:07:44 UTC (rev 18164)
@@ -24,6 +24,7 @@
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -56,8 +57,9 @@
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
-public final class Attributes implements Map<String, Attribute> {
+public final class Attributes implements Map<String, Attribute>, Serializable {
+ private static final long serialVersionUID = -1L;
private Logger logger;
// K - name of a component attribute, V - value of the component attribute
private Map<String, Attribute> attributes;
@@ -359,7 +361,7 @@
// if select options for "action" are defined in property file
if (hasSelectOptions("action")) {
method =
- getExpressionFactory().createMethodExpression(elContext, getMethodEL(outcome), String.class,
+ getExpressionFactory().createMethodExpression(elContext, getMethodEL(outcome), String.class,
new Class[0]);
return (String) method.invoke(elContext, null);
@@ -392,7 +394,7 @@
// if no select options for "actionListener" are defined in property file and it is an EL expression
if (!hasSelectOptions("actionListener") && isStringEL(listener)) {
method =
- getExpressionFactory().createMethodExpression(elContext, listener, void.class,
+ getExpressionFactory().createMethodExpression(elContext, listener, void.class,
new Class[]{ActionEvent.class});
method.invoke(elContext, new Object[]{event});
}
@@ -400,7 +402,7 @@
// if select options for "actionListener" are defined in property file
if (hasSelectOptions("actionListener")) {
method =
- getExpressionFactory().createMethodExpression(elContext, getMethodEL(listener), void.class,
+ getExpressionFactory().createMethodExpression(elContext, getMethodEL(listener), void.class,
new Class[]{ActionEvent.class});
method.invoke(elContext, new Object[]{event});
}
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-20 16:43:58 UTC (rev 18163)
+++ root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-07-21 12:07:44 UTC (rev 18164)
@@ -107,6 +107,7 @@
components.put("richDataTable", "Rich Data Table");
components.put("richExtendedDataTable", "Rich Extended Data Table");
components.put("richList", "Rich List");
+ components.put("richPanel", "Rich Panel");
}
private void createSkinList() {
Added: root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelBean.java
===================================================================
--- root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelBean.java (rev 0)
+++ root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichPanelBean.java 2010-07-21 12:07:44 UTC (rev 18164)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * 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 org.richfaces.component.UIPanel;
+
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for rich:panel.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "richPanelBean")
+@SessionScoped
+public class RichPanelBean implements Serializable {
+
+ private static final long serialVersionUID = 48122475400649801L;
+ 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(UIPanel.class, getClass());
+
+ attributes.setAttribute("rendered", true);
+
+ // FIXME these attributes were not found automatically
+ attributes.setAttribute("bodyClass", null);
+ attributes.setAttribute("header", null);
+ attributes.setAttribute("headerClass", null);
+ attributes.setAttribute("onclick", null);
+ attributes.setAttribute("ondblclick", null);
+ attributes.setAttribute("onkeydown", null);
+ attributes.setAttribute("onkeypress", null);
+ attributes.setAttribute("onkeyup", null);
+ attributes.setAttribute("onmousedown", null);
+ attributes.setAttribute("onmousemove", null);
+ attributes.setAttribute("onmouseout", null);
+ attributes.setAttribute("onmouseover", null);
+ attributes.setAttribute("onmouseup", null);
+ attributes.setAttribute("style", null);
+ attributes.setAttribute("styleClass", null);
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+}
Added: root/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichPanelBean.properties
===================================================================
Added: root/tests/metamer/trunk/application/src/main/webapp/components/richPanel/customLook.xhtml
===================================================================
--- root/tests/metamer/trunk/application/src/main/webapp/components/richPanel/customLook.xhtml (rev 0)
+++ root/tests/metamer/trunk/application/src/main/webapp/components/richPanel/customLook.xhtml 2010-07-21 12:07:44 UTC (rev 18164)
@@ -0,0 +1,99 @@
+<!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:pn="http://richfaces.org/output">
+
+ <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="richPanel.css"/>
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <style type="text/css">
+ .rf-panel-header {
+ color: fuchsia;
+ }
+
+ .panel {
+ vertical-align:top;
+ }
+
+ .top {
+ width:200px;height:100px;
+ }
+
+ .head2 {
+ background-image : url();
+ background-color : #4C9600;
+ height:18px;
+ text-align:center;
+ vertical-align:middle;
+ color:#CFF;
+ padding:4px 0;
+ }
+
+ .body3 {
+ height:100px;
+ overflow:auto;
+ }
+ </style>
+
+ <h:panelGrid columnClasses="panel" border="0" columns="2">
+ <pn:panel id="panel1">
+ <f:facet name="header">
+ Panel #1. Changing Style Synchronously
+ </f:facet>
+ Each component in the RichFaces has a pre-defined set of classes you can manipulate with. If defined, those
+ classes overwrite the ones come from the skin.
+ </pn:panel>
+
+ <pn:panel id="panel2">
+ <f:facet name="header">
+ Panel #2. Changing Style Synchronously
+ </f:facet>
+ In this example, we define header color using the .rf-panel-header class and all panels located on the same page
+ inherit this color
+ </pn:panel>
+
+ </h:panelGrid>
+
+ <h:panelGrid columnClasses="panel" border="0" columns="3">
+ <pn:panel id="panel3"
+ onmouseover="document.getElementById(this.id+'_header').style.background='#60BA01';document.getElementById(this.id+'_body').style.background='#F4FFF8'"
+ onmouseout="document.getElementById(this.id+'_header').style.background='#4C9600';document.getElementById(this.id+'_body').style.background='#E4FFC8'"
+ style="width:200px;" headerClass="head2" bodyClass="body3">
+ <f:facet name="header">
+ Panel header
+ </f:facet>
+ Base on the previous layout, but some javascript behaviour added.
+ </pn:panel>
+
+ <pn:panel id="panel4" style="width:200px;" bodyClass="body3">
+ <f:facet name="header">
+ Scrolling Text Panel
+ </f:facet>
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec
+ ligula non metus dictum aliquet. Etiam non leo venenatis libero mollis aliquet.
+ Vivamus in augue lorem. Donec sagittis pretium cursus. Vivamus id arcu at dui
+ aliquam faucibus ut in neque. Nulla facilisi. Donec sed arcu et velit egestas
+ condimentum ut ut sem. Quisque quis arcu est. Mauris nec metus congue tortor
+ sagittis porta in in orci. Suspendisse iaculis ipsum non.
+ </pn:panel>
+ </h:panelGrid>
+ </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/richPanel/list.xhtml
===================================================================
--- root/tests/metamer/trunk/application/src/main/webapp/components/richPanel/list.xhtml (rev 0)
+++ root/tests/metamer/trunk/application/src/main/webapp/components/richPanel/list.xhtml 2010-07-21 12:07:44 UTC (rev 18164)
@@ -0,0 +1,22 @@
+<!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>Rich Toggle Panel</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>rich:togglePanel</b> and input boxes for all its attributes.</div>
+
+ <h:link outcome="nested" value="Nested Panels" styleClass="link"/>
+ <div class="description">Page containing a <b>rich:togglePanel</b> with two nested panels.</div>
+
+ <h:link outcome="customLook" value="Look Customization" styleClass="link"/>
+ <div class="description">Page containing several <b>rich:togglePanel</b>s testing stylesheet usage and skinnability features.</div>
+</h:body>
+</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/application/src/main/webapp/components/richPanel/nested.xhtml
===================================================================
--- root/tests/metamer/trunk/application/src/main/webapp/components/richPanel/nested.xhtml (rev 0)
+++ root/tests/metamer/trunk/application/src/main/webapp/components/richPanel/nested.xhtml 2010-07-21 12:07:44 UTC (rev 18164)
@@ -0,0 +1,57 @@
+<!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:pn="http://richfaces.org/output">
+
+ <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="richPanel.css"/>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+
+ <pn:panel id="outerPanel" header="outer panel">
+ <h:outputText id="contentOuter" value="content of outer panel" style="font-size: x-large"/>
+
+ <h:panelGrid columns="2" columnClasses="grid-content">
+ <pn:panel id="leftPanel" header="left inner panel" styleClass="inner-panel">
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sodales risus non sapien pulvinar
+ volutpat. Suspendisse ac neque neque. Aliquam erat volutpat. Donec luctus nulla eget lectus vehicula
+ facilisis. Aenean non nisl nibh. Vestibulum odio metus, fermentum nec placerat in, varius eu ligula.
+ Maecenas bibendum elit ut metus molestie sagittis. Aliquam erat volutpat. Praesent eu nibh eu sapien
+ suscipit vulputate suscipit varius augue. Sed non lorem erat. Vivamus ut magna sapien. In lacinia
+ pharetra mi viverra volutpat. Praesent rutrum cursus dui non lobortis. Morbi nec sem eros. Proin
+ a libero diam, id laoreet risus. Ut sit amet risus elit. Nulla facilisi.
+ </pn:panel>
+
+ <pn:panel id="rightPanel" header="right inner panel" styleClass="inner-panel">
+ <ul>
+ <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
+ <li>Mauris non velit sapien, nec varius elit.</li>
+ <li>Phasellus in massa erat, vitae sagittis massa.</li>
+ <li>Quisque consectetur tortor et ipsum pulvinar tempus ac et diam.</li>
+ <li>Nulla posuere eros lectus, vitae rhoncus elit.</li>
+ <li>In consequat turpis vel arcu adipiscing euismod.</li>
+ <li>Integer et augue nec tellus vulputate porta quis suscipit enim.</li>
+ <li>Fusce sit amet orci quis sapien dignissim consectetur in eget leo.</li>
+ <li>Vestibulum auctor quam ultrices ligula congue semper.</li>
+ </ul>
+ </pn:panel>
+ </h:panelGrid>
+ </pn:panel>
+ </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/richPanel/simple.xhtml
===================================================================
--- root/tests/metamer/trunk/application/src/main/webapp/components/richPanel/simple.xhtml (rev 0)
+++ root/tests/metamer/trunk/application/src/main/webapp/components/richPanel/simple.xhtml 2010-07-21 12:07:44 UTC (rev 18164)
@@ -0,0 +1,81 @@
+<!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:pn="http://richfaces.org/output">
+
+ <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="richPanel.css"/>
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+
+ <fieldset id="fieldsetHeader">
+ <legend>Panel with header</legend>
+
+ <pn:panel id="panelWithHeader"
+ bodyClass="#{richPanelBean.attributes['bodyClass'].value}"
+ header="#{richPanelBean.attributes['header'].value}"
+ headerClass="#{richPanelBean.attributes['headerClass'].value}"
+ onclick="#{richPanelBean.attributes['onclick'].value}"
+ ondblclick="#{richPanelBean.attributes['ondblclick'].value}"
+ onkeydown="#{richPanelBean.attributes['onkeydown'].value}"
+ onkeypress="#{richPanelBean.attributes['onkeypress'].value}"
+ onkeyup="#{richPanelBean.attributes['onkeyup'].value}"
+ onmousedown="#{richPanelBean.attributes['onmousedown'].value}"
+ onmousemove="#{richPanelBean.attributes['onmousemove'].value}"
+ onmouseout="#{richPanelBean.attributes['onmouseout'].value}"
+ onmouseover="#{richPanelBean.attributes['onmouseover'].value}"
+ onmouseup="#{richPanelBean.attributes['onmouseup'].value}"
+ rendered="#{richPanelBean.attributes['rendered'].value}"
+ style="#{richPanelBean.attributes['style'].value}"
+ styleClass="#{richPanelBean.attributes['styleClass'].value}">
+ <f:facet name="header">header of panel</f:facet>
+
+ content of panel
+ </pn:panel>
+ </fieldset>
+
+ <br/>
+
+ <fieldset id="fieldsetWithoutHeader">
+ <legend>Panel without header</legend>
+
+ <pn:panel id="panelWithoutHeader"
+ bodyClass="#{richPanelBean.attributes['bodyClass'].value}"
+ header="#{richPanelBean.attributes['header'].value}"
+ headerClass="#{richPanelBean.attributes['headerClass'].value}"
+ onclick="#{richPanelBean.attributes['onclick'].value}"
+ ondblclick="#{richPanelBean.attributes['ondblclick'].value}"
+ onkeydown="#{richPanelBean.attributes['onkeydown'].value}"
+ onkeypress="#{richPanelBean.attributes['onkeypress'].value}"
+ onkeyup="#{richPanelBean.attributes['onkeyup'].value}"
+ onmousedown="#{richPanelBean.attributes['onmousedown'].value}"
+ onmousemove="#{richPanelBean.attributes['onmousemove'].value}"
+ onmouseout="#{richPanelBean.attributes['onmouseout'].value}"
+ onmouseover="#{richPanelBean.attributes['onmouseover'].value}"
+ onmouseup="#{richPanelBean.attributes['onmouseup'].value}"
+ rendered="#{richPanelBean.attributes['rendered'].value}"
+ style="#{richPanelBean.attributes['style'].value}"
+ styleClass="#{richPanelBean.attributes['styleClass'].value}">
+ content of panel
+ </pn:panel>
+
+ </fieldset>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <ta:attributes value="#{richPanelBean.attributes}" id="attributes" render="log"/>
+ </ui:define>
+
+ </ui:composition>
+</html>
\ No newline at end of file
Modified: root/tests/metamer/trunk/application/src/main/webapp/resources/css/common.css
===================================================================
--- root/tests/metamer/trunk/application/src/main/webapp/resources/css/common.css 2010-07-20 16:43:58 UTC (rev 18163)
+++ root/tests/metamer/trunk/application/src/main/webapp/resources/css/common.css 2010-07-21 12:07:44 UTC (rev 18164)
@@ -16,3 +16,6 @@
border-color: grey;
}
+a img {
+ border: 0px;
+}
\ No newline at end of file
Added: root/tests/metamer/trunk/application/src/main/webapp/resources/css/richPanel.css
===================================================================
--- root/tests/metamer/trunk/application/src/main/webapp/resources/css/richPanel.css (rev 0)
+++ root/tests/metamer/trunk/application/src/main/webapp/resources/css/richPanel.css 2010-07-21 12:07:44 UTC (rev 18164)
@@ -0,0 +1,8 @@
+.grid-content {
+ vertical-align: top;
+}
+
+.inner-panel {
+ width: 400px;
+ height: 200px;
+}
14 years, 5 months
JBoss Rich Faces SVN: r18163 - root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-07-20 12:43:58 -0400 (Tue, 20 Jul 2010)
New Revision: 18163
Modified:
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoComplete.js
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoCompleteBase.js
Log:
https://jira.jboss.org/browse/RF-8875
destroy improvements
Modified: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoComplete.js
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoComplete.js 2010-07-20 16:36:02 UTC (rev 18162)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoComplete.js 2010-07-20 16:43:58 UTC (rev 18163)
@@ -191,6 +191,8 @@
name:"AutoComplete",
destroy: function () {
//TODO: add all unbind
+ this.items = null;
+ this.cache = null;
rf.Event.unbind(rf.getDomElement(this.componentId+ID.ITEMS).parentNode, this.namespace);
$super.destroy.call(this);
},
Modified: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoCompleteBase.js
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoCompleteBase.js 2010-07-20 16:36:02 UTC (rev 18162)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoCompleteBase.js 2010-07-20 16:43:58 UTC (rev 18163)
@@ -16,7 +16,6 @@
},
unbindScrollEventHandlers: function(elements, component) {
RichFaces.Event.unbind(elements, component.getNamespace());
- elements = null;
}
});
@@ -223,6 +222,7 @@
hide: function (event) {
if (this.isVisible) {
rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
+ this.scrollElements = null;
$(rf.getDomElement(this.selectId)).hide();
this.isVisible = false;
if (this.options.attachToBody && this.parentElement) {
@@ -237,6 +237,10 @@
destroy: function () {
//TODO: add all unbind
this.parentNode = null;
+ if (this.scrollElements) {
+ rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
+ this.scrollElements = null;
+ }
rf.Event.unbindById(this.options.buttonId, this.namespace);
rf.Event.unbindById(this.fieldId, this.namespace);
rf.Event.unbindById(this.selectId, this.namespace);
14 years, 5 months
JBoss Rich Faces SVN: r18162 - root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-07-20 12:36:02 -0400 (Tue, 20 Jul 2010)
New Revision: 18162
Modified:
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoComplete.js
Log:
https://jira.jboss.org/browse/RF-8875
fetch value was added
Modified: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoComplete.js
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoComplete.js 2010-07-20 15:17:30 UTC (rev 18161)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoComplete.js 2010-07-20 16:36:02 UTC (rev 18162)
@@ -1,12 +1,21 @@
(function ($, rf) {
rf.utils = rf.utils || {};
- rf.utils.Cache = function (data, options) {
- this.key = options.key;
+ rf.utils.Cache = function (key, items, values) {
+ this.key = key;
this.cache = {}
- this.cache[this.key] = data || [];
- this.values = options.parse && options.parse(data) || this.cache[this.key];
+ this.cache[this.key] = items || [];
+ this.values = typeof values != "function" ? values || this.cache[this.key] : values(items);
+ updateItemsData(items, this.values);
};
+
+ var updateItemsData = function (items, values) {
+ if (items.first()["nodeType"]) {
+ items.each(function(index){
+ this.data("value", values[index]);
+ });
+ }
+ }
var getItems = function (key) {
var newCache = [];
@@ -91,6 +100,8 @@
ITEMS:'Items'
};
+ var DATA_TAG = "value";
+
var REGEXP_TRIM = /^[\n\s]*(.*)[\n\s]*$/;
var getData = function (nodeList) {
@@ -123,12 +134,9 @@
}
};
- var updateItemsList = function (value) {
+ var updateItemsList = function (value, fetchValues) {
this.items = $(rf.getDomElement(this.componentId+ID.ITEMS)).find(".rf-ac-i");
- this.cache = new rf.utils.Cache(this.items, {
- parse: getData,
- key: value
- });
+ this.cache = new rf.utils.Cache(value, this.items, fetchValues || getData);
};
var scrollToSelectedItem = function() {
@@ -159,8 +167,8 @@
var callAjax = function(event) {
var _this = this;
- var ajaxSuccess = function () {
- updateItemsList.call(_this, _this.inputValue);
+ var ajaxSuccess = function (event) {
+ updateItemsList.call(_this, _this.inputValue, event.componentData);
if (_this.options.selectFirst) {
_this.selectItem(0);
}
@@ -278,7 +286,8 @@
getSelectedItemValue: function () {
if ( this.index>=0) {
- return getData(this.items.eq(this.index))[0];
+ var element = this.items.eq(this.index);
+ return element.data(DATA_TAG) || getData(element)[0];
}
return undefined;
},
14 years, 5 months
JBoss Rich Faces SVN: r18161 - in root: dist/trunk and 20 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2010-07-20 11:17:30 -0400 (Tue, 20 Jul 2010)
New Revision: 18161
Added:
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/component/
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/component/SwitchType.java
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/ItemChangeEvent.java
root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/ItemChangeListener.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/TogglePanelTagHandler.java
Removed:
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/Method.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UIDivPanel.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionSelectedItemChangeListener.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeEvent.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeListener.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/taglib/
Modified:
root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
root/dist/trunk/readme-ui.txt
root/examples/output-demo/trunk/pom.xml
root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-ajax.xhtml
root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-client.xhtml
root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-server.xhtml
root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel.xhtml
root/examples/output-demo/trunk/src/main/webapp/qunit/togglePanel.xhtml
root/examples/output-demo/trunk/src/main/webapp/qunit/togglePanelItem.xhtml
root/examples/output-demo/trunk/src/main/webapp/resources/tests/richfaces-toggle-panel-item-qunit.js
root/examples/output-demo/trunk/src/main/webapp/resources/tests/richfaces-toggle-panel-qunit.js
root/ui/misc/trunk/parent/pom.xml
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UITogglePanel.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlDivPanel.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanel.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanelItem.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java
root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/pn.faces-config.xml
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/pn.taglib.xml
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanel.js
root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js
Log:
fix toggle-panel review
rename selectedItem to activeItem
rename selectedItemChangeListener to itemChangeListener
Modified: root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js
===================================================================
--- root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/core/trunk/impl/src/main/resources/META-INF/resources/richfaces-base-component.js 2010-07-20 15:17:30 UTC (rev 18161)
@@ -125,6 +125,17 @@
*
* });
*
+ * RichFaces.ui.MySecondClass = RichFaces.ui.MyClass({
+ * //
+ * name : "MySecondClass",
+ *
+ * // Constructor
+ * init : function (...) {
+ * // ...
+ * }
+ *
+ * })
+ *
* */
richfaces.BaseComponent.extendClass = function (methods) {
var DerivedClass = methods.init || richfaces.blankFunction;
@@ -140,8 +151,6 @@
return DerivedClass;
},
-
-
$.extend(richfaces.BaseComponent.prototype, (function (params) {
return {
/**
Modified: root/dist/trunk/readme-ui.txt
===================================================================
--- root/dist/trunk/readme-ui.txt 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/dist/trunk/readme-ui.txt 2010-07-20 15:17:30 UTC (rev 18161)
@@ -86,7 +86,7 @@
rich:togglePanel
rich:toggleControl
rich:togglePanelItem
-rich:selectedItemChangeListener
+rich:itemChangeListener
Learn more
Modified: root/examples/output-demo/trunk/pom.xml
===================================================================
--- root/examples/output-demo/trunk/pom.xml 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/examples/output-demo/trunk/pom.xml 2010-07-20 15:17:30 UTC (rev 18161)
@@ -2,6 +2,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.richfaces</groupId>
+ <artifactId>richfaces-parent</artifactId>
+ <version>9</version>
+ </parent>
+
<modelVersion>4.0.0</modelVersion>
<groupId>org.richfaces.ui.panels</groupId>
@@ -127,43 +133,32 @@
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.richfaces.ui.panels</groupId>
- <artifactId>richfaces-ui-panels-bom</artifactId>
+ <groupId>org.richfaces.ui.output</groupId>
+ <artifactId>richfaces-ui-output-bom</artifactId>
<version>${version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
- <dependency>
- <groupId>org.richfaces.ui.misc</groupId>
- <artifactId>richfaces-ui-misc-bom</artifactId>
- <version>${version}</version>
- <scope>import</scope>
- <type>pom</type>
- </dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.richfaces.ui.panels</groupId>
- <artifactId>richfaces-ui-panels-ui</artifactId>
+ <groupId>org.richfaces.ui.output</groupId>
+ <artifactId>richfaces-ui-output-ui</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.ui.core</groupId>
<artifactId>richfaces-ui-core-ui</artifactId>
</dependency>
- <dependency>
- <groupId>org.richfaces.ui.misc</groupId>
- <artifactId>richfaces-ui-misc-ui</artifactId>
- </dependency>
<dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-api</artifactId>
+ <groupId>${jsf2.api.groupid}</groupId>
+ <artifactId>${jsf2.api.artifactid}</artifactId>
</dependency>
<dependency>
- <groupId>com.sun.faces</groupId>
- <artifactId>jsf-impl</artifactId>
+ <groupId>${jsf2.impl.groupid}</groupId>
+ <artifactId>${jsf2.impl.artifactid}</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
Modified: root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-ajax.xhtml
===================================================================
--- root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-ajax.xhtml 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-ajax.xhtml 2010-07-20 15:17:30 UTC (rev 18161)
@@ -3,7 +3,7 @@
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:pn="http://richfaces.org/panels">
+ xmlns:pn="http://richfaces.org/output">
<body>
<ui:composition template="/templates/template.xhtml">
@@ -14,8 +14,8 @@
<ui:define name="body">
<f:view>
<h:form id="f">
- <pn:togglePanel id="my_id" selectedItem="name1" switchType="ajax"
- selectedItemChangeListener="#{togglePanelBean.itemChangeActionListener}" >
+ <pn:togglePanel id="my_id" activeItem="name1" switchType="ajax"
+ itemChangeListener="#{togglePanelBean.itemChangeActionListener}" >
<pn:togglePanelItem name="name1">hello name1</pn:togglePanelItem>
<pn:togglePanelItem name="name2">hello name2</pn:togglePanelItem>
<pn:togglePanelItem name="name3">hello name3</pn:togglePanelItem>
Modified: root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-client.xhtml
===================================================================
--- root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-client.xhtml 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-client.xhtml 2010-07-20 15:17:30 UTC (rev 18161)
@@ -3,7 +3,7 @@
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:pn="http://richfaces.org/panels">
+ xmlns:pn="http://richfaces.org/output">
<body>
<ui:composition template="/templates/template.xhtml">
@@ -13,7 +13,7 @@
<ui:define name="body">
<h:form id="f">
- <pn:togglePanel id="panel" selectedItem="name1" switchType="client" lang="en">
+ <pn:togglePanel id="panel" activeItem="name1" switchType="client" lang="en">
<pn:togglePanelItem name="name1">hello name1</pn:togglePanelItem>
<pn:togglePanelItem name="name2">hello name2</pn:togglePanelItem>
<pn:togglePanelItem name="name3">hello name3</pn:togglePanelItem>
Modified: root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-server.xhtml
===================================================================
--- root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-server.xhtml 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel-server.xhtml 2010-07-20 15:17:30 UTC (rev 18161)
@@ -3,7 +3,7 @@
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:pn="http://richfaces.org/panels">
+ xmlns:pn="http://richfaces.org/output">
<body>
<ui:composition template="/templates/template.xhtml">
@@ -14,7 +14,7 @@
<ui:define name="body">
<f:view>
<h:form id="f">
- <pn:togglePanel id="my_id" selectedItem="name1" switchType="server" lang="en">
+ <pn:togglePanel id="my_id" activeItem="name1" switchType="server" lang="en">
<pn:togglePanelItem name="name1">hello name1</pn:togglePanelItem>
<pn:togglePanelItem name="name2">hello name2</pn:togglePanelItem>
<pn:togglePanelItem name="name3">hello name3</pn:togglePanelItem>
Modified: root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel.xhtml
===================================================================
--- root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel.xhtml 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/examples/output-demo/trunk/src/main/webapp/examples/togglePanel.xhtml 2010-07-20 15:17:30 UTC (rev 18161)
@@ -3,7 +3,7 @@
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:pn="http://richfaces.org/panels">
+ xmlns:pn="http://richfaces.org/output">
<body>
<ui:composition template="/templates/template.xhtml">
@@ -13,7 +13,7 @@
<ui:define name="body">
<h:form id="f">
- <pn:togglePanel id="my_id" lang="en" selectedItem="name1">
+ <pn:togglePanel id="my_id" lang="en" activeItem="name1">
<pn:togglePanelItem name="name1">
hello name1
</pn:togglePanelItem>
Modified: root/examples/output-demo/trunk/src/main/webapp/qunit/togglePanel.xhtml
===================================================================
--- root/examples/output-demo/trunk/src/main/webapp/qunit/togglePanel.xhtml 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/examples/output-demo/trunk/src/main/webapp/qunit/togglePanel.xhtml 2010-07-20 15:17:30 UTC (rev 18161)
@@ -3,7 +3,7 @@
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:pn="http://richfaces.org/panels">
+ xmlns:pn="http://richfaces.org/output">
<body>
<ui:composition template="/templates/template.xhtml">
@@ -22,7 +22,7 @@
<p>Page</p>
<h:form id="f" style="border:blue solid thin;">
- <pn:togglePanel id="panel" selectedItem="name1" switchType="client" lang="en">
+ <pn:togglePanel id="panel" activeItem="name1" switchType="client" lang="en">
<pn:togglePanelItem id="name1" name="name1">hello name1</pn:togglePanelItem>
<pn:togglePanelItem id="name2" name="name2">hello name2</pn:togglePanelItem>
<pn:togglePanelItem id="name3" name="name3">hello name3</pn:togglePanelItem>
Modified: root/examples/output-demo/trunk/src/main/webapp/qunit/togglePanelItem.xhtml
===================================================================
--- root/examples/output-demo/trunk/src/main/webapp/qunit/togglePanelItem.xhtml 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/examples/output-demo/trunk/src/main/webapp/qunit/togglePanelItem.xhtml 2010-07-20 15:17:30 UTC (rev 18161)
@@ -3,7 +3,7 @@
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:pn="http://richfaces.org/panels">
+ xmlns:pn="http://richfaces.org/output">
<body>
<ui:composition template="/templates/template.xhtml">
@@ -22,7 +22,7 @@
<p>Page</p>
<h:form id="f" style="border:blue solid thin;">
- <pn:togglePanel id="panel" selectedItem="name1" switchType="client" lang="en">
+ <pn:togglePanel id="panel" activeItem="name1" switchType="client" lang="en">
<pn:togglePanelItem id="name1" name="name1">hello name1</pn:togglePanelItem>
<pn:togglePanelItem id="name2" name="name2">hello name2</pn:togglePanelItem>
<pn:togglePanelItem id="name3" name="name3">hello name3</pn:togglePanelItem>
Modified: root/examples/output-demo/trunk/src/main/webapp/resources/tests/richfaces-toggle-panel-item-qunit.js
===================================================================
--- root/examples/output-demo/trunk/src/main/webapp/resources/tests/richfaces-toggle-panel-item-qunit.js 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/examples/output-demo/trunk/src/main/webapp/resources/tests/richfaces-toggle-panel-item-qunit.js 2010-07-20 15:17:30 UTC (rev 18161)
@@ -20,22 +20,22 @@
expect(2);
var state = 1;
- var leave = RichFaces.Event.bindById(componentId, "leave", function () {
+ var leave = RichFaces.Event.bindById(componentId, "__leave", function () {
ok(state == 1, "leave handler invouked (state == 1)");
state++;
});
- item.leave();
+ item.__leave();
- var enter = RichFaces.Event.bindById(componentId, "enter", function () {
+ var enter = RichFaces.Event.bindById(componentId, "__enter", function () {
ok(state == 2, "enter handler invouked (state == 2)");
state++;
});
- item.enter();
+ item.__enter();
- RichFaces.Event.unbindById(componentId, "leave", leave);
- RichFaces.Event.unbindById(componentId, "enter", enter);
+ RichFaces.Event.unbindById(componentId, "__leave", leave);
+ RichFaces.Event.unbindById(componentId, "__enter", enter);
});
test("TogglePanelItem test cacelable of leave", function () {
@@ -44,14 +44,14 @@
expect(2);
var state = 1;
- var leave = RichFaces.Event.bindById(componentId, "leave", function () {
+ var leave = RichFaces.Event.bindById(componentId, "__leave", function () {
ok(true, "leave handler invouked");
return false;
});
- ok(!item.leave(), "!item.leave()");
+ ok(!item.__leave(), "!item.leave()");
- RichFaces.Event.bindById(componentId, "leave", leave);
+ RichFaces.Event.bindById(componentId, "__leave", leave);
});
});
\ No newline at end of file
Modified: root/examples/output-demo/trunk/src/main/webapp/resources/tests/richfaces-toggle-panel-qunit.js
===================================================================
--- root/examples/output-demo/trunk/src/main/webapp/resources/tests/richfaces-toggle-panel-qunit.js 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/examples/output-demo/trunk/src/main/webapp/resources/tests/richfaces-toggle-panel-qunit.js 2010-07-20 15:17:30 UTC (rev 18161)
@@ -20,7 +20,7 @@
equals(c.componentId, undefined, "componentId shouldn't be here, we must use id form component base");
equals(c.id, TOGGLE_PANEL_ID, "id");
equals(c.switchMode, "client", "switchMode");
- equals(c.selectedItem, "name1", "selectedItem");
+ equals(c.activeItem, "name1", "activeItem");
equals(c.items.length, 3, "items");
// test public api
@@ -155,14 +155,14 @@
});
var fromItem = c.getItems()[0];
- var leave = RichFaces.Event.bindById(fromItem.id, "leave", function () {
+ var leave = RichFaces.Event.bindById(fromItem.id, "__leave", function () {
ok(state == 2, "leave handler invouked (state = " + state + ")");
state++;
});
var toItem = c.getItems()[2];
- var enter = RichFaces.Event.bindById(toItem.id, "enter", function () {
+ var enter = RichFaces.Event.bindById(toItem.id, "__enter", function () {
ok(state == 3, "enter handler invouked (state = " + state + ")");
state++;
@@ -178,8 +178,8 @@
c.switchToItem("name3");
RichFaces.Event.unbindById(componentId, "beforeitemchange", beforeitemchange);
- RichFaces.Event.unbindById(fromItem.id, "leave", leave);
- RichFaces.Event.unbindById(toItem.id, "enter", enter);
+ RichFaces.Event.unbindById(fromItem.id, "__leave", leave);
+ RichFaces.Event.unbindById(toItem.id, "__enter", enter);
RichFaces.Event.unbindById(componentId, "itemchange", itemchange);
c.switchToItem("name1");
@@ -199,7 +199,7 @@
});
var fromItem = c.getItems()[0];
- var leave = RichFaces.Event.bindById(fromItem.id, "leave", function () {
+ var leave = RichFaces.Event.bindById(fromItem.id, "__leave", function () {
ok(state == 2, "leave handler invouked (state = " + state + ")");
state++;
@@ -207,7 +207,7 @@
});
var toItem = c.getItems()[2];
- var enter = RichFaces.Event.bindById(toItem.id, "enter", function () {
+ var enter = RichFaces.Event.bindById(toItem.id, "__enter", function () {
ok(state == 3, "enter handler invouked (state = " + state + ")");
state++;
@@ -223,8 +223,8 @@
c.switchToItem("name3");
RichFaces.Event.unbindById(componentId, "beforeitemchange", beforeitemchange);
- RichFaces.Event.unbindById(componentId, "leave", leave);
- RichFaces.Event.unbindById(componentId, "enter", enter);
+ RichFaces.Event.unbindById(componentId, "__leave", leave);
+ RichFaces.Event.unbindById(componentId, "__enter", enter);
RichFaces.Event.unbindById(componentId, "itemchange", itemchange);
});
Modified: root/ui/misc/trunk/parent/pom.xml
===================================================================
--- root/ui/misc/trunk/parent/pom.xml 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/misc/trunk/parent/pom.xml 2010-07-20 15:17:30 UTC (rev 18161)
@@ -41,8 +41,8 @@
<dependencyManagement>
<dependencies>
-
- <!-- TODO: remove this dependency used by componentControl -->
+
+ <!-- TODO: remove this dependency used by componentControl -->
<dependency>
<groupId>org.richfaces.ui.core</groupId>
<artifactId>richfaces-ui-core-bom</artifactId>
Copied: root/ui/output/trunk/panels/api/src/main/java/org/richfaces/component/SwitchType.java (from rev 18081, root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/Method.java)
===================================================================
--- root/ui/output/trunk/panels/api/src/main/java/org/richfaces/component/SwitchType.java (rev 0)
+++ root/ui/output/trunk/panels/api/src/main/java/org/richfaces/component/SwitchType.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -0,0 +1,24 @@
+package org.richfaces.component;
+
+/**
+ * @author akolonitsky
+ * @since Jun 15, 2010
+ */
+public enum SwitchType {
+ /**
+ * value for tab change method for - client-side tabs.
+ */
+ client,
+
+ /**
+ * value for tab change method - server-side tabs
+ */
+ server,
+
+ /**
+ * value for tab change method - ajax tabs
+ */
+ ajax;
+
+ public static final SwitchType DEFAULT = SwitchType.ajax;
+}
Copied: root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/ItemChangeEvent.java (from rev 18081, root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeEvent.java)
===================================================================
--- root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/ItemChangeEvent.java (rev 0)
+++ root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/ItemChangeEvent.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.event;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+
+/**
+ * <p>A {@link ItemChangeEvent} is a ...</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ * @since -4712-01-01
+ */
+public class ItemChangeEvent extends FacesEvent {
+
+ private static final long serialVersionUID = -4747704006016875163L;
+
+ private final String oldItem;
+ private final String newItem;
+
+ // ------------------------------------------------------------ Constructors
+
+ /**
+ * <p>Construct a new event object from the specified source component,
+ * old value, and new value.</p>
+ *
+ * <p>The default {@link javax.faces.event.PhaseId} for this event is {@link
+ * javax.faces.event.PhaseId#ANY_PHASE}.</p>
+ *
+ * @param component Source {@link UIComponent} for this event
+ *
+ * @param oldItem
+ * @param newItem
+ *
+ * @throws IllegalArgumentException if <code>component</code> is
+ * <code>null</code>
+ */
+ public ItemChangeEvent(UIComponent component, String oldItem, String newItem) {
+ super(component);
+ this.oldItem = oldItem;
+ this.newItem = newItem;
+ }
+
+
+ // -------------------------------------------------------------- Properties
+
+ public String getOldItem() {
+ return oldItem;
+ }
+
+ public String getNewItem() {
+ return newItem;
+ }
+
+ // ------------------------------------------------- Event Broadcast Methods
+
+
+ @Override
+ public boolean isAppropriateListener(FacesListener listener) {
+ return listener instanceof ItemChangeListener;
+ }
+
+ /**
+ * @throws javax.faces.event.AbortProcessingException {@inheritDoc}
+ */
+ @Override
+ public void processListener(FacesListener listener) {
+ ((ItemChangeListener) listener).processItemChange(this);
+ }
+}
+
Copied: root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/ItemChangeListener.java (from rev 18081, root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeListener.java)
===================================================================
--- root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/ItemChangeListener.java (rev 0)
+++ root/ui/output/trunk/panels/api/src/main/java/org/richfaces/event/ItemChangeListener.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.event;
+
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesListener;
+
+/**
+ * <p>A listener interface for receiving {@link ItemChangeEvent}s. A class
+ * that is interested in receiving such events implements this interface, and
+ * then registers itself with the source {@link javax.faces.component.UIComponent} of interest, by
+ * calling <code>addItemChangeListener()</code>.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ * @since -4712-01-01
+ *
+ */
+public interface ItemChangeListener extends FacesListener {
+
+
+ /**
+ * <p>Invoked when {@link ItemChangeEvent} occurs.</p>
+ *
+ * @param event The {@link ItemChangeEvent} that has occurred
+ *
+ * @throws AbortProcessingException Signal the JavaServer Faces
+ * implementation that no further processing on the current event
+ * should be performed
+ */
+ void processItemChange(ItemChangeEvent event) throws AbortProcessingException;
+
+}
Modified: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractDivPanel.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -32,15 +32,12 @@
*/
public abstract class AbstractDivPanel extends UIOutput {
- //TODO nick - http://community.jboss.org/docs/DOC-13693
- public static final String COMPONENT_TYPE = "org.richfaces.panels.DivPanel";
+ public static final String COMPONENT_TYPE = "org.richfaces.DivPanel";
- //TODO nick - http://community.jboss.org/docs/DOC-13693
- public static final String COMPONENT_FAMILY = "org.richfaces.panels.DivPanel";
+ public static final String COMPONENT_FAMILY = "org.richfaces.DivPanel";
protected AbstractDivPanel() {
- //TODO nick - http://community.jboss.org/docs/DOC-13693
- setRendererType("org.richfaces.panels.DivPanelRenderer");
+ setRendererType("org.richfaces.DivPanel");
}
@Override
Modified: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractTogglePanel.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -22,6 +22,7 @@
package org.richfaces.component;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -45,8 +46,9 @@
import javax.faces.event.ValueChangeListener;
import javax.faces.validator.Validator;
-import org.richfaces.event.SelectedItemChangeEvent;
-import org.richfaces.event.SelectedItemChangeListener;
+import org.richfaces.component.util.MessageUtil;
+import org.richfaces.event.ItemChangeEvent;
+import org.richfaces.event.ItemChangeListener;
/**
* @author akolonitsky
@@ -54,14 +56,15 @@
*/
public abstract class AbstractTogglePanel extends AbstractDivPanel implements EditableValueHolder {
- //TODO nick - http://community.jboss.org/docs/DOC-13693
- public static final String COMPONENT_TYPE = "org.richfaces.panels.TogglePanel";
+ public static final String COMPONENT_TYPE = "org.richfaces.TogglePanel";
- //TODO nick - http://community.jboss.org/docs/DOC-13693
- public static final String COMPONENT_FAMILY = "org.richfaces.panels.TogglePanel";
+ public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanel";
- private String submittedSelectedItem = null;
+ // TODO What is MessageId ?
+ public static final String UPDATE_MESSAGE_ID = "javax.faces.component.UIInput.UPDATE";
+ private String submittedActiveItem = null;
+
private enum PropertyKeys {
localValueSet,
required,
@@ -70,14 +73,14 @@
}
protected AbstractTogglePanel() {
- setRendererType("org.richfaces.panels.TogglePanelRenderer");
+ setRendererType("org.richfaces.TogglePanel");
}
// -------------------------------------------------- Editable Value Holder
public Object getSubmittedValue() {
- return this.submittedSelectedItem;
+ return this.submittedActiveItem;
}
public void resetValue() {
@@ -88,7 +91,7 @@
}
public void setSubmittedValue(Object submittedValue) {
- this.submittedSelectedItem = String.valueOf(submittedValue);
+ this.submittedActiveItem = String.valueOf(submittedValue);
}
/**
@@ -143,13 +146,11 @@
}
public MethodBinding getValidator() {
- //TODO nick - Errors shouldn't ne thrown
- throw new UnknownError();
+ throw new UnsupportedOperationException();
}
public void setValidator(MethodBinding validatorBinding) {
- //TODO nick - Errors shouldn't ne thrown
- throw new UnknownError();
+ throw new UnsupportedOperationException();
}
public MethodBinding getValueChangeListener() {
@@ -212,9 +213,10 @@
// Process all facets and children of this component
Iterator<UIComponent> kids = getFacetsAndChildren();
+ String activeItem = getActiveItemValue();
while (kids.hasNext()) {
UIComponent kid = kids.next();
- if (isSelectedItem(kid)) {
+ if (isActiveItem(kid, activeItem)) {
kid.processDecodes(context);
}
}
@@ -263,9 +265,10 @@
app.publishEvent(context, PreValidateEvent.class, this);
// Process all the facets and children of this component
Iterator<UIComponent> kids = getFacetsAndChildren();
+ String activeItem = getActiveItemValue();
while (kids.hasNext()) {
UIComponent kid = kids.next();
- if (isSelectedItem(kid)) {
+ if (isActiveItem(kid, activeItem)) {
kid.processValidators(context);
}
}
@@ -302,9 +305,10 @@
// Process all facets and children of this component
Iterator<UIComponent> kids = getFacetsAndChildren();
+ String activeItem = getActiveItemValue();
while (kids.hasNext()) {
UIComponent kid = kids.next();
- if (isSelectedItem(kid)) {
+ if (isActiveItem(kid, activeItem)) {
kid.processUpdates(context);
}
}
@@ -348,8 +352,7 @@
return;
}
- //TODO nick - selectedItem attribute?
- ValueExpression ve = getValueExpression("value");
+ ValueExpression ve = getValueExpression("activeItem");
if (ve == null) {
return;
}
@@ -370,11 +373,10 @@
}
if (messageStr == null) {
- // todo
- //message = MessageFactory.getMessage(context, UPDATE_MESSAGE_ID,
- // MessageFactory.getLabel(context, this));
+ message = MessageUtil.getMessage(context, UPDATE_MESSAGE_ID,
+ new Object[] {MessageUtil.getLabel(context, this)});
} else {
- //message = new FacesMessage(FacesMessage.SEVERITY_ERROR, messageStr, messageStr);
+ message = new FacesMessage(FacesMessage.SEVERITY_ERROR, messageStr, messageStr);
}
setValid(false);
} catch (Exception e) {
@@ -418,21 +420,21 @@
}
// Submitted value == null means "the component was not submitted at all".
- String submittedValue = getSubmittedSelectedItem();
- if (submittedValue == null) {
+ String activeItem = getSubmittedActiveItem();
+ if (activeItem == null) {
return;
}
String previous = (String) getValue();
- setValue(submittedValue);
- setSubmittedSelectedItem(null);
- if (!previous.equalsIgnoreCase(submittedValue)) {
- queueEvent(new SelectedItemChangeEvent(this, previous, submittedValue));
+ setValue(activeItem);
+ setSubmittedActiveItem(null);
+ if (!previous.equalsIgnoreCase(activeItem)) {
+ queueEvent(new ItemChangeEvent(this, previous, activeItem));
}
}
public void queueEvent(FacesEvent event) {
- if ((event instanceof SelectedItemChangeEvent) && (event.getComponent() == this)) {
+ if ((event instanceof ItemChangeEvent) && (event.getComponent() == this)) {
if (isImmediate()) {
event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
} else if (isBypassUpdates()) {
@@ -449,8 +451,8 @@
public void broadcast(FacesEvent event) throws AbortProcessingException {
super.broadcast(event);
- //TODO nick - immediate?
- if (event instanceof SelectedItemChangeEvent && isBypassUpdates()) {
+ if (event instanceof ItemChangeEvent
+ && (isBypassUpdates() || isImmediate())) {
FacesContext.getCurrentInstance().renderResponse();
}
}
@@ -466,37 +468,46 @@
return true;
}
- private boolean isSelectedItem(UIComponent kid) {
- //TODO nick - selectedItem should be cached in local variable
- String value = getSelectedItem();
+ private boolean isActiveItem(UIComponent kid) {
+ return getChildName(kid).equals(getActiveItemValue());
+ }
+
+ private String getActiveItemValue() {
+ String value = getActiveItem();
if (value == null) {
- value = getSubmittedSelectedItem();
+ value = getSubmittedActiveItem();
}
+ return value;
+ }
+
+ private static boolean isActiveItem(UIComponent kid, String value) {
return getChildName(kid).equals(value);
}
public String getFirstItem() {
- checkChildCount(getChildCount());
+ List<UIComponent> children = getRenderedChildren();
+// if (chi)
- //TODO nick - children can be rendered or not
- return getChildName(getChildren().get(0));
+ return getChildName(children.get(0));
}
- private static void checkChildCount(int childCount) {
- //TODO nick - remove this check
- if (childCount < 1) {
- throw new IllegalStateException("TogglePanel must have at least one TogglePanelItem.");
+// public UIComponent getItemByIndex
+
+ private List<UIComponent> getRenderedChildren() {
+ List<UIComponent> res = new ArrayList<UIComponent>(getChildCount());
+ for (UIComponent child : getChildren()) {
+ res.add(child);
}
+
+ return res;
}
public AbstractTogglePanelItem getItem(String name) {
if (name == null) {
throw new IllegalArgumentException("Name is required parameter.");
}
- checkChildCount(getChildCount());
List<UIComponent> children = getChildren();
- //TODO nick - return child itself
int index = getChildIndex(name, children);
if (index == -1) {
return null;
@@ -508,9 +519,7 @@
if (name == null) {
throw new IllegalArgumentException("Name is required parameter.");
}
- checkChildCount(getChildCount());
-
List<UIComponent> children = getChildren();
int nextItem = getChildIndex(name, children) + 1;
@@ -531,12 +540,11 @@
ind++;
}
-// throw new IllegalStateException("Can't find child panel item with name: " + name);
return -1;
}
private static String getChildName(UIComponent item) {
- //TODO nick - panel can include UIParam children - remove this exception
+ // TODO nick - panel can include UIParam children - remove this exception
if (!(item instanceof AbstractTogglePanelItem)) {
throw new IllegalStateException("TogglePanel can contain only TogglePanelItem as child.");
}
@@ -546,26 +554,26 @@
// ------------------------------------------------
- public String getSubmittedSelectedItem() {
- return submittedSelectedItem;
+ public String getSubmittedActiveItem() {
+ return submittedActiveItem;
}
- public void setSubmittedSelectedItem(String submittedSelectedItem) {
- this.submittedSelectedItem = submittedSelectedItem;
+ public void setSubmittedActiveItem(String submittedActiveItem) {
+ this.submittedActiveItem = submittedActiveItem;
}
// ------------------------------------------------ Properties
- public String getSelectedItem() {
+ public String getActiveItem() {
return (String) getValue();
}
- public void setSelectedItem(String value) {
+ public void setActiveItem(String value) {
setValue(value);
}
- public abstract Method getSwitchType();
+ public abstract SwitchType getSwitchType();
public abstract boolean isBypassUpdates();
@@ -579,42 +587,42 @@
public abstract Object getRender();
- public abstract MethodExpression getSelectedItemChangeListener();
+ public abstract MethodExpression getItemChangeListener();
// ------------------------------------------------ Event Processing Methods
/**
- * <p>Add a new {@link SelectedItemChangeListener} to the set of listeners
- * interested in being notified when {@link org.richfaces.event.SelectedItemChangeEvent}s occur.</p>
+ * <p>Add a new {@link org.richfaces.event.ItemChangeListener} to the set of listeners
+ * interested in being notified when {@link org.richfaces.event.ItemChangeEvent}s occur.</p>
*
- * @param listener The {@link SelectedItemChangeListener} to be added
+ * @param listener The {@link org.richfaces.event.ItemChangeListener} to be added
* @throws NullPointerException if <code>listener</code>
* is <code>null</code>
*/
- public void addSelectedItemChangeListener(SelectedItemChangeListener listener) {
+ public void addItemChangeListener(ItemChangeListener listener) {
addFacesListener(listener);
}
/**
- * <p>Return the set of registered {@link SelectedItemChangeListener}s for this instance.
+ * <p>Return the set of registered {@link org.richfaces.event.ItemChangeListener}s for this instance.
* If there are no registered listeners, a zero-length array is returned.</p>
*/
- public SelectedItemChangeListener[] getSelectedItemChangeListeners() {
- return (SelectedItemChangeListener[]) getFacesListeners(SelectedItemChangeListener.class);
+ public ItemChangeListener[] getItemChangeListeners() {
+ return (ItemChangeListener[]) getFacesListeners(ItemChangeListener.class);
}
/**
- * <p>Remove an existing {@link SelectedItemChangeListener} (if any) from the
+ * <p>Remove an existing {@link org.richfaces.event.ItemChangeListener} (if any) from the
* set of listeners interested in being notified when
- * {@link org.richfaces.event.SelectedItemChangeEvent}s occur.</p>
+ * {@link org.richfaces.event.ItemChangeEvent}s occur.</p>
*
- * @param listener The {@link SelectedItemChangeListener} to be removed
+ * @param listener The {@link org.richfaces.event.ItemChangeListener} to be removed
* @throws NullPointerException if <code>listener</code>
* is <code>null</code>
*/
- public void removeSelectedItemChangeListener(SelectedItemChangeListener listener) {
+ public void removeItemChangeListener(ItemChangeListener listener) {
removeFacesListener(listener);
}
Modified: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/AbstractTogglePanelItem.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -33,12 +33,12 @@
*/
public abstract class AbstractTogglePanelItem extends AbstractDivPanel {
- public static final String COMPONENT_TYPE = "org.richfaces.panels.TogglePanelItem";
+ public static final String COMPONENT_TYPE = "org.richfaces.TogglePanelItem";
- public static final String COMPONENT_FAMILY = "org.richfaces.panels.TogglePanelItem";
+ public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanelItem";
protected AbstractTogglePanelItem() {
- setRendererType("org.richfaces.panels.TogglePanelItemRenderer");
+ setRendererType("org.richfaces.TogglePanelItem");
}
@Override
@@ -66,7 +66,7 @@
public abstract String getName();
- public abstract Method getSwitchType();
+ public abstract SwitchType getSwitchType();
public String toString() {
return "TogglePanelItem {name: " + getName() + ", switchType: " + getSwitchType() + '}';
Deleted: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/Method.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/Method.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/Method.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -1,26 +0,0 @@
-package org.richfaces.component;
-
-/**
- * @author akolonitsky
- * @since Jun 15, 2010
- */
-//TODO nick - rename into SwitchType or PanelSwitchType
-//TODO nick - move to API
-public enum Method {
- /**
- * value for tab change method for - client-side tabs.
- */
- client,
-
- /**
- * value for tab change method - server-side tabs
- */
- server,
-
- /**
- * value for tab change method - ajax tabs
- */
- ajax
-
- //TODO nick - add DEFAULT constant
-}
Deleted: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UIDivPanel.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UIDivPanel.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UIDivPanel.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, 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.component;
-
-
-
-/**
- * @author akolonitsky
- * @since -4712-01-01
- */
-//TODO nick - remove
-public class UIDivPanel extends AbstractDivPanel {
-
- public static final String COMPONENT_TYPE = "org.richfaces.panels.DivPanel";
-
- public static final String COMPONENT_FAMILY = "org.richfaces.panels.DivPanel";
-
-
-
- @Override
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
-
-}
Modified: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UITogglePanel.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UITogglePanel.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UITogglePanel.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -26,15 +26,9 @@
/**
* @author akolonitsky
- * @since -4712-01-01
*/
-//TODO nick - no behaviors support!
public class UITogglePanel extends AbstractTogglePanel {
- public static final String COMPONENT_TYPE = "org.richfaces.panels.TogglePanel";
-
- public static final String COMPONENT_FAMILY = "org.richfaces.panels.TogglePanel";
-
private enum PropertyKeys {
switchType,
bypassUpdates,
@@ -43,20 +37,14 @@
status,
execute,
render,
- selectedItemChangeListener
+ itemChangeListener
}
-
- @Override
- public String getFamily() {
- return COMPONENT_FAMILY;
+ public SwitchType getSwitchType() {
+ return (SwitchType) getStateHelper().eval(PropertyKeys.switchType, SwitchType.DEFAULT);
}
- public Method getSwitchType() {
- return (Method) getStateHelper().eval(PropertyKeys.switchType, Method.ajax);
- }
-
- public void setSwitchType(Method switchType) {
+ public void setSwitchType(SwitchType switchType) {
getStateHelper().put(PropertyKeys.switchType, switchType);
}
@@ -108,13 +96,12 @@
getStateHelper().put(PropertyKeys.render, render);
}
- public MethodExpression getSelectedItemChangeListener() {
- //TODO nick - get, not eval
- return (MethodExpression) getStateHelper().eval(PropertyKeys.selectedItemChangeListener);
+ public MethodExpression getItemChangeListener() {
+ return (MethodExpression) getStateHelper().get(PropertyKeys.itemChangeListener);
}
- public void setSelectedItemChangeListener(MethodExpression selectedItemChangeListener) {
- getStateHelper().put(PropertyKeys.selectedItemChangeListener, selectedItemChangeListener);
+ public void setItemChangeListener(MethodExpression itemChangeListener) {
+ getStateHelper().put(PropertyKeys.itemChangeListener, itemChangeListener);
}
Modified: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/UITogglePanelItem.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -24,27 +24,15 @@
/**
* @author akolonitsky
- * @since -4712-01-01
*/
-//TODO nick - no behaviors support!
public class UITogglePanelItem extends AbstractTogglePanelItem {
- public static final String COMPONENT_TYPE = "org.richfaces.panels.TogglePanelItem";
-
- public static final String COMPONENT_FAMILY = "org.richfaces.panels.TogglePanelItem";
-
private enum PropertyKeys {
name,
switchType
}
-
@Override
- public String getFamily() {
- return COMPONENT_FAMILY;
- }
-
- @Override
public String getName() {
return String.valueOf(getStateHelper().eval(PropertyKeys.name));
}
@@ -54,13 +42,11 @@
}
@Override
- public Method getSwitchType() {
- return (Method) getStateHelper().eval(PropertyKeys.switchType, getParent().getSwitchType());
+ public SwitchType getSwitchType() {
+ return (SwitchType) getStateHelper().eval(PropertyKeys.switchType, getParent().getSwitchType());
}
- public void setSwitchType(Method switchType) {
+ public void setSwitchType(SwitchType switchType) {
getStateHelper().put(PropertyKeys.switchType, switchType);
}
-
-
}
Modified: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/behavior/ToggleControl.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -62,7 +62,6 @@
}
public String getForPanel() {
- //TODO nick - get, not eval
return (String) getStateHelper().eval(PropertyKeys.forPanel);
}
@@ -70,8 +69,7 @@
getStateHelper().put(PropertyKeys.forPanel, selector);
}
- //TODO nick - argument type is incorrect
- public void setDisableDefault(String disableDefault) {
+ public void setDisableDefault(Boolean disableDefault) {
getStateHelper().put(PropertyKeys.disableDefault, disableDefault);
}
Modified: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlDivPanel.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlDivPanel.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlDivPanel.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -23,13 +23,13 @@
package org.richfaces.component.html;
-import org.richfaces.component.UIDivPanel;
+import org.richfaces.component.AbstractDivPanel;
-public class HtmlDivPanel extends UIDivPanel {
+public class HtmlDivPanel extends AbstractDivPanel {
- public static final String COMPONENT_TYPE = "org.richfaces.panels.DivPanel";
+ public static final String COMPONENT_TYPE = "org.richfaces.DivPanel";
- public static final String COMPONENT_FAMILY = "org.richfaces.panels.DivPanel";
+ public static final String COMPONENT_FAMILY = "org.richfaces.DivPanel";
private enum PropertyKeys {
lang,
@@ -47,7 +47,7 @@
}
public HtmlDivPanel() {
- setRendererType("org.richfaces.panels.DivPanelRenderer");
+ setRendererType("org.richfaces.DivPanel");
}
@Override
Modified: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanel.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanel.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanel.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -24,12 +24,31 @@
import org.richfaces.component.UITogglePanel;
-public class HtmlTogglePanel extends UITogglePanel {
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
- public static final String COMPONENT_TYPE = "org.richfaces.panels.TogglePanel";
+// TODO nick - no behaviors support! check Push renderer to implement
+public class HtmlTogglePanel extends UITogglePanel implements ClientBehaviorHolder {
- public static final String COMPONENT_FAMILY = "org.richfaces.panels.TogglePanel";
+ // todo Html prefix
+ public static final String COMPONENT_TYPE = "org.richfaces.TogglePanel";
+ public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanel";
+
+ private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup",
+ "complete",
+ "beforedomupdate"
+ ));
+
private enum PropertyKeys {
lang,
onclick,
@@ -50,7 +69,7 @@
}
public HtmlTogglePanel() {
- setRendererType("org.richfaces.panels.TogglePanelRenderer");
+ setRendererType("org.richfaces.TogglePanel");
}
@Override
@@ -186,6 +205,8 @@
getStateHelper().put(PropertyKeys.onitemchanged, onitemchanged);
}
-
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
}
-
Modified: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanelItem.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanelItem.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/component/html/HtmlTogglePanelItem.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -24,12 +24,28 @@
import org.richfaces.component.UITogglePanelItem;
-public class HtmlTogglePanelItem extends UITogglePanelItem {
+import javax.faces.component.behavior.ClientBehaviorHolder;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
- public static final String COMPONENT_TYPE = "org.richfaces.panels.TogglePanelItem";
+// TODO nick - no behaviors support!
+public class HtmlTogglePanelItem extends UITogglePanelItem implements ClientBehaviorHolder {
- public static final String COMPONENT_FAMILY = "org.richfaces.panels.TogglePanelItem";
+ public static final String COMPONENT_TYPE = "org.richfaces.TogglePanelItem";
+ public static final String COMPONENT_FAMILY = "org.richfaces.TogglePanelItem";
+
+ private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup"
+ ));
+
private enum PropertyKeys {
lang,
onclick,
@@ -48,7 +64,7 @@
}
public HtmlTogglePanelItem() {
- setRendererType("org.richfaces.panels.TogglePanelItemRenderer");
+ setRendererType("org.richfaces.TogglePanelItem");
}
@Override
@@ -168,6 +184,9 @@
getStateHelper().put(PropertyKeys.onleave, onleave);
}
-
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
}
Copied: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java (from rev 18154, root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionSelectedItemChangeListener.java)
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java (rev 0)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionItemChangeListener.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -0,0 +1,199 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.event;
+
+import javax.el.ELContext;
+import javax.el.ELException;
+import javax.el.MethodExpression;
+import javax.el.MethodNotFoundException;
+import javax.faces.component.StateHolder;
+import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+
+/**
+ * <p><strong><span
+ * class="changed_modified_2_0">MethodExpressionItemChangeListener</span></strong>
+ * is a {@link ItemChangeListener} that wraps a {@link
+ * MethodExpression}. When it receives a {@link ItemChangeEvent}, it
+ * executes a method on an object identified by the {@link
+ * MethodExpression}.</p>
+ *
+ * @author akolonitsky
+ * @version 1.0
+ * @since -4712-01-01
+ *
+ */
+//TODO nick - good candidate for utility class
+public class MethodExpressionItemChangeListener implements ItemChangeListener, StateHolder {
+
+ private static final Class<?>[] ITEM_CHANGE_LISTENER_ZERO_ARG_SIG = new Class[] {};
+
+ private static final Object[] NO_PARAMS = new Object[0];
+
+ // ------------------------------------------------------ Instance Variables
+
+ private MethodExpression methodExpressionOneArg = null;
+ private MethodExpression methodExpressionZeroArg = null;
+
+ private boolean isTransient;
+
+ public MethodExpressionItemChangeListener() {
+ }
+
+ /**
+ * <p><span class="changed_modified_2_0">Construct</span> a {@link
+ * ItemChangeListener} that contains a {@link
+ * MethodExpression}.<span
+ * class="changed_added_2_0">To accomodate method expression targets
+ * that take no arguments instead of taking a {@link
+ * ItemChangeEvent} argument</span>, the implementation of this
+ * class must take the argument <code>methodExpressionOneArg</code>,
+ * extract its expression string, and create another
+ * <code>MethodExpression</code> whose expected param types match
+ * those of a zero argument method. The usage requirements for both
+ * of these <code>MethodExpression</code> instances are described in
+ * {@link #processItemChange}.</span></p>
+ *
+ * @param methodExpressionOneArg a <code>MethodExpression</code>
+ * that points to a method that returns <code>void</code> and takes
+ * a single argument of type {@link ItemChangeEvent}.
+ */
+ public MethodExpressionItemChangeListener(MethodExpression methodExpressionOneArg) {
+
+ super();
+ this.methodExpressionOneArg = methodExpressionOneArg;
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELContext elContext = context.getELContext();
+ this.methodExpressionZeroArg = context.getApplication().
+ getExpressionFactory().createMethodExpression(elContext,
+ methodExpressionOneArg.getExpressionString(), Void.class,
+ ITEM_CHANGE_LISTENER_ZERO_ARG_SIG);
+ }
+
+ /**
+ * <p>Construct a {@link ItemChangeListener} that contains a {@link MethodExpression}.</p>
+ *
+ * @param methodExpressionOneArg
+ * @param methodExpressionZeroArg
+ */
+ public MethodExpressionItemChangeListener(MethodExpression methodExpressionOneArg,
+ MethodExpression methodExpressionZeroArg) {
+
+ super();
+ this.methodExpressionOneArg = methodExpressionOneArg;
+ this.methodExpressionZeroArg = methodExpressionZeroArg;
+ }
+
+ // ------------------------------------------------------- Event Method
+
+ /**
+ * <p><span class="changed_modified_2_0">Call</span> through to the
+ * {@link MethodExpression} passed in our constructor. <span
+ * class="changed_added_2_0">First, try to invoke the
+ * <code>MethodExpression</code> passed to the constructor of this
+ * instance, passing the argument {@link ItemChangeEvent} as the
+ * argument. If a {@link MethodNotFoundException} is thrown, call
+ * to the zero argument <code>MethodExpression</code> derived from
+ * the <code>MethodExpression</code> passed to the constructor of
+ * this instance. If that fails for any reason, throw an {@link
+ * AbortProcessingException}, including the cause of the
+ * failure.</span></p>
+ *
+ * @throws NullPointerException {@inheritDoc}
+ * @throws AbortProcessingException {@inheritDoc}
+ */
+ public void processItemChange(ItemChangeEvent itemChangeEvent) throws AbortProcessingException {
+
+ if (itemChangeEvent == null) {
+ throw new NullPointerException();
+ }
+ FacesContext context = FacesContext.getCurrentInstance();
+ ELContext elContext = context.getELContext();
+ // PENDING: The corresponding code in MethodExpressionActionListener
+ // has an elaborate message capture, logging, and rethrowing block.
+ // Why not here?
+ try {
+ methodExpressionOneArg.invoke(elContext, new Object[] {itemChangeEvent});
+ } catch (MethodNotFoundException mnf) {
+ if (null != methodExpressionZeroArg) {
+
+ try {
+ // try to invoke a no-arg version
+ methodExpressionZeroArg.invoke(elContext, NO_PARAMS);
+ } catch (ELException e) {
+ throw new AbortProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+ } catch (ELException e) {
+ throw new AbortProcessingException(e.getMessage(), e.getCause());
+ }
+ }
+
+
+ // ------------------------------------------------ Methods from StateHolder
+
+
+ /**
+ * <p class="changed_modified_2_0">Both {@link MethodExpression}
+ * instances described in the constructor must be saved.</p>
+ */
+ public Object saveState(FacesContext context) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ return new Object[] {
+ UIComponentBase.saveAttachedState(context, methodExpressionOneArg),
+ UIComponentBase.saveAttachedState(context, methodExpressionZeroArg)
+ };
+ }
+
+
+ /**
+ * <p class="changed_modified_2_0">Both {@link MethodExpression}
+ * instances described in the constructor must be restored.</p>
+ */
+ public void restoreState(FacesContext context, Object state) {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ if (state == null) {
+ return;
+ }
+
+ methodExpressionOneArg = (MethodExpression) UIComponentBase.restoreAttachedState(context, ((Object[]) state)[0]);
+ methodExpressionZeroArg = (MethodExpression) UIComponentBase.restoreAttachedState(context, ((Object[]) state)[1]);
+ }
+
+
+ public boolean isTransient() {
+ return isTransient;
+ }
+
+ public void setTransient(boolean newTransientValue) {
+ isTransient = newTransientValue;
+ }
+}
+
Deleted: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionSelectedItemChangeListener.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionSelectedItemChangeListener.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/MethodExpressionSelectedItemChangeListener.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -1,193 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, 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.event;
-
-import javax.el.ELContext;
-import javax.el.ELException;
-import javax.el.MethodExpression;
-import javax.el.MethodNotFoundException;
-import javax.faces.component.StateHolder;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-
-/**
- * <p><strong><span
- * class="changed_modified_2_0">MethodExpressionSelectedItemChangeListener</span></strong>
- * is a {@link SelectedItemChangeListener} that wraps a {@link
- * MethodExpression}. When it receives a {@link SelectedItemChangeEvent}, it
- * executes a method on an object identified by the {@link
- * MethodExpression}.</p>
- *
- * @author akolonitsky
- * @version 1.0
- * @since -4712-01-01
- *
- */
-//TODO nick - good candidate for utility class
-public class MethodExpressionSelectedItemChangeListener implements SelectedItemChangeListener, StateHolder {
-
- //TODO nick - classes should be generified too
- private static final Class[] SELECTED_ITEM_CHANGE_LISTENER_ZERO_ARG_SIG = new Class[] {};
-
- // ------------------------------------------------------ Instance Variables
-
- private MethodExpression methodExpressionOneArg = null;
- private MethodExpression methodExpressionZeroArg = null;
-
- private boolean isTransient;
-
-
- public MethodExpressionSelectedItemChangeListener() { }
-
- /**
- * <p><span class="changed_modified_2_0">Construct</span> a {@link
- * SelectedItemChangeListener} that contains a {@link
- * MethodExpression}.<span
- * class="changed_added_2_0">To accomodate method expression targets
- * that take no arguments instead of taking a {@link
- * SelectedItemChangeEvent} argument</span>, the implementation of this
- * class must take the argument <code>methodExpressionOneArg</code>,
- * extract its expression string, and create another
- * <code>MethodExpression</code> whose expected param types match
- * those of a zero argument method. The usage requirements for both
- * of these <code>MethodExpression</code> instances are described in
- * {@link #processSelectedItemChange}.</span></p>
- *
- * @param methodExpressionOneArg a <code>MethodExpression</code>
- * that points to a method that returns <code>void</code> and takes
- * a single argument of type {@link SelectedItemChangeEvent}.
- */
- public MethodExpressionSelectedItemChangeListener(MethodExpression methodExpressionOneArg) {
-
- super();
- this.methodExpressionOneArg = methodExpressionOneArg;
- FacesContext context = FacesContext.getCurrentInstance();
- ELContext elContext = context.getELContext();
- this.methodExpressionZeroArg = context.getApplication().
- getExpressionFactory().createMethodExpression(elContext,
- methodExpressionOneArg.getExpressionString(), Void.class,
- SELECTED_ITEM_CHANGE_LISTENER_ZERO_ARG_SIG);
- }
-
- /**
- * <p>Construct a {@link SelectedItemChangeListener} that contains a {@link MethodExpression}.</p>
- */
- public MethodExpressionSelectedItemChangeListener(MethodExpression methodExpressionOneArg,
- MethodExpression methodExpressionZeroArg) {
-
- super();
- this.methodExpressionOneArg = methodExpressionOneArg;
- this.methodExpressionZeroArg = methodExpressionZeroArg;
- }
-
- // ------------------------------------------------------- Event Method
-
- /**
- * <p><span class="changed_modified_2_0">Call</span> through to the
- * {@link MethodExpression} passed in our constructor. <span
- * class="changed_added_2_0">First, try to invoke the
- * <code>MethodExpression</code> passed to the constructor of this
- * instance, passing the argument {@link SelectedItemChangeEvent} as the
- * argument. If a {@link MethodNotFoundException} is thrown, call
- * to the zero argument <code>MethodExpression</code> derived from
- * the <code>MethodExpression</code> passed to the constructor of
- * this instance. If that fails for any reason, throw an {@link
- * AbortProcessingException}, including the cause of the
- * failure.</span></p>
- *
- * @throws NullPointerException {@inheritDoc}
- * @throws AbortProcessingException {@inheritDoc}
- */
- public void processSelectedItemChange(SelectedItemChangeEvent selectedItemChangeEvent) throws AbortProcessingException {
-
- if (selectedItemChangeEvent == null) {
- throw new NullPointerException();
- }
- FacesContext context = FacesContext.getCurrentInstance();
- ELContext elContext = context.getELContext();
- // PENDING: The corresponding code in MethodExpressionActionListener
- // has an elaborate message capture, logging, and rethrowing block.
- // Why not here?
- try {
- methodExpressionOneArg.invoke(elContext, new Object[] {selectedItemChangeEvent});
- } catch (MethodNotFoundException mnf) {
- if (null != methodExpressionZeroArg) {
-
- try {
- // try to invoke a no-arg version
- methodExpressionZeroArg.invoke(elContext, new Object[]{});
- } catch (ELException ee) {
- throw new AbortProcessingException(ee.getMessage(), ee.getCause());
- }
- }
- } catch (ELException ee) {
- throw new AbortProcessingException(ee.getMessage(), ee.getCause());
- }
- }
-
-
- // ------------------------------------------------ Methods from StateHolder
-
-
- /**
- * <p class="changed_modified_2_0">Both {@link MethodExpression}
- * instances described in the constructor must be saved.</p>
- */
- public Object saveState(FacesContext context) {
- if (context == null) {
- throw new NullPointerException();
- }
-
- //TODO nick - use javax.faces.component.UIComponentBase.saveAttachedState(FacesContext, Object)
- return new Object[] {methodExpressionOneArg, methodExpressionZeroArg };
- }
-
-
- /**
- * <p class="changed_modified_2_0">Both {@link MethodExpression}
- * instances described in the constructor must be restored.</p>
- */
- public void restoreState(FacesContext context, Object state) {
-
- if (context == null) {
- throw new NullPointerException();
- }
- if (state == null) {
- return;
- }
-
- //TODO nick - use javax.faces.component.UIComponentBase.restoreAttachedState(FacesContext, Object)
- methodExpressionOneArg = (MethodExpression) ((Object[]) state)[0];
- methodExpressionZeroArg = (MethodExpression) ((Object[]) state)[1];
- }
-
-
- public boolean isTransient() {
- return isTransient;
- }
-
- public void setTransient(boolean newTransientValue) {
- isTransient = newTransientValue;
- }
-}
-
Deleted: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeEvent.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeEvent.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeEvent.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, 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.event;
-
-import javax.faces.component.UIComponent;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.FacesListener;
-
-
-/**
- * <p>A {@link SelectedItemChangeEvent} is a ...</p>
- *
- * @author akolonitsky
- * @version 1.0
- * @since -4712-01-01
- */
-//TODO nick - move to API
-//TODO nick - serialVersionUUID is missing
-public class SelectedItemChangeEvent extends FacesEvent {
-
- private final String oldItem;
- private final String newItem;
-
- // ------------------------------------------------------------ Constructors
-
- /**
- * <p>Construct a new event object from the specified source component,
- * old value, and new value.</p>
- *
- * <p>The default {@link javax.faces.event.PhaseId} for this event is {@link
- * javax.faces.event.PhaseId#ANY_PHASE}.</p>
- *
- * @param component Source {@link UIComponent} for this event
- *
- * @param oldItem
- * @param newItem
- *
- * @throws IllegalArgumentException if <code>component</code> is
- * <code>null</code>
- */
- public SelectedItemChangeEvent(UIComponent component, String oldItem, String newItem) {
- super(component);
- this.oldItem = oldItem;
- this.newItem = newItem;
- }
-
-
- // -------------------------------------------------------------- Properties
-
- public String getOldItem() {
- return oldItem;
- }
-
- public String getNewItem() {
- return newItem;
- }
-
- // ------------------------------------------------- Event Broadcast Methods
-
-
- public boolean isAppropriateListener(FacesListener listener) {
- return listener instanceof SelectedItemChangeListener;
- }
-
- /**
- * @throws javax.faces.event.AbortProcessingException {@inheritDoc}
- */
- public void processListener(FacesListener listener) {
- ((SelectedItemChangeListener) listener).processSelectedItemChange(this);
- }
-}
-
Deleted: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeListener.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeListener.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/event/SelectedItemChangeListener.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright ${year}, 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.event;
-
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesListener;
-
-/**
- * <p>A listener interface for receiving {@link SelectedItemChangeEvent}s. A class
- * that is interested in receiving such events implements this interface, and
- * then registers itself with the source {@link javax.faces.component.UIComponent} of interest, by
- * calling <code>addSelectedItemChangeListener()</code>.</p>
- *
- * @author akolonitsky
- * @version 1.0
- * @since -4712-01-01
- *
- */
-//TODO nick - move to API
-public interface SelectedItemChangeListener extends FacesListener {
-
-
- /**
- * <p>Invoked when {@link SelectedItemChangeEvent} occurs.</p>
- *
- * @param event The {@link SelectedItemChangeEvent} that has occurred
- *
- * @throws AbortProcessingException Signal the JavaServer Faces
- * implementation that no further processing on the current event
- * should be performed
- */
- void processSelectedItemChange(SelectedItemChangeEvent event) throws AbortProcessingException;
-
-}
Modified: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -37,7 +37,6 @@
* @author akolonitsky
*
*/
-//TODO nick - use Renderer instead of RendererBase
public class DivPanelRenderer extends RendererBase {
public static final String[] ATTRIBUTES = new String[] {
@@ -69,9 +68,8 @@
Map<String, Object> componentAttributes = component.getAttributes();
for (String attrName : attributes) {
Object attrValue = componentAttributes.get(attrName);
- //TODO nick - ???
if (!"null".equalsIgnoreCase(String.valueOf(attrValue))) {
- writer.writeAttribute(attrName, attrValue, attrName); // TODO Use RendererUtils
+ writer.writeAttribute(attrName, attrValue, attrName); // TODO Use RendererUtils use writeAttribute
}
}
}
@@ -88,7 +86,8 @@
protected void writeJavaScript(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
Object script = getScriptObject(context, component);
if (script != null) {
- //TODO nick - how does script relate to DIV?
+
+ // TODO nick - how does script relate to DIV?
writer.startElement(HTML.SCRIPT_ELEM, component);
writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", "type");
writer.writeText(script, null);
Modified: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/ToggleControlRenderer.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -39,8 +39,7 @@
@FacesBehaviorRenderer(
rendererType = "org.richfaces.component.behavior.ToggleControl",
renderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT)
-@ResourceDependencies({ // TODO review
- @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+@ResourceDependencies({
@ResourceDependency(name = "jquery.js"),
@ResourceDependency(name = "richfaces.js") })
public class ToggleControlRenderer extends ClientBehaviorRenderer {
Modified: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/renderkit/html/TogglePanelRenderer.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -63,7 +63,7 @@
context.getExternalContext().getRequestParameterMap();
// Don't overwrite the value unless you have to!
- String newValue = requestMap.get(getSelectedItemRequestParamName(context, component));
+ String newValue = requestMap.get(getActiveItemRequestParamName(context, component));
if (newValue != null) {
setSubmittedValue(component, newValue);
@@ -89,19 +89,19 @@
private void addOnCompleteParam(String newValue, AbstractTogglePanel panel) {
StringBuilder onComplete = new StringBuilder();
onComplete.append("RichFaces.$('").append(panel.getClientId()).append("').onCompleteHandler('")
- .append(panel.getSelectedItem()).append("','").append(newValue).append("');");
+ .append(panel.getActiveItem()).append("','").append(newValue).append("');");
AjaxContext.getCurrentInstance().appendOncomplete(onComplete.toString());
}
- private static String getSelectedItemRequestParamName(FacesContext context, UIComponent component) {
+ private static String getActiveItemRequestParamName(FacesContext context, UIComponent component) {
return component.getClientId(context) + VALUE_POSTFIX;
}
// @Override
public void setSubmittedValue(UIComponent component, Object value) {
if (component instanceof AbstractTogglePanel) {
- ((AbstractTogglePanel) component).setSubmittedSelectedItem((String) value);
+ ((AbstractTogglePanel) component).setSubmittedActiveItem((String) value);
// if (logger.isLoggable(Level.FINE)) {
// logger.fine("Set submitted value " + value + " on component ");
@@ -123,9 +123,9 @@
writer.startElement(HTML.INPUT_ELEM, comp);
writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
- writer.writeAttribute(HTML.VALUE_ATTRIBUTE, panel.getSelectedItem(), "selectedItem");
- writer.writeAttribute(HTML.ID_ATTRIBUTE, getSelectedItemRequestParamName(context, comp), null);
- writer.writeAttribute(HTML.NAME_ATTRIBUTE, getSelectedItemRequestParamName(context, comp), null);
+ writer.writeAttribute(HTML.VALUE_ATTRIBUTE, panel.getActiveItem(), "activeItem");
+ writer.writeAttribute(HTML.ID_ATTRIBUTE, getActiveItemRequestParamName(context, comp), null);
+ writer.writeAttribute(HTML.NAME_ATTRIBUTE, getActiveItemRequestParamName(context, comp), null);
writer.endElement(HTML.INPUT_ELEM);
}
@@ -135,6 +135,7 @@
return;
}
+ //TODO nick - non-rendered items shouldn't be processed
for (UIComponent child : component.getChildren()) {
if (!(child instanceof AbstractTogglePanelItem)) {
throw new IllegalStateException("Child of TogglePanel can be only TogglePanelItem");
@@ -147,14 +148,13 @@
private void doEncodeChild(FacesContext facesContext, AbstractTogglePanel panel, AbstractTogglePanelItem item)
throws IOException {
- boolean isSelected = panel.getSelectedItem().equals(item.getName());
+ boolean isSelected = panel.getActiveItem().equals(item.getName());
if (isSelected) {
item.encodeAll(facesContext);
} else {
switch (item.getSwitchType()) {
- //TODO nick - non-rendered items shouldn't be processed
case client:
hidePanelItem(item);
@@ -172,7 +172,7 @@
break;
case server:
- //TODO nick - why nothing?
+ // Do nothing.
break;
default:
@@ -183,8 +183,10 @@
}
+ // TODO why item don't know how it should be rendered
private static void hidePanelItem(UIComponent item) {
//TODO nick - attributes shouldn't be overwritten
+
item.getAttributes().put(HTML.STYLE_ATTRIBUTE, "display:none");
}
@@ -198,7 +200,7 @@
AbstractTogglePanel panel = (AbstractTogglePanel) component;
Map<String, Object> options = new HashMap<String, Object>(3);
- options.put("selectedItem", panel.getValue());
+ options.put("activeItem", panel.getValue());
options.put("switchMode", panel.getSwitchType());
options.put("items", getChildrenScriptObjects(context, panel));
Copied: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java (from rev 18081, root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/taglib/SelectedItemChangeListenerHandler.java)
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java (rev 0)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/ItemChangeListenerHandler.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -0,0 +1,158 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.view.facelets.html;
+
+import org.richfaces.component.AbstractTogglePanel;
+import org.richfaces.event.ItemChangeEvent;
+import org.richfaces.event.ItemChangeListener;
+
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.view.EditableValueHolderAttachedObjectHandler;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.TagAttribute;
+import javax.faces.view.facelets.TagAttributeException;
+import javax.faces.view.facelets.TagConfig;
+import javax.faces.view.facelets.TagException;
+import javax.faces.view.facelets.TagHandler;
+import java.io.IOException;
+import java.io.Serializable;
+
+/**
+ *
+ * @author akolonitsky
+ * @version 1.0
+ */
+public final class ItemChangeListenerHandler extends TagHandler implements EditableValueHolderAttachedObjectHandler {
+
+ private static class LazyItemChangeListener implements ItemChangeListener, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private final String type;
+
+ private final ValueExpression binding;
+
+ LazyItemChangeListener(String type, ValueExpression binding) {
+ this.type = type;
+ this.binding = binding;
+ }
+
+ public void processItemChange(ItemChangeEvent event)
+ throws AbortProcessingException {
+
+ FacesContext faces = FacesContext.getCurrentInstance();
+ if (faces == null) {
+ return;
+ }
+
+ ItemChangeListener instance = null;
+ if (this.binding != null) {
+ instance = (ItemChangeListener) binding.getValue(faces.getELContext());
+ }
+ if (instance == null && this.type != null) {
+ try {
+ instance = (ItemChangeListener) forName(this.type).newInstance();
+ } catch (Exception e) {
+ throw new AbortProcessingException("Couldn't Lazily instantiate ItemChangeListener", e);
+ }
+ if (this.binding != null) {
+ binding.setValue(faces.getELContext(), instance);
+ }
+ }
+ if (instance != null) {
+ instance.processItemChange(event);
+ }
+ }
+ }
+
+ private final TagAttribute binding;
+
+ private final String listenerType;
+
+ public ItemChangeListenerHandler(TagConfig config) {
+ super(config);
+ this.binding = this.getAttribute("binding");
+ TagAttribute type = this.getAttribute("type");
+ if (type != null) {
+ if (type.isLiteral()) {
+ try {
+ forName(type.getValue());
+ } catch (ClassNotFoundException e) {
+ throw new TagAttributeException(type, "Couldn't qualify ItemChangeListener", e);
+ }
+ } else {
+ throw new TagAttributeException(type, "Must be a literal class name of type ItemChangeListener");
+ }
+ this.listenerType = type.getValue();
+ } else {
+ this.listenerType = null;
+ }
+ }
+
+ public void apply(FaceletContext ctx, UIComponent parent) throws IOException {
+
+ // only process if it's been created
+ if (parent == null || !ComponentHandler.isNew(parent)) {
+ return;
+ }
+
+ if (parent instanceof AbstractTogglePanel) {
+ applyAttachedObject(ctx.getFacesContext(), parent);
+ } else if (UIComponent.isCompositeComponent(parent)) {
+ // Allow the composite component to know about the target component.
+ TagHandlerUtils.getOrCreateRetargetableHandlersList(parent).add(this);
+ } else {
+ throw new TagException(this.tag, "Parent is not of type EditableValueHolder, type is: " + parent);
+ }
+ }
+
+ public void applyAttachedObject(FacesContext context, UIComponent parent) {
+ ValueExpression valueExpr = null;
+ if (this.binding != null) {
+ FaceletContext ctx = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
+ valueExpr = this.binding.getValueExpression(ctx, ItemChangeListener.class);
+ }
+
+ AbstractTogglePanel evh = (AbstractTogglePanel) parent;
+ //TODO nick - this should be done via API interface define interfaces SelectedItemChangeSource
+ evh.addItemChangeListener(new LazyItemChangeListener(this.listenerType, valueExpr));
+ }
+
+ public String getFor() {
+ TagAttribute attr = this.getAttribute("for");
+ return attr == null ? null : attr.getValue();
+ }
+
+ public static Class<?> forName(String name) throws ClassNotFoundException {
+ if (null == name || "".equals(name)) {
+ return null;
+ }
+
+ return Class.forName(name, false, Thread.currentThread().getContextClassLoader());
+ }
+}
+
Copied: root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/TogglePanelTagHandler.java (from rev 18081, root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/taglib/TogglePanelTagHandler.java)
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/TogglePanelTagHandler.java (rev 0)
+++ root/ui/output/trunk/panels/ui/src/main/java/org/richfaces/view/facelets/html/TogglePanelTagHandler.java 2010-07-20 15:17:30 UTC (rev 18161)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.view.facelets.html;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+import org.richfaces.component.AbstractTogglePanel;
+import org.richfaces.event.ItemChangeEvent;
+import org.richfaces.event.MethodExpressionItemChangeListener;
+
+/**
+ * @author akolonitsky
+ * @version 1.0
+ * @since -4712-01-01
+ */
+public class TogglePanelTagHandler extends ComponentHandler {
+
+ private static final MetaRule META_RULE = new TogglePanelMetaRule();
+
+
+ public TogglePanelTagHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset metaRuleset = super.createMetaRuleset(type);
+ metaRuleset.addRule(META_RULE);
+ return metaRuleset;
+ }
+
+ private static class TogglePanelMetaRule extends MetaRule{
+
+ @Override
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(AbstractTogglePanel.class)) {
+ if ("itemChangeListener".equals(name)) {
+ return new ItemChangeExpressionMetadata(attribute);
+ }
+
+ }
+ return null;
+ }
+ }
+
+ private static final class ItemChangeExpressionMetadata extends Metadata {
+ private static final Class<?>[] ITEM_CHANGE_SIG = new Class[] {ItemChangeEvent.class };
+
+ private final TagAttribute attr;
+
+ ItemChangeExpressionMetadata(TagAttribute attr) {
+ this.attr = attr;
+ }
+
+ @Override
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractTogglePanel) instance).addItemChangeListener(new MethodExpressionItemChangeListener(
+ this.attr.getMethodExpression(ctx, null, ITEM_CHANGE_SIG)));
+ }
+ }
+
+
+
+}
+
Modified: root/ui/output/trunk/panels/ui/src/main/resources/META-INF/pn.faces-config.xml
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-07-20 15:17:30 UTC (rev 18161)
@@ -11,7 +11,7 @@
</behavior>
<component>
- <component-type>org.richfaces.panels.DivPanel</component-type>
+ <component-type>org.richfaces.DivPanel</component-type>
<component-class>org.richfaces.component.html.HtmlDivPanel</component-class>
<property>
<description></description>
@@ -91,7 +91,7 @@
</component>
<component>
- <component-type>org.richfaces.panels.TogglePanel</component-type>
+ <component-type>org.richfaces.TogglePanel</component-type>
<component-class>org.richfaces.component.html.HtmlTogglePanel</component-class>
<property>
<description></description>
@@ -191,11 +191,11 @@
<property>
<description></description>
<property-name>switchType</property-name>
- <property-class>org.richfaces.component.Method</property-class>
+ <property-class>org.richfaces.component.SwitchType</property-class>
</property>
<property>
<description></description>
- <property-name>selectedItem</property-name>
+ <property-name>activeItem</property-name>
<property-class>java.lang.String</property-class>
</property>
<property>
@@ -235,13 +235,13 @@
</property>
<property>
<description></description>
- <property-name>selectedItemChangeListener</property-name>
+ <property-name>itemChangeListener</property-name>
<property-class>javax.el.MethodExpression</property-class>
</property>
</component>
<component>
- <component-type>org.richfaces.panels.TogglePanelItem</component-type>
+ <component-type>org.richfaces.TogglePanelItem</component-type>
<component-class>org.richfaces.component.html.HtmlTogglePanelItem</component-class>
<property>
<description></description>
@@ -326,7 +326,7 @@
<property>
<description></description>
<property-name>switchType</property-name>
- <property-class>org.richfaces.component.Method</property-class>
+ <property-class>org.richfaces.component.SwitchType</property-class>
</property>
<property>
<description></description>
@@ -345,18 +345,18 @@
<render-kit>
<render-kit-id>HTML_BASIC</render-kit-id>
<renderer>
- <component-family>org.richfaces.panels.DivPanel</component-family>
- <renderer-type>org.richfaces.panels.DivPanelRenderer</renderer-type>
+ <component-family>org.richfaces.DivPanel</component-family>
+ <renderer-type>org.richfaces.DivPanel</renderer-type>
<renderer-class>org.richfaces.renderkit.html.DivPanelRenderer</renderer-class>
</renderer>
<renderer>
- <component-family>org.richfaces.panels.TogglePanel</component-family>
- <renderer-type>org.richfaces.panels.TogglePanelRenderer</renderer-type>
+ <component-family>org.richfaces.TogglePanel</component-family>
+ <renderer-type>org.richfaces.TogglePanel</renderer-type>
<renderer-class>org.richfaces.renderkit.html.TogglePanelRenderer</renderer-class>
</renderer>
<renderer>
- <component-family>org.richfaces.panels.TogglePanelItem</component-family>
- <renderer-type>org.richfaces.panels.TogglePanelItemRenderer</renderer-type>
+ <component-family>org.richfaces.TogglePanelItem</component-family>
+ <renderer-type>org.richfaces.TogglePanelItem</renderer-type>
<renderer-class>org.richfaces.renderkit.html.TogglePanelItemRenderer</renderer-class>
</renderer>
Modified: root/ui/output/trunk/panels/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/resources/META-INF/pn.taglib.xml 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/resources/META-INF/pn.taglib.xml 2010-07-20 15:17:30 UTC (rev 18161)
@@ -16,9 +16,8 @@
<tag>
<tag-name>divPanel</tag-name>
<component>
- <component-type>org.richfaces.panels.DivPanel</component-type>
- <renderer-type>org.richfaces.panels.DivPanelRenderer</renderer-type>
-
+ <component-type>org.richfaces.DivPanel</component-type>
+ <renderer-type>org.richfaces.DivPanel</renderer-type>
</component>
<attribute>
<description></description>
@@ -101,9 +100,9 @@
<tag>
<tag-name>togglePanel</tag-name>
<component>
- <component-type>org.richfaces.panels.TogglePanel</component-type>
- <renderer-type>org.richfaces.panels.TogglePanelRenderer</renderer-type>
- <handler-class>org.richfaces.taglib.TogglePanelTagHandler</handler-class>
+ <component-type>org.richfaces.TogglePanel</component-type>
+ <renderer-type>org.richfaces.TogglePanel</renderer-type>
+ <handler-class>org.richfaces.view.facelets.html.TogglePanelTagHandler</handler-class>
</component>
<attribute>
<description></description>
@@ -203,11 +202,11 @@
<attribute>
<description></description>
<name>switchType</name>
- <type>org.richfaces.component.Method</type>
+ <type>org.richfaces.component.SwitchType</type>
</attribute>
<attribute>
<description></description>
- <name>selectedItem</name>
+ <name>activeItem</name>
<type>java.lang.String</type>
</attribute>
<attribute>
@@ -247,23 +246,23 @@
</attribute>
<attribute>
<description></description>
- <name>selectedItemChangeListener</name>
+ <name>itemChangeListener</name>
<type>javax.el.MethodExpression</type>
</attribute>
</tag>
<tag>
<description>
- Register a SelectedItemChangeListener instance on the UIComponent
+ Register a ItemChangeListener instance on the UIComponent
associated with the closest parent UIComponent custom
action.
</description>
- <tag-name>selectedItemChangeListener</tag-name>
- <handler-class>org.richfaces.taglib.SelectedItemChangeListenerHandler</handler-class>
+ <tag-name>itemChangeListener</tag-name>
+ <handler-class>org.richfaces.view.facelets.html.ItemChangeListenerHandler</handler-class>
<attribute>
<description>
Fully qualified Java class name of a
- SelectedItemChangeListener to be created and registered.
+ ItemChangeListener to be created and registered.
</description>
<name>type</name>
<type>java.lang.String</type>
@@ -271,11 +270,11 @@
<attribute>
<description>
Value binding expression that evaluates to an object that
- implements org.richfaces.event.SelectedItemChangeListener.
+ implements org.richfaces.event.ItemChangeListener.
</description>
<name>binding</name>
<required>false</required>
- <type>org.richfaces.event.SelectedItemChangeListener</type>
+ <type>org.richfaces.event.ItemChangeListener</type>
</attribute>
<attribute>
<description>
@@ -291,8 +290,8 @@
<tag>
<tag-name>togglePanelItem</tag-name>
<component>
- <component-type>org.richfaces.panels.TogglePanelItem</component-type>
- <renderer-type>org.richfaces.panels.TogglePanelItemRenderer</renderer-type>
+ <component-type>org.richfaces.TogglePanelItem</component-type>
+ <renderer-type>org.richfaces.TogglePanelItem</renderer-type>
</component>
<attribute>
@@ -379,7 +378,7 @@
<attribute>
<description></description>
<name>switchType</name>
- <type>org.richfaces.component.Method</type>
+ <type>org.richfaces.component.SwitchType</type>
</attribute>
<attribute>
<description></description>
Modified: root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanel.js
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanel.js 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanel.js 2010-07-20 15:17:30 UTC (rev 18161)
@@ -57,13 +57,13 @@
* @return {Boolean} false
* */
execServer : function (oldPanel, newPanel) {
- var continueProcess = oldPanel.leave();
+ var continueProcess = oldPanel.__leave();
if (!continueProcess) {
return false;
}
- this.__setSelectedItem(newPanel.getName());
+ this.__setActiveItem(newPanel.getName());
rf.submitForm(this.__getParentForm(), null, {});
@@ -80,9 +80,9 @@
execAjax : function (oldPanel, newPanel) {
var options = $.extend({}, this.comp.options["ajax"], {}/*this.getParameters(newPanel)*/);
- this.__setSelectedItem(newPanel.getName());
+ this.__setActiveItem(newPanel.getName());
rf.ajax(this.comp.id, null, options);
- this.__setSelectedItem(oldPanel.getName());
+ this.__setActiveItem(oldPanel.getName());
return false;
},
@@ -97,14 +97,14 @@
* - true - in other cases
* */
execClient : function (oldPanel, newPanel) {
- var continueProcess = oldPanel.leave();
+ var continueProcess = oldPanel.__leave();
if (!continueProcess) {
return false;
}
- this.__setSelectedItem(newPanel.getName());
+ this.__setActiveItem(newPanel.getName());
- newPanel.enter();
+ newPanel.__enter();
this.__fireItemChange(oldPanel, newPanel);
return true;
@@ -120,9 +120,9 @@
/**
* @private
* */
- __setSelectedItem : function (name) {
+ __setActiveItem : function (name) {
rf.getDomElement(this.__getValueInputId()).value = name;
- this.comp.selectedItem = name;
+ this.comp.activeItem = name;
},
/**
@@ -153,7 +153,7 @@
this.attachToDom(componentId);
this.options = options;
- this.selectedItem = this.options.selectedItem;
+ this.activeItem = this.options.activeItem;
this.switchMode = this.options.switchMode;
this.items = this.options.items;
},
@@ -167,7 +167,7 @@
* @return {String} name of current selected panel item
*/
getSelectItem: function () {
- return this.selectedItem;
+ return this.activeItem;
},
/**
@@ -257,11 +257,11 @@
* @methodOf
* @name TogglePanel#nextItem
*
- * @param {String} [itemName = selectedItem]
+ * @param {String} [itemName = activeItem]
* @return {String} name of next panel item
*/
nextItem: function (itemName) {
- var itemIndex = this.__getItemIndex(itemName || this.selectedItem);
+ var itemIndex = this.__getItemIndex(itemName || this.activeItem);
if (itemIndex == -1) {
return null;
}
@@ -298,7 +298,7 @@
* null if it is first item
*/
prevItem: function (itemName) {
- var itemIndex = this.__getItemIndex(itemName || this.selectedItem);
+ var itemIndex = this.__getItemIndex(itemName || this.activeItem);
if (itemIndex < 1) {
return null;
}
@@ -335,8 +335,8 @@
__ITEMS_META_NAMES : {
"@first" : function (comp) { return 0; },
- "@prev" : function (comp) { return comp.__getItemIndex(comp.selectedItem) - 1; },
- "@next" : function (comp) { return comp.__getItemIndex(comp.selectedItem) + 1; },
+ "@prev" : function (comp) { return comp.__getItemIndex(comp.activeItem) - 1; },
+ "@next" : function (comp) { return comp.__getItemIndex(comp.activeItem) + 1; },
"@last" : function (comp) { return comp.items.length - 1; }
},
Modified: root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js
===================================================================
--- root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js 2010-07-20 15:11:58 UTC (rev 18160)
+++ root/ui/output/trunk/panels/ui/src/main/resources/META-INF/resources/script/TogglePanelItem.js 2010-07-20 15:17:30 UTC (rev 18161)
@@ -22,104 +22,97 @@
(function ($, rf) {
- /***************************** Stuff ******************************************************************************/
rf.ui = rf.ui || {};
- rf.ui.TogglePanelItem = function(componentId, options) {
- // call constructor of parent class
- $super.constructor.call(this, componentId);
- this.attachToDom(componentId);
+ rf.ui.TogglePanelItem = rf.BaseComponent.extendClass({
- this.options = options;
- this.name = this.options.name;
- this.togglePanelId = this.options.togglePanelId;
- this.switchMode = this.options.switchMode;
- };
+ // class name
+ name:"TogglePanelItem",
- rf.BaseComponent.extend(rf.ui.TogglePanelItem);
+ init : function (componentId, options) {
+ // call constructor of parent class
+ this.$super.constructor.call(this, componentId);
+ this.$super.attachToDom.call(this, componentId);
- // define super class link
- var $super = rf.ui.TogglePanelItem.$super;
+ this.options = options;
+ this.name = this.options.name;
+ this.togglePanelId = this.options.togglePanelId;
+ this.switchMode = this.options.switchMode;
+ },
- /***************************** Private Static Methods *************************************************************/
+ /***************************** Public Methods *****************************************************************/
+ /**
+ * @methodOf TogglePanelItem
+ * @name TogglePanelItem#getName
+ *
+ * @return {String} panel item name
+ */
+ getName: function () {
+ return this.options.name;
+ },
- function fireLeave($this) {
- return rf.Event.fireById($this.id, "leave");
- }
+ /**
+ * @methodOf
+ * @name TogglePanelItem#getTogglePanel
+ *
+ * @return {TogglePanel} parent TogglePanel
+ * */
+ getTogglePanel : function () {
+ return rf.$(this.togglePanelId);
+ },
- function fireEnter($this) {
- return rf.Event.fireById($this.id, "enter");
- }
+ /**
+ * @methodOf
+ * @name TogglePanelItem#isSelected
+ *
+ * @return {Boolean} true if this panel item is selected in the parent toggle panel
+ * */
+ isSelected : function () {
+ return this.getName() == this.getTogglePanel().getSelectItem();
+ },
- /***************************** Public Methods ********************************************************************/
- $.extend(rf.ui.TogglePanelItem.prototype, (function () {
- return {
- // class name
- name:"TogglePanelItem",
- // public api
- /**
- * @methodOf
- * @name TogglePanelItem#getName
- *
- * @return {String} panel item name
- */
- getName: function () {
- return this.options.name;
- },
+ /***************************** Private Methods ****************************************************************/
- /**
- * @methodOf
- * @name TogglePanelItem#getTogglePanel
- *
- * @return {TogglePanel} parent TogglePanel
- * */
- getTogglePanel : function () {
- return rf.$(this.togglePanelId);
- },
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __enter : function () {
+ rf.getDomElement(this.id).style.display = "block";
- /**
- * @methodOf
- * @name TogglePanelItem#isSelected
- *
- * @return {Boolean} true if this panel item is selected in the parent toggle panel
- * */
- isSelected : function () {
- return this.getName() == this.getTogglePanel().getSelectItem();
- },
+ return this.__fireEnter();
+ },
- /**
- * @private
- *
- * used in TogglePanel
- * */
- enter : function () {
- rf.getDomElement(this.id).style.display = "block";
+ /**
+ * @private
+ *
+ * used in TogglePanel
+ * */
+ __leave : function () {
+ var continueProcess = this.__fireLeave();
+ if (!continueProcess) {
+ return false;
+ }
- return fireEnter(this);
- },
+ rf.getDomElement(this.id).style.display = "none";
+ return true;
+ },
- /**
- * @private
- *
- * used in TogglePanel
- * */
- leave : function () {
- var continueProcess = fireLeave(this);
- if (!continueProcess) {
- return false;
- }
+ __fireLeave : function () {
+ return rf.Event.fireById(this.id, "__leave");
+ },
- rf.getDomElement(this.id).style.display = "none";
- return true;
- },
+ __fireEnter : function () {
+ return rf.Event.fireById(this.id, "__enter");
+ },
- // class stuff
- destroy: function () {
- // rf.Event.unbindById(this.options.buttonId, "."+this.namespace);
- // rf.Event.unbindById(this.componentId, "."+this.namespace);
-// $super.destroy.call(this);
- }
- };
- })());
+ // class stuff
+ destroy: function () {
+ // rf.Event.unbindById(this.options.buttonId, "."+this.namespace);
+ // rf.Event.unbindById(this.componentId, "."+this.namespace);
+ // $super.destroy.call(this);
+ }
+ });
})(jQuery, RichFaces);
14 years, 5 months
JBoss Rich Faces SVN: r18160 - in root/tests/metamer/trunk/application/src/main: resources/org/richfaces/tests/metamer/bean and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-07-20 11:11:58 -0400 (Tue, 20 Jul 2010)
New Revision: 18160
Added:
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichListBean.java
root/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichListBean.properties
root/tests/metamer/trunk/application/src/main/webapp/components/richList/
root/tests/metamer/trunk/application/src/main/webapp/components/richList/list.xhtml
root/tests/metamer/trunk/application/src/main/webapp/components/richList/simple.xhtml
root/tests/metamer/trunk/application/src/main/webapp/resources/css/richList.css
Modified:
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
* component rich:list added
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-20 13:33:16 UTC (rev 18159)
+++ root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-07-20 15:11:58 UTC (rev 18160)
@@ -106,6 +106,7 @@
components.put("richDataScroller", "Rich Data Scroller");
components.put("richDataTable", "Rich Data Table");
components.put("richExtendedDataTable", "Rich Extended Data Table");
+ components.put("richList", "Rich List");
}
private void createSkinList() {
Added: root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichListBean.java
===================================================================
--- root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichListBean.java (rev 0)
+++ root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichListBean.java 2010-07-20 15:11:58 UTC (rev 18160)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * 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.ViewScoped;
+
+import org.richfaces.component.UIList;
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for rich:list.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "richListBean")
+@ViewScoped
+public class RichListBean implements Serializable {
+
+ private static final long serialVersionUID = 4008175400649809L;
+ 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(UIList.class, getClass());
+
+ attributes.setAttribute("type", "ordered");
+ attributes.setAttribute("rendered", true);
+ attributes.setAttribute("rows", 20);
+
+ // TODO has to be tested in other way
+ attributes.remove("componentState");
+ attributes.remove("rowKeyVar");
+ attributes.remove("stateVar");
+ attributes.remove("value");
+ attributes.remove("var");
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+}
Property changes on: root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichListBean.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added: root/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichListBean.properties
===================================================================
--- root/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichListBean.properties (rev 0)
+++ root/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/RichListBean.properties 2010-07-20 15:11:58 UTC (rev 18160)
@@ -0,0 +1,6 @@
+attr.dir.ltr=ltr
+attr.dir.rtl=rtl
+attr.dir.none=
+attr.type.ordered=ordered
+attr.type.unordered=unordered
+attr.type.definitions=definitions
\ No newline at end of file
Added: root/tests/metamer/trunk/application/src/main/webapp/components/richList/list.xhtml
===================================================================
--- root/tests/metamer/trunk/application/src/main/webapp/components/richList/list.xhtml (rev 0)
+++ root/tests/metamer/trunk/application/src/main/webapp/components/richList/list.xhtml 2010-07-20 15:11:58 UTC (rev 18160)
@@ -0,0 +1,41 @@
+<!--
+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>Rich List</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>rich:list</b> (with model containing capitals) and
+ input boxes for all its attributes.</div>
+
+ </h:body>
+</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/application/src/main/webapp/components/richList/simple.xhtml
===================================================================
--- root/tests/metamer/trunk/application/src/main/webapp/components/richList/simple.xhtml (rev 0)
+++ root/tests/metamer/trunk/application/src/main/webapp/components/richList/simple.xhtml 2010-07-20 15:11:58 UTC (rev 18160)
@@ -0,0 +1,95 @@
+<!--
+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"
+ xmlns:it="http://richfaces.org/iteration">
+
+ <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="richList.css" />
+
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <it:list id="richList"
+ dir="#{richListBean.attributes['dir'].value}"
+ first="#{richListBean.attributes['first'].value}"
+ iterationState="#{richListBean.attributes['iterationState'].value}"
+ iterationStatusVar="#{richListBean.attributes['iterationStatusVar'].value}"
+ keepSaved="#{richListBean.attributes['keepSaved'].value}"
+ lang="#{richListBean.attributes['lang'].value}"
+ onclick="#{richListBean.attributes['onclick'].value}"
+ ondblclick="#{richListBean.attributes['ondblclick'].value}"
+ onkeydown="#{richListBean.attributes['onkeydown'].value}"
+ onkeypress="#{richListBean.attributes['onkeypress'].value}"
+ onkeyup="#{richListBean.attributes['onkeyup'].value}"
+ onmousedown="#{richListBean.attributes['onmousedown'].value}"
+ onmousemove="#{richListBean.attributes['onmousemove'].value}"
+ onmouseout="#{richListBean.attributes['onmouseout'].value}"
+ onmouseover="#{richListBean.attributes['onmouseover'].value}"
+ onmouseup="#{richListBean.attributes['onmouseup'].value}"
+ relativeRowIndex="#{richListBean.attributes['relativeRowIndex'].value}"
+ rendered="#{richListBean.attributes['rendered'].value}"
+ rowAvailable="#{richListBean.attributes['rowAvailable'].value}"
+ rowClass="#{richListBean.attributes['rowClass'].value}"
+ rowClasses="#{richListBean.attributes['rowClasses'].value}"
+ rowCount="#{richListBean.attributes['rowCount'].value}"
+ rowData="#{richListBean.attributes['rowData'].value}"
+ rowIndex="#{richListBean.attributes['rowIndex'].value}"
+ rowKey="#{richListBean.attributes['rowKey'].value}"
+ rowKeyConverter="#{richListBean.attributes['rowKeyConverter'].value}"
+ rows="#{richListBean.attributes['rows'].value}"
+ style="#{richListBean.attributes['style'].value}"
+ styleClass="#{richListBean.attributes['styleClass'].value}"
+ value="#{model.employees}"
+ var="item"
+ term="#{richListBean.attributes['term'].value}"
+ title="#{richListBean.attributes['title'].value}"
+ type="#{richListBean.attributes['type'].value}">
+ <f:facet name="term">
+ <h:outputText id="term" value="#{item.title}" style="font-weight: bold"/>
+ </f:facet>
+
+ #{item.name}
+ </it:list>
+
+ <it:dataScroller for="richList" />
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <ta:attributes value="#{richListBean.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/richList.css
===================================================================
14 years, 5 months
JBoss Rich Faces SVN: r18159 - in root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: a4jCommandButton and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-20 09:33:16 -0400 (Tue, 20 Jul 2010)
New Revision: 18159
Added:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/TestA4JActionListener.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/TestA4JCommandButton.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/TestA4JLog.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/TestA4JOutputPanel.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestPoll.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTest.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/TestCounter.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/TestInterval.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/TestHCommandButton.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/TestScroller.java
Removed:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/A4JActionListenerTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/A4JCommandButtonTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/A4JCommandLinkTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/A4JLogTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/A4JOutputPanelTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/IntervalTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/SimpleTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/HCommandButtonTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/ScrollerTestCase.java
Log:
new convention for tests: prefix Test* instead of suffix *TestCase - will improve orientation across packages
Deleted: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/A4JActionListenerTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/A4JActionListenerTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/A4JActionListenerTestCase.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * 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.ftest.a4jActionListener;
-
-import org.jboss.test.selenium.encapsulated.JavaScript;
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.jboss.test.selenium.waiting.ajax.JavaScriptCondition;
-import org.jboss.test.selenium.waiting.selenium.SeleniumCondition;
-import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-/**
- * Test case for page /faces/components/a4jActionListener/all.xhtml
- *
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
- * @version $Revision$
- */
-public class A4JActionListenerTestCase extends AbstractMetamerTest {
-
- private ElementLocator invokeButtonType = pjq("input[id$=invokeByTypeButton]");
- private ElementLocator invokeButtonBinding = pjq("input[id$=invokeByBindingButton]");
- private ElementLocator invokeButtonMethod = pjq("input[id$=invokeMethodButton]");
- private ElementLocator invokeButtonCC = pjq("input[id$=invokeFromCCButton:button]");
- private JQueryLocator message = pjq("ul[id$=messages] li");
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/a4jActionListener/all.xhtml");
- }
-
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- @Test(dataProvider = "templates")
- public void testInvokeListenerByType(String templates) {
- final String hashCodeRegExp = "@[0-9a-fA-F]{1,}$";
- final String msg = "Implementation of ActionListener created and called: "
- + "org.richfaces.tests.metamer.bean.A4JActionListenerBean$ActionListenerImpl";
-
- selenium.click(invokeButtonType);
- waitGui.until(elementPresent.locator(message));
- final String output1 = selenium.getText(message);
-
- assertEquals(output1.replaceAll(hashCodeRegExp, ""), msg, "Message after first invocation of listener by type.");
-
- int count = selenium.getCount(message);
- assertEquals(count, 1, "Only one message should be displayed on the page.");
-
- // do the same once again
-
- selenium.click(invokeButtonType);
-
- waitModel.failWith("New object of class ActionListenerImpl should be instantiated.").until(
- new SeleniumCondition() {
-
- public boolean isTrue() {
- return !output1.equals(selenium.getText(message));
- }
- });
-
- count = selenium.getCount(message);
- assertEquals(count, 1, "Only one message should be displayed on the page.");
-
- }
-
- @Test(dataProvider = "templates")
- public void testInvokeListenerByBinding(String templates) {
- final String msg = "Bound listener called";
-
- selenium.click(invokeButtonBinding);
- waitGui.until(elementPresent.locator(message));
- String output = selenium.getText(message);
-
- assertEquals(output, msg, "Message after first invocation of listener by binding.");
-
- int count = selenium.getCount(message);
- assertEquals(count, 1, "Only one message should be displayed on the page.");
- }
-
- @Test(dataProvider = "templates")
- public void testInvokeListenerMethod(String templates) {
- final String msg = "Method expression listener called";
-
- selenium.click(invokeButtonMethod);
- waitGui.until(elementPresent.locator(message));
- String output = selenium.getText(message);
-
- assertEquals(output, msg, "Message after first invocation of listener method.");
-
- int count = selenium.getCount(message);
- assertEquals(count, 1, "Only one message should be displayed on the page.");
- }
-
- @Test(dataProvider = "templates")
- public void testInvokeListenerMethodCC(String templates) {
- final String msg = "Method expression listener called from composite component";
-
- selenium.click(invokeButtonCC);
- waitGui.until(elementPresent.locator(message));
- String output = selenium.getText(message);
-
- assertEquals(output, msg, "Message after first invocation of listener method from composite component.");
-
- int count = selenium.getCount(message);
- assertEquals(count, 1, "Only one message should be displayed on the page.");
- }
-}
Copied: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/TestA4JActionListener.java (from rev 18158, root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/A4JActionListenerTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/TestA4JActionListener.java (rev 0)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/TestA4JActionListener.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * 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.ftest.a4jActionListener;
+
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.waiting.ajax.JavaScriptCondition;
+import org.jboss.test.selenium.waiting.selenium.SeleniumCondition;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jActionListener/all.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestA4JActionListener extends AbstractMetamerTest {
+
+ private ElementLocator invokeButtonType = pjq("input[id$=invokeByTypeButton]");
+ private ElementLocator invokeButtonBinding = pjq("input[id$=invokeByBindingButton]");
+ private ElementLocator invokeButtonMethod = pjq("input[id$=invokeMethodButton]");
+ private ElementLocator invokeButtonCC = pjq("input[id$=invokeFromCCButton:button]");
+ private JQueryLocator message = pjq("ul[id$=messages] li");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jActionListener/all.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInvokeListenerByType(String templates) {
+ final String hashCodeRegExp = "@[0-9a-fA-F]{1,}$";
+ final String msg = "Implementation of ActionListener created and called: "
+ + "org.richfaces.tests.metamer.bean.A4JActionListenerBean$ActionListenerImpl";
+
+ selenium.click(invokeButtonType);
+ waitGui.until(elementPresent.locator(message));
+ final String output1 = selenium.getText(message);
+
+ assertEquals(output1.replaceAll(hashCodeRegExp, ""), msg, "Message after first invocation of listener by type.");
+
+ int count = selenium.getCount(message);
+ assertEquals(count, 1, "Only one message should be displayed on the page.");
+
+ // do the same once again
+
+ selenium.click(invokeButtonType);
+
+ waitModel.failWith("New object of class ActionListenerImpl should be instantiated.").until(
+ new SeleniumCondition() {
+
+ public boolean isTrue() {
+ return !output1.equals(selenium.getText(message));
+ }
+ });
+
+ count = selenium.getCount(message);
+ assertEquals(count, 1, "Only one message should be displayed on the page.");
+
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInvokeListenerByBinding(String templates) {
+ final String msg = "Bound listener called";
+
+ selenium.click(invokeButtonBinding);
+ waitGui.until(elementPresent.locator(message));
+ String output = selenium.getText(message);
+
+ assertEquals(output, msg, "Message after first invocation of listener by binding.");
+
+ int count = selenium.getCount(message);
+ assertEquals(count, 1, "Only one message should be displayed on the page.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInvokeListenerMethod(String templates) {
+ final String msg = "Method expression listener called";
+
+ selenium.click(invokeButtonMethod);
+ waitGui.until(elementPresent.locator(message));
+ String output = selenium.getText(message);
+
+ assertEquals(output, msg, "Message after first invocation of listener method.");
+
+ int count = selenium.getCount(message);
+ assertEquals(count, 1, "Only one message should be displayed on the page.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInvokeListenerMethodCC(String templates) {
+ final String msg = "Method expression listener called from composite component";
+
+ selenium.click(invokeButtonCC);
+ waitGui.until(elementPresent.locator(message));
+ String output = selenium.getText(message);
+
+ assertEquals(output, msg, "Message after first invocation of listener method from composite component.");
+
+ int count = selenium.getCount(message);
+ assertEquals(count, 1, "Only one message should be displayed on the page.");
+ }
+}
Deleted: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/A4JCommandButtonTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/A4JCommandButtonTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/A4JCommandButtonTestCase.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -1,320 +0,0 @@
-/*******************************************************************************
- * 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.ftest.a4jCommandButton;
-
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.Attribute;
-import org.jboss.test.selenium.locator.AttributeLocator;
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-/**
- * Test case for page /faces/components/a4jCommandButton/simple.xhtml
- *
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
- * @version $Revision$
- */
-public class A4JCommandButtonTestCase extends AbstractMetamerTest {
-
- private ElementLocator input = pjq("input[id$=input]");
- private ElementLocator button = pjq("input[id$=a4jCommandButton]");
- private ElementLocator output1 = pjq("span[id$=output1]");
- private ElementLocator output2 = pjq("span[id$=output2]");
- private ElementLocator output3 = pjq("span[id$=output3]");
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/a4jCommandButton/simple.xhtml");
- }
-
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- @Test(dataProvider = "templates", groups = "client-side-perf")
- public void testSimpleClick(String templates) {
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(button);
-
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "RichFaces 4", "output1 when 'RichFaces 4' in input");
-
- output = selenium.getText(output2);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4' in input");
-
- output = selenium.getText(output3);
- assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces 4' in input");
- }
-
- @Test(dataProvider = "templates")
- public void testSimpleClickUnicode(String templates) {
- selenium.typeKeys(input, "ľščťžýáíéňô");
- selenium.click(button);
-
- waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "ľščťžýáíéňô", "output1 when 'ľščťžýáíéňô' in input");
-
- output = selenium.getText(output2);
- assertEquals(output, "ľščťžý", "output2 when 'ľščťžýáíéňô' in input");
-
- output = selenium.getText(output3);
- assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when 'ľščťžýáíéňô' in input");
- }
-
- @Test(dataProvider = "templates")
- public void testAction(String templates) {
- ElementLocator doubleStringAction = pjq("input[value=doubleStringAction]");
- ElementLocator first6CharsAction = pjq("input[value=first6CharsAction]");
- ElementLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
-
- selenium.click(doubleStringAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- String output = selenium.getText(output2);
- assertEquals(output, "RichFaces 4RichFaces 4",
- "output2 when 'RichFaces 4' in input and doubleStringAction selected");
-
- selenium.click(first6CharsAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ň");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- output = selenium.getText(output2);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
-
- selenium.click(toUpperCaseAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ě");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- output = selenium.getText(output2);
- assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
- }
-
- @Test(dataProvider = "templates")
- public void testActionListener(String templates) {
- ElementLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
- ElementLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
- ElementLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
-
- selenium.click(doubleStringActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- String output = selenium.getText(output3);
- assertEquals(output, "RichFaces 4RichFaces 4",
- "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
-
- selenium.click(first6CharsActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ň");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- output = selenium.getText(output3);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
-
- selenium.click(toUpperCaseActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ě");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- output = selenium.getText(output3);
- assertEquals(output, "RICHFACES 4Ě",
- "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
- }
-
- @Test(dataProvider = "templates")
- public void testDisabled(String templates) {
- ElementLocator disabledChecbox = pjq("input[id$=disabledInput]");
- AttributeLocator disabledAttribute = button.getAttribute(new Attribute("disabled"));
-
- selenium.click(disabledChecbox);
- selenium.waitForPageToLoad(TIMEOUT);
-
- String isDisabled = selenium.getAttribute(disabledAttribute);
- assertEquals(isDisabled.toLowerCase(), "disabled", "The value of attribute disabled");
- }
-
- @Test(dataProvider = "templates")
- public void testOnclick(String templates) {
- testFireEvent(Event.CLICK, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOndblclick(String templates) {
- testFireEvent(Event.DBLCLICK, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnkeydown(String templates) {
- testFireEvent(Event.KEYDOWN, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnkeypress(String templates) {
- testFireEvent(Event.KEYPRESS, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOneyup(String templates) {
- testFireEvent(Event.KEYUP, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmousedown(String templates) {
- testFireEvent(Event.MOUSEDOWN, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmousemove(String templates) {
- testFireEvent(Event.MOUSEMOVE, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseout(String templates) {
- testFireEvent(Event.MOUSEOUT, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseover(String templates) {
- testFireEvent(Event.MOUSEOVER, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseup(String templates) {
- testFireEvent(Event.MOUSEUP, button);
- }
-
- @Test(dataProvider = "templates")
- public void testRender(String templates) {
- ElementLocator renderInput = pjq("input[name$=renderInput]");
-
- selenium.type(renderInput, "output1");
- selenium.waitForPageToLoad(TIMEOUT);
-
- selenium.typeKeys(input, "aaa");
- selenium.click(button);
-
- waitGui.until(textEquals.locator(output1).text("aaa"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "aaa", "output1 when 'aaa' in input and 'output1' set to be rerendered");
-
- output = selenium.getText(output2);
- assertEquals(output, "", "output2 when 'aaa' in input and 'output1' set to be rerendered");
-
- output = selenium.getText(output3);
- assertEquals(output, "", "output3 when 'aaa' in input and 'output1' set to be rerendered");
-
- selenium.type(renderInput, "output2 output3");
- selenium.waitForPageToLoad(TIMEOUT);
-
- selenium.typeKeys(input, "bbb");
- selenium.click(button);
-
- waitGui.until(textEquals.locator(output2).text("bbb"));
-
- output = selenium.getText(output1);
- assertEquals(output, "aaa", "output1 when 'bbb' in input and 'output2 output3' set to be rerendered");
-
- output = selenium.getText(output2);
- assertEquals(output, "bbb", "output2 when 'bbb' in input and 'output2 output3' set to be rerendered");
-
- output = selenium.getText(output3);
- assertEquals(output, "BBB", "output3 when 'bbb' in input and 'output2 output3' set to be rerendered");
-
- }
-
- @Test(dataProvider = "templates")
- public void testRendered(String templates) {
- ElementLocator renderedCheckbox = pjq("input[name$=renderedInput]");
-
- selenium.click(renderedCheckbox);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isElementPresent(button), "Button should not be displayed");
- }
-
- @Test(dataProvider = "templates")
- public void testStyleClass(String templates) {
- ElementLocator wide = pjq("input[name$=styleClassInput][value=wide]");
- ElementLocator big = pjq("input[name$=styleClassInput][value=big]");
- ElementLocator none = pjq("input[name$=styleClassInput][value=]");
-
- final AttributeLocator classAttribute = button.getAttribute(new Attribute("class"));
-
- selenium.click(wide);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(button, "wide"), "Button's class was not changed to 'wide'");
-
- selenium.click(big);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(button, "big"), "Button's class was not changed to 'big'");
-
- selenium.click(none);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
- }
-
- @Test(dataProvider = "templates")
- public void testStyle(String templates) {
- ElementLocator styleInput = pjq("input[id$=styleInput]");
- final AttributeLocator attribute = button.getAttribute(new Attribute("style"));
- final String value = "font-size: 20px;";
-
- selenium.type(styleInput, value);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
- }
-
- @Test(dataProvider = "templates")
- public void testValue(String templates) {
- ElementLocator valueInput = pjq("input[id$=valueInput]");
- final AttributeLocator attribute = button.getAttribute(new Attribute("value"));
- final String value = "new label";
-
- selenium.type(valueInput, value);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertEquals(selenium.getAttribute(attribute), value, "Value of the button did not change");
- }
-
-}
Copied: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/TestA4JCommandButton.java (from rev 18158, root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/A4JCommandButtonTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/TestA4JCommandButton.java (rev 0)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/TestA4JCommandButton.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -0,0 +1,320 @@
+/*******************************************************************************
+ * 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.ftest.a4jCommandButton;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jCommandButton/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestA4JCommandButton extends AbstractMetamerTest {
+
+ private ElementLocator input = pjq("input[id$=input]");
+ private ElementLocator button = pjq("input[id$=a4jCommandButton]");
+ private ElementLocator output1 = pjq("span[id$=output1]");
+ private ElementLocator output2 = pjq("span[id$=output2]");
+ private ElementLocator output3 = pjq("span[id$=output3]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jCommandButton/simple.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ @Test(dataProvider = "templates", groups = "client-side-perf")
+ public void testSimpleClick(String templates) {
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "RichFaces 4", "output1 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces 4' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testSimpleClickUnicode(String templates) {
+ selenium.typeKeys(input, "ľščťžýáíéňô");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "ľščťžýáíéňô", "output1 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "ľščťžý", "output2 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when 'ľščťžýáíéňô' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testAction(String templates) {
+ ElementLocator doubleStringAction = pjq("input[value=doubleStringAction]");
+ ElementLocator first6CharsAction = pjq("input[value=first6CharsAction]");
+ ElementLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
+
+ selenium.click(doubleStringAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output2);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringAction selected");
+
+ selenium.click(first6CharsAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
+
+ selenium.click(toUpperCaseAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testActionListener(String templates) {
+ ElementLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
+ ElementLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
+ ElementLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
+
+ selenium.click(doubleStringActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output3);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
+
+ selenium.click(first6CharsActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
+
+ selenium.click(toUpperCaseActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4Ě",
+ "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDisabled(String templates) {
+ ElementLocator disabledChecbox = pjq("input[id$=disabledInput]");
+ AttributeLocator disabledAttribute = button.getAttribute(new Attribute("disabled"));
+
+ selenium.click(disabledChecbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ String isDisabled = selenium.getAttribute(disabledAttribute);
+ assertEquals(isDisabled.toLowerCase(), "disabled", "The value of attribute disabled");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnclick(String templates) {
+ testFireEvent(Event.CLICK, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOndblclick(String templates) {
+ testFireEvent(Event.DBLCLICK, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeydown(String templates) {
+ testFireEvent(Event.KEYDOWN, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeypress(String templates) {
+ testFireEvent(Event.KEYPRESS, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOneyup(String templates) {
+ testFireEvent(Event.KEYUP, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousedown(String templates) {
+ testFireEvent(Event.MOUSEDOWN, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousemove(String templates) {
+ testFireEvent(Event.MOUSEMOVE, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseout(String templates) {
+ testFireEvent(Event.MOUSEOUT, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseover(String templates) {
+ testFireEvent(Event.MOUSEOVER, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseup(String templates) {
+ testFireEvent(Event.MOUSEUP, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRender(String templates) {
+ ElementLocator renderInput = pjq("input[name$=renderInput]");
+
+ selenium.type(renderInput, "output1");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.typeKeys(input, "aaa");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output1).text("aaa"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "aaa", "output1 when 'aaa' in input and 'output1' set to be rerendered");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "", "output2 when 'aaa' in input and 'output1' set to be rerendered");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "", "output3 when 'aaa' in input and 'output1' set to be rerendered");
+
+ selenium.type(renderInput, "output2 output3");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.typeKeys(input, "bbb");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output2).text("bbb"));
+
+ output = selenium.getText(output1);
+ assertEquals(output, "aaa", "output1 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "bbb", "output2 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "BBB", "output3 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRendered(String templates) {
+ ElementLocator renderedCheckbox = pjq("input[name$=renderedInput]");
+
+ selenium.click(renderedCheckbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isElementPresent(button), "Button should not be displayed");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyleClass(String templates) {
+ ElementLocator wide = pjq("input[name$=styleClassInput][value=wide]");
+ ElementLocator big = pjq("input[name$=styleClassInput][value=big]");
+ ElementLocator none = pjq("input[name$=styleClassInput][value=]");
+
+ final AttributeLocator classAttribute = button.getAttribute(new Attribute("class"));
+
+ selenium.click(wide);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(button, "wide"), "Button's class was not changed to 'wide'");
+
+ selenium.click(big);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(button, "big"), "Button's class was not changed to 'big'");
+
+ selenium.click(none);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyle(String templates) {
+ ElementLocator styleInput = pjq("input[id$=styleInput]");
+ final AttributeLocator attribute = button.getAttribute(new Attribute("style"));
+ final String value = "font-size: 20px;";
+
+ selenium.type(styleInput, value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testValue(String templates) {
+ ElementLocator valueInput = pjq("input[id$=valueInput]");
+ final AttributeLocator attribute = button.getAttribute(new Attribute("value"));
+ final String value = "new label";
+
+ selenium.type(valueInput, value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertEquals(selenium.getAttribute(attribute), value, "Value of the button did not change");
+ }
+
+}
Deleted: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/A4JCommandLinkTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/A4JCommandLinkTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/A4JCommandLinkTestCase.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -1,336 +0,0 @@
-/*******************************************************************************
- * 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.ftest.a4jCommandLink;
-
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.Attribute;
-import org.jboss.test.selenium.locator.AttributeLocator;
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-/**
- * Test case for page /faces/components/a4jCommandLink/simple.xhtml
- *
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
- * @version $Revision$
- */
-public class A4JCommandLinkTestCase extends AbstractMetamerTest {
-
- private ElementLocator input = pjq("input[id$=input]");
- private ElementLocator link = pjq("a[id$=a4jCommandLink]");
- private ElementLocator output1 = pjq("span[id$=output1]");
- private ElementLocator output2 = pjq("span[id$=output2]");
- private ElementLocator output3 = pjq("span[id$=output3]");
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/a4jCommandLink/simple.xhtml");
- }
-
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- @Test(dataProvider = "templates", groups = "client-side-perf")
- public void testSimpleClick(String templates) {
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(link);
-
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "RichFaces 4", "output1 when 'RichFaces 4' in input");
-
- output = selenium.getText(output2);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4' in input");
-
- output = selenium.getText(output3);
- assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces 4' in input");
- }
-
- @Test(dataProvider = "templates")
- public void testSimpleClickUnicode(String templates) {
- selenium.typeKeys(input, "ľščťžýáíéňô");
- selenium.click(link);
-
- waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "ľščťžýáíéňô", "output1 when 'ľščťžýáíéňô' in input");
-
- output = selenium.getText(output2);
- assertEquals(output, "ľščťžý", "output2 when 'ľščťžýáíéňô' in input");
-
- output = selenium.getText(output3);
- assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when 'ľščťžýáíéňô' in input");
- }
-
- @Test(dataProvider = "templates")
- public void testAction(String templates) {
- ElementLocator doubleStringAction = pjq("input[value=doubleStringAction]");
- ElementLocator first6CharsAction = pjq("input[value=first6CharsAction]");
- ElementLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
-
- selenium.click(doubleStringAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(link);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- String output = selenium.getText(output2);
- assertEquals(output, "RichFaces 4RichFaces 4",
- "output2 when 'RichFaces 4' in input and doubleStringAction selected");
-
- selenium.click(first6CharsAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ň");
- selenium.click(link);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- output = selenium.getText(output2);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
-
- selenium.click(toUpperCaseAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ě");
- selenium.click(link);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- output = selenium.getText(output2);
- assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
- }
-
- @Test(dataProvider = "templates")
- public void testActionListener(String templates) {
- ElementLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
- ElementLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
- ElementLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
-
- selenium.click(doubleStringActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(link);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- String output = selenium.getText(output3);
- assertEquals(output, "RichFaces 4RichFaces 4",
- "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
-
- selenium.click(first6CharsActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ň");
- selenium.click(link);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- output = selenium.getText(output3);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
-
- selenium.click(toUpperCaseActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ě");
- selenium.click(link);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- output = selenium.getText(output3);
- assertEquals(output, "RICHFACES 4Ě",
- "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
- }
-
- @Test(dataProvider = "templates")
- public void testDisabled(String templates) {
- ElementLocator disabledChecbox = pjq("input[id$=disabledInput]");
- ElementLocator newLink = pjq("span[id$=a4jCommandLink]");
-
- selenium.click(disabledChecbox);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertFalse(selenium.isElementPresent(link), link.getAsString()
- + " should not be on page when the link is disabled");
- assertTrue(selenium.isElementPresent(newLink), newLink.getAsString()
- + " should be on page when the link is disabled");
-
- }
-
- @Test(dataProvider = "templates")
- public void testOnclick(String templates) {
- testFireEvent(Event.CLICK, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOndblclick(String templates) {
- testFireEvent(Event.DBLCLICK, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOnkeydown(String templates) {
- testFireEvent(Event.KEYDOWN, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOnkeypress(String templates) {
- testFireEvent(Event.KEYPRESS, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOneyup(String templates) {
- testFireEvent(Event.KEYUP, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmousedown(String templates) {
- testFireEvent(Event.MOUSEDOWN, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmousemove(String templates) {
- testFireEvent(Event.MOUSEMOVE, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseout(String templates) {
- testFireEvent(Event.MOUSEOUT, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseover(String templates) {
- testFireEvent(Event.MOUSEOVER, link);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseup(String templates) {
- testFireEvent(Event.MOUSEUP, link);
- }
-
- @Test(dataProvider = "templates")
- public void testRender(String templates) {
- ElementLocator renderInput = pjq("input[name$=renderInput]");
-
- selenium.type(renderInput, "output1");
- selenium.waitForPageToLoad(TIMEOUT);
-
- selenium.typeKeys(input, "aaa");
- selenium.click(link);
-
- waitGui.until(textEquals.locator(output1).text("aaa"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "aaa", "output1 when 'aaa' in input and 'output1' set to be rerendered");
-
- output = selenium.getText(output2);
- assertEquals(output, "", "output2 when 'aaa' in input and 'output1' set to be rerendered");
-
- output = selenium.getText(output3);
- assertEquals(output, "", "output3 when 'aaa' in input and 'output1' set to be rerendered");
-
- selenium.type(renderInput, "output2 output3");
- selenium.waitForPageToLoad(TIMEOUT);
-
- selenium.typeKeys(input, "bbb");
- selenium.click(link);
-
- waitGui.until(textEquals.locator(output2).text("bbb"));
-
- output = selenium.getText(output1);
- assertEquals(output, "aaa", "output1 when 'bbb' in input and 'output2 output3' set to be rerendered");
-
- output = selenium.getText(output2);
- assertEquals(output, "bbb", "output2 when 'bbb' in input and 'output2 output3' set to be rerendered");
-
- output = selenium.getText(output3);
- assertEquals(output, "BBB", "output3 when 'bbb' in input and 'output2 output3' set to be rerendered");
-
- }
-
- @Test(dataProvider = "templates")
- public void testRendered(String templates) {
- ElementLocator renderedCheckbox = pjq("input[name$=renderedInput]");
-
- selenium.click(renderedCheckbox);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isElementPresent(link), "Button should not be displayed");
- }
-
- @Test(dataProvider = "templates")
- public void testStyleClass(String templates) {
- ElementLocator bold = pjq("input[name$=styleClassInput][value=bold]");
- ElementLocator strike = pjq("input[name$=styleClassInput][value=strike]");
- ElementLocator none = pjq("input[name$=styleClassInput][value=]");
-
- final AttributeLocator classAttribute = link.getAttribute(new Attribute("class"));
-
- selenium.click(bold);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(link, "bold"), "Button's class was not changed to 'bold'");
-
- selenium.click(strike);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(link, "strike"), "Button's class was not changed to 'strike'");
-
- selenium.click(none);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
- }
-
- @Test(dataProvider = "templates")
- public void testStyle(String templates) {
- ElementLocator styleInput = pjq("input[id$=styleInput]");
- final AttributeLocator attribute = link.getAttribute(new Attribute("style"));
- final String value = "font-size: 20px;";
-
- selenium.type(styleInput, value);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
- }
-
- @Test(dataProvider = "templates")
- public void testValue(String templates) {
- ElementLocator valueInput = pjq("input[id$=valueInput]");
- final String value = "new label";
-
- selenium.type(valueInput, value);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertEquals(selenium.getText(link), value, "Value of the button did not change");
- }
-
- private void testFireEvent(Event event) {
- ElementLocator eventInput = pjq("input[id$=on" + event.getEventName() + "Input]");
- final String value = "alert('" + event.getEventName() + "')";
-
- selenium.type(eventInput, value);
- selenium.fireEvent(eventInput, Event.BLUR);
- selenium.waitForPageToLoad(TIMEOUT);
-
- selenium.fireEvent(link, event);
-
- assertEquals(selenium.getAlert(), event.getEventName(), event.getEventName()
- + " attribute did not change correctly");
- }
-
-}
Copied: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java (from rev 18158, root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/A4JCommandLinkTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java (rev 0)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -0,0 +1,336 @@
+/*******************************************************************************
+ * 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.ftest.a4jCommandLink;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jCommandLink/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestA4JCommandLink extends AbstractMetamerTest {
+
+ private ElementLocator input = pjq("input[id$=input]");
+ private ElementLocator link = pjq("a[id$=a4jCommandLink]");
+ private ElementLocator output1 = pjq("span[id$=output1]");
+ private ElementLocator output2 = pjq("span[id$=output2]");
+ private ElementLocator output3 = pjq("span[id$=output3]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jCommandLink/simple.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ @Test(dataProvider = "templates", groups = "client-side-perf")
+ public void testSimpleClick(String templates) {
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(link);
+
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "RichFaces 4", "output1 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces 4' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testSimpleClickUnicode(String templates) {
+ selenium.typeKeys(input, "ľščťžýáíéňô");
+ selenium.click(link);
+
+ waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "ľščťžýáíéňô", "output1 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "ľščťžý", "output2 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when 'ľščťžýáíéňô' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testAction(String templates) {
+ ElementLocator doubleStringAction = pjq("input[value=doubleStringAction]");
+ ElementLocator first6CharsAction = pjq("input[value=first6CharsAction]");
+ ElementLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
+
+ selenium.click(doubleStringAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output2);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringAction selected");
+
+ selenium.click(first6CharsAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
+
+ selenium.click(toUpperCaseAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testActionListener(String templates) {
+ ElementLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
+ ElementLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
+ ElementLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
+
+ selenium.click(doubleStringActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output3);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
+
+ selenium.click(first6CharsActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
+
+ selenium.click(toUpperCaseActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4Ě",
+ "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDisabled(String templates) {
+ ElementLocator disabledChecbox = pjq("input[id$=disabledInput]");
+ ElementLocator newLink = pjq("span[id$=a4jCommandLink]");
+
+ selenium.click(disabledChecbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertFalse(selenium.isElementPresent(link), link.getAsString()
+ + " should not be on page when the link is disabled");
+ assertTrue(selenium.isElementPresent(newLink), newLink.getAsString()
+ + " should be on page when the link is disabled");
+
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnclick(String templates) {
+ testFireEvent(Event.CLICK, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOndblclick(String templates) {
+ testFireEvent(Event.DBLCLICK, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeydown(String templates) {
+ testFireEvent(Event.KEYDOWN, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeypress(String templates) {
+ testFireEvent(Event.KEYPRESS, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOneyup(String templates) {
+ testFireEvent(Event.KEYUP, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousedown(String templates) {
+ testFireEvent(Event.MOUSEDOWN, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousemove(String templates) {
+ testFireEvent(Event.MOUSEMOVE, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseout(String templates) {
+ testFireEvent(Event.MOUSEOUT, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseover(String templates) {
+ testFireEvent(Event.MOUSEOVER, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseup(String templates) {
+ testFireEvent(Event.MOUSEUP, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRender(String templates) {
+ ElementLocator renderInput = pjq("input[name$=renderInput]");
+
+ selenium.type(renderInput, "output1");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.typeKeys(input, "aaa");
+ selenium.click(link);
+
+ waitGui.until(textEquals.locator(output1).text("aaa"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "aaa", "output1 when 'aaa' in input and 'output1' set to be rerendered");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "", "output2 when 'aaa' in input and 'output1' set to be rerendered");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "", "output3 when 'aaa' in input and 'output1' set to be rerendered");
+
+ selenium.type(renderInput, "output2 output3");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.typeKeys(input, "bbb");
+ selenium.click(link);
+
+ waitGui.until(textEquals.locator(output2).text("bbb"));
+
+ output = selenium.getText(output1);
+ assertEquals(output, "aaa", "output1 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "bbb", "output2 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "BBB", "output3 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRendered(String templates) {
+ ElementLocator renderedCheckbox = pjq("input[name$=renderedInput]");
+
+ selenium.click(renderedCheckbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isElementPresent(link), "Button should not be displayed");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyleClass(String templates) {
+ ElementLocator bold = pjq("input[name$=styleClassInput][value=bold]");
+ ElementLocator strike = pjq("input[name$=styleClassInput][value=strike]");
+ ElementLocator none = pjq("input[name$=styleClassInput][value=]");
+
+ final AttributeLocator classAttribute = link.getAttribute(new Attribute("class"));
+
+ selenium.click(bold);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(link, "bold"), "Button's class was not changed to 'bold'");
+
+ selenium.click(strike);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(link, "strike"), "Button's class was not changed to 'strike'");
+
+ selenium.click(none);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyle(String templates) {
+ ElementLocator styleInput = pjq("input[id$=styleInput]");
+ final AttributeLocator attribute = link.getAttribute(new Attribute("style"));
+ final String value = "font-size: 20px;";
+
+ selenium.type(styleInput, value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testValue(String templates) {
+ ElementLocator valueInput = pjq("input[id$=valueInput]");
+ final String value = "new label";
+
+ selenium.type(valueInput, value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertEquals(selenium.getText(link), value, "Value of the button did not change");
+ }
+
+ private void testFireEvent(Event event) {
+ ElementLocator eventInput = pjq("input[id$=on" + event.getEventName() + "Input]");
+ final String value = "alert('" + event.getEventName() + "')";
+
+ selenium.type(eventInput, value);
+ selenium.fireEvent(eventInput, Event.BLUR);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.fireEvent(link, event);
+
+ assertEquals(selenium.getAlert(), event.getEventName(), event.getEventName()
+ + " attribute did not change correctly");
+ }
+
+}
Deleted: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/A4JLogTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/A4JLogTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/A4JLogTestCase.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -1,234 +0,0 @@
-/*******************************************************************************
- * 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.ftest.a4jLog;
-
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-/**
- * Test case for page /faces/components/a4jLog/simple.xhtml
- *
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
- * @version $Revision$
- */
-public class A4JLogTestCase extends AbstractMetamerTest {
-
- /**
- * Enumeration representing all possible levels for a4j:log.
- */
- public enum LogLevel {
- DEBUG, INFO, WARN, ERROR;
- }
-
- private ElementLocator input = pjq("input[id$=nameInput]");
- private ElementLocator submitButton = pjq("input[id$=submitButton]");
- private ElementLocator output = pjq("span[id$=out]");
-
- private ElementLocator log = pjq("div.rich-log");
- private ElementLocator levelSelect = pjq("div.rich-log select");
- private JQueryLocator logMsg = pjq("div.rich-log div.rich-log-contents div");
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/a4jLog/simple.xhtml");
- }
-
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- @Test(dataProvider = "templates")
- public void testSubmit(String templates) {
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(submitButton);
-
- waitGui.until(textEquals.locator(output).text("Hello RichFaces 4!"));
-
- int count = selenium.getCount(logMsg);
- assertTrue(count > 0, "There should be at least one message in log after submit button was clicked.");
- }
-
- @Test(dataProvider = "templates")
- public void testSubmitUnicode(String templates) {
- selenium.typeKeys(input, "ľščťžýáíéôúäň");
- selenium.click(submitButton);
-
- waitGui.until(textEquals.locator(output).text("Hello ľščťžýáíéôúäň!"));
-
- int count = selenium.getCount(logMsg);
- assertTrue(count > 0, "There should be at least one message in log after submit button was clicked.");
- }
-
- @Test(dataProvider = "templates")
- public void testClearButton(String templates) {
- ElementLocator clearButton = pjq("div.rich-log button");
-
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(submitButton);
-
- waitGui.until(textEquals.locator(output).text("Hello RichFaces 4!"));
-
- int count = selenium.getCount(logMsg);
- assertTrue(count > 0, "There should be at least one message in log after submit button was clicked.");
-
- // test clear
- selenium.click(clearButton);
- count = selenium.getCount(logMsg);
- assertEquals(count, 0, "There should be no messages in log after clear button was clicked.");
- }
-
- @Test(dataProvider = "templates")
- public void testRendered(String templates) {
- ElementLocator renderedInput = pjq("input[id$=renderedInput]");
-
- selenium.click(renderedInput);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertFalse(selenium.isElementPresent(log), "Log should not be displayed.");
- }
-
- @Test(dataProvider = "templates")
- public void testDebugFilterDebug(String templates) {
- testLogging(LogLevel.DEBUG, LogLevel.DEBUG);
- }
-
- @Test(dataProvider = "templates")
- public void testDebugFilterInfo(String templates) {
- testLogging(LogLevel.DEBUG, LogLevel.INFO);
- }
-
- @Test(dataProvider = "templates")
- public void testDebugFilterWarn(String templates) {
- testLogging(LogLevel.DEBUG, LogLevel.WARN);
- }
-
- @Test(dataProvider = "templates")
- public void testDebugFilterError(String templates) {
- testLogging(LogLevel.DEBUG, LogLevel.ERROR);
- }
-
- @Test(dataProvider = "templates")
- public void testInfoFilterDebug(String templates) {
- testLogging(LogLevel.INFO, LogLevel.DEBUG);
- }
-
- @Test(dataProvider = "templates")
- public void testInfoFilterInfo(String templates) {
- testLogging(LogLevel.INFO, LogLevel.INFO);
- }
-
- @Test(dataProvider = "templates")
- public void testInfoFilterWarn(String templates) {
- testLogging(LogLevel.INFO, LogLevel.WARN);
- }
-
- @Test(dataProvider = "templates")
- public void testInfoFilterError(String templates) {
- testLogging(LogLevel.INFO, LogLevel.ERROR);
- }
-
- @Test(dataProvider = "templates")
- public void testWarnFilterDebug(String templates) {
- testLogging(LogLevel.WARN, LogLevel.DEBUG);
- }
-
- @Test(dataProvider = "templates")
- public void testWarnFilterInfo(String templates) {
- testLogging(LogLevel.WARN, LogLevel.INFO);
- }
-
- @Test(dataProvider = "templates")
- public void testWarnFilterWarn(String templates) {
- testLogging(LogLevel.WARN, LogLevel.WARN);
- }
-
- @Test(dataProvider = "templates")
- public void testWarnFilterError(String templates) {
- testLogging(LogLevel.WARN, LogLevel.ERROR);
- }
-
- @Test(dataProvider = "templates")
- public void testErrorFilterDebug(String templates) {
- testLogging(LogLevel.ERROR, LogLevel.DEBUG);
- }
-
- @Test(dataProvider = "templates")
- public void testErrorFilterInfo(String templates) {
- testLogging(LogLevel.ERROR, LogLevel.INFO);
- }
-
- @Test(dataProvider = "templates")
- public void testErrorFilterWarn(String templates) {
- testLogging(LogLevel.ERROR, LogLevel.WARN);
- }
-
- @Test(dataProvider = "templates")
- public void testErrorFilterError(String templates) {
- testLogging(LogLevel.ERROR, LogLevel.ERROR);
- }
-
- private void testLogging(LogLevel logLevel, LogLevel filterLevel) {
- ElementLocator logButton = pjq("input[id$=" + logLevel.toString().toLowerCase() + "Button]");
- ElementLocator levelInput = pjq("input[type=radio][value=" + filterLevel.toString().toLowerCase() + "]");
- ElementLocator msgType = logMsg.getChild(jq("span:eq(0)"));
- ElementLocator msgContent = logMsg.getChild(jq("span:eq(1)"));
-
- if (filterLevel != LogLevel.DEBUG) {
- selenium.click(levelInput);
- selenium.waitForPageToLoad(TIMEOUT);
- }
-
- String selectedLevel = selenium.getSelectedLabel(levelSelect);
- assertEquals(selectedLevel, filterLevel.toString().toLowerCase(), "Log level in select wasn't changed.");
-
- selenium.typeKeys(input, logLevel.toString());
- selenium.click(logButton);
-
- int count = selenium.getCount(logMsg);
- assertEquals(count, filterLevel.ordinal() <= logLevel.ordinal() ? 1 : 0,
- "There should be only one message in log.");
-
- if (count == 0) {
- return;
- }
-
- String output = selenium.getText(msgType).replaceAll("\\[.*\\]:$", "");
- assertEquals(output, logLevel.toString().toLowerCase(), "Message type in log.");
- output = selenium.getText(msgContent);
- assertEquals(output, logLevel.toString(), "Message content.");
-
- }
-}
Copied: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/TestA4JLog.java (from rev 18158, root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/A4JLogTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/TestA4JLog.java (rev 0)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/TestA4JLog.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -0,0 +1,234 @@
+/*******************************************************************************
+ * 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.ftest.a4jLog;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jLog/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestA4JLog extends AbstractMetamerTest {
+
+ /**
+ * Enumeration representing all possible levels for a4j:log.
+ */
+ public enum LogLevel {
+ DEBUG, INFO, WARN, ERROR;
+ }
+
+ private ElementLocator input = pjq("input[id$=nameInput]");
+ private ElementLocator submitButton = pjq("input[id$=submitButton]");
+ private ElementLocator output = pjq("span[id$=out]");
+
+ private ElementLocator log = pjq("div.rich-log");
+ private ElementLocator levelSelect = pjq("div.rich-log select");
+ private JQueryLocator logMsg = pjq("div.rich-log div.rich-log-contents div");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jLog/simple.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ @Test(dataProvider = "templates")
+ public void testSubmit(String templates) {
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(submitButton);
+
+ waitGui.until(textEquals.locator(output).text("Hello RichFaces 4!"));
+
+ int count = selenium.getCount(logMsg);
+ assertTrue(count > 0, "There should be at least one message in log after submit button was clicked.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testSubmitUnicode(String templates) {
+ selenium.typeKeys(input, "ľščťžýáíéôúäň");
+ selenium.click(submitButton);
+
+ waitGui.until(textEquals.locator(output).text("Hello ľščťžýáíéôúäň!"));
+
+ int count = selenium.getCount(logMsg);
+ assertTrue(count > 0, "There should be at least one message in log after submit button was clicked.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testClearButton(String templates) {
+ ElementLocator clearButton = pjq("div.rich-log button");
+
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(submitButton);
+
+ waitGui.until(textEquals.locator(output).text("Hello RichFaces 4!"));
+
+ int count = selenium.getCount(logMsg);
+ assertTrue(count > 0, "There should be at least one message in log after submit button was clicked.");
+
+ // test clear
+ selenium.click(clearButton);
+ count = selenium.getCount(logMsg);
+ assertEquals(count, 0, "There should be no messages in log after clear button was clicked.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRendered(String templates) {
+ ElementLocator renderedInput = pjq("input[id$=renderedInput]");
+
+ selenium.click(renderedInput);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertFalse(selenium.isElementPresent(log), "Log should not be displayed.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDebugFilterDebug(String templates) {
+ testLogging(LogLevel.DEBUG, LogLevel.DEBUG);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDebugFilterInfo(String templates) {
+ testLogging(LogLevel.DEBUG, LogLevel.INFO);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDebugFilterWarn(String templates) {
+ testLogging(LogLevel.DEBUG, LogLevel.WARN);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDebugFilterError(String templates) {
+ testLogging(LogLevel.DEBUG, LogLevel.ERROR);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInfoFilterDebug(String templates) {
+ testLogging(LogLevel.INFO, LogLevel.DEBUG);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInfoFilterInfo(String templates) {
+ testLogging(LogLevel.INFO, LogLevel.INFO);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInfoFilterWarn(String templates) {
+ testLogging(LogLevel.INFO, LogLevel.WARN);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInfoFilterError(String templates) {
+ testLogging(LogLevel.INFO, LogLevel.ERROR);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testWarnFilterDebug(String templates) {
+ testLogging(LogLevel.WARN, LogLevel.DEBUG);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testWarnFilterInfo(String templates) {
+ testLogging(LogLevel.WARN, LogLevel.INFO);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testWarnFilterWarn(String templates) {
+ testLogging(LogLevel.WARN, LogLevel.WARN);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testWarnFilterError(String templates) {
+ testLogging(LogLevel.WARN, LogLevel.ERROR);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testErrorFilterDebug(String templates) {
+ testLogging(LogLevel.ERROR, LogLevel.DEBUG);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testErrorFilterInfo(String templates) {
+ testLogging(LogLevel.ERROR, LogLevel.INFO);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testErrorFilterWarn(String templates) {
+ testLogging(LogLevel.ERROR, LogLevel.WARN);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testErrorFilterError(String templates) {
+ testLogging(LogLevel.ERROR, LogLevel.ERROR);
+ }
+
+ private void testLogging(LogLevel logLevel, LogLevel filterLevel) {
+ ElementLocator logButton = pjq("input[id$=" + logLevel.toString().toLowerCase() + "Button]");
+ ElementLocator levelInput = pjq("input[type=radio][value=" + filterLevel.toString().toLowerCase() + "]");
+ ElementLocator msgType = logMsg.getChild(jq("span:eq(0)"));
+ ElementLocator msgContent = logMsg.getChild(jq("span:eq(1)"));
+
+ if (filterLevel != LogLevel.DEBUG) {
+ selenium.click(levelInput);
+ selenium.waitForPageToLoad(TIMEOUT);
+ }
+
+ String selectedLevel = selenium.getSelectedLabel(levelSelect);
+ assertEquals(selectedLevel, filterLevel.toString().toLowerCase(), "Log level in select wasn't changed.");
+
+ selenium.typeKeys(input, logLevel.toString());
+ selenium.click(logButton);
+
+ int count = selenium.getCount(logMsg);
+ assertEquals(count, filterLevel.ordinal() <= logLevel.ordinal() ? 1 : 0,
+ "There should be only one message in log.");
+
+ if (count == 0) {
+ return;
+ }
+
+ String output = selenium.getText(msgType).replaceAll("\\[.*\\]:$", "");
+ assertEquals(output, logLevel.toString().toLowerCase(), "Message type in log.");
+ output = selenium.getText(msgContent);
+ assertEquals(output, logLevel.toString(), "Message content.");
+
+ }
+}
Deleted: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/A4JOutputPanelTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/A4JOutputPanelTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/A4JOutputPanelTestCase.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -1,307 +0,0 @@
-/*******************************************************************************
- * 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.ftest.a4jOutputPanel;
-
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.Attribute;
-import org.jboss.test.selenium.locator.AttributeLocator;
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-/**
- * Test case for page /faces/components/a4jOutputPanel/simple.xhtml
- *
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
- * @version $Revision$
- */
-public class A4JOutputPanelTestCase extends AbstractMetamerTest {
-
- private ElementLocator increaseCounterButton = pjq("input[id$=button]");
- private ElementLocator outputDiv = pjq("div[id$=outputPanel]");
- private ElementLocator outputSpan = pjq("span[id$=outputPanel]");
- private ElementLocator optionBlue = pjq("input[name$=styleClassInput][value=blue-background]");
- private ElementLocator optionGray = pjq("input[name$=styleClassInput][value=gray-background]");
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/a4jOutputPanel/simple.xhtml");
- }
-
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- /**
- * Data provider for templates, events and layout of output panel.
- *
- * @return array containing templates that should be used (defined in testng.xml) or default array (containing only
- * plain template) if nothing is defined, JavaScript events that are defined for output panel and layout of
- * panel (block or inline)
- */
- @DataProvider(name = "templatesEventsLayouts")
- private Object[][] getTemplatesEventsLayouts() {
- final int layoutsCount = 2;
- // list of templates, e.g. {{"plain"}, {"richDataTable1,redDiv"}}
- Object[][] templates = getTemplates();
- // list of events that will be tested
- Event[] events = new Event[]{Event.CLICK, Event.DBLCLICK, Event.KEYDOWN, Event.KEYPRESS, Event.KEYUP,
- Event.MOUSEDOWN, Event.MOUSEMOVE, Event.MOUSEOUT, Event.MOUSEOVER, Event.MOUSEUP};
-
- Object[][] result = new Object[templates.length * events.length * layoutsCount][];
- int index = 0;
-
- for (int i = 0; i < templates.length; i++) {
- for (int j = 0; j < events.length; j++) {
- for (int k = 0; k < layoutsCount; k++) {
- index = i * events.length * layoutsCount + j * layoutsCount + k;
- result[index] = new Object[]{templates[i][0], events[j], k == 0 ? "block" : "inline"};
- }
- }
- }
-
- return result;
- }
-
- @Test(dataProvider = "templatesEventsLayouts")
- public void testEvent(String templates, Event event, String type) {
- ElementLocator element = null;
-
- if ("inline".equals(type)) {
- // for inline layout set background to blue
- selenium.click(pjq("input[name$=layoutInput][value=inline]"));
- selenium.waitForPageToLoad(TIMEOUT);
-
- selenium.click(optionBlue);
- selenium.waitForPageToLoad(TIMEOUT);
-
- element = outputSpan;
- } else {
- // for inline layout set background to gray
- selenium.click(optionGray);
- selenium.waitForPageToLoad(TIMEOUT);
-
- element = outputDiv;
- }
-
- testFireEvent(event, element);
- }
-
- @Test(dataProvider = "templates")
- public void testClick(String templates) {
- selenium.click(increaseCounterButton);
- waitGui.until(textEquals.locator(outputDiv).text("1"));
-
- selenium.click(increaseCounterButton);
- waitGui.until(textEquals.locator(outputDiv).text("2"));
- }
-
- @Test(dataProvider = "templates")
- public void testAjaxRendered(String templates) {
- ElementLocator ajaxRenderedCheckbox = pjq("input[id$=ajaxRenderedInput]");
- ElementLocator reRenderAllImage = jq("div.header img[id$=reRenderAllImage]");
-
- selenium.click(ajaxRenderedCheckbox);
- selenium.waitForPageToLoad(TIMEOUT);
-
- selenium.click(increaseCounterButton);
- selenium.click(increaseCounterButton);
-
- String output = selenium.getText(outputDiv);
- assertEquals(output, "0", "Output after two clicks when ajaxRendered is set to false.");
-
- selenium.click(reRenderAllImage);
- waitGui.until(textEquals.locator(outputDiv).text("2"));
- }
-
- @Test(dataProvider = "templates")
- public void testDir(String templates) {
- ElementLocator optionLtr = pjq("input[name$=dirInput][value=ltr]");
- ElementLocator optionRtl = pjq("input[name$=dirInput][value=rtl]");
- ElementLocator optionNone = pjq("input[name$=dirInput][value=]");
- AttributeLocator attributeDir = outputDiv.getAttribute(new Attribute("dir"));
-
- // right-to-left
- selenium.click(optionRtl);
- selenium.waitForPageToLoad(TIMEOUT);
- String attributeValue = selenium.getAttribute(attributeDir);
- assertEquals(attributeValue, "rtl", "Attribute dir after rtl was set.");
-
- // left-to-right
- selenium.click(optionLtr);
- selenium.waitForPageToLoad(TIMEOUT);
- attributeValue = selenium.getAttribute(attributeDir);
- assertEquals(attributeValue, "ltr", "Attribute dir after ltr was set.");
-
- // not specified
- selenium.click(optionNone);
- selenium.waitForPageToLoad(TIMEOUT);
- if (selenium.isAttributePresent(attributeDir)) {
- attributeValue = selenium.getAttribute(attributeDir);
- assertEquals(attributeValue, "", "Attribute dir after none was set.");
- }
- }
-
- @Test(dataProvider = "templates")
- public void testLang(String templates) {
- ElementLocator langInput = pjq("input[id$=langInput]");
- AttributeLocator attributeLang = outputDiv.getAttribute(new Attribute("lang"));
-
- selenium.typeKeys(langInput, "en");
- selenium.waitForPageToLoad(TIMEOUT);
-
- String attributeValue = selenium.getAttribute(attributeLang);
- assertEquals(attributeValue, "en", "Lang attribute");
-
- selenium.typeKeys(langInput, "sk");
- selenium.waitForPageToLoad(TIMEOUT);
-
- attributeValue = selenium.getAttribute(attributeLang);
- assertEquals(attributeValue, "sk", "Lang attribute");
- }
-
- @Test(dataProvider = "templates")
- public void testLayout(String templates) {
- ElementLocator optionBlock = pjq("input[name$=layoutInput][value=block]");
- ElementLocator optionInline = pjq("input[name$=layoutInput][value=inline]");
- ElementLocator optionNone = pjq("input[name$=layoutInput][value=none]");
-
- assertTrue(selenium.isElementPresent(outputDiv), "Div should be rendered on the beginning.");
- assertFalse(selenium.isElementPresent(outputSpan), "Div should be rendered on the beginning.");
-
- selenium.click(optionInline);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isElementPresent(outputDiv), "Span should be rendered when inline is set.");
- assertTrue(selenium.isElementPresent(outputSpan), "Span should be rendered when inline is set.");
-
- selenium.click(optionBlock);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.isElementPresent(outputDiv), "Div should be rendered when block is set.");
- assertFalse(selenium.isElementPresent(outputSpan), "Div should be rendered when block is set.");
-
- selenium.click(optionNone);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isElementPresent(outputDiv), "Span should be rendered when none is set.");
- assertTrue(selenium.isElementPresent(outputSpan), "Span should be rendered when none is set.");
- }
-
- @Test(dataProvider = "templates")
- public void testRendered(String templates) {
- ElementLocator renderedInput = pjq("input[id$=renderedInput]");
-
- selenium.click(renderedInput);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isElementPresent(outputDiv), "Panel should not be rendered.");
-
- selenium.click(increaseCounterButton);
- selenium.click(increaseCounterButton);
-
- selenium.click(renderedInput);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.isElementPresent(outputDiv), "Panel should be rendered.");
-
- String counter = selenium.getText(outputDiv);
- assertEquals(counter, "2", "Counter after two clicks on button.");
- }
-
- @Test(dataProvider = "templates")
- public void testStyle(String templates) {
- String style = "background-color: magenta; color: white; font-weight: bold;";
- ElementLocator styleInput = pjq("input[id$=styleInput]");
- AttributeLocator attributeStyle = outputDiv.getAttribute(Attribute.STYLE);
-
- selenium.typeKeys(styleInput, style);
- selenium.waitForPageToLoad(TIMEOUT);
-
- String attributeValue = selenium.getAttribute(attributeStyle);
- assertEquals(attributeValue, style, "Value of attribute style.");
-
- selenium.typeKeys(styleInput, "");
- selenium.waitForPageToLoad(TIMEOUT);
-
- if (selenium.isAttributePresent(attributeStyle)) {
- attributeValue = selenium.getAttribute(attributeStyle);
- assertEquals(attributeValue, "", "Value of attribute style.");
- }
- }
-
- @Test(dataProvider = "templates")
- public void testStyleClass(String templates) {
- ElementLocator optionNone = pjq("input[name$=styleClassInput][value=]");
- AttributeLocator attributeClass = outputDiv.getAttribute(Attribute.CLASS);
-
- selenium.click(optionBlue);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(outputDiv, "blue-background"), "Panel should have class blue-background set.");
- assertFalse(selenium.belongsClass(outputDiv, "gray-background"),
- "Panel should not have class gray-background set.");
-
- selenium.click(optionGray);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(outputDiv, "gray-background"), "Panel should have class gray-background set.");
- assertFalse(selenium.belongsClass(outputDiv, "blue-background"),
- "Panel should not have class blue-background set.");
-
- selenium.click(optionNone);
- selenium.waitForPageToLoad(TIMEOUT);
- if (selenium.isAttributePresent(attributeClass)) {
- assertFalse(selenium.belongsClass(outputDiv, "blue-background"),
- "Panel should not have class blue-background set.");
- assertFalse(selenium.belongsClass(outputDiv, "gray-background"),
- "Panel should not have class gray-background set.");
- }
- }
-
- @Test(dataProvider = "templates")
- public void testTitle(String templates) {
- String title = "a4j:outputPanel title";
- ElementLocator titleInput = pjq("input[id$=titleInput]");
- AttributeLocator attributeTitle = outputDiv.getAttribute(new Attribute("title"));
-
- selenium.typeKeys(titleInput, title);
- selenium.waitForPageToLoad(TIMEOUT);
-
- String attributeValue = selenium.getAttribute(attributeTitle);
- assertEquals(attributeValue, title, "Value of attribute title.");
-
- selenium.typeKeys(titleInput, "");
- selenium.waitForPageToLoad(TIMEOUT);
-
- if (selenium.isAttributePresent(attributeTitle)) {
- attributeValue = selenium.getAttribute(attributeTitle);
- assertEquals(attributeValue, "", "Value of attribute style.");
- }
- }
-}
Copied: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/TestA4JOutputPanel.java (from rev 18158, root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/A4JOutputPanelTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/TestA4JOutputPanel.java (rev 0)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/TestA4JOutputPanel.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -0,0 +1,307 @@
+/*******************************************************************************
+ * 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.ftest.a4jOutputPanel;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jOutputPanel/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestA4JOutputPanel extends AbstractMetamerTest {
+
+ private ElementLocator increaseCounterButton = pjq("input[id$=button]");
+ private ElementLocator outputDiv = pjq("div[id$=outputPanel]");
+ private ElementLocator outputSpan = pjq("span[id$=outputPanel]");
+ private ElementLocator optionBlue = pjq("input[name$=styleClassInput][value=blue-background]");
+ private ElementLocator optionGray = pjq("input[name$=styleClassInput][value=gray-background]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jOutputPanel/simple.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ /**
+ * Data provider for templates, events and layout of output panel.
+ *
+ * @return array containing templates that should be used (defined in testng.xml) or default array (containing only
+ * plain template) if nothing is defined, JavaScript events that are defined for output panel and layout of
+ * panel (block or inline)
+ */
+ @DataProvider(name = "templatesEventsLayouts")
+ private Object[][] getTemplatesEventsLayouts() {
+ final int layoutsCount = 2;
+ // list of templates, e.g. {{"plain"}, {"richDataTable1,redDiv"}}
+ Object[][] templates = getTemplates();
+ // list of events that will be tested
+ Event[] events = new Event[]{Event.CLICK, Event.DBLCLICK, Event.KEYDOWN, Event.KEYPRESS, Event.KEYUP,
+ Event.MOUSEDOWN, Event.MOUSEMOVE, Event.MOUSEOUT, Event.MOUSEOVER, Event.MOUSEUP};
+
+ Object[][] result = new Object[templates.length * events.length * layoutsCount][];
+ int index = 0;
+
+ for (int i = 0; i < templates.length; i++) {
+ for (int j = 0; j < events.length; j++) {
+ for (int k = 0; k < layoutsCount; k++) {
+ index = i * events.length * layoutsCount + j * layoutsCount + k;
+ result[index] = new Object[]{templates[i][0], events[j], k == 0 ? "block" : "inline"};
+ }
+ }
+ }
+
+ return result;
+ }
+
+ @Test(dataProvider = "templatesEventsLayouts")
+ public void testEvent(String templates, Event event, String type) {
+ ElementLocator element = null;
+
+ if ("inline".equals(type)) {
+ // for inline layout set background to blue
+ selenium.click(pjq("input[name$=layoutInput][value=inline]"));
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.click(optionBlue);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ element = outputSpan;
+ } else {
+ // for inline layout set background to gray
+ selenium.click(optionGray);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ element = outputDiv;
+ }
+
+ testFireEvent(event, element);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testClick(String templates) {
+ selenium.click(increaseCounterButton);
+ waitGui.until(textEquals.locator(outputDiv).text("1"));
+
+ selenium.click(increaseCounterButton);
+ waitGui.until(textEquals.locator(outputDiv).text("2"));
+ }
+
+ @Test(dataProvider = "templates")
+ public void testAjaxRendered(String templates) {
+ ElementLocator ajaxRenderedCheckbox = pjq("input[id$=ajaxRenderedInput]");
+ ElementLocator reRenderAllImage = jq("div.header img[id$=reRenderAllImage]");
+
+ selenium.click(ajaxRenderedCheckbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.click(increaseCounterButton);
+ selenium.click(increaseCounterButton);
+
+ String output = selenium.getText(outputDiv);
+ assertEquals(output, "0", "Output after two clicks when ajaxRendered is set to false.");
+
+ selenium.click(reRenderAllImage);
+ waitGui.until(textEquals.locator(outputDiv).text("2"));
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDir(String templates) {
+ ElementLocator optionLtr = pjq("input[name$=dirInput][value=ltr]");
+ ElementLocator optionRtl = pjq("input[name$=dirInput][value=rtl]");
+ ElementLocator optionNone = pjq("input[name$=dirInput][value=]");
+ AttributeLocator attributeDir = outputDiv.getAttribute(new Attribute("dir"));
+
+ // right-to-left
+ selenium.click(optionRtl);
+ selenium.waitForPageToLoad(TIMEOUT);
+ String attributeValue = selenium.getAttribute(attributeDir);
+ assertEquals(attributeValue, "rtl", "Attribute dir after rtl was set.");
+
+ // left-to-right
+ selenium.click(optionLtr);
+ selenium.waitForPageToLoad(TIMEOUT);
+ attributeValue = selenium.getAttribute(attributeDir);
+ assertEquals(attributeValue, "ltr", "Attribute dir after ltr was set.");
+
+ // not specified
+ selenium.click(optionNone);
+ selenium.waitForPageToLoad(TIMEOUT);
+ if (selenium.isAttributePresent(attributeDir)) {
+ attributeValue = selenium.getAttribute(attributeDir);
+ assertEquals(attributeValue, "", "Attribute dir after none was set.");
+ }
+ }
+
+ @Test(dataProvider = "templates")
+ public void testLang(String templates) {
+ ElementLocator langInput = pjq("input[id$=langInput]");
+ AttributeLocator attributeLang = outputDiv.getAttribute(new Attribute("lang"));
+
+ selenium.typeKeys(langInput, "en");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ String attributeValue = selenium.getAttribute(attributeLang);
+ assertEquals(attributeValue, "en", "Lang attribute");
+
+ selenium.typeKeys(langInput, "sk");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ attributeValue = selenium.getAttribute(attributeLang);
+ assertEquals(attributeValue, "sk", "Lang attribute");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testLayout(String templates) {
+ ElementLocator optionBlock = pjq("input[name$=layoutInput][value=block]");
+ ElementLocator optionInline = pjq("input[name$=layoutInput][value=inline]");
+ ElementLocator optionNone = pjq("input[name$=layoutInput][value=none]");
+
+ assertTrue(selenium.isElementPresent(outputDiv), "Div should be rendered on the beginning.");
+ assertFalse(selenium.isElementPresent(outputSpan), "Div should be rendered on the beginning.");
+
+ selenium.click(optionInline);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isElementPresent(outputDiv), "Span should be rendered when inline is set.");
+ assertTrue(selenium.isElementPresent(outputSpan), "Span should be rendered when inline is set.");
+
+ selenium.click(optionBlock);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.isElementPresent(outputDiv), "Div should be rendered when block is set.");
+ assertFalse(selenium.isElementPresent(outputSpan), "Div should be rendered when block is set.");
+
+ selenium.click(optionNone);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isElementPresent(outputDiv), "Span should be rendered when none is set.");
+ assertTrue(selenium.isElementPresent(outputSpan), "Span should be rendered when none is set.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRendered(String templates) {
+ ElementLocator renderedInput = pjq("input[id$=renderedInput]");
+
+ selenium.click(renderedInput);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isElementPresent(outputDiv), "Panel should not be rendered.");
+
+ selenium.click(increaseCounterButton);
+ selenium.click(increaseCounterButton);
+
+ selenium.click(renderedInput);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.isElementPresent(outputDiv), "Panel should be rendered.");
+
+ String counter = selenium.getText(outputDiv);
+ assertEquals(counter, "2", "Counter after two clicks on button.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyle(String templates) {
+ String style = "background-color: magenta; color: white; font-weight: bold;";
+ ElementLocator styleInput = pjq("input[id$=styleInput]");
+ AttributeLocator attributeStyle = outputDiv.getAttribute(Attribute.STYLE);
+
+ selenium.typeKeys(styleInput, style);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ String attributeValue = selenium.getAttribute(attributeStyle);
+ assertEquals(attributeValue, style, "Value of attribute style.");
+
+ selenium.typeKeys(styleInput, "");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ if (selenium.isAttributePresent(attributeStyle)) {
+ attributeValue = selenium.getAttribute(attributeStyle);
+ assertEquals(attributeValue, "", "Value of attribute style.");
+ }
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyleClass(String templates) {
+ ElementLocator optionNone = pjq("input[name$=styleClassInput][value=]");
+ AttributeLocator attributeClass = outputDiv.getAttribute(Attribute.CLASS);
+
+ selenium.click(optionBlue);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(outputDiv, "blue-background"), "Panel should have class blue-background set.");
+ assertFalse(selenium.belongsClass(outputDiv, "gray-background"),
+ "Panel should not have class gray-background set.");
+
+ selenium.click(optionGray);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(outputDiv, "gray-background"), "Panel should have class gray-background set.");
+ assertFalse(selenium.belongsClass(outputDiv, "blue-background"),
+ "Panel should not have class blue-background set.");
+
+ selenium.click(optionNone);
+ selenium.waitForPageToLoad(TIMEOUT);
+ if (selenium.isAttributePresent(attributeClass)) {
+ assertFalse(selenium.belongsClass(outputDiv, "blue-background"),
+ "Panel should not have class blue-background set.");
+ assertFalse(selenium.belongsClass(outputDiv, "gray-background"),
+ "Panel should not have class gray-background set.");
+ }
+ }
+
+ @Test(dataProvider = "templates")
+ public void testTitle(String templates) {
+ String title = "a4j:outputPanel title";
+ ElementLocator titleInput = pjq("input[id$=titleInput]");
+ AttributeLocator attributeTitle = outputDiv.getAttribute(new Attribute("title"));
+
+ selenium.typeKeys(titleInput, title);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ String attributeValue = selenium.getAttribute(attributeTitle);
+ assertEquals(attributeValue, title, "Value of attribute title.");
+
+ selenium.typeKeys(titleInput, "");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ if (selenium.isAttributePresent(attributeTitle)) {
+ attributeValue = selenium.getAttribute(attributeTitle);
+ assertEquals(attributeValue, "", "Value of attribute style.");
+ }
+ }
+}
Deleted: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollTestCase.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * 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.ftest.a4jPoll;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.Attribute;
-import org.jboss.test.selenium.locator.AttributeLocator;
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.jboss.test.selenium.locator.LocatorFactory.*;
-import static org.testng.Assert.*;
-import static org.jboss.test.selenium.SystemProperties.isSeleniumDebug;
-import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
-import static org.jboss.test.selenium.utils.PrimitiveUtils.*;
-
-/**
- * Tests the a4j:poll component.
- *
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public class PollTestCase extends AbstractMetamerTest {
-
- private static final Attribute ATTRIBUTE_TITLE = new Attribute("title");
- private static final int[] TEST_INTERVAL_VALUES = new int[]{1000, 5000, 500};
- private static final int TEST_INTERVAL_ITERATIONS = 5;
- private static final int MAX_DEVIATION = 100;
- private static final int MAX_AVERAGE_DEVIATION = 50;
-
- ElementLocator attributeEnabled = id("form:attributes:enabledInput");
- ElementLocator attributeInterval = id("form:attributes:intervalInput");
- JQueryLocator time = pjq("span[id$=time]");
- AttributeLocator clientTime = pjq("span[id$=clientDate]").getAttribute(ATTRIBUTE_TITLE);
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/a4jPoll/simple.xhtml");
- }
-
- @AfterMethod(alwaysRun = true)
- public void clearSession() {
- invalidateSession();
- }
-
- /**
- * <p>
- * Test the progress of polling for 3 different values from client side.
- * </p>
- *
- * <p>
- * It defines the new interval value first for each iteration and then enable polling.
- * </p>
- *
- * <p>
- * Then, it waits for first poll event (zero iteration).
- * </p>
- *
- * <p>
- * For 5 following poll events it checks that runtime visible from client (output from JavaScript's new
- * Date().getTime()) between the events haven't greater deviation from defined interval than defined
- * {@link #MAX_DEVIATION}.
- * </p>
- *
- * <p>
- * Test also computes average value of deviation and checks that the average value of all obtained particular
- * deviations isn't greater than {@link #MAX_AVERAGE_DEVIATION}.
- * </p>
- */
- @Test(dataProvider = "templates", groups = "client-side-perf")
- public void testIntervalFromClientPerspective(String templates) {
-
- long total = 0;
- long count = 0;
- for (int interval : TEST_INTERVAL_VALUES) {
- selenium.type(attributeInterval, String.valueOf(interval));
- selenium.waitForPageToLoad();
-
- selenium.check(attributeEnabled);
- selenium.fireEvent(attributeEnabled, Event.CHANGE);
- selenium.waitForPageToLoad();
-
- selenium.getPageExtensions().install();
-
- long currentTime = getClientTime();
-
- for (int i = 0; i <= TEST_INTERVAL_ITERATIONS; i++) {
- long runtime = System.currentTimeMillis();
- selenium.getRequestInterceptor().clearRequestTypeDone();
- selenium.getRequestInterceptor().waitForRequestTypeChange();
- runtime -= getClientTime();
- if (i > 0) {
-
- long deviation = Math.abs(interval - Math.abs(runtime));
- if (isSeleniumDebug()) {
- System.out.println(format("deviation for interval {0}: {1}", interval, deviation));
- }
- assertTrue(deviation <= MAX_DEVIATION, format(
- "Particular deviation ({2}) for interval {0} was greater than {1}", interval, MAX_DEVIATION,
- deviation));
- total += deviation;
- count += 1;
- }
- currentTime += runtime;
- }
-
- selenium.uncheck(attributeEnabled);
- selenium.fireEvent(attributeEnabled, Event.CHANGE);
- selenium.waitForPageToLoad();
- }
-
- long averageDeviation = total / count;
-
- if (isSeleniumDebug()) {
- System.out.println(format("total average deviation: {0}", averageDeviation));
- }
-
- assertTrue(averageDeviation <= MAX_AVERAGE_DEVIATION, format(
- "Average deviation ({1}) was greater than given maximum {0}", MAX_AVERAGE_DEVIATION, averageDeviation));
- }
-
- /**
- * Returns the time of poll event (the time when arrived the response from server)
- * @return the time of poll event (the time when arrived the response from server)
- */
- private long getClientTime() {
- return asLong(selenium.getAttribute(clientTime));
- }
-
-}
Copied: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestPoll.java (from rev 18158, root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestPoll.java (rev 0)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestPoll.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -0,0 +1,155 @@
+/*******************************************************************************
+ * 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.ftest.a4jPoll;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.jboss.test.selenium.locator.LocatorFactory.*;
+import static org.testng.Assert.*;
+import static org.jboss.test.selenium.SystemProperties.isSeleniumDebug;
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
+import static org.jboss.test.selenium.utils.PrimitiveUtils.*;
+
+/**
+ * Tests the a4j:poll component.
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestPoll extends AbstractMetamerTest {
+
+ private static final Attribute ATTRIBUTE_TITLE = new Attribute("title");
+ private static final int[] TEST_INTERVAL_VALUES = new int[]{1000, 5000, 500};
+ private static final int TEST_INTERVAL_ITERATIONS = 5;
+ private static final int MAX_DEVIATION = 100;
+ private static final int MAX_AVERAGE_DEVIATION = 50;
+
+ ElementLocator attributeEnabled = id("form:attributes:enabledInput");
+ ElementLocator attributeInterval = id("form:attributes:intervalInput");
+ JQueryLocator time = pjq("span[id$=time]");
+ AttributeLocator clientTime = pjq("span[id$=clientDate]").getAttribute(ATTRIBUTE_TITLE);
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jPoll/simple.xhtml");
+ }
+
+ @AfterMethod(alwaysRun = true)
+ public void clearSession() {
+ invalidateSession();
+ }
+
+ /**
+ * <p>
+ * Test the progress of polling for 3 different values from client side.
+ * </p>
+ *
+ * <p>
+ * It defines the new interval value first for each iteration and then enable polling.
+ * </p>
+ *
+ * <p>
+ * Then, it waits for first poll event (zero iteration).
+ * </p>
+ *
+ * <p>
+ * For 5 following poll events it checks that runtime visible from client (output from JavaScript's new
+ * Date().getTime()) between the events haven't greater deviation from defined interval than defined
+ * {@link #MAX_DEVIATION}.
+ * </p>
+ *
+ * <p>
+ * Test also computes average value of deviation and checks that the average value of all obtained particular
+ * deviations isn't greater than {@link #MAX_AVERAGE_DEVIATION}.
+ * </p>
+ */
+ @Test(dataProvider = "templates", groups = "client-side-perf")
+ public void testIntervalFromClientPerspective(String templates) {
+
+ long total = 0;
+ long count = 0;
+ for (int interval : TEST_INTERVAL_VALUES) {
+ selenium.type(attributeInterval, String.valueOf(interval));
+ selenium.waitForPageToLoad();
+
+ selenium.check(attributeEnabled);
+ selenium.fireEvent(attributeEnabled, Event.CHANGE);
+ selenium.waitForPageToLoad();
+
+ selenium.getPageExtensions().install();
+
+ long currentTime = getClientTime();
+
+ for (int i = 0; i <= TEST_INTERVAL_ITERATIONS; i++) {
+ long runtime = System.currentTimeMillis();
+ selenium.getRequestInterceptor().clearRequestTypeDone();
+ selenium.getRequestInterceptor().waitForRequestTypeChange();
+ runtime -= getClientTime();
+ if (i > 0) {
+
+ long deviation = Math.abs(interval - Math.abs(runtime));
+ if (isSeleniumDebug()) {
+ System.out.println(format("deviation for interval {0}: {1}", interval, deviation));
+ }
+ assertTrue(deviation <= MAX_DEVIATION, format(
+ "Particular deviation ({2}) for interval {0} was greater than {1}", interval, MAX_DEVIATION,
+ deviation));
+ total += deviation;
+ count += 1;
+ }
+ currentTime += runtime;
+ }
+
+ selenium.uncheck(attributeEnabled);
+ selenium.fireEvent(attributeEnabled, Event.CHANGE);
+ selenium.waitForPageToLoad();
+ }
+
+ long averageDeviation = total / count;
+
+ if (isSeleniumDebug()) {
+ System.out.println(format("total average deviation: {0}", averageDeviation));
+ }
+
+ assertTrue(averageDeviation <= MAX_AVERAGE_DEVIATION, format(
+ "Average deviation ({1}) was greater than given maximum {0}", MAX_AVERAGE_DEVIATION, averageDeviation));
+ }
+
+ /**
+ * Returns the time of poll event (the time when arrived the response from server)
+ * @return the time of poll event (the time when arrived the response from server)
+ */
+ private long getClientTime() {
+ return asLong(selenium.getAttribute(clientTime));
+ }
+
+}
Copied: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTest.java (from rev 18158, root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTest.java (rev 0)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTest.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * 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.ftest.a4jPush;
+
+import static org.testng.Assert.*;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.jboss.test.selenium.SeleniumGetter.*;
+
+import java.io.IOException;
+import java.net.URL;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpMethod;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.jboss.test.selenium.SystemProperties;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.request.RequestType;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.BeforeClass;
+
+/**
+ * Abstract test case for testing a4j:push component.
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public abstract class AbstractPushTest extends AbstractMetamerTest {
+
+ private static final int STATUS_CODE_OK = 200;
+
+ protected PushAttributes pushAttributes = new PushAttributes();
+
+ private ElementLocator outputCounter = pjq("span[id$=outputCounter]");
+
+ private HttpClient httpClient;
+ private HttpMethod pushMethod;
+
+ @Override
+ public URL getTestUrl() {
+ URL contextPath = SystemProperties.getContextPath();
+ return buildUrl(contextPath, "faces/components/a4jPush/simple.xhtml");
+ }
+
+ /**
+ * Initializes the HttpClient which triggers events in {@link #generatePushEvent()}.
+ */
+ @BeforeClass
+ public void initializeHttpClient() {
+ httpClient = new HttpClient();
+ URL eventProducerUrl = buildUrl(getTestUrl(), "event-producer.xhtml");
+ pushMethod = new GetMethod(eventProducerUrl.toString());
+ }
+
+ /**
+ * Returns the value of counter as pushed value
+ *
+ * @return the value of counter as pushed value
+ */
+ protected int getCounter() {
+ return getText(outputCounter).asInteger();
+ }
+
+ /**
+ * Push the event specified number times and then waits for observation of event by client.
+ *
+ * @param numberOfPushes
+ * the number of events should be generated
+ */
+ protected void pushAndWait(int numberOfPushes) throws HttpException, IOException {
+ selenium.getPageExtensions().install();
+ selenium.getRequestInterceptor().clearRequestTypeDone();
+
+ for (int i = 0; i < numberOfPushes; i++) {
+ generatePushEvent();
+ }
+
+ selenium.getRequestInterceptor().waitForRequestTypeChange();
+ RequestType requestDone = selenium.getRequestInterceptor().getRequestTypeDone();
+
+ assertEquals(requestDone, RequestType.XHR);
+ }
+
+ /**
+ * <p>
+ * Generates the push event for all registered listeners from a4j:push test Simple page.
+ * </p>
+ *
+ * <p>
+ * Internally use HttpClient to ping URL triggering push event in preRenderView phase.
+ * </p>
+ */
+ private void generatePushEvent() throws HttpException, IOException {
+ httpClient.executeMethod(pushMethod);
+ assertEquals(pushMethod.getStatusCode(), STATUS_CODE_OK);
+ }
+}
Deleted: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTestCase.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * 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.ftest.a4jPush;
-
-import static org.testng.Assert.*;
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.jboss.test.selenium.SeleniumGetter.*;
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.jboss.test.selenium.SystemProperties;
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.jboss.test.selenium.request.RequestType;
-import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.BeforeClass;
-
-/**
- * Abstract test case for testing a4j:push component.
- *
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public abstract class AbstractPushTestCase extends AbstractMetamerTest {
-
- private static final int STATUS_CODE_OK = 200;
-
- protected PushAttributes pushAttributes = new PushAttributes();
-
- private ElementLocator outputCounter = pjq("span[id$=outputCounter]");
-
- private HttpClient httpClient;
- private HttpMethod pushMethod;
-
- @Override
- public URL getTestUrl() {
- URL contextPath = SystemProperties.getContextPath();
- return buildUrl(contextPath, "faces/components/a4jPush/simple.xhtml");
- }
-
- /**
- * Initializes the HttpClient which triggers events in {@link #generatePushEvent()}.
- */
- @BeforeClass
- public void initializeHttpClient() {
- httpClient = new HttpClient();
- URL eventProducerUrl = buildUrl(getTestUrl(), "event-producer.xhtml");
- pushMethod = new GetMethod(eventProducerUrl.toString());
- }
-
- /**
- * Returns the value of counter as pushed value
- *
- * @return the value of counter as pushed value
- */
- protected int getCounter() {
- return getText(outputCounter).asInteger();
- }
-
- /**
- * Push the event specified number times and then waits for observation of event by client.
- *
- * @param numberOfPushes
- * the number of events should be generated
- */
- protected void pushAndWait(int numberOfPushes) throws HttpException, IOException {
- selenium.getPageExtensions().install();
- selenium.getRequestInterceptor().clearRequestTypeDone();
-
- for (int i = 0; i < numberOfPushes; i++) {
- generatePushEvent();
- }
-
- selenium.getRequestInterceptor().waitForRequestTypeChange();
- RequestType requestDone = selenium.getRequestInterceptor().getRequestTypeDone();
-
- assertEquals(requestDone, RequestType.XHR);
- }
-
- /**
- * <p>
- * Generates the push event for all registered listeners from a4j:push test Simple page.
- * </p>
- *
- * <p>
- * Internally use HttpClient to ping URL triggering push event in preRenderView phase.
- * </p>
- */
- private void generatePushEvent() throws HttpException, IOException {
- httpClient.executeMethod(pushMethod);
- assertEquals(pushMethod.getStatusCode(), STATUS_CODE_OK);
- }
-}
Deleted: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/IntervalTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/IntervalTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/IntervalTestCase.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * 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.ftest.a4jPush;
-
-import static org.jboss.test.selenium.utils.PrimitiveUtils.asLong;
-import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-
-import java.io.IOException;
-
-import org.apache.commons.httpclient.HttpException;
-import org.jboss.test.selenium.locator.Attribute;
-import org.jboss.test.selenium.locator.AttributeLocator;
-import org.testng.annotations.Test;
-
-/**
- * Tests the interval attribute for a4j:push
- *
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public class IntervalTestCase extends AbstractPushTestCase {
-
- private static final Attribute ATTRIBUTE_TITLE = new Attribute("title");
- private static final int[] INTERVAL_VALUES = new int[]{1000, 5000, 500};
- private static final long MAX_DEVIATION = 100;
- private static final long MAX_AVERAGE_DEVIATION = 75;
- private static final int DEFAULT_COUNTER_STEP = 2;
- private static final int ITERATION_COUNT = 3;
- private static final int MULTIPLE_PUSH_COUNT = 5;
-
- AttributeLocator clientTime = pjq("span[id$=clientDate]").getAttribute(ATTRIBUTE_TITLE);
-
- private long startTime;
- private int counter;
- private int counterStep;
-
- private long deviationTotal = 0;
- private long deviationCount = 0;
-
- /**
- * <p>
- * For 3 different intervals, test that the interval between push event triggered and event observered by client
- * haven't greater deviation than the specified interval.
- * </p>
- *
- * <p>
- * First set the given interval into the interval attribute.
- * </p>
- *
- * <p>
- * Then push and wait for result of update triggered by observation of push event.
- * </p>
- *
- * <p>
- * Then repeat push and wait 6 times with 1 event triggered and 5 events triggered in sequence.
- * </p>
- */
- @Test
- public void testIntervalFromClientPerspective() throws HttpException, IOException {
- for (int interval : INTERVAL_VALUES) {
- counterStep = DEFAULT_COUNTER_STEP;
- pushAttributes.setInterval(interval);
-
- pushAndWait(1);
- for (int i = 0; i < ITERATION_COUNT; i++) {
- startIntervalAndCounter();
- pushAndWait(1);
- validateIntervalAndCounter(interval);
-
- startIntervalAndCounter();
- pushAndWait(MULTIPLE_PUSH_COUNT);
- validateIntervalAndCounter(interval);
- }
- }
-
- validateAverageDeviation();
- }
-
- /**
- * Remembers start of the time frame and current value of counter.
- */
- private void startIntervalAndCounter() {
- startTime = getClientTime();
- counter = getCounter();
- }
-
- /**
- * <p>
- * Obtains current value of counter and end of the time frame to compute the run time.
- * </p>
- *
- * <p>
- * Validates that run time haven't greater deviation from given maximum {@link #MAX_DEVIATION}.
- * </p>
- *
- * <p>
- * Remembers the deviation as part of total deviation for computing average value.
- * </p>
- *
- * <p>
- * Validates that counter have been increased by right value.
- * </p>
- */
- private void validateIntervalAndCounter(int interval) {
- long runTime = getClientTime() - startTime;
- long deviation = Math.abs(interval - runTime);
- assertTrue(deviation <= MAX_DEVIATION, format("Deviation ({0}) is greater than defined maximum {1}", deviation,
- MAX_DEVIATION));
-
- if (seleniumDebug) {
- System.out.println(format("deviation for interval {0}: {1}", interval, deviation));
- }
-
- deviationTotal += deviation;
- deviationCount += 1;
-
- int newCounter = getCounter();
- assertEquals(newCounter, counter + counterStep);
- counter = newCounter;
-
- }
-
- /**
- * Validates the average deviations from intervals.
- */
- private void validateAverageDeviation() {
- long averageDeviation = deviationTotal / deviationCount;
- if (seleniumDebug) {
- System.out.println("averageDeviation: " + averageDeviation);
- }
- assertTrue(averageDeviation <= MAX_AVERAGE_DEVIATION, format(
- "Average deviation for all the intervals ({0}) should not be greater than defined maximum {1}",
- averageDeviation, MAX_AVERAGE_DEVIATION));
- }
-
- /**
- * Returns the time of push event (the time when arrived the response from server)
- *
- * @return the time of push event (the time when arrived the response from server)
- */
- private long getClientTime() {
- return asLong(selenium.getAttribute(clientTime));
- }
-}
Deleted: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/SimpleTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/SimpleTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/SimpleTestCase.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * 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.ftest.a4jPush;
-
-import static org.testng.Assert.assertNotSame;
-import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
-
-import java.io.IOException;
-
-import org.apache.commons.httpclient.HttpException;
-import org.testng.annotations.Test;
-
-/**
- * Test case for simple usage of a4j:push component.
- *
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public class SimpleTestCase extends AbstractPushTestCase {
- private static final long SIMPLE_INTERVAL = 2500;
-
- /**
- * <p>
- * Sets the interval to value {@link #SIMPLE_INTERVAL}.
- * </p>
- *
- * <p>
- * Then try to generate push event, wait for client observation.
- * </p>
- *
- * <p>
- * Validates that counter is changed between iterations.
- * </p>
- */
- @Test
- public void testSimple() throws HttpException, IOException {
- pushAttributes.setInterval(SIMPLE_INTERVAL);
-
- int beginCounter = getCounter();
- pushAndWait(1);
- int endCounter = getCounter();
-
- assertNotSame(beginCounter < endCounter, format(
- "The counter before push is greater {0} or equal the end counter {1}", beginCounter, endCounter));
- }
-}
Copied: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/TestCounter.java (from rev 18158, root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/SimpleTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/TestCounter.java (rev 0)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/TestCounter.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.ftest.a4jPush;
+
+import static org.testng.Assert.assertNotSame;
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
+
+import java.io.IOException;
+
+import org.apache.commons.httpclient.HttpException;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for simple usage of a4j:push component.
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestCounter extends AbstractPushTest {
+ private static final long SIMPLE_INTERVAL = 2500;
+
+ /**
+ * <p>
+ * Sets the interval to value {@link #SIMPLE_INTERVAL}.
+ * </p>
+ *
+ * <p>
+ * Then try to generate push event, wait for client observation.
+ * </p>
+ *
+ * <p>
+ * Validates that counter is changed between iterations.
+ * </p>
+ */
+ @Test
+ public void testSimple() throws HttpException, IOException {
+ pushAttributes.setInterval(SIMPLE_INTERVAL);
+
+ int beginCounter = getCounter();
+ pushAndWait(1);
+ int endCounter = getCounter();
+
+ assertNotSame(beginCounter < endCounter, format(
+ "The counter before push is greater {0} or equal the end counter {1}", beginCounter, endCounter));
+ }
+}
Copied: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/TestInterval.java (from rev 18158, root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/IntervalTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/TestInterval.java (rev 0)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/TestInterval.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * 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.ftest.a4jPush;
+
+import static org.jboss.test.selenium.utils.PrimitiveUtils.asLong;
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.io.IOException;
+
+import org.apache.commons.httpclient.HttpException;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.testng.annotations.Test;
+
+/**
+ * Tests the interval attribute for a4j:push
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestInterval extends AbstractPushTest {
+
+ private static final Attribute ATTRIBUTE_TITLE = new Attribute("title");
+ private static final int[] INTERVAL_VALUES = new int[]{1000, 5000, 500};
+ private static final long MAX_DEVIATION = 100;
+ private static final long MAX_AVERAGE_DEVIATION = 75;
+ private static final int DEFAULT_COUNTER_STEP = 2;
+ private static final int ITERATION_COUNT = 3;
+ private static final int MULTIPLE_PUSH_COUNT = 5;
+
+ AttributeLocator clientTime = pjq("span[id$=clientDate]").getAttribute(ATTRIBUTE_TITLE);
+
+ private long startTime;
+ private int counter;
+ private int counterStep;
+
+ private long deviationTotal = 0;
+ private long deviationCount = 0;
+
+ /**
+ * <p>
+ * For 3 different intervals, test that the interval between push event triggered and event observered by client
+ * haven't greater deviation than the specified interval.
+ * </p>
+ *
+ * <p>
+ * First set the given interval into the interval attribute.
+ * </p>
+ *
+ * <p>
+ * Then push and wait for result of update triggered by observation of push event.
+ * </p>
+ *
+ * <p>
+ * Then repeat push and wait 6 times with 1 event triggered and 5 events triggered in sequence.
+ * </p>
+ */
+ @Test
+ public void testIntervalFromClientPerspective() throws HttpException, IOException {
+ for (int interval : INTERVAL_VALUES) {
+ counterStep = DEFAULT_COUNTER_STEP;
+ pushAttributes.setInterval(interval);
+
+ pushAndWait(1);
+ for (int i = 0; i < ITERATION_COUNT; i++) {
+ startIntervalAndCounter();
+ pushAndWait(1);
+ validateIntervalAndCounter(interval);
+
+ startIntervalAndCounter();
+ pushAndWait(MULTIPLE_PUSH_COUNT);
+ validateIntervalAndCounter(interval);
+ }
+ }
+
+ validateAverageDeviation();
+ }
+
+ /**
+ * Remembers start of the time frame and current value of counter.
+ */
+ private void startIntervalAndCounter() {
+ startTime = getClientTime();
+ counter = getCounter();
+ }
+
+ /**
+ * <p>
+ * Obtains current value of counter and end of the time frame to compute the run time.
+ * </p>
+ *
+ * <p>
+ * Validates that run time haven't greater deviation from given maximum {@link #MAX_DEVIATION}.
+ * </p>
+ *
+ * <p>
+ * Remembers the deviation as part of total deviation for computing average value.
+ * </p>
+ *
+ * <p>
+ * Validates that counter have been increased by right value.
+ * </p>
+ */
+ private void validateIntervalAndCounter(int interval) {
+ long runTime = getClientTime() - startTime;
+ long deviation = Math.abs(interval - runTime);
+ assertTrue(deviation <= MAX_DEVIATION, format("Deviation ({0}) is greater than defined maximum {1}", deviation,
+ MAX_DEVIATION));
+
+ if (seleniumDebug) {
+ System.out.println(format("deviation for interval {0}: {1}", interval, deviation));
+ }
+
+ deviationTotal += deviation;
+ deviationCount += 1;
+
+ int newCounter = getCounter();
+ assertEquals(newCounter, counter + counterStep);
+ counter = newCounter;
+
+ }
+
+ /**
+ * Validates the average deviations from intervals.
+ */
+ private void validateAverageDeviation() {
+ long averageDeviation = deviationTotal / deviationCount;
+ if (seleniumDebug) {
+ System.out.println("averageDeviation: " + averageDeviation);
+ }
+ assertTrue(averageDeviation <= MAX_AVERAGE_DEVIATION, format(
+ "Average deviation for all the intervals ({0}) should not be greater than defined maximum {1}",
+ averageDeviation, MAX_AVERAGE_DEVIATION));
+ }
+
+ /**
+ * Returns the time of push event (the time when arrived the response from server)
+ *
+ * @return the time of push event (the time when arrived the response from server)
+ */
+ private long getClientTime() {
+ return asLong(selenium.getAttribute(clientTime));
+ }
+}
Deleted: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/HCommandButtonTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/HCommandButtonTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/HCommandButtonTestCase.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -1,290 +0,0 @@
-/*******************************************************************************
- * 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.ftest.hCommandButton;
-
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.Attribute;
-import org.jboss.test.selenium.locator.AttributeLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-/**
- * Test case for page /faces/components/commandButton/simple.xhtml
- *
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
- * @version $Revision$
- */
-public class HCommandButtonTestCase extends AbstractMetamerTest {
-
- private JQueryLocator input = pjq("input[id$=input]");
- private JQueryLocator button = pjq("input[id$=commandButton]");
- private JQueryLocator output1 = pjq("span[id$=output1]");
- private JQueryLocator output2 = pjq("span[id$=output2]");
- private JQueryLocator output3 = pjq("span[id$=output3]");
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/commandButton/simple.xhtml");
- }
-
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- @Test(dataProvider = "templates", groups = "client-side-perf")
- public void testSimpleClick(String templates) {
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(button);
-
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "RichFaces 4", "output1 when 'RichFaces 4' in input");
-
- output = selenium.getText(output2);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4' in input");
-
- output = selenium.getText(output3);
- assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces 4' in input");
- }
-
- @Test(dataProvider = "templates")
- public void testSimpleClickUnicode(String templates) {
- selenium.typeKeys(input, "ľščťžýáíéňô");
- selenium.click(button);
-
- waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "ľščťžýáíéňô", "output1 when 'ľščťžýáíéňô' in input");
-
- output = selenium.getText(output2);
- assertEquals(output, "ľščťžý", "output2 when 'ľščťžýáíéňô' in input");
-
- output = selenium.getText(output3);
- assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when 'ľščťžýáíéňô' in input");
- }
-
- @Test(dataProvider = "templates")
- public void testAction(String templates) {
- JQueryLocator doubleStringAction = pjq("input[value=doubleStringAction]");
- JQueryLocator first6CharsAction = pjq("input[value=first6CharsAction]");
- JQueryLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
-
- selenium.click(doubleStringAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- String output = selenium.getText(output2);
- assertEquals(output, "RichFaces 4RichFaces 4",
- "output2 when 'RichFaces 4' in input and doubleStringAction selected");
-
- selenium.click(first6CharsAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ň");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- output = selenium.getText(output2);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
-
- selenium.click(toUpperCaseAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ě");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- output = selenium.getText(output2);
- assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
- }
-
- @Test(dataProvider = "templates")
- public void testActionListener(String templates) {
- JQueryLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
- JQueryLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
- JQueryLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
-
- selenium.click(doubleStringActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- String output = selenium.getText(output3);
- assertEquals(output, "RichFaces 4RichFaces 4",
- "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
-
- selenium.click(first6CharsActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ň");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- output = selenium.getText(output3);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
-
- selenium.click(toUpperCaseActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ě");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- output = selenium.getText(output3);
- assertEquals(output, "RICHFACES 4Ě",
- "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
- }
-
- @Test(dataProvider = "templates")
- public void testDisabled(String templates) {
- JQueryLocator disabledChecbox = pjq("input[id$=disabledInput]");
- AttributeLocator disabledAttribute = button.getAttribute(new Attribute("disabled"));
-
- selenium.click(disabledChecbox);
- selenium.waitForPageToLoad(TIMEOUT);
-
- String isDisabled = selenium.getAttribute(disabledAttribute);
- assertEquals(isDisabled.toLowerCase(), "disabled", "The value of attribute disabled");
- }
-
- // not implemented in Mojarra
- // @Test(dataProvider = "templates")
- public void testOnblur(String templates) {
- testFireEvent(Event.BLUR, button);
- }
-
- // not implemented in Mojarra
- // @Test(dataProvider = "templates")
- public void testOnchange(String templates) {
- testFireEvent(Event.CHANGE, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnclick(String templates) {
- testFireEvent(Event.CLICK, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOndblclick(String templates) {
- testFireEvent(Event.DBLCLICK, button);
- }
-
- // not implemented in Mojarra
- // @Test(dataProvider = "templates")
- public void testOnfocus(String templates) {
- testFireEvent(Event.FOCUS, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnkeydown(String templates) {
- testFireEvent(Event.KEYDOWN, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnkeypress(String templates) {
- testFireEvent(Event.KEYPRESS, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnkeyup(String templates) {
- testFireEvent(Event.KEYUP, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmousedown(String templates) {
- testFireEvent(Event.MOUSEDOWN, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmousemove(String templates) {
- testFireEvent(Event.MOUSEMOVE, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseout(String templates) {
- testFireEvent(Event.MOUSEOUT, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseover(String templates) {
- testFireEvent(Event.MOUSEOVER, button);
- }
-
- @Test(dataProvider = "templates")
- public void testOnmouseup(String templates) {
- testFireEvent(Event.MOUSEUP, button);
- }
-
- @Test(dataProvider = "templates")
- public void testStyleClass(String templates) {
-
- JQueryLocator wide = pjq("input[name$=styleClassInput][value=wide]");
- JQueryLocator big = pjq("input[name$=styleClassInput][value=big]");
- JQueryLocator none = pjq("input[name$=styleClassInput][value=]");
-
- final AttributeLocator classAttribute = button.getAttribute(new Attribute("class"));
-
- selenium.click(wide);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(button, "wide"), "Button's class was not changed to 'wide'");
-
- selenium.click(big);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(button, "big"), "Button's class was not changed to 'big'");
-
- selenium.click(none);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
- }
-
- @Test(dataProvider = "templates")
- public void testStyle(String templates) {
- JQueryLocator styleInput = pjq("input[id$=styleInput]");
- final AttributeLocator attribute = button.getAttribute(new Attribute("style"));
- final String value = "font-size: 20px;";
-
- selenium.type(styleInput, value);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
- }
-
- @Test(dataProvider = "templates")
- public void testValue(String templates) {
- JQueryLocator valueInput = pjq("input[id$=valueInput]");
- final AttributeLocator attribute = button.getAttribute(new Attribute("value"));
- final String value = "new label";
-
- selenium.type(valueInput, value);
- selenium.waitForPageToLoad(TIMEOUT);
-
- assertEquals(selenium.getAttribute(attribute), value, "Value of the button did not change");
- }
-
-}
Copied: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/TestHCommandButton.java (from rev 18158, root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/HCommandButtonTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/TestHCommandButton.java (rev 0)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/TestHCommandButton.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -0,0 +1,290 @@
+/*******************************************************************************
+ * 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.ftest.hCommandButton;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/commandButton/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestHCommandButton extends AbstractMetamerTest {
+
+ private JQueryLocator input = pjq("input[id$=input]");
+ private JQueryLocator button = pjq("input[id$=commandButton]");
+ private JQueryLocator output1 = pjq("span[id$=output1]");
+ private JQueryLocator output2 = pjq("span[id$=output2]");
+ private JQueryLocator output3 = pjq("span[id$=output3]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/commandButton/simple.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ @Test(dataProvider = "templates", groups = "client-side-perf")
+ public void testSimpleClick(String templates) {
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "RichFaces 4", "output1 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces 4' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testSimpleClickUnicode(String templates) {
+ selenium.typeKeys(input, "ľščťžýáíéňô");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "ľščťžýáíéňô", "output1 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "ľščťžý", "output2 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when 'ľščťžýáíéňô' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testAction(String templates) {
+ JQueryLocator doubleStringAction = pjq("input[value=doubleStringAction]");
+ JQueryLocator first6CharsAction = pjq("input[value=first6CharsAction]");
+ JQueryLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
+
+ selenium.click(doubleStringAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output2);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringAction selected");
+
+ selenium.click(first6CharsAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
+
+ selenium.click(toUpperCaseAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testActionListener(String templates) {
+ JQueryLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
+ JQueryLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
+ JQueryLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
+
+ selenium.click(doubleStringActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output3);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
+
+ selenium.click(first6CharsActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
+
+ selenium.click(toUpperCaseActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4Ě",
+ "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDisabled(String templates) {
+ JQueryLocator disabledChecbox = pjq("input[id$=disabledInput]");
+ AttributeLocator disabledAttribute = button.getAttribute(new Attribute("disabled"));
+
+ selenium.click(disabledChecbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ String isDisabled = selenium.getAttribute(disabledAttribute);
+ assertEquals(isDisabled.toLowerCase(), "disabled", "The value of attribute disabled");
+ }
+
+ // not implemented in Mojarra
+ // @Test(dataProvider = "templates")
+ public void testOnblur(String templates) {
+ testFireEvent(Event.BLUR, button);
+ }
+
+ // not implemented in Mojarra
+ // @Test(dataProvider = "templates")
+ public void testOnchange(String templates) {
+ testFireEvent(Event.CHANGE, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnclick(String templates) {
+ testFireEvent(Event.CLICK, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOndblclick(String templates) {
+ testFireEvent(Event.DBLCLICK, button);
+ }
+
+ // not implemented in Mojarra
+ // @Test(dataProvider = "templates")
+ public void testOnfocus(String templates) {
+ testFireEvent(Event.FOCUS, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeydown(String templates) {
+ testFireEvent(Event.KEYDOWN, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeypress(String templates) {
+ testFireEvent(Event.KEYPRESS, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeyup(String templates) {
+ testFireEvent(Event.KEYUP, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousedown(String templates) {
+ testFireEvent(Event.MOUSEDOWN, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousemove(String templates) {
+ testFireEvent(Event.MOUSEMOVE, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseout(String templates) {
+ testFireEvent(Event.MOUSEOUT, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseover(String templates) {
+ testFireEvent(Event.MOUSEOVER, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseup(String templates) {
+ testFireEvent(Event.MOUSEUP, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyleClass(String templates) {
+
+ JQueryLocator wide = pjq("input[name$=styleClassInput][value=wide]");
+ JQueryLocator big = pjq("input[name$=styleClassInput][value=big]");
+ JQueryLocator none = pjq("input[name$=styleClassInput][value=]");
+
+ final AttributeLocator classAttribute = button.getAttribute(new Attribute("class"));
+
+ selenium.click(wide);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(button, "wide"), "Button's class was not changed to 'wide'");
+
+ selenium.click(big);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(button, "big"), "Button's class was not changed to 'big'");
+
+ selenium.click(none);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyle(String templates) {
+ JQueryLocator styleInput = pjq("input[id$=styleInput]");
+ final AttributeLocator attribute = button.getAttribute(new Attribute("style"));
+ final String value = "font-size: 20px;";
+
+ selenium.type(styleInput, value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testValue(String templates) {
+ JQueryLocator valueInput = pjq("input[id$=valueInput]");
+ final AttributeLocator attribute = button.getAttribute(new Attribute("value"));
+ final String value = "new label";
+
+ selenium.type(valueInput, value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertEquals(selenium.getAttribute(attribute), value, "Value of the button did not change");
+ }
+
+}
Deleted: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/ScrollerTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/ScrollerTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/ScrollerTestCase.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * 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.ftest.richExtendedDataTable;
-
-import static org.jboss.test.selenium.locator.LocatorFactory.*;
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.Test;
-
-/**
- * Test of DataScroller tied to Extended Data Table
- *
- * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
- * @version $Revision$
- */
-public class ScrollerTestCase extends AbstractMetamerTest {
-
- private static final int TOTAL_ROW_COUNT = 50;
- private static final Integer[] ROW_COUNT_VALUES =
- new Integer[]{null, 10, 1, TOTAL_ROW_COUNT, 13, 9, 17, TOTAL_ROW_COUNT + 1, 2 * TOTAL_ROW_COUNT};
- DataScroller dataScroller1 = new DataScroller(pjq("span.rf-ds[id$=scroller1]"));
- DataScroller dataScroller2 = new DataScroller(pjq("span.rf-ds[id$=scroller2]"));
- DataTable table = new DataTable(pjq("div.rf-edt[id$=richEDT]"));
- ElementLocator attributeRowsInput = id("form:attributes:rowsInput");
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/richExtendedDataTable/scroller.xhtml");
- }
-
- /**
- * Tests row count for scroller in footer of the EDT.
- *
- * @see {@link #testRowCount(DataScroller)}
- */
- @Test(dataProvider = "templates", groups = "client-side-perf")
- public void testRowCountFooterScroller(String templates) {
- testRowCount(dataScroller2);
- }
-
- /**
- * Tests row count for scroller outside of the EDT.
- *
- * @see {@link #testRowCount(DataScroller)}
- */
- @Test(dataProvider = "templates")
- public void testRowCountOutsideTable(String templates) {
- testRowCount(dataScroller1);
- }
-
- /**
- * <p>
- * Test the data scroller functionality for different values of row count
- * </p>
- *
- * <p>
- * If desired, sets the value of 'rows' first for each iteration.
- * </p>
- *
- * <p>
- * Then goes to first page and verifies that there is valid number of rows.
- * </p>
- *
- * <p>
- * Verifies that on the first page is less than total number of rows if the scroller has several pages.
- * </p>
- *
- * <p>
- * If the scroller has pages enabled, goes to last page and verifies that this is valid number of pages visible in
- * scroller and the number of rows is valid.
- * </p>
- *
- * <p>
- */
- private void testRowCount(DataScroller dataScroller) {
- for (Integer rowsPerPage : ROW_COUNT_VALUES) {
- if (rowsPerPage != null) {
- selenium.type(attributeRowsInput, String.valueOf(rowsPerPage));
- selenium.waitForPageToLoad();
- }
-
- dataScroller.gotoFirstPage();
- int rowCountPreset = Integer.valueOf(selenium.getValue(attributeRowsInput));
- int rowCountActual = table.getCountOfTableRows();
- assertEquals(rowCountActual, Math.min(TOTAL_ROW_COUNT, rowCountPreset));
-
- assertEquals(dataScroller.hasPages(), rowCountActual < TOTAL_ROW_COUNT);
- if (dataScroller.hasPages()) {
- dataScroller.gotoLastPage();
-
- int pagesExpected = pageCountActualExpected(rowCountActual);
- int countOfVisiblePages = dataScroller.getCountOfVisiblePages();
-
- if (countOfVisiblePages < pagesExpected) {
- int lastVisiblePage = dataScroller.getLastVisiblePage();
- assertEquals(lastVisiblePage, pageCountActualExpected(rowCountActual));
- } else {
- assertEquals(countOfVisiblePages, pagesExpected);
- }
-
- int rowCountExpected = rowCountLastPageExpected(rowCountPreset);
- rowCountActual = table.getCountOfTableRows();
- assertEquals(rowCountActual, rowCountExpected);
- }
- }
- }
-
- private int pageCountActualExpected(int rowCountActual) {
- return Double.valueOf(Math.ceil((double) TOTAL_ROW_COUNT / rowCountActual)).intValue();
- }
-
- private int rowCountLastPageExpected(int rowCountPreset) {
- int result = TOTAL_ROW_COUNT % rowCountPreset;
- return (result == 0) ? rowCountPreset : result;
- }
-}
Copied: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/TestScroller.java (from rev 18158, root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/ScrollerTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/TestScroller.java (rev 0)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/TestScroller.java 2010-07-20 13:33:16 UTC (rev 18159)
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * 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.ftest.richExtendedDataTable;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.*;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.testng.annotations.Test;
+
+/**
+ * Test of DataScroller tied to Extended Data Table
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestScroller extends AbstractMetamerTest {
+
+ private static final int TOTAL_ROW_COUNT = 50;
+ private static final Integer[] ROW_COUNT_VALUES =
+ new Integer[]{null, 10, 1, TOTAL_ROW_COUNT, 13, 9, 17, TOTAL_ROW_COUNT + 1, 2 * TOTAL_ROW_COUNT};
+ DataScroller dataScroller1 = new DataScroller(pjq("span.rf-ds[id$=scroller1]"));
+ DataScroller dataScroller2 = new DataScroller(pjq("span.rf-ds[id$=scroller2]"));
+ DataTable table = new DataTable(pjq("div.rf-edt[id$=richEDT]"));
+ ElementLocator attributeRowsInput = id("form:attributes:rowsInput");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richExtendedDataTable/scroller.xhtml");
+ }
+
+ /**
+ * Tests row count for scroller in footer of the EDT.
+ *
+ * @see {@link #testRowCount(DataScroller)}
+ */
+ @Test(dataProvider = "templates", groups = "client-side-perf")
+ public void testRowCountFooterScroller(String templates) {
+ testRowCount(dataScroller2);
+ }
+
+ /**
+ * Tests row count for scroller outside of the EDT.
+ *
+ * @see {@link #testRowCount(DataScroller)}
+ */
+ @Test(dataProvider = "templates")
+ public void testRowCountOutsideTable(String templates) {
+ testRowCount(dataScroller1);
+ }
+
+ /**
+ * <p>
+ * Test the data scroller functionality for different values of row count
+ * </p>
+ *
+ * <p>
+ * If desired, sets the value of 'rows' first for each iteration.
+ * </p>
+ *
+ * <p>
+ * Then goes to first page and verifies that there is valid number of rows.
+ * </p>
+ *
+ * <p>
+ * Verifies that on the first page is less than total number of rows if the scroller has several pages.
+ * </p>
+ *
+ * <p>
+ * If the scroller has pages enabled, goes to last page and verifies that this is valid number of pages visible in
+ * scroller and the number of rows is valid.
+ * </p>
+ *
+ * <p>
+ */
+ private void testRowCount(DataScroller dataScroller) {
+ for (Integer rowsPerPage : ROW_COUNT_VALUES) {
+ if (rowsPerPage != null) {
+ selenium.type(attributeRowsInput, String.valueOf(rowsPerPage));
+ selenium.waitForPageToLoad();
+ }
+
+ dataScroller.gotoFirstPage();
+ int rowCountPreset = Integer.valueOf(selenium.getValue(attributeRowsInput));
+ int rowCountActual = table.getCountOfTableRows();
+ assertEquals(rowCountActual, Math.min(TOTAL_ROW_COUNT, rowCountPreset));
+
+ assertEquals(dataScroller.hasPages(), rowCountActual < TOTAL_ROW_COUNT);
+ if (dataScroller.hasPages()) {
+ dataScroller.gotoLastPage();
+
+ int pagesExpected = pageCountActualExpected(rowCountActual);
+ int countOfVisiblePages = dataScroller.getCountOfVisiblePages();
+
+ if (countOfVisiblePages < pagesExpected) {
+ int lastVisiblePage = dataScroller.getLastVisiblePage();
+ assertEquals(lastVisiblePage, pageCountActualExpected(rowCountActual));
+ } else {
+ assertEquals(countOfVisiblePages, pagesExpected);
+ }
+
+ int rowCountExpected = rowCountLastPageExpected(rowCountPreset);
+ rowCountActual = table.getCountOfTableRows();
+ assertEquals(rowCountActual, rowCountExpected);
+ }
+ }
+ }
+
+ private int pageCountActualExpected(int rowCountActual) {
+ return Double.valueOf(Math.ceil((double) TOTAL_ROW_COUNT / rowCountActual)).intValue();
+ }
+
+ private int rowCountLastPageExpected(int rowCountPreset) {
+ int result = TOTAL_ROW_COUNT % rowCountPreset;
+ return (result == 0) ? rowCountPreset : result;
+ }
+}
14 years, 5 months
JBoss Rich Faces SVN: r18158 - in root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: a4jActionListener and 8 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-20 09:31:25 -0400 (Tue, 20 Jul 2010)
New Revision: 18158
Added:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
Removed:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractTestappTestCase.java
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/A4JActionListenerTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/A4JCommandButtonTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/A4JCommandLinkTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/A4JLogTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/A4JOutputPanelTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/HCommandButtonTestCase.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/ScrollerTestCase.java
Log:
renamed AbstractTestappTestCase to AbstractMetamerTest
Copied: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java (from rev 18155, root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractTestappTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java (rev 0)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2010-07-20 13:31:25 UTC (rev 18158)
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * 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.ftest;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.AbstractTestCase;
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.testng.SkipException;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Optional;
+import org.testng.annotations.Parameters;
+
+/**
+ * Abstract test case used as a basis for majority of test cases.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public abstract class AbstractMetamerTest extends AbstractTestCase {
+
+ /**
+ * timeout in miliseconds
+ */
+ public static final long TIMEOUT = 5000;
+ private String[][] templates;
+
+ /**
+ * Returns the url to test page to be opened by Selenium
+ *
+ * @return absolute url to the test page to be opened by Selenium
+ */
+ public abstract URL getTestUrl();
+
+ /**
+ * Data provider for templates.
+ *
+ * @return array containing templates that should be used (defined in testng.xml) or default array (containing only
+ * plain template) if nothing is defined
+ */
+ @DataProvider(name = "templates")
+ protected Object[][] getTemplates() {
+ if (templates != null && templates.length > 0) {
+ return templates;
+ }
+
+ return new Object[][]{{"plain"}};
+ }
+
+ /**
+ * Loads and parses attribute "templates" from testng.xml.
+ *
+ * @param urlParams
+ */
+ @BeforeClass(alwaysRun = true)
+ @Parameters({"templates"})
+ public void initTemplates(@Optional String urlParams) {
+ if (urlParams == null) {
+ return;
+ }
+
+ String[] array = urlParams.split(" ");
+ templates = new String[array.length][];
+
+ for (int i = 0; i < array.length; i++) {
+ templates[i] = new String[1];
+ templates[i][0] = array[i];
+ }
+ }
+
+ /**
+ * Opens the tested page. If templates is not empty nor null, it appends url parameter with templates.
+ *
+ * @param templates
+ * templates that will be used for test, e.g. "red_div"
+ */
+ @BeforeMethod(alwaysRun = true)
+ public void loadPage(Object[] templates) {
+ if (selenium == null) {
+ new SkipException("selenium isn't initialized");
+ }
+ String urlParams = "";
+ if (templates != null && templates.length != 0) {
+ urlParams = "?templates=" + templates[0];
+ }
+ selenium.open(buildUrl(getTestUrl() + urlParams));
+ selenium.waitForPageToLoad(TIMEOUT);
+ }
+
+ /**
+ * Invalidates session by clicking on a button on tested page.
+ */
+ public void invalidateSession() {
+ selenium.deleteAllVisibleCookies();
+ }
+
+ /**
+ * Forces the current thread sleep for given time.
+ *
+ * @param millis
+ * number of miliseconds for which the thread will sleep
+ */
+ @Deprecated
+ protected void waitFor(long millis) {
+ try {
+ Thread.sleep(millis);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Factory method for creating instances of class JQueryLocator which locates the element using <a
+ * href="http://api.jquery.com/category/selectors/">JQuery Selector</a> syntax. It adds "div.content " in front of
+ * each selector.
+ *
+ * @param jquerySelector
+ * the jquery selector
+ * @return the j query locator
+ * @see JQueryLocator
+ */
+ public static JQueryLocator pjq(String jquerySelector) {
+ return new JQueryLocator("div.content " + jquerySelector);
+ }
+
+ /**
+ * A helper method for testing javascripts events. It sets alert('testedevent') to the input field for given event
+ * and fires the event. Then it checks the message in the alert dialog.
+ *
+ * @param event
+ * JavaScript event to be tested
+ * @param element
+ * locator of tested element
+ */
+ protected void testFireEvent(Event event, ElementLocator element) {
+ ElementLocator eventInput = pjq("input[id$=on" + event.getEventName() + "Input]");
+ final String value = "alert('" + event.getEventName() + "')";
+
+ selenium.type(eventInput, value);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.fireEvent(element, event);
+
+ assertEquals(selenium.getAlert(), event.getEventName(), event.getEventName()
+ + " attribute did not change correctly");
+ }
+
+ /**
+ * Hides header, footer and inputs for attributes.
+ */
+ protected void hideControls() {
+ selenium.getEval(new JavaScript("window.hideControls()"));
+ }
+
+ /**
+ * Shows header, footer and inputs for attributes.
+ */
+ protected void showControls() {
+ selenium.getEval(new JavaScript("window.showControls()"));
+ }
+
+}
Deleted: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractTestappTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractTestappTestCase.java 2010-07-20 13:17:34 UTC (rev 18157)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractTestappTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
@@ -1,190 +0,0 @@
-/*******************************************************************************
- * 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.ftest;
-
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.AbstractTestCase;
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.encapsulated.JavaScript;
-import org.jboss.test.selenium.locator.ElementLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.testng.SkipException;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Optional;
-import org.testng.annotations.Parameters;
-
-/**
- * Abstract test case used as a basis for majority of test cases.
- *
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
- * @version $Revision$
- */
-public abstract class AbstractTestappTestCase extends AbstractTestCase {
-
- /**
- * timeout in miliseconds
- */
- public static final long TIMEOUT = 5000;
- private String[][] templates;
-
- /**
- * Returns the url to test page to be opened by Selenium
- *
- * @return absolute url to the test page to be opened by Selenium
- */
- public abstract URL getTestUrl();
-
- /**
- * Data provider for templates.
- *
- * @return array containing templates that should be used (defined in testng.xml) or default array (containing only
- * plain template) if nothing is defined
- */
- @DataProvider(name = "templates")
- protected Object[][] getTemplates() {
- if (templates != null && templates.length > 0) {
- return templates;
- }
-
- return new Object[][]{{"plain"}};
- }
-
- /**
- * Loads and parses attribute "templates" from testng.xml.
- *
- * @param urlParams
- */
- @BeforeClass(alwaysRun = true)
- @Parameters({"templates"})
- public void initTemplates(@Optional String urlParams) {
- if (urlParams == null) {
- return;
- }
-
- String[] array = urlParams.split(" ");
- templates = new String[array.length][];
-
- for (int i = 0; i < array.length; i++) {
- templates[i] = new String[1];
- templates[i][0] = array[i];
- }
- }
-
- /**
- * Opens the tested page. If templates is not empty nor null, it appends url parameter with templates.
- *
- * @param templates
- * templates that will be used for test, e.g. "red_div"
- */
- @BeforeMethod(alwaysRun = true)
- public void loadPage(Object[] templates) {
- if (selenium == null) {
- new SkipException("selenium isn't initialized");
- }
- String urlParams = "";
- if (templates != null && templates.length != 0) {
- urlParams = "?templates=" + templates[0];
- }
- selenium.open(buildUrl(getTestUrl() + urlParams));
- selenium.waitForPageToLoad(TIMEOUT);
- }
-
- /**
- * Invalidates session by clicking on a button on tested page.
- */
- public void invalidateSession() {
- selenium.deleteAllVisibleCookies();
- }
-
- /**
- * Forces the current thread sleep for given time.
- *
- * @param millis
- * number of miliseconds for which the thread will sleep
- */
- @Deprecated
- protected void waitFor(long millis) {
- try {
- Thread.sleep(millis);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Factory method for creating instances of class JQueryLocator which locates the element using <a
- * href="http://api.jquery.com/category/selectors/">JQuery Selector</a> syntax. It adds "div.content " in front of
- * each selector.
- *
- * @param jquerySelector
- * the jquery selector
- * @return the j query locator
- * @see JQueryLocator
- */
- public static JQueryLocator pjq(String jquerySelector) {
- return new JQueryLocator("div.content " + jquerySelector);
- }
-
- /**
- * A helper method for testing javascripts events. It sets alert('testedevent') to the input field for given event
- * and fires the event. Then it checks the message in the alert dialog.
- *
- * @param event
- * JavaScript event to be tested
- * @param element
- * locator of tested element
- */
- protected void testFireEvent(Event event, ElementLocator element) {
- ElementLocator eventInput = pjq("input[id$=on" + event.getEventName() + "Input]");
- final String value = "alert('" + event.getEventName() + "')";
-
- selenium.type(eventInput, value);
- selenium.waitForPageToLoad(TIMEOUT);
-
- selenium.fireEvent(element, event);
-
- assertEquals(selenium.getAlert(), event.getEventName(), event.getEventName()
- + " attribute did not change correctly");
- }
-
- /**
- * Hides header, footer and inputs for attributes.
- */
- protected void hideControls() {
- selenium.getEval(new JavaScript("window.hideControls()"));
- }
-
- /**
- * Shows header, footer and inputs for attributes.
- */
- protected void showControls() {
- selenium.getEval(new JavaScript("window.showControls()"));
- }
-
-}
Modified: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/A4JActionListenerTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/A4JActionListenerTestCase.java 2010-07-20 13:17:34 UTC (rev 18157)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/A4JActionListenerTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
@@ -32,7 +32,7 @@
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.waiting.ajax.JavaScriptCondition;
import org.jboss.test.selenium.waiting.selenium.SeleniumCondition;
-import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
@@ -42,7 +42,7 @@
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
-public class A4JActionListenerTestCase extends AbstractTestappTestCase {
+public class A4JActionListenerTestCase extends AbstractMetamerTest {
private ElementLocator invokeButtonType = pjq("input[id$=invokeByTypeButton]");
private ElementLocator invokeButtonBinding = pjq("input[id$=invokeByBindingButton]");
Modified: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/A4JCommandButtonTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/A4JCommandButtonTestCase.java 2010-07-20 13:17:34 UTC (rev 18157)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/A4JCommandButtonTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
@@ -33,7 +33,7 @@
import org.jboss.test.selenium.locator.Attribute;
import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.ElementLocator;
-import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
@@ -43,7 +43,7 @@
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
-public class A4JCommandButtonTestCase extends AbstractTestappTestCase {
+public class A4JCommandButtonTestCase extends AbstractMetamerTest {
private ElementLocator input = pjq("input[id$=input]");
private ElementLocator button = pjq("input[id$=a4jCommandButton]");
Modified: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/A4JCommandLinkTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/A4JCommandLinkTestCase.java 2010-07-20 13:17:34 UTC (rev 18157)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/A4JCommandLinkTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
@@ -33,7 +33,7 @@
import org.jboss.test.selenium.locator.Attribute;
import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.ElementLocator;
-import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
@@ -43,7 +43,7 @@
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
-public class A4JCommandLinkTestCase extends AbstractTestappTestCase {
+public class A4JCommandLinkTestCase extends AbstractMetamerTest {
private ElementLocator input = pjq("input[id$=input]");
private ElementLocator link = pjq("a[id$=a4jCommandLink]");
Modified: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/A4JLogTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/A4JLogTestCase.java 2010-07-20 13:17:34 UTC (rev 18157)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/A4JLogTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
@@ -32,7 +32,7 @@
import org.jboss.test.selenium.locator.ElementLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
@@ -42,7 +42,7 @@
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
-public class A4JLogTestCase extends AbstractTestappTestCase {
+public class A4JLogTestCase extends AbstractMetamerTest {
/**
* Enumeration representing all possible levels for a4j:log.
Modified: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/A4JOutputPanelTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/A4JOutputPanelTestCase.java 2010-07-20 13:17:34 UTC (rev 18157)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/A4JOutputPanelTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
@@ -34,7 +34,7 @@
import org.jboss.test.selenium.locator.Attribute;
import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.ElementLocator;
-import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -45,7 +45,7 @@
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
-public class A4JOutputPanelTestCase extends AbstractTestappTestCase {
+public class A4JOutputPanelTestCase extends AbstractMetamerTest {
private ElementLocator increaseCounterButton = pjq("input[id$=button]");
private ElementLocator outputDiv = pjq("div[id$=outputPanel]");
Modified: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollTestCase.java 2010-07-20 13:17:34 UTC (rev 18157)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/PollTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
@@ -28,7 +28,7 @@
import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.ElementLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
@@ -45,7 +45,7 @@
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class PollTestCase extends AbstractTestappTestCase {
+public class PollTestCase extends AbstractMetamerTest {
private static final Attribute ATTRIBUTE_TITLE = new Attribute("title");
private static final int[] TEST_INTERVAL_VALUES = new int[]{1000, 5000, 500};
Modified: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTestCase.java 2010-07-20 13:17:34 UTC (rev 18157)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPush/AbstractPushTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
@@ -35,7 +35,7 @@
import org.jboss.test.selenium.SystemProperties;
import org.jboss.test.selenium.locator.ElementLocator;
import org.jboss.test.selenium.request.RequestType;
-import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.testng.annotations.BeforeClass;
/**
@@ -44,7 +44,7 @@
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public abstract class AbstractPushTestCase extends AbstractTestappTestCase {
+public abstract class AbstractPushTestCase extends AbstractMetamerTest {
private static final int STATUS_CODE_OK = 200;
Modified: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/HCommandButtonTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/HCommandButtonTestCase.java 2010-07-20 13:17:34 UTC (rev 18157)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/HCommandButtonTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
@@ -33,7 +33,7 @@
import org.jboss.test.selenium.locator.Attribute;
import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
@@ -43,7 +43,7 @@
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
-public class HCommandButtonTestCase extends AbstractTestappTestCase {
+public class HCommandButtonTestCase extends AbstractMetamerTest {
private JQueryLocator input = pjq("input[id$=input]");
private JQueryLocator button = pjq("input[id$=commandButton]");
Modified: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/ScrollerTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/ScrollerTestCase.java 2010-07-20 13:17:34 UTC (rev 18157)
+++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/ScrollerTestCase.java 2010-07-20 13:31:25 UTC (rev 18158)
@@ -29,7 +29,7 @@
import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.locator.ElementLocator;
-import org.richfaces.tests.metamer.ftest.AbstractTestappTestCase;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.testng.annotations.Test;
/**
@@ -38,7 +38,7 @@
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class ScrollerTestCase extends AbstractTestappTestCase {
+public class ScrollerTestCase extends AbstractMetamerTest {
private static final int TOTAL_ROW_COUNT = 50;
private static final Integer[] ROW_COUNT_VALUES =
14 years, 5 months
JBoss Rich Faces SVN: r18157 - in root/tests/metamer/trunk/application/src/main: resources/org/richfaces/tests/metamer/bean and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-07-20 09:17:34 -0400 (Tue, 20 Jul 2010)
New Revision: 18157
Added:
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JRepeatBean.java
root/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/A4JRepeatBean.properties
root/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/
root/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/list.xhtml
root/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/matrix.xhtml
root/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/simple.xhtml
root/tests/metamer/trunk/application/src/main/webapp/resources/css/a4jRepeat.css
Modified:
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java
Log:
* added two pages with a4j:repeat
Added: root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JRepeatBean.java
===================================================================
--- root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JRepeatBean.java (rev 0)
+++ root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JRepeatBean.java 2010-07-20 13:17:34 UTC (rev 18157)
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * 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 java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.ViewScoped;
+
+import org.richfaces.component.UIRepeat;
+import org.richfaces.tests.metamer.Attributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Managed bean for a4j:repeat.
+ *
+ * @author Nick Belaevski, <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean(name = "a4jRepeatBean")
+@ViewScoped
+public class A4JRepeatBean implements Serializable {
+
+ private static final long serialVersionUID = 4864439475400649809L;
+ private static final int MATRIX_DIMENSION = 4;
+ private static Logger logger;
+ private Attributes attributes;
+ private List<Data> dataList;
+ private Data selectedDataItem = null;
+ private List<MatrixRow> matrixRows;
+
+ public static final class MatrixCell implements Serializable {
+
+ private static final long serialVersionUID = -5911659561854593681L;
+ private int value = 0;
+
+ public int getValue() {
+ return value;
+ }
+
+ public void setValue(int value) {
+ this.value = value;
+ }
+
+ public void clearValueAction() {
+ setValue(0);
+ }
+
+ public void increaseValueAction() {
+ value++;
+ }
+
+ public void decreaseValueAction() {
+ value--;
+ }
+ }
+
+ public static final class MatrixRow implements Serializable {
+
+ private static final long serialVersionUID = -5051037819565283283L;
+ private List<MatrixCell> cells = new ArrayList<MatrixCell>();
+
+ public List<MatrixCell> getCells() {
+ return cells;
+ }
+
+ public void addCell(MatrixCell cell) {
+ cells.add(cell);
+ }
+ }
+
+ public static final class Data implements Serializable {
+
+ private static final long serialVersionUID = -1461777632529492912L;
+ private String text;
+
+ /**
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * @param text the text to set
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+ }
+
+ /**
+ * Initializes the managed bean.
+ */
+ @PostConstruct
+ public void init() {
+ logger = LoggerFactory.getLogger(getClass());
+ logger.debug("initializing bean " + getClass().getName());
+
+ // initialize model for page simple.xhtml
+ dataList = new ArrayList<Data>();
+ for (int i = 0; i < 20; i++) {
+ Data data = new Data();
+ data.setText(MessageFormat.format("Item {0}", i));
+ dataList.add(data);
+ }
+
+ // initialize model for page matrix.xhtml
+ matrixRows = new ArrayList<MatrixRow>();
+ for (int i = 0; i < MATRIX_DIMENSION; i++) {
+ MatrixRow matrixRow = new MatrixRow();
+
+ for (int j = 0; j < MATRIX_DIMENSION; j++) {
+ MatrixCell matrixCell = new MatrixCell();
+ matrixRow.addCell(matrixCell);
+ }
+
+ matrixRows.add(matrixRow);
+ }
+
+ // initialize attributes
+ attributes = Attributes.getUIComponentAttributes(UIRepeat.class, getClass());
+ attributes.setAttribute("rendered", true);
+ // TODO has to be tested in other way
+ attributes.remove("componentState");
+ attributes.remove("iterationStatusVar");
+ attributes.remove("rowKeyVar");
+ attributes.remove("value");
+ attributes.remove("var");
+ }
+
+ public Attributes getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Attributes attributes) {
+ this.attributes = attributes;
+ }
+
+ /**
+ * @return the data
+ */
+ public List<Data> getDataList() {
+ return dataList;
+ }
+
+ /**
+ * @return the selectedDataItem
+ */
+ public Data getSelectedDataItem() {
+ return selectedDataItem;
+ }
+
+ /**
+ * @param selectedDataItem the selectedDataItem to set
+ */
+ public void setSelectedDataItem(Data selectedDataItem) {
+ this.selectedDataItem = selectedDataItem;
+ }
+
+ public List<MatrixRow> getMatrixRows() {
+ return matrixRows;
+ }
+}
Property changes on: root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/A4JRepeatBean.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-20 11:43:50 UTC (rev 18156)
+++ root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichBean.java 2010-07-20 13:17:34 UTC (rev 18157)
@@ -100,6 +100,7 @@
components.put("a4jParam", "A4J Action Parameter");
components.put("a4jPoll", "A4J Poll");
components.put("a4jPush", "A4J Push");
+ components.put("a4jRepeat", "A4J Repeat");
components.put("commandButton", "JSF Command Button");
components.put("richDataGrid", "Rich Data Grid");
components.put("richDataScroller", "Rich Data Scroller");
Added: root/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/A4JRepeatBean.properties
===================================================================
Added: root/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/list.xhtml
===================================================================
--- root/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/list.xhtml (rev 0)
+++ root/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/list.xhtml 2010-07-20 13:17:34 UTC (rev 18157)
@@ -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 Repeat</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:repeat</b> and
+ input boxes for all its attributes.</div>
+
+ <h:link outcome="matrix" value="Matrix" styleClass="link" />
+ <div class="description">Simple page that contains <b>a4j:repeat</b> rendering a table. Page contains input boxes for all repeat's attributes.</div>
+
+ </h:body>
+</html>
\ No newline at end of file
Added: root/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/matrix.xhtml
===================================================================
--- root/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/matrix.xhtml (rev 0)
+++ root/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/matrix.xhtml 2010-07-20 13:17:34 UTC (rev 18157)
@@ -0,0 +1,99 @@
+<!--
+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="a4jRepeat.css" />
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <h:panelGroup id="matrixInput" layout="block">
+ <table>
+ <tbody>
+ <a4j:repeat id="a4jRepeatRows"
+ iterationStatusVar="rowStatus"
+ value="#{a4jRepeatBean.matrixRows}"
+ var="row">
+ <tr>
+ <a4j:repeat id="a4jRepeatColumns" value="#{row.cells}" var="cell" iterationStatusVar="cellStatus">
+ <td><h:panelGroup layout="block"
+ styleClass="cell #{rowStatus.even ? 'row-even' : 'row-odd'} #{cellStatus.even ? 'cell-even' : 'cell-odd'}">
+ <h:inputText id="valueInput" value="#{cell.value}" size="3">
+ <f:convertNumber id="valueConvertNumber" />
+ <a4j:ajax id="valueInputAjax" render="matrixInput matrixOutput" />
+ </h:inputText>
+
+ <h:commandLink id="clearLink" action="#{cell.clearValueAction}" value="C">
+ <a4j:ajax render="matrixInput matrixOutput" />
+ </h:commandLink>
+ <h:outputText value=" / " />
+ <h:commandLink id="increaseLink" action="#{cell.increaseValueAction}" value="+">
+ <a4j:ajax render="matrixInput matrixOutput" />
+ </h:commandLink>
+ <h:outputText value=" / " />
+ <h:commandLink id="decreaseLink" action="#{cell.decreaseValueAction}" value="-">
+ <a4j:ajax render="matrixInput matrixOutput" />
+ </h:commandLink>
+ </h:panelGroup></td>
+ </a4j:repeat>
+ </tr>
+ </a4j:repeat>
+ </tbody>
+ </table>
+ </h:panelGroup>
+ <hr/>
+ <h:panelGroup id="matrixOutput" layout="block">
+ <table>
+ <tbody>
+ <a4j:repeat value="#{a4jRepeatBean.matrixRows}" var="row">
+ <tr>
+ <a4j:repeat value="#{row.cells}" var="cell">
+ <td><h:panelGroup styleClass="cell" layout="block">
+ #{cell.value}
+ </h:panelGroup></td>
+ </a4j:repeat>
+ </tr>
+ </a4j:repeat>
+ </tbody>
+ </table>
+ </h:panelGroup>
+ </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/a4jRepeat/simple.xhtml
===================================================================
--- root/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/simple.xhtml (rev 0)
+++ root/tests/metamer/trunk/application/src/main/webapp/components/a4jRepeat/simple.xhtml 2010-07-20 13:17:34 UTC (rev 18157)
@@ -0,0 +1,86 @@
+<!--
+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="a4jRepeat.css" />
+ </ui:define>
+
+ <ui:define name="outOfTemplateBefore">
+ </ui:define>
+
+ <ui:define name="component">
+ <h:outputText id="output" value="#{a4jRepeatBean.selectedDataItem.text}"/>
+
+ <ul id="list">
+ <a4j:repeat id="a4jRepeat"
+ first="#{a4jRepeatBean.attributes['first'].value}"
+ iterationState="#{a4jRepeatBean.attributes['iterationState'].value}"
+ iterationStatusVar="status"
+ keepSaved="#{a4jRepeatBean.attributes['keepSaved'].value}"
+ relativeRowIndex="#{a4jRepeatBean.attributes['relativeRowIndex'].value}"
+ rendered="#{a4jRepeatBean.attributes['rendered'].value}"
+ rowAvailable="#{a4jRepeatBean.attributes['rowAvailable'].value}"
+ rowCount="#{a4jRepeatBean.attributes['rowCount'].value}"
+ rowData="#{a4jRepeatBean.attributes['rowData'].value}"
+ rowIndex="#{a4jRepeatBean.attributes['rowIndex'].value}"
+ rowKey="#{a4jRepeatBean.attributes['rowKey'].value}"
+ rowKeyConverter="#{a4jRepeatBean.attributes['rowKeyConverter'].value}"
+ rows="#{a4jRepeatBean.attributes['rows'].value}"
+ value="#{a4jRepeatBean.dataList}"
+ var="item">
+ <li><h:inputText value="#{item.text}" />
+ <h:commandLink value="Link">
+ <f:ajax render="@form" execute="@form" />
+ <f:setPropertyActionListener target="#{a4jRepeatBean.selectedDataItem}" value="#{item}" />
+ </h:commandLink>
+
+ <h:outputText id="statusBegin" value="begin=#{status.begin}, "/>
+ <h:outputText id="statusEnd" value="end=#{status.end}, "/>
+ <h:outputText id="statusIndex" value="index=#{status.index}, "/>
+ <h:outputText id="statusCount" value="count=#{status.count}, "/>
+ <h:outputText id="statusFirst" value="first=#{status.first}, "/>
+ <h:outputText id="statusLast" value="last=#{status.last}, "/>
+ <h:outputText id="statusEven" value="even=#{status.even}, "/>
+ <h:outputText id="statusRowCount" value="rowCount=#{status.rowCount}"/>
+ </li>
+ </a4j:repeat>
+ </ul>
+ </ui:define>
+
+ <ui:define name="outOfTemplateAfter">
+ <ta:attributes value="#{a4jRepeatBean.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/a4jRepeat.css
===================================================================
--- root/tests/metamer/trunk/application/src/main/webapp/resources/css/a4jRepeat.css (rev 0)
+++ root/tests/metamer/trunk/application/src/main/webapp/resources/css/a4jRepeat.css 2010-07-20 13:17:34 UTC (rev 18157)
@@ -0,0 +1,8 @@
+.cell {
+ width: 120px;
+ padding: 10px;
+}
+
+.cell-even.row-even,.cell-odd.row-odd {
+ background-color: #CFC;
+}
\ No newline at end of file
14 years, 5 months
JBoss Rich Faces SVN: r18156 - root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-07-20 07:43:50 -0400 (Tue, 20 Jul 2010)
New Revision: 18156
Modified:
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoCompleteBase.js
Log:
https://jira.jboss.org/browse/RF-8875
attachToBody javascript options was added
Modified: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoCompleteBase.js
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoCompleteBase.js 2010-07-20 11:40:39 UTC (rev 18155)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/AutoCompleteBase.js 2010-07-20 11:43:50 UTC (rev 18156)
@@ -206,9 +206,14 @@
show: function (event) {
if (!this.isVisible) {
if (this.onBeforeShow(event)!=false) {
+ this.scrollElements = rf.Event.bindScrollEventHandlers(this.selectId, this.hide, this, this.namespace);
+ if (this.options.attachToBody) {
+ var element = rf.getDomElement(this.selectId);
+ this.parentElement = element.parentNode;
+ $(element).detach().appendTo("body");
+ }
$(rf.getDomElement(this.selectId)).setPosition({id: this.fieldId}, {type:"DROPDOWN", offset:[0,20]}).show();
this.isVisible = true;
- this.scrollElements = rf.Event.bindScrollEventHandlers(this.selectId, this.hide, this, this.namespace);
if (this.onShow) {
this.onShow(event);
}
@@ -220,6 +225,10 @@
rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
$(rf.getDomElement(this.selectId)).hide();
this.isVisible = false;
+ if (this.options.attachToBody && this.parentElement) {
+ $(rf.getDomElement(this.selectId)).detach().appendTo(this.parentElement);
+ this.parentElement = null;
+ }
if (this.onHide) {
this.onHide(event);
}
@@ -227,8 +236,10 @@
},
destroy: function () {
//TODO: add all unbind
+ this.parentNode = null;
rf.Event.unbindById(this.options.buttonId, this.namespace);
rf.Event.unbindById(this.fieldId, this.namespace);
+ rf.Event.unbindById(this.selectId, this.namespace);
$super.destroy.call(this);
},
getNamespace: function () {
14 years, 5 months
JBoss Rich Faces SVN: r18155 - root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean.
by richfaces-svn-commits@lists.jboss.org
Author: ppitonak(a)redhat.com
Date: 2010-07-20 07:40:39 -0400 (Tue, 20 Jul 2010)
New Revision: 18155
Modified:
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDataTableBean.java
root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichExtendedDataTableBean.java
Log:
* refactoring needed because of changes in class SortOrder
Modified: root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDataTableBean.java
===================================================================
--- root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDataTableBean.java 2010-07-20 05:30:54 UTC (rev 18154)
+++ root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichDataTableBean.java 2010-07-20 11:40:39 UTC (rev 18155)
@@ -60,8 +60,8 @@
private boolean state = true;
// sorting
- private SortOrder capitalsOrder = SortOrder.unsorted;
- private SortOrder statesOrder = SortOrder.unsorted;
+ private SortOrder capitalsOrder = SortOrder.UNSORTED;
+ private SortOrder statesOrder = SortOrder.UNSORTED;
// filtering
private String sexFilter;
@@ -180,20 +180,20 @@
}
public void sortByCapitals() {
- statesOrder = SortOrder.unsorted;
- if (capitalsOrder.equals(SortOrder.ascending)) {
- setCapitalsOrder(SortOrder.descending);
+ statesOrder = SortOrder.UNSORTED;
+ if (capitalsOrder.equals(SortOrder.ASCENDING)) {
+ setCapitalsOrder(SortOrder.DESCENDING);
} else {
- setCapitalsOrder(SortOrder.ascending);
+ setCapitalsOrder(SortOrder.ASCENDING);
}
}
public void sortByStates() {
- capitalsOrder = SortOrder.unsorted;
- if (statesOrder.equals(SortOrder.ascending)) {
- setStatesOrder(SortOrder.descending);
+ capitalsOrder = SortOrder.UNSORTED;
+ if (statesOrder.equals(SortOrder.ASCENDING)) {
+ setStatesOrder(SortOrder.DESCENDING);
} else {
- setStatesOrder(SortOrder.ascending);
+ setStatesOrder(SortOrder.ASCENDING);
}
}
Modified: root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichExtendedDataTableBean.java
===================================================================
--- root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichExtendedDataTableBean.java 2010-07-20 05:30:54 UTC (rev 18154)
+++ root/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichExtendedDataTableBean.java 2010-07-20 11:40:39 UTC (rev 18155)
@@ -60,8 +60,8 @@
private boolean state = true;
// sorting
- private SortOrder capitalsOrder = SortOrder.unsorted;
- private SortOrder statesOrder = SortOrder.unsorted;
+ private SortOrder capitalsOrder = SortOrder.UNSORTED;
+ private SortOrder statesOrder = SortOrder.UNSORTED;
// filtering
private String sexFilter;
@@ -195,20 +195,20 @@
}
public void sortByCapitals() {
- statesOrder = SortOrder.unsorted;
- if (capitalsOrder.equals(SortOrder.ascending)) {
- setCapitalsOrder(SortOrder.descending);
+ statesOrder = SortOrder.UNSORTED;
+ if (capitalsOrder.equals(SortOrder.ASCENDING)) {
+ setCapitalsOrder(SortOrder.DESCENDING);
} else {
- setCapitalsOrder(SortOrder.ascending);
+ setCapitalsOrder(SortOrder.ASCENDING);
}
}
public void sortByStates() {
- capitalsOrder = SortOrder.unsorted;
- if (statesOrder.equals(SortOrder.ascending)) {
- setStatesOrder(SortOrder.descending);
+ capitalsOrder = SortOrder.UNSORTED;
+ if (statesOrder.equals(SortOrder.ASCENDING)) {
+ setStatesOrder(SortOrder.DESCENDING);
} else {
- setStatesOrder(SortOrder.ascending);
+ setStatesOrder(SortOrder.ASCENDING);
}
}
14 years, 5 months