JBoss Rich Faces SVN: r10674 - in trunk/sandbox: samples/queue-sample and 26 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-10-06 14:13:47 -0400 (Mon, 06 Oct 2008)
New Revision: 10674
Added:
trunk/sandbox/samples/queue-sample/
trunk/sandbox/samples/queue-sample/pom.xml
trunk/sandbox/samples/queue-sample/src/
trunk/sandbox/samples/queue-sample/src/main/
trunk/sandbox/samples/queue-sample/src/main/java/
trunk/sandbox/samples/queue-sample/src/main/java/org/
trunk/sandbox/samples/queue-sample/src/main/java/org/richfaces/
trunk/sandbox/samples/queue-sample/src/main/java/org/richfaces/Bean.java
trunk/sandbox/samples/queue-sample/src/main/webapp/
trunk/sandbox/samples/queue-sample/src/main/webapp/META-INF/
trunk/sandbox/samples/queue-sample/src/main/webapp/META-INF/MANIFEST.MF
trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/
trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/faces-config.xml
trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/web.xml
trunk/sandbox/samples/queue-sample/src/main/webapp/index.jsp
trunk/sandbox/samples/queue-sample/src/main/webapp/pages/
trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.jsp
trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.xhtml
trunk/sandbox/samples/queue-sample/src/test/
trunk/sandbox/samples/queue-sample/src/test/java/
trunk/sandbox/samples/queue-sample/src/test/java/org/
trunk/sandbox/samples/queue-sample/src/test/java/org/richfaces/
trunk/sandbox/samples/queue-sample/src/test/java/org/richfaces/BeanTest.java
trunk/sandbox/ui/queue/
trunk/sandbox/ui/queue/pom.xml
trunk/sandbox/ui/queue/src/
trunk/sandbox/ui/queue/src/main/
trunk/sandbox/ui/queue/src/main/config/
trunk/sandbox/ui/queue/src/main/config/component/
trunk/sandbox/ui/queue/src/main/config/component/queue.xml
trunk/sandbox/ui/queue/src/main/java/
trunk/sandbox/ui/queue/src/main/java/org/
trunk/sandbox/ui/queue/src/main/java/org/ajax4jsf/
trunk/sandbox/ui/queue/src/main/java/org/ajax4jsf/taglib/
trunk/sandbox/ui/queue/src/main/java/org/ajax4jsf/taglib/html/
trunk/sandbox/ui/queue/src/main/java/org/ajax4jsf/taglib/html/facelets/
trunk/sandbox/ui/queue/src/main/java/org/ajax4jsf/taglib/html/facelets/QueueHandler.java
trunk/sandbox/ui/queue/src/main/java/org/ajax4jsf/taglib/html/jsp/
trunk/sandbox/ui/queue/src/main/java/org/ajax4jsf/taglib/html/jsp/QueueTag.java
Modified:
trunk/sandbox/samples/pom.xml
trunk/sandbox/ui/pom.xml
Log:
Modified: trunk/sandbox/samples/pom.xml
===================================================================
--- trunk/sandbox/samples/pom.xml 2008-10-06 17:25:49 UTC (rev 10673)
+++ trunk/sandbox/samples/pom.xml 2008-10-06 18:13:47 UTC (rev 10674)
@@ -18,5 +18,6 @@
<!--module>contextMenuDemo</module-->
<module>fileUploadPOC</module>
<module>editor-sample</module>
+ <module>queue-sample</module>
</modules>
</project>
\ No newline at end of file
Property changes on: trunk/sandbox/samples/queue-sample
___________________________________________________________________
Name: svn:ignore
+ .project
.settings
.classpath
target
Added: trunk/sandbox/samples/queue-sample/pom.xml
===================================================================
--- trunk/sandbox/samples/queue-sample/pom.xml (rev 0)
+++ trunk/sandbox/samples/queue-sample/pom.xml 2008-10-06 18:13:47 UTC (rev 10674)
@@ -0,0 +1,37 @@
+<?xml version="1.0"?><project>
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.richfaces.sandbox</groupId>
+ <version>3.3.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces</groupId>
+ <artifactId>queue-sample</artifactId>
+ <packaging>war</packaging>
+ <name>queue-sample Maven Webapp</name>
+ <version>3.3.0-SNAPSHOT</version>
+ <build>
+ <finalName>queue-sample</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.sandbox.ui</groupId>
+ <artifactId>queue</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added: trunk/sandbox/samples/queue-sample/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/java/org/richfaces/Bean.java (rev 0)
+++ trunk/sandbox/samples/queue-sample/src/main/java/org/richfaces/Bean.java 2008-10-06 18:13:47 UTC (rev 10674)
@@ -0,0 +1,29 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces;
+/**
+ * @author $Autor$
+ *
+ */
+public class Bean {
+
+}
\ No newline at end of file
Added: trunk/sandbox/samples/queue-sample/src/main/webapp/META-INF/MANIFEST.MF
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/META-INF/MANIFEST.MF (rev 0)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/META-INF/MANIFEST.MF 2008-10-06 18:13:47 UTC (rev 10674)
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+
Added: trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/faces-config.xml (rev 0)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/faces-config.xml 2008-10-06 18:13:47 UTC (rev 10674)
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+<faces-config>
+ <managed-bean>
+ <managed-bean-name>bean</managed-bean-name>
+ <managed-bean-class>org.richfaces.Bean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+</faces-config>
Added: trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/WEB-INF/web.xml 2008-10-06 18:13:47 UTC (rev 10674)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <display-name>Archetype Created Web Application</display-name>
+ <context-param>
+ <param-name>javax.faces.CONFIG_FILES</param-name>
+ <param-value>/WEB-INF/faces-config.xml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
+ <param-value>server</param-value>
+ </context-param>
+ <!--
+ -->
+ <filter>
+ <display-name>Ajax4jsf Filter</display-name>
+ <filter-name>ajax4jsf</filter-name>
+ <filter-class>org.ajax4jsf.Filter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>ajax4jsf</filter-name>
+ <servlet-name>Faces Servlet</servlet-name>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ <dispatcher>INCLUDE</dispatcher>
+ <dispatcher>ERROR</dispatcher>
+ </filter-mapping>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+</web-app>
Added: trunk/sandbox/samples/queue-sample/src/main/webapp/index.jsp
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/index.jsp (rev 0)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/index.jsp 2008-10-06 18:13:47 UTC (rev 10674)
@@ -0,0 +1,11 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+
+<html>
+
+<head></head>
+
+ <body>
+ <jsp:forward page="/pages/index.jsf" />
+ </body>
+
+</html>
\ No newline at end of file
Added: trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.jsp (rev 0)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.jsp 2008-10-06 18:13:47 UTC (rev 10674)
@@ -0,0 +1,21 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
+<%@ taglib uri="http://labs.jboss.com/jbossrichfaces/ui/ui/queue" prefix="q"%>
+<html>
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <q:queue name="queue" requestDelay="1000"/>
+ <h:outputText id ="outputText" value="Test"></h:outputText>
+ <a4j:commandButton value="commandButton1" reRender="outputText" eventsQueue="queue"/>
+ <a4j:commandButton value="commandButton2" reRender="outputText" eventsQueue="queue"/>
+ <a4j:commandButton value="commandButton3" reRender="outputText" eventsQueue="queue"/>
+ <a4j:commandButton value="commandButton4" reRender="outputText" eventsQueue="queue"/>
+ </h:form>
+ </f:view>
+ </body>
+</html>
Added: trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.xhtml
===================================================================
--- trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.xhtml (rev 0)
+++ trunk/sandbox/samples/queue-sample/src/main/webapp/pages/index.xhtml 2008-10-06 18:13:47 UTC (rev 10674)
@@ -0,0 +1,12 @@
+<!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:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
+ >
+ <f:view>
+
+ </f:view>
+</html>
\ No newline at end of file
Added: trunk/sandbox/samples/queue-sample/src/test/java/org/richfaces/BeanTest.java
===================================================================
--- trunk/sandbox/samples/queue-sample/src/test/java/org/richfaces/BeanTest.java (rev 0)
+++ trunk/sandbox/samples/queue-sample/src/test/java/org/richfaces/BeanTest.java 2008-10-06 18:13:47 UTC (rev 10674)
@@ -0,0 +1,46 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+*/
+public class BeanTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public BeanTest( String testName )
+ {
+ super( testName );
+ }
+
+ public void testStub() throws Exception {
+
+ }
+}
Modified: trunk/sandbox/ui/pom.xml
===================================================================
--- trunk/sandbox/ui/pom.xml 2008-10-06 17:25:49 UTC (rev 10673)
+++ trunk/sandbox/ui/pom.xml 2008-10-06 18:13:47 UTC (rev 10674)
@@ -19,5 +19,6 @@
<!--module>rex-button</module-->
<module>sortableHeader</module>
<module>editor</module>
+ <module>queue</module>
</modules>
</project>
\ No newline at end of file
Property changes on: trunk/sandbox/ui/queue
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
Added: trunk/sandbox/ui/queue/pom.xml
===================================================================
--- trunk/sandbox/ui/queue/pom.xml (rev 0)
+++ trunk/sandbox/ui/queue/pom.xml 2008-10-06 18:13:47 UTC (rev 10674)
@@ -0,0 +1,50 @@
+<?xml version="1.0"?><project>
+ <parent>
+ <artifactId>ui</artifactId>
+ <groupId>org.richfaces.sandbox</groupId>
+ <version>3.3.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.sandbox.ui</groupId>
+ <artifactId>queue</artifactId>
+ <name>queue</name>
+ <version>3.3.0-SNAPSHOT</version>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.richfaces.cdk</groupId>
+ <artifactId>maven-cdk-plugin</artifactId>
+ <version>3.3.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <library>
+ <prefix>org.richfaces.ui</prefix>
+ <taglib>
+ <shortName>queue</shortName>
+ </taglib>
+ </library>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-impl</artifactId>
+ <version>3.3.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added: trunk/sandbox/ui/queue/src/main/config/component/queue.xml
===================================================================
--- trunk/sandbox/ui/queue/src/main/config/component/queue.xml (rev 0)
+++ trunk/sandbox/ui/queue/src/main/config/component/queue.xml 2008-10-06 18:13:47 UTC (rev 10674)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "http://labs.jboss.com/jbossrichfaces/component-config.dtd">
+<components>
+ <component>
+ <name>org.richfaces.Queue</name>
+ <family>org.richfaces.Queue</family>
+ <classname>org.richfaces.component.html.HtmlQueue</classname>
+ <superclass>javax.faces.component.UIComponentBase</superclass>
+ <description>
+ <![CDATA[The <rich:queue> tag.]]>
+ </description>
+ <tag generate="false" bodyContent="empty">
+ <name>queue</name>
+ <classname>org.ajax4jsf.taglib.html.jsp.QueueTag</classname>
+ <test/>
+ </tag>
+ <taghandler >
+ <classname>org.ajax4jsf.taglib.html.facelets.QueueHandler</classname>
+ </taghandler>
+ <property>
+ <name>name</name>
+ <classname>java.lang.String</classname>
+ <description>A name of this queue.</description>
+ </property>
+ <property >
+ <name>limitToList</name>
+ <classname>boolean</classname>
+ <description>If "true", updates on client side ONLY elements from this 'reRender' property. If "false" (default) updates all rendered by ajax region components</description>
+ </property>
+ <property >
+ <name>requestDelay</name>
+ <classname>int</classname>
+ <description>
+ Attribute defines the time (in ms.) that the request will be wait in the queue before it is ready to send.
+ When the delay time is over, the request will be sent to the server or removed if the newest 'similar' request is in a queue already
+ </description>
+ </property>
+ <property>
+ <name>ignoreDupResponses</name>
+ <classname>boolean</classname>
+ <description>
+ Attribute allows to ignore an Ajax Response produced by a request if the newest 'similar' request is
+ in a queue already. ignoreDupResponses="true" does not cancel the request while it is processed on the server,
+ but just allows to avoid unnecessary updates on the client side if the response isn't actual now
+ </description>
+ </property>
+ <property>
+ <name>timeout</name>
+ <classname>int</classname>
+ <description>Response waiting time on a particular request. If a response is not received during this time, the request is aborted</description>
+ </property>
+ </component>
+</components>
Added: trunk/sandbox/ui/queue/src/main/java/org/ajax4jsf/taglib/html/facelets/QueueHandler.java
===================================================================
--- trunk/sandbox/ui/queue/src/main/java/org/ajax4jsf/taglib/html/facelets/QueueHandler.java (rev 0)
+++ trunk/sandbox/ui/queue/src/main/java/org/ajax4jsf/taglib/html/facelets/QueueHandler.java 2008-10-06 18:13:47 UTC (rev 10674)
@@ -0,0 +1,73 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf.taglib.html.facelets;
+
+import java.io.IOException;
+
+import javax.el.ELException;
+import javax.faces.FacesException;
+import javax.faces.component.UIComponent;
+
+import org.ajax4jsf.model.QueueImpl;
+
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.FaceletException;
+import com.sun.facelets.tag.TagAttribute;
+import com.sun.facelets.tag.TagConfig;
+import com.sun.facelets.tag.TagHandler;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class QueueHandler extends TagHandler {
+
+ private final TagAttribute name;
+
+ private final TagAttribute requestDelay;
+
+ private final TagAttribute timeout;
+
+ private final TagAttribute ignoreDupResponses;
+
+ private final TagAttribute limitToList;
+
+ public QueueHandler(TagConfig config) {
+ super(config);
+ name = getAttribute("name");
+ requestDelay = getAttribute("requestDelay");
+ timeout = getAttribute("timeout");
+ ignoreDupResponses = getAttribute("ignoreDupResponses");
+ limitToList = getAttribute("limitToList");
+ }
+
+ public void apply(FaceletContext ctx, UIComponent parent)
+ throws IOException, FacesException, FaceletException, ELException {
+ QueueImpl queue = new QueueImpl();
+ queue.setIgnoreDupResponsesExpression(ignoreDupResponses.getValueExpression(ctx, Boolean.class));
+ queue.setLimitToListExpression(limitToList.getValueExpression(ctx, Boolean.class));
+ queue.setNameExpression(name.getValueExpression(ctx, String.class));
+ queue.setRequestDelayExpression(requestDelay.getValueExpression(ctx, Integer.class));
+ queue.setTimeoutExpression(timeout.getValueExpression(ctx, Integer.class));
+ }
+
+}
Added: trunk/sandbox/ui/queue/src/main/java/org/ajax4jsf/taglib/html/jsp/QueueTag.java
===================================================================
--- trunk/sandbox/ui/queue/src/main/java/org/ajax4jsf/taglib/html/jsp/QueueTag.java (rev 0)
+++ trunk/sandbox/ui/queue/src/main/java/org/ajax4jsf/taglib/html/jsp/QueueTag.java 2008-10-06 18:13:47 UTC (rev 10674)
@@ -0,0 +1,73 @@
+package org.ajax4jsf.taglib.html.jsp;
+
+import javax.el.ValueExpression;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.Tag;
+import javax.servlet.jsp.tagext.TagSupport;
+
+import org.ajax4jsf.model.QueueImpl;
+import org.ajax4jsf.model.QueuesManager;
+
+/**
+ * @author Konstantin Mishin
+ *
+ */
+public class QueueTag extends TagSupport {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2597802287523562588L;
+
+ private ValueExpression name;
+
+ private ValueExpression requestDelay;
+
+ private ValueExpression timeout;
+
+ private ValueExpression ignoreDupResponses;
+
+ private ValueExpression limitToList;
+
+ public int doStartTag() throws JspException {
+ QueueImpl queue = new QueueImpl();
+ queue.setIgnoreDupResponsesExpression(ignoreDupResponses);
+ queue.setLimitToListExpression(limitToList);
+ queue.setNameExpression(name);
+ queue.setRequestDelayExpression(requestDelay);
+ queue.setTimeoutExpression(timeout);
+
+ QueuesManager.put(queue);
+
+ return Tag.SKIP_BODY;
+ }
+
+ public void release() {
+ name = null;
+ requestDelay = null;
+ timeout = null;
+ ignoreDupResponses = null;
+ limitToList = null;
+ super.release();
+ }
+
+ public void setName(ValueExpression name) {
+ this.name = name;
+ }
+
+ public void setRequestDelay(ValueExpression requestDelay) {
+ this.requestDelay = requestDelay;
+ }
+
+ public void setTimeout(ValueExpression timeout) {
+ this.timeout = timeout;
+ }
+
+ public void setIgnoreDupResponses(ValueExpression ignoreDupResponses) {
+ this.ignoreDupResponses = ignoreDupResponses;
+ }
+
+ public void setLimitToList(ValueExpression limitToList) {
+ this.limitToList = limitToList;
+ }
+}
16 years, 1 month
JBoss Rich Faces SVN: r10673 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/panelMenu and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-10-06 13:25:49 -0400 (Mon, 06 Oct 2008)
New Revision: 10673
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenu/panelMenuTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuTest.java
Log:
PanelMenu: expandMode and mode apply to all nested components if not overriden
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java 2008-10-06 16:30:08 UTC (rev 10672)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java 2008-10-06 17:25:49 UTC (rev 10673)
@@ -24,75 +24,101 @@
import javax.faces.event.ActionEvent;
public class RichPanelTestBean {
- private String value;
- private int value2;
- private Object panelValue;
- private Object panelValue2;
-
- public RichPanelTestBean() {
- value = "";
- value2 = 0;
- }
+ private String value;
- public String getValue() {
- return value;
- }
+ private int value2;
- public void setValue(String value) {
- this.value = value;
- }
-
- public void actionListener(ActionEvent event) {
- this.value = event.getComponent().getId();
- }
-
- public String action1() {
- this.value2 = 1;
- return null;
- }
-
- public String action2() {
- this.value2 = 2;
- return null;
- }
-
- public String increment() {
- if (4 == this.value2) {
- this.value2 = 0;
- }
- this.value2++;
- return null;
- }
+ private Object panelValue;
- public int getValue2() {
- return value2;
- }
+ private Object panelValue2;
- public void setValue2(int value2) {
- this.value2 = value2;
- }
-
- public Object getPanelValue() {
- return panelValue;
- }
+ private String itemAction;
- public void setPanelValue(Object panelValue) {
- this.panelValue = panelValue;
- }
+ public RichPanelTestBean() {
+ value = "";
+ value2 = 0;
+ }
- public void cleanValues(ActionEvent event) {
- value = "";
- value2 = 0;
- panelValue = null;
- panelValue2 = null;
- }
+ public String getValue() {
+ return value;
+ }
- public Object getPanelValue2() {
- return panelValue2;
- }
+ public void setValue(String value) {
+ this.value = value;
+ }
- public void setPanelValue2(Object panelValue2) {
- this.panelValue2 = panelValue2;
- }
+ public int getValue2() {
+ return value2;
+ }
+ public void setValue2(int value2) {
+ this.value2 = value2;
+ }
+
+ public Object getPanelValue() {
+ return panelValue;
+ }
+
+ public void setPanelValue(Object panelValue) {
+ this.panelValue = panelValue;
+ }
+
+ public Object getPanelValue2() {
+ return panelValue2;
+ }
+
+ public void setPanelValue2(Object panelValue2) {
+ this.panelValue2 = panelValue2;
+ }
+
+ /**
+ * Gets value of itemAction field.
+ *
+ * @return value of itemAction field
+ */
+ public String getItemAction() {
+ return itemAction;
+ }
+
+ /**
+ * Set a new value for itemAction field.
+ *
+ * @param itemAction
+ * a new value for itemAction field
+ */
+ public void setItemAction(String itemAction) {
+ this.itemAction = itemAction;
+ }
+
+ public void actionListener(ActionEvent event) {
+ this.value = event.getComponent().getId();
+ }
+
+ public void itemActionServer() {
+ setItemAction("server");
+ }
+
+ public void itemActionAjax() {
+ setItemAction("ajax");
+ }
+
+ public void itemActionNone() {
+ setItemAction("NOT none");
+ }
+
+ public String increment() {
+ if (4 == this.value2) {
+ this.value2 = 0;
+ }
+ this.value2++;
+ return null;
+ }
+
+ public void cleanValues() {
+ value = "";
+ value2 = 0;
+ panelValue = null;
+ panelValue2 = null;
+ itemAction = "";
+ }
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/panelMenu/panelMenuTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuTest.java 2008-10-06 16:30:08 UTC (rev 10672)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/PanelMenuTest.java 2008-10-06 17:25:49 UTC (rev 10673)
@@ -7,9 +7,11 @@
public class PanelMenuTest extends SeleniumTestBase {
+ private final static String RESET_METHOD_NAME = "#{panelBean.cleanValues}";
+
@Test
public void testPanelMenuClientAPI(Template template) {
- renderPage(template);
+ renderPage(template, RESET_METHOD_NAME);
String form1 = getParentId() + "_form1:";
String form2 = getParentId() + "_form2:";
@@ -48,13 +50,12 @@
Assert.assertFalse(isVisibleById(ajaxItem));
Assert.assertFalse(isVisibleById(serverItem));
Assert.assertFalse(isVisibleById(clientItem));
-
- tearDown();
}
@Test
public void testPanelMenuComponent(Template template) {
- renderPage(template);
+ renderPage(template, RESET_METHOD_NAME);
+
String parentId = getParentId() + "_form1:";
String value1Id = getParentId() + "_value";
@@ -120,13 +121,12 @@
writeStatus("Click on disabled client group");
clickById(disabledGroup);
Assert.assertFalse(isVisibleById(disabledItem));
-
- tearDown();
}
@Test
public void testPanelMenuComponentSingleMode(Template template) {
- renderPage(template);
+ renderPage(template, RESET_METHOD_NAME);
+
String parentId = getParentId() + "_form2:";
String value1Id = getParentId() + "_value";
@@ -191,55 +191,67 @@
writeStatus("Click on disabled client group");
clickById(disabledGroup);
Assert.assertFalse(isVisibleById(disabledItem));
-
- tearDown();
}
@Test
- public void testPanelMenuItemAction(Template template) {
- renderPage(template);
+ public void testPanelMenuItemActionAndSubmitModeInheritance(Template template) {
+ renderPage(template, RESET_METHOD_NAME);
+
String parentId = getParentId() + "_form";
+ String itemAction = getParentId() + "_itemAction";
- String value1Id = getParentId() + "_value";
- String value2Id = getParentId() + "_value2";
+ writeStatus("Test panel menu with ajax submission mode.");
+ writeStatus("Click on ajax group");
- String group = "tablehide" + parentId + "1:pGroup1";
- String groupSingle = "tablehide" + parentId + "2:pGroup1_single";
+ clickAjaxCommandAndWait("tablehide" + parentId + "1:pGroup1");
- String item = "tablehide" + parentId + "1:pItem1";
- String itemSingle = "tablehide" + parentId + "2:pItem1_single";
+ writeStatus("Click on expanded server action item");
+ clickCommandAndWait("tablehide" + parentId + "1:pItem1");
+ AssertTextEquals(itemAction, "server", "Server mode action is not triggered");
- writeStatus("Click on ajax group");
- clickById(group);
- waitForAjaxCompletion();
- AssertTextEquals(value1Id, "pGroup1");
+ writeStatus("Click on server group");
+ clickCommandAndWait("tablehide" + parentId + "1:pGroup2");
+
+ writeStatus("Click on expanded ajax action item");
+ clickAjaxCommandAndWait("tablehide" + parentId + "1:pItem2");
+ AssertTextEquals(itemAction, "ajax", "Ajax mode action is not triggered");
+
+ writeStatus("Click on client group");
+
+ clickById("tablehide" + parentId + "1:pGroup3");
+
+ writeStatus("Click on expanded none action item");
+ clickById("tablehide" + parentId + "1:pItem3");
+ AssertTextNotEquals(itemAction, "NOT none", "Nothing is going to happen");
+
+ writeStatus("Test panel menu with default(server) submission mode.");
writeStatus("Click on ajax group");
- clickById(groupSingle);
- waitForAjaxCompletion();
- AssertTextEquals(value1Id, "pGroup1_single");
- writeStatus("Click on server group");
- clickCommandAndWait(item);
- AssertTextEquals(value1Id, "pItem1");
- AssertTextEquals(value2Id, "1");
+ clickAjaxCommandAndWait("tablehide" + parentId + "2:pGroup1_single");
+ writeStatus("Click on expanded server action item");
+ clickCommandAndWait("tablehide" + parentId + "2:pItem1_single");
+ AssertTextEquals(itemAction, "server", "Server mode action is not triggered");
+
writeStatus("Click on server group");
- clickCommandAndWait(itemSingle);
- AssertTextEquals(value1Id, "pItem1_single");
- AssertTextEquals(value2Id, "2");
- tearDown();
+ clickCommandAndWait("tablehide" + parentId + "2:pGroup2_single");
+
+ writeStatus("Click on expanded ajax action item");
+ clickAjaxCommandAndWait("tablehide" + parentId + "2:pItem2_single");
+ AssertTextEquals(itemAction, "ajax", "Ajax mode action is not triggered");
+
+ writeStatus("Click on client group");
+
+ clickById("tablehide" + parentId + "2:pGroup3_single");
+
+ writeStatus("Click on expanded none action item");
+ clickById("tablehide" + parentId + "2:pItem3_single");
+ AssertTextNotEquals(itemAction, "NOT none", "Nothing is going to happen");
}
public String getTestUrl() {
return "pages/panelMenu/panelMenuTest.xhtml";
}
-
- private void tearDown() {
- writeStatus("Clean bean values");
- clickById(getParentId() + "_form2:clean");
- waitForAjaxCompletion();
- }
-
}
16 years, 1 month
JBoss Rich Faces SVN: r10672 - trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-10-06 12:30:08 -0400 (Mon, 06 Oct 2008)
New Revision: 10672
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
Log:
Remove import
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-10-06 13:32:43 UTC (rev 10671)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-10-06 16:30:08 UTC (rev 10672)
@@ -28,7 +28,6 @@
import org.ajax4jsf.bean.Configurator;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.template.Template;
-import org.apache.tools.ant.types.FilterSet.OnMissing;
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
import org.testng.Assert;
16 years, 1 month
JBoss Rich Faces SVN: r10671 - trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-10-06 09:32:43 -0400 (Mon, 06 Oct 2008)
New Revision: 10671
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxSupportTest.java
Log:
a4j support tests
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxSupportTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxSupportTest.java 2008-10-06 12:27:20 UTC (rev 10670)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxSupportTest.java 2008-10-06 13:32:43 UTC (rev 10671)
@@ -34,7 +34,7 @@
*/
@Test
public void testAjaxSupportComponent(Template template) {
- //checkBasicFunctionality(template);
+ checkBasicFunctionality(template);
}
/**
@@ -68,13 +68,14 @@
private void checkBasicFunctionality(Template template) {
init(template);
- checkCommandComponent();
String data = checkInputComponent();
checkRequestDelayAttribute(data);
+ checkCommandComponent();
}
private void checkCommandComponent() {
- /*clickById(linkId);
+ setValueById(validManagerId, "1");
+ clickById(linkId);
waitForAjaxCompletion();
String data = getTextById(dataId);
checkMessage(data, A4JSupport.Messages.FOR_LINK,
@@ -86,10 +87,11 @@
data = getTextById(dataId);
checkMessage(data, A4JSupport.Messages.FOR_LINK,
"'onclick' ajax support for link[id='_form:linkAL'] failed.",
- A4JSupport.Messages.FOR_LINK + " successful");*/
+ A4JSupport.Messages.FOR_LINK + " successful");
}
private String checkInputComponent() {
+ setValueById(validManagerId, "1");
String checkBoxId = parentFormId + "checkbox";
clickById(checkBoxId);
@@ -109,6 +111,7 @@
}
private void checkRequestDelayAttribute(String data) {
+ setValueById(validManagerId, "1");
String command = parentFormId + "command";
clickById(command);
16 years, 1 month
JBoss Rich Faces SVN: r10670 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-10-06 08:27:20 -0400 (Mon, 06 Oct 2008)
New Revision: 10670
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/dataScroller.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataScrollerTest.java
Log:
Datascroller: test rendering and HTML attributes
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/dataScroller.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/dataScroller.xhtml 2008-10-06 12:20:08 UTC (rev 10669)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/dataScroller/dataScroller.xhtml 2008-10-06 12:27:20 UTC (rev 10670)
@@ -27,6 +27,12 @@
align="left"
maxPages="#{dataScrollerBean.maxPages}"
page="#{dataScrollerBean.page}"
+ onclick="EventQueue.fire('onclick')"
+ onmousedown="EventQueue.fire('onmousedown')"
+ onmousemove="EventQueue.fire('onmousemove')"
+ onmouseout="EventQueue.fire('onmouseout')"
+ onmouseover="EventQueue.fire('onmouseover')"
+ onmouseup="EventQueue.fire('onmouseup')"
/>
<br/><br/>
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataScrollerTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataScrollerTest.java 2008-10-06 12:20:08 UTC (rev 10669)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DataScrollerTest.java 2008-10-06 12:27:20 UTC (rev 10670)
@@ -6,7 +6,13 @@
package org.richfaces.testng;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
import org.ajax4jsf.template.Template;
+import org.richfaces.SeleniumEvent;
import org.richfaces.SeleniumTestBase;
import org.testng.Assert;
import org.testng.annotations.Test;
@@ -24,17 +30,41 @@
String dataTableId;
+
@Test
public void testDataScroller(Template template) {
renderPage(template);
String parentId = getParentId();
dataScrollerId = parentId + "_data:scroller";
dataScrollerTableId = parentId + "_data:scroller_table";
+
+ //FIXME: currently dataTableId is invalid (dataTableId + ':0'). May be it's cause of problem with component state storing inside dataTable.
dataTableId = (!template.getName().equals(Template.DATA_TABLE.getName())) ? parentId + "_data:tbl" : parentId + "_data:tbl:0";
testRendering();
+ testHTMLEvent(dataScrollerId);
}
+ private void testHTMLEvent(String id) {
+ List<String> event = new ArrayList<String>();
+ event.add("onclick");
+ event.add("onmousedown");
+ event.add("onmousemove");
+ event.add("onmouseout");
+ event.add("onmouseover");
+ event.add("onmouseup");
+
+ clickById(id);
+ selenium.mouseDown(id);
+ selenium.mouseMove(id);
+ selenium.mouseOut(id);
+ selenium.mouseOver(id);
+ selenium.mouseUp(id);
+
+ assertEvents(event);
+
+ }
+
private void testRendering() {
assertClassNames(dataScrollerId,new String []
{"dr-dscr",
16 years, 1 month
JBoss Rich Faces SVN: r10669 - trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/_autotest.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-10-06 08:20:08 -0400 (Mon, 06 Oct 2008)
New Revision: 10669
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/_autotest/autotestsetup.xhtml
Log:
autotest
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/_autotest/autotestsetup.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/_autotest/autotestsetup.xhtml 2008-10-06 11:41:40 UTC (rev 10668)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/_autotest/autotestsetup.xhtml 2008-10-06 12:20:08 UTC (rev 10669)
@@ -14,6 +14,23 @@
d.appendChild(i);
}
+ function addAttribute(name, value) {
+ var d = $('attrs_name');
+ var i = document.createElement('input');
+ i.name = "at_name";
+ i.type="hidden";
+ i.value = name;
+ d.appendChild(i);
+
+ d = $('attrs_value');
+ i = document.createElement('input');
+ i.name = "at_value";
+ i.type="hidden";
+ i.value = value;
+ d.appendChild(i);
+
+ }
+
function $(id) {
return document.getElementById(id);
}
@@ -27,6 +44,8 @@
<form id="f" method="post" action="#{facesContext.externalContext.request.contextPath}/autotest/test">
<input id="c" type="hidden" name="c" value="" />
<div id="events" />
+<div id="attrs_name" />
+<div id="attrs_value" />
</form>
Loading...
</body>
16 years, 1 month
JBoss Rich Faces SVN: r10668 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: andrei_exadel
Date: 2008-10-06 07:41:40 -0400 (Mon, 06 Oct 2008)
New Revision: 10668
Added:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumEvent.java
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/AutoTestContext.java
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/AutoTestServlet.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
Log:
AutoTest refactoring
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/AutoTestContext.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/AutoTestContext.java 2008-10-03 19:09:01 UTC (rev 10667)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/AutoTestContext.java 2008-10-06 11:41:40 UTC (rev 10668)
@@ -1,7 +1,9 @@
package org.ajax4jsf.autotest;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
public class AutoTestContext {
@@ -9,6 +11,8 @@
List<String> events = new ArrayList<String>();
+ Map<String, String> attributes = new HashMap<String, String>();
+
String rendered;
public AutoTestContext(String component) {
@@ -18,6 +22,10 @@
public void addEvent(String ev) {
events.add(ev);
}
+
+ public void addAttribute(String name, String value) {
+ attributes.put(name, value);
+ }
/**
* @return the component
@@ -32,6 +40,10 @@
public List<String> getEvents() {
return events;
}
+
+ public Map<String, String> getAttributes() {
+ return attributes;
+ }
/**
* @return the rendered
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/AutoTestServlet.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/AutoTestServlet.java 2008-10-03 19:09:01 UTC (rev 10667)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/autotest/AutoTestServlet.java 2008-10-06 11:41:40 UTC (rev 10668)
@@ -25,6 +25,10 @@
private static final String EVENT_PARAMETER_NAME = "ev";
+ private static final String ATTRIBUTE_PARAMETER_NAME = "at_name";
+
+ private static final String ATTRIBUTE_PARAMETER_VALUE = "at_value";
+
private static final String CONTEXT_NAME = "SeleniumAutoTestContext";
String header = "<html xmlns=\"http://www.w3.org/1999/xhtml\" " +
@@ -54,6 +58,11 @@
writer.write(ev + "=\"EventQueue.fire('"+ev+"')\" ");
}
+ for (String attribute : context.getAttributes().keySet()) {
+ writer.write(attribute + "=\"" + context.getAttributes().get(attribute)+"\" ");
+ }
+
+
writer.write(">");
writer.write("</" + context.getComponent() + ">");
@@ -65,12 +74,19 @@
throws ServletException, IOException {
String component = req.getParameter(COMPONENT_PARAMETER_NAME);
String [] events = req.getParameterValues(EVENT_PARAMETER_NAME);
+ String [] attributes_name = req.getParameterValues(ATTRIBUTE_PARAMETER_NAME);
+ String [] attributes_value = req.getParameterValues(ATTRIBUTE_PARAMETER_VALUE);
+
AutoTestContext context = new AutoTestContext(component);
for (String event: events) {
context.addEvent(event);
}
+ for (int i = 0; i < attributes_name.length; i++) {
+ context.addAttribute(attributes_name[i], attributes_value[i]);
+ }
+
getServletContext().setAttribute(CONTEXT_NAME, context);
resp.sendRedirect("/richfaces/faces/NEKO/pages/_autotest/autotest.xhtml");
Added: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumEvent.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumEvent.java (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumEvent.java 2008-10-06 11:41:40 UTC (rev 10668)
@@ -0,0 +1,27 @@
+package org.richfaces;
+
+public enum SeleniumEvent {
+
+ ONCLICK("onclick"),
+ ONDBCLICK("ondbclick"),
+ ONMOUSEOVER("onmouseover"),
+ ONMOUSEMOVE("onmousemove"),
+ ONMOUSEOUT("onmouseout"),
+ ONMOUSEDOWN("onmousedown"),
+ ONMOUSEUP("onmouseup"),
+ ONDRAGANDDROP("ondraganddrop"),
+ ONKEYDOWN("onkeydown"),
+ ONKEYUP("onkeyup"),
+ ONKEYPRESS("onkeypress");
+
+ private String name;
+
+ private SeleniumEvent(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+}
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-10-03 19:09:01 UTC (rev 10667)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/SeleniumTestBase.java 2008-10-06 11:41:40 UTC (rev 10668)
@@ -23,10 +23,12 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import org.ajax4jsf.bean.Configurator;
import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.template.Template;
+import org.apache.tools.ant.types.FilterSet.OnMissing;
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
import org.testng.Assert;
@@ -982,16 +984,29 @@
}
}
- public void autoTest(Template template, String component, List<String> events) {
+ public void autoTest(Template template, String component, List<SeleniumEvent> events, Map<String , String> attributes) {
selenium.open(protocol + "://" + host + ":" + port + "/" + APPLICATION_NAME + filterPrefix + "/pages/_autotest/autotestsetup.xhtml");
waitForPageToLoad();
runScript("setComponent('"+component+"');", false);
- for (String ev : events) {
- runScript("addEvent('"+ev+"');", false);
+ List<String> assertevent = new ArrayList<String>();
+
+ for (SeleniumEvent ev : events) {
+ if (ev != SeleniumEvent.ONDRAGANDDROP) {
+ runScript("addEvent('"+ev.getName()+"');", false);
+ assertevent.add(ev.getName());
+ }else {
+ runScript("addEvent('ondrag');addEvent('ondrop');", false);
+ assertevent.add("ondrag");
+ assertevent.add("ondrop");
+ }
}
+ for (String attr : attributes.keySet()) {
+ runScript("addAttribute('"+attr+"', '"+attributes.get(attr)+"');", false);
+ }
+
runScript("submitForm();", false);
waitForPageToLoad();
@@ -999,13 +1014,31 @@
waitForPageToLoad();
String id = template.getPrefix() + "test";
- for (String ev : events) {
- if ("onclick".equals(ev)) {
+ for (SeleniumEvent ev : events) {
+ if (ev == SeleniumEvent.ONCLICK) {
clickById(id);
+ }else if (ev == SeleniumEvent.ONDBCLICK) {
+ selenium.doubleClick(id);
+ } else if (ev == SeleniumEvent.ONMOUSEDOWN) {
+ selenium.mouseDown(id);
+ }else if (ev == SeleniumEvent.ONMOUSEMOVE) {
+ selenium.mouseMove(id);
+ }else if (ev == SeleniumEvent.ONMOUSEUP) {
+ selenium.mouseUp(id);
+ }else if (ev == SeleniumEvent.ONMOUSEOVER) {
+ selenium.mouseOver(id);
+ }else if (ev == SeleniumEvent.ONMOUSEOUT) {
+ selenium.mouseOut(id);
+ }else if (ev == SeleniumEvent.ONKEYDOWN) {
+ selenium.keyDown(id, "a");
+ }else if (ev == SeleniumEvent.ONKEYUP) {
+ selenium.keyUp(id, "a");
+ }else if (ev == SeleniumEvent.ONKEYPRESS) {
+ selenium.keyPress(id, "a");
}
}
- assertEvents(events);
+ assertEvents(assertevent);
}
}
16 years, 1 month
JBoss Rich Faces SVN: r10667 - in trunk/test-applications/seleniumTest/richfaces/src: main/java/org/ajax4jsf/bean and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-10-03 15:09:01 -0400 (Fri, 03 Oct 2008)
New Revision: 10667
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/listener/
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/listener/AjaxSupportActionListener.java
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/util/
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/util/FacesUtils.java
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/A4JSupport.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxSupport/ajaxSupport.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxSupportTest.java
Log:
tests for a4j:support
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/A4JSupport.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/A4JSupport.java 2008-10-03 16:40:37 UTC (rev 10666)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/A4JSupport.java 2008-10-03 19:09:01 UTC (rev 10667)
@@ -6,6 +6,8 @@
private String data = null;
+ public static final String BEAN_NAME = "ajaxSupport";
+
public static class Messages {
public static final String FOR_LINK = "Link onclick passed";
@@ -16,6 +18,8 @@
public static final String FOR_SUBMIT = "Default listener";
public static final String NO_DATA = "nodata";
+
+ public static final String VALID_MESSAGE = "field is required";
}
public void linkListener (ActionEvent event) {
Added: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/listener/AjaxSupportActionListener.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/listener/AjaxSupportActionListener.java (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/listener/AjaxSupportActionListener.java 2008-10-03 19:09:01 UTC (rev 10667)
@@ -0,0 +1,28 @@
+package org.ajax4jsf.listener;
+
+import javax.faces.event.ActionEvent;
+import javax.faces.event.ActionListener;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.event.ValueChangeListener;
+
+import org.ajax4jsf.bean.A4JSupport;
+import org.ajax4jsf.bean.A4JSupport.Messages;
+import org.ajax4jsf.util.FacesUtils;
+
+public class AjaxSupportActionListener implements ActionListener, ValueChangeListener {
+
+ public void processAction(ActionEvent e) {
+ process(Messages.FOR_LINK);
+ }
+
+ public void processValueChange(ValueChangeEvent ce) {
+ process(Messages.FOR_CHECKBOX);
+ }
+
+ private void process(String str) {
+ A4JSupport bean = (A4JSupport) FacesUtils.getFacesBean(A4JSupport.BEAN_NAME);
+ if (bean != null) {
+ bean.setData(str);
+ }
+ }
+}
Added: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/util/FacesUtils.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/util/FacesUtils.java (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/util/FacesUtils.java 2008-10-03 19:09:01 UTC (rev 10667)
@@ -0,0 +1,13 @@
+package org.ajax4jsf.util;
+
+import javax.el.ELResolver;
+import javax.faces.context.FacesContext;
+
+public class FacesUtils {
+
+ public static Object getFacesBean(String beanName) {
+ FacesContext fcontext = FacesContext.getCurrentInstance();
+ ELResolver resolver = fcontext.getApplication().getELResolver();
+ return resolver.getValue(fcontext.getELContext(), null, beanName);
+ }
+}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxSupport/ajaxSupport.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxSupportTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxSupportTest.java 2008-10-03 16:40:37 UTC (rev 10666)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxSupportTest.java 2008-10-03 19:09:01 UTC (rev 10667)
@@ -15,30 +15,103 @@
*/
public class AjaxSupportTest extends SeleniumTestBase {
+ private static final String ALISTENER_PREFIX = "AL";
+
+ private String parentFormId;
+
+ private String linkId;
+
+ private String validManagerId;
+
+ private String messageId;
+
+ private String dataId;
+
+ /**
+ * 1.action and actionListener defined as component attributes and actionListener
+ * defined as nested tag are invoked on the server after event of attached
+ * to component occurs, navigation occurs
+ */
@Test
public void testAjaxSupportComponent(Template template) {
- renderPage(template);
- String parentId = getParentId() + "_form:";
+ //checkBasicFunctionality(template);
+ }
+
+ /**
+ * @see #testAjaxSupportComponent(Template template)
+ *
+ * the same for the case of external validation
+ * failure - listeners and navigation do not work
+ */
+ @Test
+ public void testValidationFailed(Template template) {
+ init(template);
+
+ setValueById(validManagerId, "");
+
+ clickById(linkId);
+ waitForAjaxCompletion();
+ String data = getTextById(dataId);
+ if (!A4JSupport.Messages.NO_DATA.equals(data)) {
+ Assert.fail();
+ }
+
+ clickById(linkId + ALISTENER_PREFIX);
+ waitForAjaxCompletion();
+ data = getTextById(dataId);
+ if (!A4JSupport.Messages.NO_DATA.equals(data)) {
+ Assert.fail();
+ }
+ }
+
+
+ private void checkBasicFunctionality(Template template) {
+ init(template);
- String dataId = parentId + "data";
- String linkId = parentId + "link";
- String checkBoxId = parentId + "checkbox";
- String command = parentId + "command";
+ checkCommandComponent();
+ String data = checkInputComponent();
+ checkRequestDelayAttribute(data);
+ }
+
+ private void checkCommandComponent() {
+ /*clickById(linkId);
+ waitForAjaxCompletion();
+ String data = getTextById(dataId);
+ checkMessage(data, A4JSupport.Messages.FOR_LINK,
+ "'onclick' ajax support for link[id='_form:link'] failed.",
+ A4JSupport.Messages.FOR_LINK + " successful");
- clickById(linkId);
+ clickById(linkId + ALISTENER_PREFIX);
+ waitForAjaxCompletion();
+ data = getTextById(dataId);
+ checkMessage(data, A4JSupport.Messages.FOR_LINK,
+ "'onclick' ajax support for link[id='_form:linkAL'] failed.",
+ A4JSupport.Messages.FOR_LINK + " successful");*/
+ }
+
+ private String checkInputComponent() {
+ String checkBoxId = parentFormId + "checkbox";
+
+ clickById(checkBoxId);
waitForAjaxCompletion();
String data = getTextById(dataId);
- checkMessage(data, A4JSupport.Messages.FOR_LINK, "'onclick' ajax support for link[id='_form:link'] failed.",
- A4JSupport.Messages.FOR_LINK + " successful");
-
- clickById(checkBoxId);
+ checkMessage(data, A4JSupport.Messages.FOR_CHECKBOX,
+ "'onchange' ajax support for checkbox[id='_form:checkbox'] failed.", A4JSupport.Messages.FOR_CHECKBOX
+ + " successful");
+
+ clickById(checkBoxId + ALISTENER_PREFIX);
waitForAjaxCompletion();
data = getTextById(dataId);
checkMessage(data, A4JSupport.Messages.FOR_CHECKBOX,
- "'onchange' ajax support for checkbox[id='_form:checkbox'] failed.", A4JSupport.Messages.FOR_CHECKBOX
+ "'onchange' ajax support for checkbox[id='_form:checkboxAL'] failed.", A4JSupport.Messages.FOR_CHECKBOX
+ " successful");
-
- clickById(command);
+ return data;
+ }
+
+ private void checkRequestDelayAttribute(String data) {
+ String command = parentFormId + "command";
+
+ clickById(command);
pause(1000, command);
if (!data.equals(getTextById(dataId))) {
writeStatus("<a4j:support failed. 'requestDelay' attribute does not work.");
@@ -54,9 +127,8 @@
writeStatus("<a4j:support failed. 'disableDefault' attribute does not work");
Assert.fail("<a4j:support failed. 'disableDefault' attribute does not work.");
}
-
}
-
+
private void checkMessage(String data, String message, String errorMessage, String okMessage) {
if (message.equals(data)) {
writeStatus(okMessage);
@@ -69,6 +141,19 @@
}
}
+ private void init(Template template) {
+ renderPage(template);
+ initIds();
+ }
+
+ private void initIds() {
+ parentFormId = getParentId() + "_form:";
+ linkId = parentFormId + "link";
+ validManagerId = parentFormId + "validManager";
+ messageId = getParentId() + "message";
+ dataId = parentFormId + "data";
+ }
+
@Override
public String getTestUrl() {
return "pages/ajaxSupport/ajaxSupport.xhtml";
16 years, 1 month
JBoss Rich Faces SVN: r10666 - in trunk/ui/calendar/src/main: resources/org/richfaces/renderkit/html/css and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2008-10-03 12:40:37 -0400 (Fri, 03 Oct 2008)
New Revision: 10666
Modified:
trunk/ui/calendar/src/main/config/component/calendar.xml
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
Log:
https://jira.jboss.org/jira/browse/RF-4001
also readonly attribute has been added
Modified: trunk/ui/calendar/src/main/config/component/calendar.xml
===================================================================
--- trunk/ui/calendar/src/main/config/component/calendar.xml 2008-10-03 15:55:25 UTC (rev 10665)
+++ trunk/ui/calendar/src/main/config/component/calendar.xml 2008-10-03 16:40:37 UTC (rev 10666)
@@ -151,6 +151,15 @@
<defaultvalue>false</defaultvalue>
</property>
<property>
+ <name>readonly</name>
+ <classname>boolean</classname>
+ <description>
+ If "true". Date and time are not selectable. In
+ "popup" mode input is disabled and button is enabled. Default value is "false".
+ </description>
+ <defaultvalue>false</defaultvalue>
+ </property>
+ <property>
<name>jointPoint</name>
<classname>java.lang.String</classname>
<description>
Modified: trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss
===================================================================
--- trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss 2008-10-03 15:55:25 UTC (rev 10665)
+++ trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss 2008-10-03 16:40:37 UTC (rev 10666)
@@ -228,6 +228,11 @@
<u:style name="white-space" value="nowrap"/>
</u:selector>
+ <u:selector name=".rich-calendar-tool-btn-disabled">
+ <u:style name="padding" value="2px 3px 2px 3px"/>
+ <u:style name="white-space" value="nowrap"/>
+ </u:selector>
+
<u:selector name=".rich-calendar-tool-btn-hover">
<u:style name="background-color" skin="calendarWeekBackgroundColor"/>
<u:style name="color" skin="generalTextColor"/>
Modified: trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
--- trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-10-03 15:55:25 UTC (rev 10665)
+++ trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-10-03 16:40:37 UTC (rev 10666)
@@ -570,6 +570,9 @@
// style - table style
// className - table class
+ // disabled
+ // readonly
+
//var _d = new Date();
this.id = id;
@@ -610,7 +613,6 @@
if (typeof this.params.boundaryDatesMode=="string") this.params.boundaryDatesMode = this.params.boundaryDatesMode.toLowerCase();
if (typeof this.params.todayControlMode=="string") this.todayControlMode = this.params.todayControlMode.toLowerCase();
- //
if (typeof this.params.isDayEnabled != "function") this.params.isDayEnabled = function (context) {return true;};
if (typeof this.params.dayStyleClass != "function") this.params.dayStyleClass = function (context) {return "";};
@@ -678,13 +680,7 @@
var htmlTextWeekDayBar='';
var context;
-// TODO (version 3.3.0): remove onmouse over/up/out/down css classes and onclick listeners if component disabled
-// var eventsStr = "";
-// if (!this.params.disabled) {
-// eventsStr = 'onclick="'+tempStr+'eventCellOnClick(event, this);" onmouseover="'+tempStr+'eventCellOnMouseOver(event, this);" onmouseout="'+tempStr+'eventCellOnMouseOut(event, this);"';
-// }
-
- var eventsStr = 'onclick="'+tempStr+'eventCellOnClick(event, this);" onmouseover="'+tempStr+'eventCellOnMouseOver(event, this);" onmouseout="'+tempStr+'eventCellOnMouseOut(event, this);"';
+ var eventsStr = this.params.disabled || this.params.readonly ? '' : 'onclick="'+tempStr+'eventCellOnClick(event, this);" onmouseover="'+tempStr+'eventCellOnMouseOver(event, this);" onmouseout="'+tempStr+'eventCellOnMouseOut(event, this);"';
if (this.params.showWeekDaysBar)
{
var htmlTextWeekDayBar = '<tr id="'+this.params.weekDayBarId+'">';
@@ -1654,7 +1650,7 @@
if (dataobj._month!=0)
{
classNames+=' rich-calendar-boundary-dates';
- if (boundaryDatesModeFlag)
+ if (!this.params.disabled && !this.params.readonly && boundaryDatesModeFlag)
{
classNames+=' rich-calendar-btn';
}
@@ -1674,7 +1670,7 @@
this.selectedDateCellColor = this.getCellBackgroundColor(element);
classNames+=" rich-calendar-select";
}
- else if (dataobj.enabled) classNames+=' rich-calendar-btn';
+ else if (!this.params.disabled && !this.params.readonly && dataobj.enabled) classNames+=' rich-calendar-btn';
// add custom style class
if (dataobj.customStyleClass)
@@ -1839,7 +1835,7 @@
}
// todayControl select mode
- if (this.todayControlMode=='select')
+ if (this.todayControlMode=='select' && !this.params.disabled && !this.params.readonly)
if (updateflag && !noUpdate && this.submitFunction)
{
this.afterLoad = this.selectToday;
@@ -1923,7 +1919,7 @@
// find cell and change style class
var e = $(this.DATE_ELEMENT_ID+(this.firstDateIndex + this.selectedDate.getDate()-1));
- this.clearEffect(this.selectedDateCellId, this.highlightEffect2, "rich-calendar-select", "rich-calendar-btn");
+ this.clearEffect(this.selectedDateCellId, this.highlightEffect2, "rich-calendar-select", (this.params.disabled || this.params.readonly ? null : "rich-calendar-btn"));
this.selectedDateCellId = e.id;
this.selectedDateCellColor = this.getCellBackgroundColor(e);
@@ -1947,7 +1943,7 @@
{
this.selectedDate = null;
- this.clearEffect(this.selectedDateCellId, this.highlightEffect2, "rich-calendar-select", "rich-calendar-btn");
+ this.clearEffect(this.selectedDateCellId, this.highlightEffect2, "rich-calendar-select", (this.params.disabled || this.params.readonly ? null : "rich-calendar-btn"));
if (this.selectedDateCellId)
{
@@ -1989,7 +1985,7 @@
this.selectedDate = null;
this.invokeEvent("dateselected", null, null, null);
- this.selectedDateCellId = this.clearEffect(this.selectedDateCellId, this.highlightEffect2, "rich-calendar-select", "rich-calendar-btn");
+ this.selectedDateCellId = this.clearEffect(this.selectedDateCellId, this.highlightEffect2, "rich-calendar-select", (this.params.disabled || this.params.readonly ? null : "rich-calendar-btn"));
this.renderHF();
if (!this.showApplyButton)
@@ -2143,9 +2139,7 @@
CalendarView.getControl = function(text, attributes, functionName, paramsStr) {
var attr = Object.extend({
onclick: (functionName ? "Richfaces.getComponent('calendar',this)."+functionName+"("+(paramsStr ? paramsStr : "")+");" : "")+"return true;",
- className: "rich-calendar-btn"
}, attributes);
-
return new E('div',attr,[new T(text)]);
};
@@ -2154,13 +2148,10 @@
if (!calendar.selectedDate || calendar.showApplyButton) return "";
var text = Richfaces.Calendar.formatDate(calendar.selectedDate,(calendar.timeType ? calendar.datePattern : calendar.params.datePattern), calendar.params.monthLabels, calendar.params.monthLabelsShort);
-// TODO: version: 3.3.0
-// var onclick ="";
-// if(!calendar.params.disabled) {
-// onclick = "Richfaces.getComponent('calendar',this).showSelectedDate(); return true;"
-// }
var onclick = "Richfaces.getComponent('calendar',this).showSelectedDate(); return true;"
- var markup = new E('div', {'class': 'rich-calendar-tool-btn', 'onclick': onclick}, [new ET(text)]);
+ var markup = ( calendar.params.disabled ?
+ new E('div', {'class': 'rich-calendar-tool-btn-disabled'}, [new ET(text)]) :
+ new E('div', {'class': 'rich-calendar-tool-btn', 'onclick': onclick}, [new ET(text)]) );
return markup;
};
@@ -2170,17 +2161,13 @@
if (!calendar.selectedDate || !calendar.timeType) return "";
var text = Richfaces.Calendar.formatDate(calendar.selectedDate, calendar.timePattern, calendar.params.monthLabels, calendar.params.monthLabelsShort);
-
+
var onmouseover = "Element.removeClassName(this, 'rich-calendar-tool-btn-press');";
var onmouseout = "Element.addClassName(this, 'rich-calendar-tool-btn-press');";
var onclick = "Richfaces.getComponent('calendar',this).showTimeEditor();return true;";
-// TODO: version: 3.3.0
-// if(!calendar.params.disabled) {
-// onmouseover = "Element.removeClassName(this, 'rich-calendar-tool-btn-press');";
-// onmouseout = "Element.addClassName(this, 'rich-calendar-tool-btn-press');";
-// onclick = "Richfaces.getComponent('calendar',this).showTimeEditor();return true;";
-// }
- var markup = new E('div', {'class': 'rich-calendar-tool-btn rich-calendar-tool-btn-hover rich-calendar-tool-btn-press', 'onclick': onclick,
+ var markup = calendar.params.disabled || calendar.params.readonly ?
+ new E('div', {'class': 'rich-calendar-tool-btn-disabled'}, [new ET(text)]) :
+ new E('div', {'class': 'rich-calendar-tool-btn rich-calendar-tool-btn-hover rich-calendar-tool-btn-press', 'onclick': onclick,
'onmouseover': + onmouseover ,
'onmouseout' : + onmouseout}, [new ET(text)]);
@@ -2188,48 +2175,36 @@
};
CalendarView.toolButtonAttributes = {className: "rich-calendar-tool-btn", onmouseover:"this.className='rich-calendar-tool-btn rich-calendar-tool-btn-hover'", onmouseout:"this.className='rich-calendar-tool-btn'", onmousedown:"this.className='rich-calendar-tool-btn rich-calendar-tool-btn-hover rich-calendar-tool-btn-press'", onmouseup:"this.className='rich-calendar-tool-btn rich-calendar-tool-btn-hover'"};
-CalendarView.nextYearControl = CalendarView.getControl(">>", CalendarView.toolButtonAttributes, "nextYear");
-CalendarView.previousYearControl = CalendarView.getControl("<<", CalendarView.toolButtonAttributes, "prevYear");
-CalendarView.nextMonthControl = CalendarView.getControl(">", CalendarView.toolButtonAttributes, "nextMonth");
-CalendarView.previousMonthControl = CalendarView.getControl("<", CalendarView.toolButtonAttributes, "prevMonth");
-//TODO: version: 3.3.0
-//CalendarView.clearAttributesIfDisabled = function (calendar, attributes){
-// var disabled = calendar.params.disabled;
-// if (disabled && attributes) {
-// attributes.onmouseup = "";
-// attributes.onmousedown = "";
-// attributes.onmouseover = "";
-// attributes.onmouseout = "";
-// attributes.onclick = "";
-// }
-// return attributes;
-//}
-
+CalendarView.nextYearControl = function (context) {
+ return (!context.calendar.params.disabled ? CalendarView.getControl(">>", CalendarView.toolButtonAttributes, "nextYear") : "");
+};
+CalendarView.previousYearControl = function (context) {
+ return (!context.calendar.params.disabled ? CalendarView.getControl("<<", CalendarView.toolButtonAttributes, "prevYear") : "");
+};
+CalendarView.nextMonthControl = function (context) {
+ return (!context.calendar.params.disabled ? CalendarView.getControl(">", CalendarView.toolButtonAttributes, "nextMonth") : "");
+};
+CalendarView.previousMonthControl = function (context) {
+ return (!context.calendar.params.disabled ? CalendarView.getControl("<", CalendarView.toolButtonAttributes, "prevMonth") : "");
+};
CalendarView.currentMonthControl = function (context) {
-// TODO: version: 3.3.0
-// var attributes = CalendarView.clearAttributesIfDisabled(context.calendar,CalendarView.toolButtonAttributes);
- return CalendarView.getControl(Richfaces.Calendar.formatDate(context.calendar.getCurrentDate(), "MMMM, yyyy", context.monthLabels, context.monthLabelsShort), CalendarView.toolButtonAttributes, "showDateEditor");
+ var text = Richfaces.Calendar.formatDate(context.calendar.getCurrentDate(), "MMMM, yyyy", context.monthLabels, context.monthLabelsShort);
+ var markup = context.calendar.params.disabled ?
+ new E('div',{className: "rich-calendar-tool-btn-disabled"},[new T(text)]) :
+ CalendarView.getControl(text, CalendarView.toolButtonAttributes, "showDateEditor");
+ return markup;
};
CalendarView.todayControl = function (context) {
-// TODO: version: 3.3.0
-// var attributes = CalendarView.clearAttributesIfDisabled(context.calendar,CalendarView.toolButtonAttributes);
- return (context.calendar.todayControlMode!='hidden' ? CalendarView.getControl(context.controlLabels.today, CalendarView.toolButtonAttributes, "today") : "");
+ return (!context.calendar.params.disabled && context.calendar.todayControlMode!='hidden' ? CalendarView.getControl(context.controlLabels.today, CalendarView.toolButtonAttributes, "today") : "");
};
-
CalendarView.closeControl = function (context) {
-// TODO: version: 3.3.0
-// var attributes = CalendarView.clearAttributesIfDisabled(context.calendar,CalendarView.toolButtonAttributes);
return (context.calendar.params.popup ? CalendarView.getControl(context.controlLabels.close, CalendarView.toolButtonAttributes, "close", "false") : "");
};
CalendarView.applyControl = function (context) {
-// TODO: version: 3.3.0
-// var attributes = CalendarView.clearAttributesIfDisabled(context.calendar,CalendarView.toolButtonAttributes);
- return (context.calendar.showApplyButton ? CalendarView.getControl(context.controlLabels.apply, CalendarView.toolButtonAttributes, "close", "true") : "");
+ return (!context.calendar.params.disabled && !context.calendar.params.readonly && context.calendar.showApplyButton ? CalendarView.getControl(context.controlLabels.apply, CalendarView.toolButtonAttributes, "close", "true") : "");
};
CalendarView.cleanControl = function (context) {
-// TODO: version: 3.3.0
-// var attributes = CalendarView.clearAttributesIfDisabled(context.calendar,CalendarView.toolButtonAttributes);
- return (context.calendar.selectedDate ? CalendarView.getControl(context.controlLabels.clean, CalendarView.toolButtonAttributes, "resetSelectedDate") : "");
+ return (!context.calendar.params.disabled && !context.calendar.params.readonly && context.calendar.selectedDate ? CalendarView.getControl(context.controlLabels.clean, CalendarView.toolButtonAttributes, "resetSelectedDate") : "");
};
CalendarView.selectedDateControl = function (context) { return CalendarView.getSelectedDateControl(context.calendar);};
@@ -2291,8 +2266,8 @@
[
new ET(function (context) { return Richfaces.evalMacro("timeControl", context)})
]),
- new E('td',{'width': '100%'}, []),
- new E('td',{'class': 'rich-calendar-toolfooter', 'style':function(context){return (this.isEmpty ? 'display:none;' : '')+(!context.calendar.showApplyButton ? 'background-image:none;' : '');}},
+ new E('td',{'class': 'rich-calendar-toolfooter', 'style': 'background-image:none;', 'width': '100%'}, []),
+ new E('td',{'class': 'rich-calendar-toolfooter', 'style':function(context){return (this.isEmpty ? 'display:none;' : '')+(context.calendar.params.disabled || context.calendar.params.readonly || !context.calendar.showApplyButton ? 'background-image:none;' : '');}},
[
new ET(function (context) { return Richfaces.evalMacro("todayControl", context)})
]),
@@ -2359,27 +2334,6 @@
this.weekDayLabels=calendar.params.weekDayLabels;
this.weekDayLabelsShort=calendar.params.weekDayLabelsShort;
this.controlLabels=calendar.params.labels;
-
-// TODO: remove onmouse over/up/out/down css classes and onclick listeners if component disabled (version 3.3.0)
-// if (this.nextYearControl) {
-// var attrs = this.nextYearControl.attrs;
-// CalendarView.clearAttributesIfDisabled(this.calendar, attrs);
-// }
-//
-// if (this.previousYearControl) {
-// var attrs = this.previousYearControl.attrs;
-// CalendarView.clearAttributesIfDisabled(this.calendar, attrs);
-// }
-//
-// if (this.previousMonthControl) {
-// var attrs = this.previousMonthControl.attrs;
-// CalendarView.clearAttributesIfDisabled(this.calendar, attrs);
-// }
-//
-// if (this.nextMonthControl) {
-// var attrs = this.nextMonthControl.attrs;
-// CalendarView.clearAttributesIfDisabled(this.calendar, attrs);
-// }
},
nextYearControl: CalendarView.nextYearControl,
previousYearControl: CalendarView.previousYearControl,
Modified: trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
===================================================================
--- trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2008-10-03 15:55:25 UTC (rev 10665)
+++ trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2008-10-03 16:40:37 UTC (rev 10666)
@@ -72,7 +72,8 @@
<jsp:scriptlet>
<![CDATA[
boolean manualInput = getUtils().isBooleanAttribute(component, "enableManualInput");
- if(!manualInput){
+ boolean readonly = getUtils().isBooleanAttribute(component, "readonly");
+ if(!manualInput || readonly){
getUtils().writeAttribute(writer, "readonly", "readonly");
}
]]>
@@ -177,6 +178,7 @@
enableManualInput: #{component.attributes['enableManualInput']},
showInput: #{component.attributes['showInput']},
disabled: #{component.disabled},
+ readonly: #{component.attributes['readonly']},
ajaxSingle: #{component.attributes['ajaxSingle']},
verticalOffset:#{component.verticalOffset},
horizontalOffset: #{component.horizontalOffset},
16 years, 1 month
JBoss Rich Faces SVN: r10665 - in trunk/test-applications/seleniumTest/richfaces/src: main/webapp/pages/ajaxRegion and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: dsvyatobatsko
Date: 2008-10-03 11:55:25 -0400 (Fri, 03 Oct 2008)
New Revision: 10665
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/A4JRegionTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxRegion/ajaxRegionTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxRegionTest.java
Log:
AjaxRegion: test ajaxListener are invoked on each AJAX request
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/A4JRegionTestBean.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/A4JRegionTestBean.java 2008-10-03 14:39:55 UTC (rev 10664)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/A4JRegionTestBean.java 2008-10-03 15:55:25 UTC (rev 10665)
@@ -1,5 +1,7 @@
package org.ajax4jsf.bean;
+import org.ajax4jsf.event.AjaxEvent;
+
public class A4JRegionTestBean {
private Integer internal = 0;
@@ -8,6 +10,10 @@
private Integer value = 0;
+ private boolean isInternalListenerInvoked;
+
+ private boolean isExternalListenerInvoked;
+
/**
* Gets value of internal field.
*
@@ -64,4 +70,44 @@
public void setValue(Integer value) {
this.value = value;
}
+
+ /**
+ * Gets value of isInternalListenerInvoked field.
+ * @return value of isInternalListenerInvoked field
+ */
+ public boolean isInternalListenerInvoked() {
+ return isInternalListenerInvoked;
+ }
+
+ /**
+ * Set a new value for isInternalListenerInvoked field.
+ * @param isInternalListenerInvoked a new value for isInternalListenerInvoked field
+ */
+ public void setInternalListenerInvoked(boolean isInternalListenerInvoked) {
+ this.isInternalListenerInvoked = isInternalListenerInvoked;
+ }
+
+ /**
+ * Gets value of isExternalListenerInvoked field.
+ * @return value of isExternalListenerInvoked field
+ */
+ public boolean isExternalListenerInvoked() {
+ return isExternalListenerInvoked;
+ }
+
+ /**
+ * Set a new value for isExternalListenerInvoked field.
+ * @param isExternalListenerInvoked a new value for isExternalListenerInvoked field
+ */
+ public void setExternalListenerInvoked(boolean isExternalListenerInvoked) {
+ this.isExternalListenerInvoked = isExternalListenerInvoked;
+ }
+
+ public void processOuterAjax(AjaxEvent event) {
+ setExternalListenerInvoked(true);
+ }
+
+ public void processInnerAjax(AjaxEvent event) {
+ setInternalListenerInvoked(true);
+ }
}
Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxRegion/ajaxRegionTest.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxRegionTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxRegionTest.java 2008-10-03 14:39:55 UTC (rev 10664)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxRegionTest.java 2008-10-03 15:55:25 UTC (rev 10665)
@@ -61,6 +61,29 @@
AssertValueEquals(renderElemId, "11");
}
+ @Test
+ public void testAjaxListenerInvokedOnEachAJAXRequest(Template template) {
+ renderPage(template);
+
+ writeStatus("Check ajax listener is invoked on each AJAX request");
+
+ String parentId = getParentId() + "_form:";
+
+ String externalLink = parentId + "externalLink";
+ String internalLink = parentId + "internalLink";
+
+ String outerListener = parentId + "outerListener";
+ String innerListener = parentId + "innerListener";
+
+ clickAjaxCommandAndWait(internalLink);
+ AssertTextEquals(innerListener, "true", "AjaxListener for inner region must have been invoked");
+ AssertTextEquals(outerListener, "false", "AjaxListener for outer region mustn't have been invoked");
+
+ clickAjaxCommandAndWait(externalLink);
+ AssertTextEquals(innerListener, "true", "AjaxListener for inner region must have been invoked");
+ AssertTextEquals(outerListener, "true", "AjaxListener for outer region must have been invoked");
+ }
+
public String getTestUrl() {
return "pages/ajaxRegion/ajaxRegionTest.xhtml";
}
16 years, 1 month