Author: alexsmirnov
Date: 2010-12-19 01:02:48 -0500 (Sun, 19 Dec 2010)
New Revision: 20677
Added:
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/CustomValidator.java
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajax-validator.xhtml
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/client-validator.xhtml
Removed:
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/DataBean.java
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/GraphValidatorBean.java
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/LengthBean.java
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MaxBean.java
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MinBean.java
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MinMaxBean.java
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/NotEmptyBean.java
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/NotNullBean.java
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/Validable.java
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajaxValidation.xhtml
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/beanValidation.xhtml
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/graphValidation.xhtml
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/TestCriteria.java
Modified:
branches/RF-7654/examples/template/src/main/webapp/WEB-INF/web.xml
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/Bean.java
branches/RF-7654/examples/validator-demo/src/main/webapp/WEB-INF/faces-config.xml
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/AjaxValidationTest.java
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/ClientValidationTest.java
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/client-test.xhtml
branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/test.xhtml
Log:
RESOLVED - issue RF-9222: CSV: development sample subtask
https://issues.jboss.org/browse/RF-9222
Modified: branches/RF-7654/examples/template/src/main/webapp/WEB-INF/web.xml
===================================================================
--- branches/RF-7654/examples/template/src/main/webapp/WEB-INF/web.xml 2010-12-18 00:39:32
UTC (rev 20676)
+++ branches/RF-7654/examples/template/src/main/webapp/WEB-INF/web.xml 2010-12-19 06:02:48
UTC (rev 20677)
@@ -1,6 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"
version="2.5">
<display-name>validator-demo</display-name>
+ <context-param>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>Development</param-value>
+ </context-param>
+
+ <context-param>
+ <param-name>org.richfaces.enableControlSkinning</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.richfaces.enableControlSkinningClasses</param-name>
+ <param-value>true</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>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>facelets.DEVELOPMENT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+
+ <!-- Faces Servlet -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+
+ <!-- Faces Servlet Mapping -->
+ <!--
+
+ This mapping identifies a jsp page as having JSF content. If a request
+ comes to the server for foo.faces, the container will send the request
+ to the FacesServlet, which will expect a corresponding foo.jsp page to
+ exist containing the content.
+ -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>/faces/*</url-pattern>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
Modified:
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/Bean.java
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/Bean.java 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/Bean.java 2010-12-19
06:02:48 UTC (rev 20677)
@@ -1,70 +1,22 @@
-/**
- * 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.example;
-
-import javax.validation.constraints.Pattern;
-
-
-/**
- * JSF bean with text property validation.
- */
-public class Bean {
-
- /**
- * Text property
- */
- private String email;
-
- private String creditCardNumber;
-
- /**
- * @return the creditCardNumber
- */
- @Pattern(regexp="\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d")
- public String getCreditCardNumber() {
- return creditCardNumber;
- }
-
- /**
- * @param creditCardNumber the creditCardNumber to set
- */
- public void setCreditCardNumber(String creditCardNumber) {
- this.creditCardNumber = creditCardNumber;
- }
-
- /**
- * @return the text
- */
-// @Email
-// @Pattern(regexp="^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9](a)[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$")
- public String getEmail() {
- return email;
- }
-
- /**
- * @param text the text to set
- */
- public void setEmail(String text) {
- this.email = text;
- }
-
-}
\ No newline at end of file
+package org.richfaces.example;
+
+public class Bean {
+
+ public static final String FOO_VALUE = "fooValue";
+
+ private String value=FOO_VALUE;
+
+ /**
+ * @return the value
+ */
+ public String getValue() {
+ return value;
+ }
+ /**
+ * @param value the value to set
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
Added:
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/CustomValidator.java
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/CustomValidator.java
(rev 0)
+++
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/CustomValidator.java 2010-12-19
06:02:48 UTC (rev 20677)
@@ -0,0 +1,39 @@
+/*
+ * $Id$
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.richfaces.example;
+
+import javax.faces.validator.LengthValidator;
+
+/**
+ * <p class="changed_added_4_0"></p>
+ * @author asmirnov(a)exadel.com
+ *
+ */
+public class CustomValidator extends LengthValidator {
+
+ public CustomValidator() {
+ setMinimum(1);
+ setMaximum(3);
+ }
+}
Property changes on:
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/CustomValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Deleted:
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/DataBean.java
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/DataBean.java 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/DataBean.java 2010-12-19
06:02:48 UTC (rev 20677)
@@ -1,49 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.validation.Valid;
-import javax.validation.constraints.Max;
-
-
-/**
- * @author asmirnov
- *
- */
-public class DataBean {
-
- private final List<Validable> beans;
-
- /**
- * @return the beans
- */
- @Valid
- public List<Validable> getBeans() {
- return beans;
- }
-
- public DataBean() {
- beans = new ArrayList<Validable>(6);
- beans.add(new NotNullBean());
- beans.add(new NotEmptyBean());
- beans.add(new LengthBean());
- beans.add(new MinBean());
- beans.add(new MaxBean());
- beans.add(new MinMaxBean());
- }
-
- @Max(value=20,message="Total value should be less then 20")
- public int getTotal(){
- int total = 0;
- for (Validable bean : beans) {
- total += bean.getIntValue();
- }
- return total;
- }
-
-
-}
Deleted:
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/GraphValidatorBean.java
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/GraphValidatorBean.java 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/GraphValidatorBean.java 2010-12-19
06:02:48 UTC (rev 20677)
@@ -1,99 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-
-
-/**
- * @author asmirnov
- *
- */
-public class GraphValidatorBean implements Cloneable {
-
- @Min(0)
- @Max(10)
- private int first ;
-
- @Min(value=5,message="Value {0} should be more than {value}")
- @Max(15)
- private int second ;
-
- @Min(0)
- @Max(20)
- private int third ;
-
- private String actionResult;
-
- /**
- * @return the actionResult
- */
- public String getActionResult() {
- return actionResult;
- }
-
- /**
- * @param actionResult the actionResult to set
- */
- public void setActionResult(String actionResult) {
- this.actionResult = actionResult;
- }
-
- /**
- * @return the first
- */
- public int getFirst() {
- return first;
- }
-
- /**
- * @param first the first to set
- */
- public void setFirst(int first) {
- this.first = first;
- }
-
- /**
- * @return the second
- */
- public int getSecond() {
- return second;
- }
-
- /**
- * @param second the second to set
- */
- public void setSecond(int second) {
- this.second = second;
- }
-
- /**
- * @return the third
- */
- public int getThird() {
- return third;
- }
-
- /**
- * @param third the third to set
- */
- public void setThird(int third) {
- this.third = third;
- }
-
- /**
- * @return total summ of the list values.
- */
- @Max(value=20,message="Total value should be less then 20")
- public int getSumm(){
- return first+second+third;
- }
-
- public String action() {
- // Persist your data here
- setActionResult("Data have been saved");
- return "ok";
- }
-}
Deleted:
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/LengthBean.java
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/LengthBean.java 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/LengthBean.java 2010-12-19
06:02:48 UTC (rev 20677)
@@ -1,64 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-import javax.validation.constraints.Size;
-
-
-/**
- * @author asmirnov
- *
- */
-public class LengthBean implements Validable {
-
- @Size(max=10,min=2,message="incorrect field length")
- private String text;
-
- private int intValue;
-
- /**
- * @return the text
- */
- public String getText() {
- return text;
- }
-
- /**
- * @param text the text to set
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * @return the intValue
- */
- public int getIntValue() {
- return intValue;
- }
-
- /**
- * @param intValue the intValue to set
- */
- public void setIntValue(int intValue) {
- this.intValue = intValue;
- }
-
- public String getTextDescription() {
- return "Validate String Length, for a range 2-10 chars";
- }
-
- public String getIntDescription() {
- return "Integer Value, no restrictions";
- }
-
- public String getIntSummary() {
- return "Invalid user name";
- }
-
- public String getTextSummary() {
- return "Invalid user name";
- }
-
-}
Deleted:
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MaxBean.java
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MaxBean.java 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MaxBean.java 2010-12-19
06:02:48 UTC (rev 20677)
@@ -1,69 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Pattern;
-
-/**
- * @author asmirnov
- *
- */
-public class MaxBean implements Validable {
-
- private String text;
-
- @Max(10)
- private int intValue;
-
- /**
- * @return the text
- */
-// @CreditCardNumber
- @Pattern(regexp="\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d")
- public String getText() {
- return text;
- }
-
- /**
- * @param text the text to set
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * @return the intValue
- */
- public int getIntValue() {
- return intValue;
- }
-
- /**
- * @param intValue the intValue to set
- */
- public void setIntValue(int intValue) {
- this.intValue = intValue;
- }
-
- public String getTextDescription() {
- return "Text value, should be correct credit card number";
- }
-
- public String getIntDescription() {
- // TODO Auto-generated method stub
- return "Integer Value, less then 10";
- }
-
- public String getIntSummary() {
- // TODO Auto-generated method stub
- return "Invalid number of items";
- }
-
- public String getTextSummary() {
- // TODO Auto-generated method stub
- return "Invalid payment card";
- }
-
-}
Deleted:
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MinBean.java
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MinBean.java 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MinBean.java 2010-12-19
06:02:48 UTC (rev 20677)
@@ -1,66 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-import javax.validation.constraints.Min;
-
-/**
- * @author asmirnov
- *
- */
-public class MinBean implements Validable {
-
- private String text;
-
- @Min(2)
- private int intValue;
-
- /**
- * @return the text
- */
- public String getText() {
- return text;
- }
-
- /**
- * @param text the text to set
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * @return the intValue
- */
- public int getIntValue() {
- return intValue;
- }
-
- /**
- * @param intValue the intValue to set
- */
- public void setIntValue(int intValue) {
- this.intValue = intValue;
- }
-
- public String getTextDescription() {
- return "Text value, no restrictions";
- }
-
- public String getIntDescription() {
- // TODO Auto-generated method stub
- return "Integer Value, more then 1";
- }
-
- public String getIntSummary() {
- // TODO Auto-generated method stub
- return "Invalid rooms qty";
- }
-
- public String getTextSummary() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
Deleted:
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MinMaxBean.java
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MinMaxBean.java 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/MinMaxBean.java 2010-12-19
06:02:48 UTC (rev 20677)
@@ -1,68 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-
-/**
- * @author asmirnov
- *
- */
-public class MinMaxBean implements Validable {
-
- private String text;
-
- @Min(value=2,message="Value {0} should be more than {value}")
- @Max(10)
- private int intValue;
-
- /**
- * @return the text
- */
- public String getText() {
- return text;
- }
-
- /**
- * @param text the text to set
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * @return the intValue
- */
- public int getIntValue() {
- return intValue;
- }
-
- /**
- * @param intValue the intValue to set
- */
- public void setIntValue(int intValue) {
- this.intValue = intValue;
- }
-
- public String getTextDescription() {
- return "Text Value, no restrictions";
- }
-
- public String getIntDescription() {
- // TODO Auto-generated method stub
- return "Integer Value, valid values from 2 to 10";
- }
-
- public String getIntSummary() {
- // TODO Auto-generated method stub
- return "Invalid price";
- }
-
- public String getTextSummary() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
Deleted:
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/NotEmptyBean.java
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/NotEmptyBean.java 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/NotEmptyBean.java 2010-12-19
06:02:48 UTC (rev 20677)
@@ -1,67 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-import javax.validation.constraints.Size;
-
-
-/**
- * @author asmirnov
- *
- */
-public class NotEmptyBean implements Validable {
-
- @Size(min=1)
- private String text;
-
- private int intValue;
-
- /**
- * @return the text
- */
- public String getText() {
- return text;
- }
-
- /**
- * @param text the text to set
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * @return the intValue
- */
- public int getIntValue() {
- return intValue;
- }
-
- /**
- * @param intValue the intValue to set
- */
- public void setIntValue(int intValue) {
- this.intValue = intValue;
- }
-
- public String getTextDescription() {
- return "Text value, Not Empty Validation";
- }
-
- public String getIntDescription() {
- // TODO Auto-generated method stub
- return "Integer Value, no restrictions";
- }
-
- public String getIntSummary() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getTextSummary() {
- // TODO Auto-generated method stub
- return "Invalid password";
- }
-
-}
Deleted:
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/NotNullBean.java
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/NotNullBean.java 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/NotNullBean.java 2010-12-19
06:02:48 UTC (rev 20677)
@@ -1,66 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @author asmirnov
- *
- */
-public class NotNullBean implements Validable {
-
- @NotNull
- private String text;
-
- private int intValue;
-
- /**
- * @return the text
- */
- public String getText() {
- return text;
- }
-
- /**
- * @param text the text to set
- */
- public void setText(String text) {
- this.text = text;
- }
-
- /**
- * @return the intValue
- */
- public int getIntValue() {
- return intValue;
- }
-
- /**
- * @param intValue the intValue to set
- */
- public void setIntValue(int intValue) {
- this.intValue = intValue;
- }
-
- public String getTextDescription() {
- return "Text Value, Not Null Validation";
- }
-
- public String getIntDescription() {
- // TODO Auto-generated method stub
- return "Integer Value, no restrictions";
- }
-
- public String getIntSummary() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getTextSummary() {
- // TODO Auto-generated method stub
- return "Invalid address";
- }
-
-}
Deleted:
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/Validable.java
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/Validable.java 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/examples/validator-demo/src/main/java/org/richfaces/example/Validable.java 2010-12-19
06:02:48 UTC (rev 20677)
@@ -1,21 +0,0 @@
-/**
- *
- */
-package org.richfaces.example;
-
-/**
- * @author asmirnov
- *
- */
-public interface Validable {
-
- public String getText();
-
- public String getTextDescription();
-
- public String getTextSummary();
-
- public int getIntValue();
-
- public String getIntSummary();
-}
Modified:
branches/RF-7654/examples/validator-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/examples/validator-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-12-19
06:02:48 UTC (rev 20677)
@@ -1,6 +1,14 @@
<?xml version="1.0"?>
<faces-config version="2.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
+<managed-bean>
+ <managed-bean-name>test</managed-bean-name>
+ <managed-bean-class>org.richfaces.example.Bean</managed-bean-class>
+ <managed-bean-scope>request</managed-bean-scope>
+</managed-bean>
+<validator>
+ <validator-id>custom</validator-id>
+ <validator-class>org.richfaces.example.CustomValidator</validator-class>
+</validator>
-
</faces-config>
Added:
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajax-validator.xhtml
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajax-validator.xhtml
(rev 0)
+++
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajax-validator.xhtml 2010-12-19
06:02:48 UTC (rev 20677)
@@ -0,0 +1,16 @@
+<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:csv="http://richfaces.org/csv">
+ <h:head><title>Ajax validator</title></h:head>
+ <h:body>
+ <h:form id="form">
+ <h:inputText id="text" value="#{test.value}">
+ <f:validator validatorId="custom" />
+ <csv:validator event="blur" />
+ </h:inputText>
+ <h:outputText id="out"
value="#{test.value}"></h:outputText>
+ <csv:message id="uiMessage" for="text" />
+ </h:form>
+ </h:body>
+</html>
Property changes on:
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajax-validator.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajaxValidation.xhtml
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajaxValidation.xhtml 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/ajaxValidation.xhtml 2010-12-19
06:02:48 UTC (rev 20677)
@@ -1,37 +0,0 @@
-<!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="http://richfaces.org/a4j"
-
xmlns:rich="http://richfaces.org/rich"
-
xmlns:s="http://jboss.com/products/seam/taglib"
-
xmlns:c="http://java.sun.com/jstl/core">
-<ui:composition template="/layout/template.xhtml">
- <ui:param name="title" value="<rich:ajaxValidator>
usage" />
- <ui:param name="javaBean" value="org/richfaces/example/Bean.java"
/>
- <!-- Page header -->
- <ui:define name="header">
- <h1><rich:ajaxValidator> usage</h1>
- </ui:define>
- <!-- content -->
- <ui:define name="content">
- <h:form id="form">
- <h:panelGrid columns="3">
- <h:outputLabel for="email" value="Email Address:" />
- <h:inputText id="email" value="#{bean.email}"
label="Email">
- <rich:ajaxValidator event="onkeyup" summary="Invalid Email
address" profiles="javax.validation.groups.Default"/>
- </h:inputText>
- <rich:message for="email"/>
- <h:outputLabel for="card" value="Credit card number:" />
- <h:inputText id="card" value="#{bean.creditCardNumber}"
label="Credit card">
- <rich:ajaxValidator event="onkeyup" summary="Invalid credit card
number" profiles="javax.validation.groups.Default"/>
- </h:inputText>
- <rich:message for="card"/>
- </h:panelGrid>
- <h:commandButton value="Submit"></h:commandButton>
- <rich:messages/>
- </h:form>
- </ui:define>
-</ui:composition>
-</html>
\ No newline at end of file
Deleted:
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/beanValidation.xhtml
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/beanValidation.xhtml 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/beanValidation.xhtml 2010-12-19
06:02:48 UTC (rev 20677)
@@ -1,37 +0,0 @@
-<!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="http://richfaces.org/a4j"
-
xmlns:rich="http://richfaces.org/rich"
-
xmlns:s="http://jboss.com/products/seam/taglib"
-
xmlns:c="http://java.sun.com/jstl/core">
-<ui:composition template="/layout/template.xhtml">
- <ui:param name="title" value="<rich:beanValidator>
usage" />
- <ui:param name="javaBean" value="org/richfaces/example/Bean.java"
/>
- <!-- Page header -->
- <ui:define name="header">
- <h1><rich:beanValidator> usage</h1>
- </ui:define>
- <!-- content -->
- <ui:define name="content">
- <h:form id="form">
- <h:panelGrid columns="3">
- <h:outputLabel for="email" value="Email Address:" />
- <h:inputText id="email" value="#{bean.email}"
label="Email">
- <rich:beanValidator summary="Invalid Email address" />
- </h:inputText>
- <rich:message for="email"/>
- <h:outputLabel for="card" value="Credit card number:" />
- <h:inputText id="card" value="#{bean.creditCardNumber}"
label="Credit card">
- <rich:beanValidator summary="Invalid credit card number"
profiles="javax.validation.groups.Default"/>
- </h:inputText>
- <rich:message for="card"/>
- </h:panelGrid>
- <h:commandButton value="Submit"></h:commandButton>
- <rich:messages/>
- </h:form>
- </ui:define>
-</ui:composition>
-</html>
Added:
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/client-validator.xhtml
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/client-validator.xhtml
(rev 0)
+++
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/client-validator.xhtml 2010-12-19
06:02:48 UTC (rev 20677)
@@ -0,0 +1,16 @@
+<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:csv="http://richfaces.org/csv">
+ <h:head><title>Client Side Validator</title></h:head>
+ <h:body>
+ <h:form id="form">
+ <h:inputText id="text" value="#{test.value}">
+ <f:validateLength minimum="1" maximum="3"/>
+ <csv:validator event="blur" />
+ </h:inputText>
+ <h:outputText id="out"
value="#{test.value}"></h:outputText>
+ <csv:message id="uiMessage" for="text" />
+ </h:form>
+ </h:body>
+</html>
Property changes on:
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/client-validator.xhtml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/graphValidation.xhtml
===================================================================
---
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/graphValidation.xhtml 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/examples/validator-demo/src/main/webapp/examples/graphValidation.xhtml 2010-12-19
06:02:48 UTC (rev 20677)
@@ -1,59 +0,0 @@
-<!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="http://richfaces.org/a4j"
-
xmlns:rich="http://richfaces.org/rich"
-
xmlns:s="http://jboss.com/products/seam/taglib"
-
xmlns:c="http://java.sun.com/jstl/core">
-<ui:composition template="/layout/template.xhtml">
- <ui:param name="title" value="<rich:graphValidator>
usage" />
- <ui:param name="javaBean"
value="org/richfaces/example/GraphValidatorBean.java" />
- <!-- Page header -->
- <ui:define name="header">
- <h1><rich:graphValidator> usage</h1>
- </ui:define>
- <!-- content -->
- <ui:define name="description">
- <p>In that sampe <rich:graphValidator> component appends
JSR-303 or Hibernate validators to all enclosed input components
- that check restrictions for field values, and, in addition, validates whole
bean.</p>
- <p>JSF bean fields are annotated with @Min/@Max restrictions and getter for
the 'total' attribute is also annotated by the @Max</p>
- <p>As a result, even valid field values would make whole bean an invalid.
For example, values '2','7','15' are valid for fields values but
their sum exceed maximum total value '20'</p>
- <p>Validator assignes new values to a cloned bean instance hence model is
not updated with invalid values.</p>
- </ui:define>
- <ui:define name="content">
- <h:form id="form">
- <rich:graphValidator value="#{graphValidatorBean}"
id="validator" profiles="javax.validation.groups.Default">
- <h:panelGrid columns="4">
- <h:outputText value=""/>
- <h:outputText value="Input"/>
- <h:outputText value="Message"/>
- <h:outputText value="Model value"/>
-
- <h:outputLabel for="value0" value="First value, integer from 0 to
10:" />
- <h:inputText id="value0" value="#{graphValidatorBean.first}"
label="First" />
- <rich:message for="value0"/>
- <h:outputText value="#{graphValidatorBean.first}"/>
-
- <h:outputLabel for="value1" value="Second value,integer from 5 to
15:" />
- <h:inputText id="value1" value="#{graphValidatorBean.second}"
label="Second" />
- <rich:message for="value1"/>
- <h:outputText value="#{graphValidatorBean.second}"/>
-
- <h:outputLabel for="value2" value="Third value,integer from 0 to
20:" />
- <h:inputText id="value2" value="#{graphValidatorBean.third}"
label="Third" />
- <rich:message for="value2"/>
- <h:outputText value="#{graphValidatorBean.third}"/>
-
- <h:outputLabel for="total" value="Total, should be no more then
20:" />
- <h:outputText id="total"
value="#{graphValidatorBean.summ}"/>
- </h:panelGrid>
- <h:commandButton value="Submit"
action="#{graphValidatorBean.action}"></h:commandButton>
- <h:outputText id="result"
value="#{graphValidatorBean.actionResult}"/>
- </rich:graphValidator>
- <rich:messages/>
- </h:form>
- </ui:define>
-</ui:composition>
-</html>
\ No newline at end of file
Modified:
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/AjaxValidationTest.java
===================================================================
---
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/AjaxValidationTest.java 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/AjaxValidationTest.java 2010-12-19
06:02:48 UTC (rev 20677)
@@ -69,7 +69,7 @@
HtmlInput input = getInput(page);
input.setValueAttribute(value);
input.fireEvent("blur");
- HtmlElement message = page.getElementById("form:uiMessage");
+ HtmlElement message = page.getElementById("uiMessage");
assertThat(message.getTextContent(), matcher);
// System.out.println(page.asXml());
}
Modified:
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/ClientValidationTest.java
===================================================================
---
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/ClientValidationTest.java 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/component/ClientValidationTest.java 2010-12-19
06:02:48 UTC (rev 20677)
@@ -71,7 +71,7 @@
page = (HtmlPage) input.setValueAttribute(value);
input.fireEvent("blur");
System.out.println(page.asXml());
- HtmlElement message = page.getElementById("form:uiMessage");
+ HtmlElement message = page.getElementById("uiMessage");
assertThat(message.getTextContent(), matcher);
}
Deleted:
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/TestCriteria.java
===================================================================
---
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/TestCriteria.java 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/TestCriteria.java 2010-12-19
06:02:48 UTC (rev 20677)
@@ -1,33 +0,0 @@
-package org.richfaces.javascript.client;
-
-import java.util.Map;
-
-import com.google.common.collect.Maps;
-
-public class TestCriteria {
-
- private final Object value;
-
- private final Map<String, Object> options = Maps.newHashMap();
-
- public TestCriteria(Object value) {
- this.value = value;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the string
- */
- public Object getValue() {
- return value;
- }
-
- /**
- * <p class="changed_added_4_0"></p>
- * @return the options
- */
- public Map<String, Object> getOptions() {
- return options;
- }
-
-}
Modified:
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java
===================================================================
---
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/DocumentReadyTest.java 2010-12-19
06:02:48 UTC (rev 20677)
@@ -29,6 +29,7 @@
import org.junit.Test;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.javascript.host.Event;
/**
* <p class="changed_added_4_0"></p>
@@ -53,6 +54,6 @@
@Test
public void testUnload() throws Exception {
sendMessage();
- qunit.getPage().getDocumentElement().fireEvent("unload");
+ qunit.getPage().getDocumentElement().fireEvent(Event.TYPE_UNLOAD);
}
}
Modified:
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java
===================================================================
---
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/ui/validator/ui/src/test/java/org/richfaces/javascript/client/message/MessageTestBase.java 2010-12-19
06:02:48 UTC (rev 20677)
@@ -8,6 +8,7 @@
import org.junit.Rule;
import org.richfaces.javascript.Message;
+import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
@@ -31,9 +32,15 @@
}
protected Builder createQunitPage() {
- return
Qunit.builder().loadJsfResource("jquery.js").loadJsfResource("richfaces.js")
+ return
Qunit.builder().emulate(BrowserVersion.FIREFOX_3_6).loadJsfResource("jquery.js").loadJsfResource("richfaces.js")
.loadJsfResource("richfaces-event.js").loadJsfResource("richfaces-base-component.js").
- loadJsfResource("csv.js",
"org.richfaces").loadJsfResource("message.js",
"org.richfaces").content("<div id=\"foo\" ><ul
id=\"" + MY_MESSAGE +
"\">"+getMessageContent()+"</ul></div>");
+ loadJsfResource("csv.js",
"org.richfaces").loadJsfResource("message.js",
"org.richfaces").content(/*"<form id=\"form\"
name=\"form\" method=\"post\" action=\"/client-test.jsf\"
enctype=\"application/x-www-form-urlencoded\">\n" + */
+ " <input type=\"hidden\" name=\"form\"
value=\"form\"/>\n" +
+ " <input id=\"form:text\" type=\"text\"
name=\"form:text\" value=\"fooValue\"
onblur=\"form_3Atext_3Av("form:text",this,event)\"/>\n"
+
+ " <span id=\"form:out\">\n" +
+ " fooValue\n" +
+ " </span><div id=\"foo\" ><ul
id=\"" + MY_MESSAGE +
"\">"+getMessageContent()+"</ul></div><input
type=\"hidden\" name=\"javax.faces.ViewState\"
id=\"javax.faces.ViewState\"
value=\"4262028796446907996:-2607792463910755035\"
autocomplete=\"off\"/>\n"
+ /*+ " </form>"*/);
}
Modified:
branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/client-test.xhtml
===================================================================
---
branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/client-test.xhtml 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/client-test.xhtml 2010-12-19
06:02:48 UTC (rev 20677)
@@ -10,7 +10,7 @@
<csv:validator event="blur" />
</h:inputText>
<h:outputText id="out"
value="#{test.value}"></h:outputText>
- <csv:message id="uiMessage" for="text" />
</h:form>
+ <csv:message id="uiMessage" for="text" />
</h:body>
</html>
Modified:
branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/test.xhtml
===================================================================
---
branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/test.xhtml 2010-12-18
00:39:32 UTC (rev 20676)
+++
branches/RF-7654/ui/validator/ui/src/test/resources/org/richfaces/component/test.xhtml 2010-12-19
06:02:48 UTC (rev 20677)
@@ -10,7 +10,7 @@
<csv:validator event="blur" />
</h:inputText>
<h:outputText id="out"
value="#{test.value}"></h:outputText>
- <csv:message id="uiMessage" for="text" />
</h:form>
+ <csv:message id="uiMessage" for="text" />
</h:body>
</html>