Author: Alex.Kolonitsky
Date: 2009-03-23 08:55:15 -0400 (Mon, 23 Mar 2009)
New Revision: 13094
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColorPickerBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/colorPickerAutoTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/colorPickerTest.xhtml
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColorPickerTest.java
trunk/ui/colorPicker/src/test/java/org/richfaces/component/ColorPickerTest.java
Removed:
trunk/ui/colorPicker/src/test/java/org/richfaces/component/JSFComponentTest.java
Modified:
trunk/samples/colorPickerDemo/pom.xml
trunk/samples/colorPickerDemo/src/main/java/org/richfaces/sandbox/samples/Bean.java
trunk/samples/colorPickerDemo/src/main/webapp/WEB-INF/faces-config.xml
trunk/samples/colorPickerDemo/src/main/webapp/WEB-INF/web.xml
trunk/samples/colorPickerDemo/src/main/webapp/pages/index.jsp
trunk/samples/colorPickerDemo/src/test/java/org/richfaces/sandbox/samples/BeanTest.java
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
trunk/ui/colorPicker/src/main/config/component/colorPicker.xml
trunk/ui/colorPicker/src/main/java/org/richfaces/component/UIColorPicker.java
trunk/ui/colorPicker/src/main/java/org/richfaces/renderkit/ColorPickerRendererBase.java
trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css/colorPicker.xcss
trunk/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx
Log:
Color Picker Skinning
Modified: trunk/samples/colorPickerDemo/pom.xml
===================================================================
--- trunk/samples/colorPickerDemo/pom.xml 2009-03-23 12:10:39 UTC (rev 13093)
+++ trunk/samples/colorPickerDemo/pom.xml 2009-03-23 12:55:15 UTC (rev 13094)
@@ -1,47 +1,62 @@
-<?xml version="1.0"?><project>
- <parent>
- <artifactId>samples</artifactId>
- <groupId>org.richfaces</groupId>
- <version>3.3.1-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces.samples</groupId>
- <artifactId>colorPickerDemo</artifactId>
- <packaging>war</packaging>
- <name>colorPicker Maven Webapp</name>
- <build>
- <finalName>colorPickerDemo</finalName>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </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.ui</groupId>
- <artifactId>core</artifactId>
- <version>3.3.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.richfaces.framework</groupId>
- <artifactId>richfaces-impl</artifactId>
- <version>3.3.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.richfaces.ui</groupId>
- <artifactId>colorPicker</artifactId>
- <version>3.3.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
+<?xml version="1.0"?>
+<project>
+ <parent>
+ <artifactId>samples</artifactId>
+ <groupId>org.richfaces</groupId>
+ <version>3.3.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.samples</groupId>
+ <artifactId>colorPickerDemo</artifactId>
+ <packaging>war</packaging>
+ <name>colorPicker Maven Webapp</name>
+ <build>
+ <finalName>colorPickerDemo</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin
+ </artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </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.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.samples
+ </groupId>
+ <artifactId>skins</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>core</artifactId>
+ <version>3.3.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>dataTable</artifactId>
+ <version>3.3.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>colorPicker</artifactId>
+ <version>3.3.1-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
</project>
Modified:
trunk/samples/colorPickerDemo/src/main/java/org/richfaces/sandbox/samples/Bean.java
===================================================================
---
trunk/samples/colorPickerDemo/src/main/java/org/richfaces/sandbox/samples/Bean.java 2009-03-23
12:10:39 UTC (rev 13093)
+++
trunk/samples/colorPickerDemo/src/main/java/org/richfaces/sandbox/samples/Bean.java 2009-03-23
12:55:15 UTC (rev 13094)
@@ -29,8 +29,8 @@
public class Bean {
private String color = "rgb(255, 250, 240)";
- private String color2 = "#ffffff";
-
+ private String color2 = "#ffffff";
+
public Bean() {
}
Modified: trunk/samples/colorPickerDemo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/colorPickerDemo/src/main/webapp/WEB-INF/faces-config.xml 2009-03-23
12:10:39 UTC (rev 13093)
+++ trunk/samples/colorPickerDemo/src/main/webapp/WEB-INF/faces-config.xml 2009-03-23
12:55:15 UTC (rev 13094)
@@ -2,9 +2,15 @@
<!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.sandbox.samples.Bean</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
- </managed-bean>
+ <managed-bean>
+ <managed-bean-name>bean</managed-bean-name>
+
<managed-bean-class>org.richfaces.sandbox.samples.Bean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+ </managed-bean>
+
+ <managed-bean>
+ <managed-bean-name>skinBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.SkinBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
</faces-config>
Modified: trunk/samples/colorPickerDemo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/samples/colorPickerDemo/src/main/webapp/WEB-INF/web.xml 2009-03-23 12:10:39 UTC
(rev 13093)
+++ trunk/samples/colorPickerDemo/src/main/webapp/WEB-INF/web.xml 2009-03-23 12:55:15 UTC
(rev 13094)
@@ -1,58 +1,60 @@
<?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>
-
+
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>
+ <context-param>
+ <param-name>org.ajax4jsf.SKIN</param-name>
+ <param-value>#{skinBean.skin}</param-value>
+ </context-param>
<context-param>
- <param-name>org.richfaces.SKIN</param-name>
- <param-value>blueSky</param-value>
- </context-param>
- <context-param>
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
<param-value>false</param-value>
</context-param>
-<!--context-param>
- <param-name>org.richfaces.LoadStyleStrategy</param-name>
- <param-value>NONE</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>
+ <!--
+ context-param>
+ <param-name>org.richfaces.LoadStyleStrategy</param-name>
+ <param-value>NONE</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>
Modified: trunk/samples/colorPickerDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/samples/colorPickerDemo/src/main/webapp/pages/index.jsp 2009-03-23 12:10:39 UTC
(rev 13093)
+++ trunk/samples/colorPickerDemo/src/main/webapp/pages/index.jsp 2009-03-23 12:55:15 UTC
(rev 13094)
@@ -1,33 +1,35 @@
-<%@ page contentType="application/xhtml+xml; charset=ISO-8859-1" %>
-
-<%@ taglib
uri="http://java.sun.com/jsf/html" prefix="h"%>
-<%@ taglib
uri="http://java.sun.com/jsf/core" prefix="f"%>
-<%@ taglib
uri="http://labs.jboss.com/jbossrichfaces/ui/colorPicker"
prefix="colorPicker"%>
-<%@ taglib
uri="http://richfaces.org/a4j" prefix="a4j"%>
-<html>
- <head>
- <title>ColorPicker sample page</title>
- </head>
- <body>
- <f:view>
- <h:form>
- <colorPicker:colorPicker id="cp"></colorPicker:colorPicker>
- <a4j:commandButton value="submit"
reRender="cp"></a4j:commandButton>
- <br /><br /><br /><br /><br /><br
/><br /><br /><br />
- <br /><br /><br /><br /><br />
- <colorPicker:colorPicker value="#{bean.color2}"
flat="true" colorMode="rgb">
- <f:facet name="icon">
- <f:verbatim>
- <h:graphicImage value="/pages/colorPicker_ico.png"
width="18px" height="18px"/>
- </f:verbatim>
- </f:facet>
- <f:facet name="arrows">
- <f:verbatim>
- <div style="width: 30px; height: 5px; border: 1px solid gray;
background:none;"></div>
- </f:verbatim>
- </f:facet>
- </colorPicker:colorPicker>
- </h:form>
- </f:view>
- </body>
-</html>
+<%@ page contentType="application/xhtml+xml; charset=ISO-8859-1" %>
+
+<%@ 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/dataTable"
prefix="rich" %>
+<%@ taglib
uri="http://labs.jboss.com/jbossrichfaces/ui/colorPicker"
prefix="colorPicker"%>
+<html>
+ <head>
+ <title>ColorPicker sample page</title>
+ </head>
+ <body>
+ <f:view>
+ <h:form id="skinForm" >
+ <h:selectOneRadio binding="#{skinBean.component}" />
+ <h:commandLink action="#{skinBean.change}" value="set
skin" />
+ <h:outputText value=" Current skin: #{skinBean.skin}"
/><br />
+ </h:form>
+
+ <h:form>
+ <rich:dataTable value="1"
id="Selenium_Test_DataTable" rowKeyVar="row">
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Data Table" />
+ </f:facet>
+
+ <colorPicker:colorPicker id="cp"
value="#ff0000" />
+
+ <h:outputText value="#{row}"/>
+ </rich:column>
+ </rich:dataTable>
+ </h:form>
+ </f:view>
+ </body>
+</html>
\ No newline at end of file
Modified:
trunk/samples/colorPickerDemo/src/test/java/org/richfaces/sandbox/samples/BeanTest.java
===================================================================
---
trunk/samples/colorPickerDemo/src/test/java/org/richfaces/sandbox/samples/BeanTest.java 2009-03-23
12:10:39 UTC (rev 13093)
+++
trunk/samples/colorPickerDemo/src/test/java/org/richfaces/sandbox/samples/BeanTest.java 2009-03-23
12:55:15 UTC (rev 13094)
@@ -27,20 +27,17 @@
/**
*/
-public class BeanTest
- extends TestCase
-{
+public class BeanTest extends TestCase {
/**
* Create the test case
- *
- * @param testName name of the test case
+ *
+ * @param testName - name of the test case
*/
- public BeanTest( String testName )
- {
- super( testName );
+ public BeanTest(String testName) {
+ super(testName);
}
-
+
public void testStub() throws Exception {
-
+
}
}
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColorPickerBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColorPickerBean.java
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/ColorPickerBean.java 2009-03-23
12:55:15 UTC (rev 13094)
@@ -0,0 +1,92 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * 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.bean;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+
+public class ColorPickerBean implements Validator, Converter{
+
+ private String value = "#ff0000";
+ private String trace;
+
+ private Boolean filterNewValues;
+
+ public ColorPickerBean() {
+ }
+
+ public void init() {
+ value = "#ff0000";
+ trace = null;
+
+ filterNewValues = true;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setTrace(String trace) {
+ this.trace = trace;
+ }
+
+ public String getTrace() {
+ return trace;
+ }
+
+ public void valueChangeListener(ValueChangeEvent event) {
+ trace = "changed";
+ }
+
+ public void validate(FacesContext context, UIComponent component,
+ Object value) throws ValidatorException {
+ if ("#ff00ff".equals(value)) {
+ throw new ValidatorException(new FacesMessage("Value mustn't be equal
#ff00ff."));
+ }
+ }
+
+ public Object getAsObject(FacesContext context, UIComponent component,
+ String value) {
+ return value != null ? value.substring(2): null;
+ }
+
+ public String getAsString(FacesContext context, UIComponent component,
+ Object value) {
+ return value != null ? "c:" + value.toString(): null;
+ }
+
+ public void setFilterNewValues(Boolean filterNewValues) {
+ this.filterNewValues = filterNewValues;
+ }
+
+ public Boolean getFilterNewValues() {
+ return filterNewValues;
+ }
+}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java 2009-03-23
12:10:39 UTC (rev 13093)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/IndexBean.java 2009-03-23
12:55:15 UTC (rev 13094)
@@ -122,6 +122,7 @@
list.add(new ComponentItem("<rich:effect>",
"effect/effectTest.xhtml"));
list.add(new ComponentItem("<rich:graphValidator>",
"graphValidator/graphValidatorTest.xhtml"));
list.add(new ComponentItem("<rich:panel>",
"panel/panelTest.xhtml"));
+ list.add(new ComponentItem("<rich:colorPicker>",
"colorPicker/colorPickerTest.xhtml"));
sortList();
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2009-03-23
12:10:39 UTC (rev 13093)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/.faces-config.xml.jsfdia 2009-03-23
12:55:15 UTC (rev 13094)
@@ -1,25 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
-<PROCESS ENTITY="JSFProcess">
- <PROCESS-ITEM ENTITY="JSFProcessGroup"
- NAME="rules:#pages#ajaxInclude#step1.xhtml"
- PATH="/pages/ajaxInclude/step1.xhtml" SHAPE="32,17,0,0">
- <PROCESS-ITEM ENTITY="JSFProcessItem"
- ID="rules:#pages#ajaxInclude#step1.xhtml:0" NAME="item"
PATH="/pages/ajaxInclude/step1.xhtml">
- <PROCESS-ITEM-OUTPUT ENTITY="JSFProcessItemOutput"
- ID="next::#pages#ajaxInclude#step2.xhtml" NAME="output"
- PATH="/pages/ajaxInclude/step2.xhtml"
- TARGET="rules:#pages#ajaxInclude#step2.xhtml" TITLE="next"/>
+<PROCESS model-entity="JSFProcess">
+ <PROCESS-ITEM NAME="rules:#pages#ajaxInclude#step1.xhtml"
+ PATH="/pages/ajaxInclude/step1.xhtml" SHAPE="32,17,0,0"
model-entity="JSFProcessGroup">
+ <PROCESS-ITEM ID="rules:#pages#ajaxInclude#step1.xhtml:0"
NAME="item"
+ PATH="/pages/ajaxInclude/step1.xhtml"
model-entity="JSFProcessItem">
+ <PROCESS-ITEM-OUTPUT ID="next::#pages#ajaxInclude#step2.xhtml"
+ NAME="output" PATH="/pages/ajaxInclude/step2.xhtml"
+ TARGET="rules:#pages#ajaxInclude#step2.xhtml" TITLE="next"
model-entity="JSFProcessItemOutput"/>
</PROCESS-ITEM>
</PROCESS-ITEM>
- <PROCESS-ITEM ENTITY="JSFProcessGroup"
- NAME="rules:#pages#ajaxInclude#step2.xhtml"
- PATH="/pages/ajaxInclude/step2.xhtml" SHAPE="240,33,0,0">
- <PROCESS-ITEM ENTITY="JSFProcessItem"
- ID="rules:#pages#ajaxInclude#step2.xhtml:0" NAME="item"
PATH="/pages/ajaxInclude/step2.xhtml">
- <PROCESS-ITEM-OUTPUT ENTITY="JSFProcessItemOutput"
- ID="previous::#pages#ajaxInclude#step1.xhtml" NAME="output"
- PATH="/pages/ajaxInclude/step1.xhtml"
- TARGET="rules:#pages#ajaxInclude#step1.xhtml"
TITLE="previous"/>
+ <PROCESS-ITEM NAME="rules:#pages#ajaxInclude#step2.xhtml"
+ PATH="/pages/ajaxInclude/step2.xhtml" SHAPE="240,33,0,0"
model-entity="JSFProcessGroup">
+ <PROCESS-ITEM ID="rules:#pages#ajaxInclude#step2.xhtml:0"
NAME="item"
+ PATH="/pages/ajaxInclude/step2.xhtml"
model-entity="JSFProcessItem">
+ <PROCESS-ITEM-OUTPUT ID="previous::#pages#ajaxInclude#step1.xhtml"
+ NAME="output" PATH="/pages/ajaxInclude/step1.xhtml"
+ TARGET="rules:#pages#ajaxInclude#step1.xhtml" TITLE="previous"
model-entity="JSFProcessItemOutput"/>
</PROCESS-ITEM>
</PROCESS-ITEM>
+ <PROCESS-ITEM
+ NAME="rules:#pages#ajaxSupport#testAjaxSingleAttribute3.xhtml"
+ PATH="/pages/ajaxSupport/testAjaxSingleAttribute3.xhtml"
+ SHAPE="32,129,0,0" model-entity="JSFProcessGroup">
+ <PROCESS-ITEM
+ ID="rules:#pages#ajaxSupport#testAjaxSingleAttribute3.xhtml:0"
+ NAME="item"
PATH="/pages/ajaxSupport/testAjaxSingleAttribute3.xhtml"
model-entity="JSFProcessItem">
+ <PROCESS-ITEM-OUTPUT
+ ID="navigate::#pages#ajaxSupport#successNavigation.xhtml"
+ NAME="output" PATH="/pages/ajaxSupport/successNavigation.xhtml"
+ TARGET="rules:#pages#ajaxSupport#successNavigation.xhtml"
+ TITLE="navigate" model-entity="JSFProcessItemOutput"/>
+ </PROCESS-ITEM>
+ </PROCESS-ITEM>
+ <PROCESS-ITEM NAME="rules:#*" PATH="/*"
SHAPE="32,241,0,0" model-entity="JSFProcessGroup">
+ <PROCESS-ITEM ID="rules:#*:0" NAME="item" PATH="/*"
model-entity="JSFProcessItem">
+ <PROCESS-ITEM-OUTPUT
+ ID="autoTestNavigation::#layout#autotest#autoTestNavigationPage.xhtml"
+ NAME="output"
PATH="/layout/autotest/autoTestNavigationPage.xhtml"
+ TARGET="rules:#layout#autotest#autoTestNavigationPage.xhtml"
+ TITLE="autoTestNavigation"
model-entity="JSFProcessItemOutput"/>
+ </PROCESS-ITEM>
+ </PROCESS-ITEM>
+ <PROCESS-ITEM
+ NAME="rules:#layout#autotest#autoTestNavigationPage.xhtml"
+ PATH="/layout/autotest/autoTestNavigationPage.xhtml"
+ SHAPE="240,257,0,0" model-entity="JSFProcessGroup"/>
+ <PROCESS-ITEM NAME="rules:#pages#ajaxSupport#successNavigation.xhtml"
+ PATH="/pages/ajaxSupport/successNavigation.xhtml"
SHAPE="240,145,0,0" model-entity="JSFProcessGroup"/>
</PROCESS>
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-03-23
12:10:39 UTC (rev 13093)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/WEB-INF/faces-config.xml 2009-03-23
12:55:15 UTC (rev 13094)
@@ -146,6 +146,11 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
+ <managed-bean-name>colorPickerBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.bean.ColorPickerBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+ <managed-bean>
<managed-bean-name>ddmenuBean</managed-bean-name>
<managed-bean-class>org.ajax4jsf.bean.DropDownMenuTestBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/colorPickerAutoTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/colorPickerAutoTest.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/colorPickerAutoTest.xhtml 2009-03-23
12:55:15 UTC (rev 13094)
@@ -0,0 +1,35 @@
+<!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:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.autoTestTemplate}">
+ <ui:define name="component">
+ <rich:colorPicker id="componentId"
+ value="#{colorPickerBean.value}"
+
+ onclick="EventQueue.fire('onclick')"
+ onmousedown="EventQueue.fire('onmousedown')"
+ onmousemove="EventQueue.fire('onmousemove')"
+ onmouseup="EventQueue.fire('onmouseup')"
+ onmouseout="EventQueue.fire('onmouseout')"
+ onmouseover="EventQueue.fire('onmouseover')"
+ onkeydown="EventQueue.fire('onkeydown')"
+ onkeypress="EventQueue.fire('onkeypress')"
+ onkeyup="EventQueue.fire('onkeyup')"
+ >
+
+ <!-- rendered="#{autoTestBean.rendered}"
+ required="#{autoTestBean.required}"
+ requiredMessage="#{autoTestBean.requiredMessage}"
+ immediate="#{autoTestBean.immediate}"
+ style="width: 100%; color: yellow"
+ styleClass="noname"-->
+
+ </rich:colorPicker>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/colorPickerTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/colorPickerTest.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/colorPicker/colorPickerTest.xhtml 2009-03-23
12:55:15 UTC (rev 13094)
@@ -0,0 +1,38 @@
+<!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:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="#{templateBean.template}">
+ <ui:define name="component">
+ <h:form id="autoTestForm">
+ <rich:colorPicker
+ id="componentId"
+ value="#{colorPickerBean.value}"
+
+
+ onclick="EventQueue.fire('onclick')"
+ onmousedown="EventQueue.fire('onmousedown')"
+ onmousemove="EventQueue.fire('onmousemove')"
+ onmouseup="EventQueue.fire('onmouseup')"
+ onmouseout="EventQueue.fire('onmouseout')"
+ onmouseover="EventQueue.fire('onmouseover')"
+ onkeydown="EventQueue.fire('onkeydown')"
+ onkeypress="EventQueue.fire('onkeypress')"
+ onkeyup="EventQueue.fire('onkeyup')"
+ />
+
+ <a4j:commandButton id="submit" value="Submit"
reRender="outputPanel"></a4j:commandButton>
+ </h:form>
+
+ <a4j:outputPanel id="outputPanel">
+ <h:outputText id="value"
value="#{colorPickerBean.value}"></h:outputText>
+ <h:outputText id="trace"
value="#{colorPickerBean.trace}"></h:outputText>
+ <rich:message id="message"
for="comboBox"></rich:message>
+ </a4j:outputPanel>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Added:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColorPickerTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColorPickerTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/ColorPickerTest.java 2009-03-23
12:55:15 UTC (rev 13094)
@@ -0,0 +1,260 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * 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.testng;
+
+import org.ajax4jsf.template.Template;
+import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class ColorPickerTest extends SeleniumTestBase {
+
+ private String colorPicker;
+ private String colorPickerButton;
+ private String colorPickerList;
+ private String xPathInput;
+ private String xPathColorArea;
+ private String hexInputId;
+
+ private String submit;
+// private String value;
+// private String trace;
+// private String message;
+
+ private void init(Template template) {
+ renderPage(null, template, "#{comboBean.init}");
+ String mainForm = getParentId() + "autoTestForm";
+
+ colorPicker = mainForm + ":componentId";
+ colorPickerButton = colorPicker;
+ colorPickerList = colorPicker + "-colorPicker-popup";
+ hexInputId = colorPicker + "-colorPicker-hex";
+ xPathInput = "xpath=id('" + colorPickerButton +
"')/input";
+
+ submit = mainForm + ":submit";
+
+// value = getParentId() + "value";
+// trace = getParentId() + "trace";
+// message = getParentId() + "message";
+ }
+
+// @Test
+// public void testColorPickerComponent(Template template) {
+// init(template);
+//
+// // Test setted value
+// testValueSettedOnPage(template);
+//
+// // Select color on RGB
+// testSetValueOnRGB(template);
+//
+// // open colorPicker and close it by Cancel button
+// testSetValueOnHSB(template);
+//
+// // open colorPicker and close it by Cancel button
+// testInputValueByColorArea(template);
+//
+// // test cancel button
+// testCancelButton(template);
+//
+// // test cancel button
+// testValue(template);
+// }
+
+ @Test
+ public void testCancelButton(Template template) {
+ init(template);
+
+ openColorPicker();
+
+ final String oldValue = selenium.getValue(xPathInput);
+
+ setValueOnRGB("255", "0", "255");
+
+ Assert.assertTrue(isVisible(hexInputId), "Hex Input must be
presented");
+ Assert.assertEquals("#" + selenium.getValue(hexInputId),
"#ff00ff");
+
+ final String xPathButtonCancel = "xpath=id('" + colorPickerList +
"')//button[@name='cancel']";
+ Assert.assertTrue(isVisible(xPathButtonCancel), "Button Cancel must be
presented");
+ selenium.click(xPathButtonCancel);
+
+ Assert.assertFalse(isVisible(colorPickerList), "Component's pop-up must
show up on click");
+
+ Assert.assertTrue(isVisible(xPathInput), "Button Ok must be
presented");
+ Assert.assertEquals(selenium.getValue(xPathInput), oldValue); // value from page
+ }
+
+
+ public void testInputValueByColorArea(Template template) {
+ init(template);
+
+ openColorPicker();
+
+ xPathColorArea = "xpath=id('" + colorPickerList +
"')//div[@class='rich-colorPicker-color']/div";
+ selenium.clickAt(xPathColorArea, "0,0"); // don't work
+
+ testInputedValue("#ffffff");
+ }
+
+ @Test
+ public void testValueSettedOnPage(Template template) { // don't work in tables
+ init(template);
+
+ Assert.assertTrue(isVisible(colorPickerButton), "Component must be
visible");
+ Assert.assertFalse(isVisible(colorPickerList), "Component's pop-up must
show up on click");
+
+ Assert.assertTrue(isVisible(xPathInput), "Input must be presented");
+ Assert.assertEquals(selenium.getValue(xPathInput), "#ff0000"); // value
from page
+ }
+
+ @Test
+ public void testSetValueOnHSB(Template template) {
+ init(template);
+
+ openColorPicker();
+
+ selenium.type(colorPicker + "-colorPicker-hsb-h", "120");
+ selenium.type(colorPicker + "-colorPicker-hsb-s", "100");
+ selenium.type(colorPicker + "-colorPicker-hsb-b", "100");
+
+ testInputedValue("#00ff00");
+ }
+
+ @Test
+ public void testSetValueOnRGB(Template template) {
+ init(template);
+
+ openColorPicker();
+
+ setValueOnRGB("0", "0", "255");
+
+ testInputedValue("#0000ff");
+ }
+
+ private void setValueOnRGB(String r, String g, String b) {
+ selenium.type(colorPicker + "-colorPicker-rgb-r", r);
+ selenium.type(colorPicker + "-colorPicker-rgb-g", g);
+ selenium.type(colorPicker + "-colorPicker-rgb-b", b);
+ }
+
+ private void testInputedValue(final String expectedValue) {
+ Assert.assertTrue(isVisible(hexInputId), "Hex Input must be
presented");
+ Assert.assertEquals("#" + selenium.getValue(hexInputId),
expectedValue);
+
+ final String xPathButtonOk = "xpath=id('" + colorPickerList +
"')//button[@name='submit']";
+ Assert.assertTrue(isVisible(xPathButtonOk), "Button Cancel must be
presented");
+ selenium.click(xPathButtonOk);
+
+ Assert.assertFalse(isVisible(colorPickerList), "Component's pop-up must
show up on click");
+
+ Assert.assertTrue(isVisible(xPathInput), "Button Ok must be
presented");
+ Assert.assertEquals(selenium.getValue(xPathInput), expectedValue); // value from
page
+ }
+
+ /**
+ * Check that valueChangeListener triggered
+ * when user select new value from popup.
+ * Selected value should be correctly applied.
+ */
+ @Test
+ public void testValue(Template template) {
+ init(template);
+
+ openColorPicker();
+ setValueOnRGB("0", "255", "255");
+ testInputedValue("#00ffff");
+
+ clickAjaxCommandAndWait(submit);
+ Assert.assertEquals(selenium.getValue(xPathInput), "#00ffff");
+ }
+
+ private void openColorPicker() {
+ clickById(colorPickerButton);
+ Assert.assertTrue(isVisible(colorPickerList), "Component's pop-up must
show up on click");
+ }
+
+// /**
+// * Check component validation.
+// * Specific validator defined in "validator" attribute
+// * should be triggered either as the ones defined using nested validator tags
+// */
+// @Test
+// public void testValidators(Template template) {
+// init(template);
+//
+// Assert.assertEquals(selenium.getText(message), "");
+//
+// AutoTester
+// openColorPicker();
+// setValueOnRGB("0", "255", "255");
+// testInputedValue("#00ffff");
+// clickAjaxCommandAndWait(submit);
+// Assert.assertEquals(selenium.getText(message), "Value mustn't be equal
11.");
+//
+// openColorPicker();
+// setValueOnRGB("255", "255", "255");
+// testInputedValue("#ffffff");
+// clickAjaxCommandAndWait(submit);
+// Assert.assertEquals(selenium.getText(message), "Value mustn't be equal
44.");
+// }
+//
+// /**
+// * The same as for RF-6064 but for the case of validation failure.
+// * Submitted value should be output back unchanged after submit
+// */
+// @Test
+// public void testValidationFailure(Template template) {
+// init(template);
+// Assert.assertEquals(selenium.getText(value), "");
+// Assert.assertEquals(selenium.getText(message), "");
+// selenium.click(colorPickerButton);
+// selenium.mouseMove("xpath=id('" + colorPickerList +
"')/span[4]");
+// selenium.click("xpath=id('" + colorPickerList +
"')/span[4]");
+// clickAjaxCommandAndWait(submit);
+// Assert.assertEquals(selenium.getText(value), "");
+// Assert.assertEquals(selenium.getText(message), "Value mustn't be equal
44.");
+// }
+//
+// /**
+// * Check "immediate", "required" &
"requiredMessage" attributes
+// */
+// @Test
+// public void testImmediateAndRequired(Template template) {
+// AutoTester autoTester = getAutoTester(this);
+// autoTester.renderPage(template, null);
+// autoTester.testImmediate(false);
+// autoTester.testRequiredAndRequiredMessageAttributes();
+// }
+
+ @Override
+ public void setValueEmpty() {
+ selenium.type(getParentId() + "autoTestForm:componentIdcolorPickerValue",
"");
+ }
+
+ public String getTestUrl() {
+ return "pages/colorPicker/colorPickerTest.xhtml";
+ }
+
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/colorPicker/colorPickerAutoTest.xhtml";
+ }
+}
\ No newline at end of file
Modified: trunk/ui/colorPicker/src/main/config/component/colorPicker.xml
===================================================================
--- trunk/ui/colorPicker/src/main/config/component/colorPicker.xml 2009-03-23 12:10:39 UTC
(rev 13093)
+++ trunk/ui/colorPicker/src/main/config/component/colorPicker.xml 2009-03-23 12:55:15 UTC
(rev 13094)
@@ -54,7 +54,8 @@
</description>
<defaultvalue><![CDATA["#ffffff"]]></defaultvalue>
</property>
- &ui_component_attributes;
+
+ &ui_component_attributes;
&html_events;
&ui_input_attributes;
</component>
Modified: trunk/ui/colorPicker/src/main/java/org/richfaces/component/UIColorPicker.java
===================================================================
---
trunk/ui/colorPicker/src/main/java/org/richfaces/component/UIColorPicker.java 2009-03-23
12:10:39 UTC (rev 13093)
+++
trunk/ui/colorPicker/src/main/java/org/richfaces/component/UIColorPicker.java 2009-03-23
12:55:15 UTC (rev 13094)
@@ -15,5 +15,12 @@
public static final String COMPONENT_TYPE = "org.richfaces.ColorPicker";
public static final String COMPONENT_FAMILY = "org.richfaces.ColorPicker";
+
+ @Override
+ public void setValue(Object value) {
+ // TODO Remove it
+ super.setValue(value);
+ }
+
}
Modified:
trunk/ui/colorPicker/src/main/java/org/richfaces/renderkit/ColorPickerRendererBase.java
===================================================================
---
trunk/ui/colorPicker/src/main/java/org/richfaces/renderkit/ColorPickerRendererBase.java 2009-03-23
12:10:39 UTC (rev 13093)
+++
trunk/ui/colorPicker/src/main/java/org/richfaces/renderkit/ColorPickerRendererBase.java 2009-03-23
12:55:15 UTC (rev 13094)
@@ -15,10 +15,10 @@
public void decode(FacesContext context, UIComponent component){
ExternalContext external = context.getExternalContext();
- Map requestParams = external.getRequestParameterMap();
+ Map<String, String> requestParams = external.getRequestParameterMap();
UIColorPicker colorPicker = (UIColorPicker)component;
String clientId = colorPicker.getClientId(context);
- String submittedValue = (String)requestParams.get(clientId);
+ String submittedValue = requestParams.get(clientId);
if (submittedValue != null) {
colorPicker.setSubmittedValue(submittedValue);
Modified:
trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css/colorPicker.xcss
===================================================================
---
trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css/colorPicker.xcss 2009-03-23
12:10:39 UTC (rev 13093)
+++
trunk/ui/colorPicker/src/main/resources/org/richfaces/renderkit/html/css/colorPicker.xcss 2009-03-23
12:55:15 UTC (rev 13094)
@@ -171,17 +171,26 @@
<u:selector name=".rich-colorPicker-ext">
<u:style name="border-color" skin="panelBorderColor"/>
- <u:style name="background-color"
skin="additionalBackgroundColor"/>
+ <u:style name="background-color"
skin="generalBackgroundColor"/>
<u:style name="font-family" skin="generalFamilyFont"/>
</u:selector>
<u:selector name=".rich-colorPicker-span input">
<u:style name="background-image">
- <f:resource
f:key="org.richfaces.renderkit.html.images.InputBackgroundImage" />
+ <f:resource
f:key="org.richfaces.renderkit.html.images.InputBackgroundImage" />
</u:style>
<u:style name="border-color" skin="panelBorderColor"/>
<u:style name="font-size" skin="generalSizeFont"/>
<u:style name="font-family" skin="generalFamilyFont"/>
</u:selector>
+ <u:selector name=".rich-colorPicker-ext input">
+ <u:style name="color" skin="controlTextColor"/>
+ <u:style name="background-color"
skin="controlBackgroundColor"/>
+ </u:selector>
+ <u:selector name=".rich-colorPicker-ext label">
+ <u:style name="color" skin="generalSizeFont"/>
+ <u:style name="font-size" skin="generalSizeFont"/>
+ <u:style name="font-family" skin="generalFamilyFont"/>
+ </u:selector>
<u:selector name=".rich-colorPicker-icon">
<u:style name="border-color" skin="panelBorderColor"/>
</u:selector>
@@ -194,6 +203,18 @@
<u:selector name=".rich-colorPicker-current-color">
<u:style name="border-color" skin="panelBorderColor"/>
</u:selector>
+ <u:selector name=".rich-colorPicker-cancel">
+ <u:style name="font-size" skin="buttonFontSize"/>
+ <u:style name="font-family" skin="buttonFamilyFont"/>
+ <u:style name="color" skin="headerTextColor"/>
+ <u:style name="border-color" skin="headerBackgroundColor"/>
+ </u:selector>
+ <u:selector name=".rich-colorPicker-submit">
+ <u:style name="font-size" skin="buttonFontSize"/>
+ <u:style name="font-family" skin="buttonFamilyFont"/>
+ <u:style name="color" skin="headerTextColor"/>
+ <u:style name="border-color" skin="headerBackgroundColor"/>
+ </u:selector>
<u:selector name=".rich-colorPicker-color div">
<u:style name="background-image">
<f:resource
f:key="/org/richfaces/renderkit/html/images/colorpicker_overlay.png" />
Modified: trunk/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx
===================================================================
--- trunk/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx 2009-03-23
12:10:39 UTC (rev 13093)
+++ trunk/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx 2009-03-23
12:55:15 UTC (rev 13094)
@@ -25,21 +25,17 @@
<span id="#{clientId}"
class="rich-colorPicker-span" x:passThruWithExclusions="value,name,type,id,styleClass,class,style">
<input readonly="readonly" type="text"
name="#{clientId}" value="#{this:getInputValue(context,
component)}"/>
- <jsp:scriptlet>
- <![CDATA[if(component.getFacet("icon")!=null &&
component.getFacet("icon").isRendered()) {]]>
- </jsp:scriptlet>
+ <jsp:scriptlet><![CDATA[
+ if(component.getFacet("icon")!=null &&
component.getFacet("icon").isRendered()) {
+ ]]></jsp:scriptlet>
<u:insertFacet name="icon" />
- <jsp:scriptlet>
- <![CDATA[
+ <jsp:scriptlet><![CDATA[
}else{
- ]]>
- </jsp:scriptlet>
- <img src="#{arrow}" class="rich-colorPicker-icon
#{component.attributes['iconClass']}"
style="#{component.attributes['iconStyle']}"
vertical-align="middle"/>
- <jsp:scriptlet>
- <![CDATA[
+ ]]></jsp:scriptlet>
+ <img src="#{arrow}" class="rich-colorPicker-icon
#{component.attributes['iconClass']}"
style="#{component.attributes['iconStyle']}"
vertical-align="middle"/>
+ <jsp:scriptlet><![CDATA[
}
- ]]>
- </jsp:scriptlet>
+ ]]></jsp:scriptlet>
</span>
<div id="#{clientId}-colorPicker-popup"
class="rich-colorPicker-wrapper">
Copied: trunk/ui/colorPicker/src/test/java/org/richfaces/component/ColorPickerTest.java
(from rev 13022,
trunk/ui/colorPicker/src/test/java/org/richfaces/component/JSFComponentTest.java)
===================================================================
--- trunk/ui/colorPicker/src/test/java/org/richfaces/component/ColorPickerTest.java
(rev 0)
+++
trunk/ui/colorPicker/src/test/java/org/richfaces/component/ColorPickerTest.java 2009-03-23
12:55:15 UTC (rev 13094)
@@ -0,0 +1,183 @@
+/**
+ * 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.component;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIForm;
+import javax.faces.component.html.HtmlForm;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+
+import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
+
+/**
+ * Unit test for simple Component.
+ */
+public class ColorPickerTest extends AbstractAjax4JsfTestCase {
+ private UIForm form;
+ private UIColorPicker colorPicker;
+ private UIColorPicker colorPicker2;
+
+ private ColorPickerBean targetBean = null;
+
+ /**
+ * Create the test case
+ *
+ * @param testName - name of the test case
+ */
+ public ColorPickerTest(String testName) {
+ super(testName);
+ }
+
+ public void setUp() throws Exception {
+ super.setUp();
+
+ application.addComponent(UIColorPicker.COMPONENT_TYPE,
+ "org.richfaces.component.html.HtmlColorPicker");
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ colorPicker = (UIColorPicker)
application.createComponent(UIColorPicker.COMPONENT_TYPE);
+ form.getChildren().add(colorPicker);
+
+ targetBean = new ColorPickerBean();
+ externalContext.getRequestMap().put("targetBean", targetBean);
+ colorPicker.setValueBinding("value",
application.createValueBinding("#{targetBean.value}"));
+
+ colorPicker2 = (UIColorPicker)
application.createComponent(UIColorPicker.COMPONENT_TYPE);
+ }
+
+ public void tearDown() throws Exception {
+ form = null;
+ colorPicker = null;
+ colorPicker2 = null;
+
+ targetBean = null;
+
+ super.tearDown();
+ }
+
+ /**
+ * Tests if component accepts request parameters and stores them in
+ * submittedValue(). If component is immediate, validation (possibly with
+ * conversion) should occur on that phase.
+ *
+ * @throws Exception
+ */
+ public void testDecode() throws Exception {
+ final String value = "value";
+
+ externalContext.addRequestParameterMap(colorPicker.getClientId(facesContext),
value);
+ colorPicker.processDecodes(facesContext);
+
+ Object submittedValue = colorPicker.getSubmittedValue();
+ assertEquals(value, submittedValue);
+ }
+
+ public void testDecodeImmediate() throws Exception {
+ colorPicker.setImmediate(true);
+ colorPicker.addValidator(new Validator() {
+
+ public void validate(FacesContext arg0, UIComponent arg1, Object arg2) throws
ValidatorException {
+ FacesMessage mess = new FacesMessage("Fake test message.");
+ throw new ValidatorException(mess);
+
+ }
+ });
+
+ externalContext.addRequestParameterMap(colorPicker.getClientId(facesContext),
"value");
+ colorPicker.processDecodes(facesContext);
+
+ assertTrue(facesContext.getMessages().hasNext());
+ }
+
+ /**
+ * Tests if component handles value bindings correctly
+ *
+ * @throws Exception
+ */
+ public void testUpdate() throws Exception {
+ externalContext.addRequestParameterMap(colorPicker.getClientId(facesContext),
"value");
+
+ colorPicker.processDecodes(facesContext);
+ colorPicker.processValidators(facesContext);
+ colorPicker.processUpdates(facesContext);
+
+ assertEquals("value", targetBean.getValue());
+ }
+
+ /**
+ * Tests if component handles validation correctly
+ *
+ * @throws Exception
+ */
+ public void testValidate() throws Exception {
+ colorPicker.addValidator(new Validator() {
+
+ public void validate(FacesContext arg0, UIComponent arg1,
+ Object arg2) throws ValidatorException {
+ FacesMessage mess = new FacesMessage("Fake test message.");
+ throw new ValidatorException(mess);
+
+ }
+
+ });
+ externalContext.addRequestParameterMap(colorPicker.getClientId(facesContext),
"value");
+
+ colorPicker.processDecodes(facesContext);
+ colorPicker.processValidators(facesContext);
+
+ assertTrue(facesContext.getMessages().hasNext());
+ assertNotNull(colorPicker.getSubmittedValue());
+ }
+
+ public void testSaveRestore() throws Exception {
+ final String value = "value";
+
+ colorPicker.setValueBinding("value", null);
+ assertNull(colorPicker.getValueBinding("value"));
+
+ colorPicker.setValue(value);
+ assertEquals(value, colorPicker.getValue());
+
+ Object state = colorPicker.saveState(facesContext);
+
+ colorPicker2.restoreState(facesContext, state);
+ assertEquals(value, colorPicker2.getValue());
+ }
+
+ protected class ColorPickerBean {
+ private String value = null;
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+ }
+}
Deleted: trunk/ui/colorPicker/src/test/java/org/richfaces/component/JSFComponentTest.java
===================================================================
---
trunk/ui/colorPicker/src/test/java/org/richfaces/component/JSFComponentTest.java 2009-03-23
12:10:39 UTC (rev 13093)
+++
trunk/ui/colorPicker/src/test/java/org/richfaces/component/JSFComponentTest.java 2009-03-23
12:55:15 UTC (rev 13094)
@@ -1,53 +0,0 @@
-/**
- * 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.component;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import javax.faces.component.UIComponent;
-
-/**
- * Unit test for simple Component.
- */
-public class JSFComponentTest
- extends TestCase
-{
- /**
- * Create the test case
- *
- * @param testName name of the test case
- */
- public JSFComponentTest( String testName )
- {
- super( testName );
- }
-
-
- /**
- * Rigourous Test :-)
- */
- public void testComponent()
- {
- assertTrue( true );
- }
-}