Author: alexsmirnov
Date: 2011-03-07 15:17:43 -0500 (Mon, 07 Mar 2011)
New Revision: 22078
Added:
trunk/examples/validator-demo/src/main/java/org/richfaces/example/BooleanBean.java
trunk/examples/validator-demo/src/main/java/org/richfaces/example/PasswordValidationBean.java
trunk/examples/validator-demo/src/main/webapp/examples/passwordValidation.xhtml
trunk/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/
trunk/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test.xhtml
trunk/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test1.xhtml
trunk/examples/validator-demo/src/main/webapp/richfaces/
trunk/examples/validator-demo/src/main/webapp/richfaces/graphValidator/
trunk/examples/validator-demo/src/main/webapp/richfaces/graphValidator/samples/
Removed:
trunk/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test.xhtml
trunk/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test1.xhtml
trunk/examples/validator-demo/src/main/webapp/richfaces/graphValidator/
trunk/examples/validator-demo/src/main/webapp/richfaces/graphValidator/samples/
Modified:
trunk/examples/validator-demo/
trunk/examples/validator-demo/src/main/webapp/WEB-INF/faces-config.xml
trunk/examples/validator-demo/src/main/webapp/examples/beanValidation.xhtml
Log:
Merge changes from 4.0.x
Property changes on: trunk/examples/validator-demo
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/4.0.X/examples/validator-demo:21810-22077
Copied: trunk/examples/validator-demo/src/main/java/org/richfaces/example/BooleanBean.java
(from rev 22077,
branches/4.0.X/examples/validator-demo/src/main/java/org/richfaces/example/BooleanBean.java)
===================================================================
--- trunk/examples/validator-demo/src/main/java/org/richfaces/example/BooleanBean.java
(rev 0)
+++
trunk/examples/validator-demo/src/main/java/org/richfaces/example/BooleanBean.java 2011-03-07
20:17:43 UTC (rev 22078)
@@ -0,0 +1,41 @@
+/**
+ *
+ */
+package org.richfaces.example;
+
+import javax.validation.constraints.AssertTrue;
+
+
+/**
+ * @author asmirnov
+ *
+ */
+public class BooleanBean extends Validable<Boolean> {
+
+ @AssertTrue()
+ private Boolean value = false;
+
+ /**
+ * @return the intValue
+ */
+ public Boolean getValue() {
+ return value;
+ }
+
+ /**
+ * @param intValue the intValue to set
+ */
+ public void setValue(Boolean intValue) {
+ this.value = intValue;
+ }
+
+
+ public String getDescription() {
+ return "Boolean Value, should be true";
+ }
+
+ public String getLabel() {
+ return "assertTrue";
+ }
+
+}
Copied:
trunk/examples/validator-demo/src/main/java/org/richfaces/example/PasswordValidationBean.java
(from rev 22077,
branches/4.0.X/examples/validator-demo/src/main/java/org/richfaces/example/PasswordValidationBean.java)
===================================================================
---
trunk/examples/validator-demo/src/main/java/org/richfaces/example/PasswordValidationBean.java
(rev 0)
+++
trunk/examples/validator-demo/src/main/java/org/richfaces/example/PasswordValidationBean.java 2011-03-07
20:17:43 UTC (rev 22078)
@@ -0,0 +1,49 @@
+package org.richfaces.example;
+
+import java.io.Serializable;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import javax.faces.context.FacesContext;
+import javax.validation.constraints.AssertTrue;
+import javax.validation.constraints.Size;
+
+@ManagedBean
+@SessionScoped
+public class PasswordValidationBean implements Cloneable, Serializable{
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1952428504080910113L;
+ @Size(min = 5, max = 15, message = "Wrong size for password")
+ private String password="";
+ @Size(min = 5, max = 15, message = "Wrong size for confirmation")
+ private String confirm="";
+
+ @AssertTrue(message = "Different passwords entered!")
+ public boolean isPasswordsEquals() {
+ return password.equals(confirm);
+ }
+
+ public void storeNewPassword() {
+ FacesContext.getCurrentInstance().addMessage(null,
+ new FacesMessage(FacesMessage.SEVERITY_INFO, "Succesfully
changed!", "Succesfully changed!"));
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public void setConfirm(String confirm) {
+ this.confirm = confirm;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public String getConfirm() {
+ return confirm;
+ }
+}
Modified: trunk/examples/validator-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/examples/validator-demo/src/main/webapp/WEB-INF/faces-config.xml 2011-03-07
20:14:44 UTC (rev 22077)
+++ trunk/examples/validator-demo/src/main/webapp/WEB-INF/faces-config.xml 2011-03-07
20:17:43 UTC (rev 22078)
@@ -16,6 +16,11 @@
<managed-bean-class>org.richfaces.example.DataBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+<managed-bean>
+ <managed-bean-name>booleanBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.example.BooleanBean</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>
Modified: trunk/examples/validator-demo/src/main/webapp/examples/beanValidation.xhtml
===================================================================
--- trunk/examples/validator-demo/src/main/webapp/examples/beanValidation.xhtml 2011-03-07
20:14:44 UTC (rev 22077)
+++ trunk/examples/validator-demo/src/main/webapp/examples/beanValidation.xhtml 2011-03-07
20:17:43 UTC (rev 22078)
@@ -15,12 +15,17 @@
<h:form id="form">
<h:panelGrid columns="3">
<c:forEach items="#{dataBean.beans}" var="bean">
- <h:outputLabel for="#{bean.label}"
value="#{bean.description}" />
- <h:inputText id="#{bean.label}" value="#{bean.value}"
label="#{bean.label}" converter="#{bean.converter}">
+ <h:outputLabel for="${bean.label}"
value="#{bean.description}" />
+ <h:inputText id="${bean.label}" value="#{bean.value}"
label="#{bean.label}" converter="#{bean.converter}">
<csv:validator summary="Invalid value" />
</h:inputText>
- <csv:message for="#{bean.label}" />
+ <csv:message for="${bean.label}" />
</c:forEach>
+ <h:outputLabel for="assertTrue"
value="#{booleanBean.description}" />
+ <h:selectBooleanCheckbox id="assertTrue"
value="#{booleanBean.value}" label="#{booleanBean.label}" >
+ <csv:validator summary="Required checkbox" />
+ </h:selectBooleanCheckbox>
+ <csv:message for="assertTrue" />
</h:panelGrid>
<h:commandButton value="Submit"></h:commandButton>
<csv:messages />
Copied: trunk/examples/validator-demo/src/main/webapp/examples/passwordValidation.xhtml
(from rev 22077,
branches/4.0.X/examples/validator-demo/src/main/webapp/examples/passwordValidation.xhtml)
===================================================================
--- trunk/examples/validator-demo/src/main/webapp/examples/passwordValidation.xhtml
(rev 0)
+++
trunk/examples/validator-demo/src/main/webapp/examples/passwordValidation.xhtml 2011-03-07
20:17:43 UTC (rev 22078)
@@ -0,0 +1,91 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:rich="http://richfaces.org/csv"
+
xmlns:rc="http://java.sun.com/jsf/composite/org.richfaces.showcase&q...
+ template="/layout/template.xhtml">
+ <ui:param name="title" value="<csv:graphValidator>
password validation" />
+ <!-- Page header -->
+ <ui:define name="header">
+ <style>
+.red {
+ color: red;
+}
+
+.green {
+ color: green;
+}
+</style>
+ <h1><csv:graphValidator> usage, password validation</h1>
+ </ui:define>
+ <!-- content -->
+ <ui:define name="content">
+ <h:panelGrid columns="2">
+ <f:facet name="head">
+ <h:outputText value="Actual values in the
model"/>
+ </f:facet>
+ <h:outputText value="Password:"/><h:outputText
value="#{passwordValidationBean.password}"/>
+ <h:outputText
value="Confirmation:"/><h:outputText
value="#{passwordValidationBean.confirm}"/>
+ </h:panelGrid>
+ <h:form>
+ Simple
+ <rich:graphValidator value="#{passwordValidationBean}"
id="gv">
+ <rich:messages />
+ <h:panelGrid columns="3">
+ <h:outputText value="Enter new password:" />
+ <h:inputSecret value="#{passwordValidationBean.password}"
+ id="pass" />
+ <rich:message for="pass" />
+ <h:outputText value="Confirm the new password:" />
+ <h:inputSecret value="#{passwordValidationBean.confirm}"
id="conf" />
+ <rich:message for="conf" />
+ </h:panelGrid>
+
+ <!--
+ <rc:test password="#{passwordValidationBean.password}"
confirmation="#{passwordValidationBean.confirm}" />
+ <rc:test1 bean="#{passwordValidationBean}" />
+ -->
+
+
+ <h:commandButton value="Store changes"
+ action="#{passwordValidationBean.storeNewPassword}" />
+ </rich:graphValidator>
+ </h:form>
+ <hr />
+ <h:form>
+ Test
+ <rich:graphValidator value="#{passwordValidationBean}"
id="gv">
+ <rich:messages />
+ <rc:test password="#{passwordValidationBean.password}"
+ confirmation="#{passwordValidationBean.confirm}" />
+
+
+ <h:commandButton value="Store changes"
+ action="#{passwordValidationBean.storeNewPassword}" />
+ </rich:graphValidator>
+ </h:form>
+ <hr />
+ <h:form>
+ Test A
+ <rich:graphValidator value="#{passwordValidationBean}"
id="gv">
+ <rich:messages />
+ <rc:test />
+
+ <h:commandButton value="Store changes"
+ action="#{passwordValidationBean.storeNewPassword}" />
+ </rich:graphValidator>
+ </h:form>
+ <hr />
+ <h:form>
+ Test1
+ <rich:graphValidator value="#{passwordValidationBean}"
id="gv">
+ <rich:messages />
+ <rc:test1 bean="#{passwordValidationBean}" />
+ <h:commandButton value="Store changes"
+ action="#{passwordValidationBean.storeNewPassword}" />
+ </rich:graphValidator>
+ </h:form>
+ </ui:define>
+</ui:composition>
\ No newline at end of file
Deleted:
trunk/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test.xhtml
===================================================================
---
branches/4.0.X/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test.xhtml 2011-03-07
20:14:44 UTC (rev 22077)
+++
trunk/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test.xhtml 2011-03-07
20:17:43 UTC (rev 22078)
@@ -1,30 +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:h="http://java.sun.com/jsf/html"
-
xmlns:f="http://java.sun.com/jsf/core"
-
xmlns:ui="http://java.sun.com/jsf/facelets"
-
xmlns:c="http://java.sun.com/jsp/jstl/core"
-
xmlns:composite="http://java.sun.com/jsf/composite"
-
xmlns:rich="http://richfaces.org/csv"
- >
-<head>
-<title>panel</title>
-</head>
-<body>
-
-<composite:interface>
-</composite:interface>
-
-<composite:implementation>
- <h:panelGrid columns="3">
- <h:outputText value="Enter new password:" />
- <h:inputSecret value="#{cc.attrs.password}" id="pass" />
- <rich:message for="pass" />
- <h:outputText value="Confirm the new password:" />
- <h:inputSecret value="#{cc.attrs.confirmation}" id="conf"
/>
- <rich:message for="conf" />
- </h:panelGrid>
-</composite:implementation>
-</body>
-</html>
Copied:
trunk/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test.xhtml
(from rev 22077,
branches/4.0.X/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test.xhtml)
===================================================================
---
trunk/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test.xhtml
(rev 0)
+++
trunk/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test.xhtml 2011-03-07
20:17:43 UTC (rev 22078)
@@ -0,0 +1,30 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:c="http://java.sun.com/jsp/jstl/core"
+
xmlns:composite="http://java.sun.com/jsf/composite"
+
xmlns:rich="http://richfaces.org/csv"
+ >
+<head>
+<title>panel</title>
+</head>
+<body>
+
+<composite:interface>
+</composite:interface>
+
+<composite:implementation>
+ <h:panelGrid columns="3">
+ <h:outputText value="Enter new password:" />
+ <h:inputSecret value="#{cc.attrs.password}" id="pass" />
+ <rich:message for="pass" />
+ <h:outputText value="Confirm the new password:" />
+ <h:inputSecret value="#{cc.attrs.confirmation}" id="conf"
/>
+ <rich:message for="conf" />
+ </h:panelGrid>
+</composite:implementation>
+</body>
+</html>
Deleted:
trunk/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test1.xhtml
===================================================================
---
branches/4.0.X/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test1.xhtml 2011-03-07
20:14:44 UTC (rev 22077)
+++
trunk/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test1.xhtml 2011-03-07
20:17:43 UTC (rev 22078)
@@ -1,40 +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:h="http://java.sun.com/jsf/html"
-
xmlns:f="http://java.sun.com/jsf/core"
-
xmlns:ui="http://java.sun.com/jsf/facelets"
-
xmlns:c="http://java.sun.com/jsp/jstl/core"
-
xmlns:composite="http://java.sun.com/jsf/composite"
-
xmlns:rich="http://richfaces.org/csv"
- >
-<head>
-<title>panel</title>
-</head>
-<body>
-
-<composite:interface>
- <composite:valueHolder targets="pass,conf" name="xxx" />
-</composite:interface>
-
-<composite:implementation>
- #{cc.attrs.bean} a
- <h:panelGrid columns="2">
- <f:facet name="head">
- <h:outputText value="Actual values in the
model"/>
- </f:facet>
- <h:outputText value="Password:"/><h:outputText
value="#{cc.attrs.bean.password}"/>
- <h:outputText
value="Confirmation:"/><h:outputText
value="#{cc.attrs.bean.confirm}"/>
- </h:panelGrid>
-
- <h:panelGrid columns="3">
- <h:outputText value="Enter new password:" />
- <h:inputSecret value="#{cc.attrs.bean.password}" id="pass"
/>
- <rich:message for="pass" />
- <h:outputText value="Confirm the new password:" />
- <h:inputSecret value="#{cc.attrs.bean.confirm}" id="conf"
/>
- <rich:message for="conf" />
- </h:panelGrid>
-</composite:implementation>
-</body>
-</html>
Copied:
trunk/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test1.xhtml
(from rev 22077,
branches/4.0.X/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test1.xhtml)
===================================================================
---
trunk/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test1.xhtml
(rev 0)
+++
trunk/examples/validator-demo/src/main/webapp/resources/org.richfaces.showcase/test1.xhtml 2011-03-07
20:17:43 UTC (rev 22078)
@@ -0,0 +1,40 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets"
+
xmlns:c="http://java.sun.com/jsp/jstl/core"
+
xmlns:composite="http://java.sun.com/jsf/composite"
+
xmlns:rich="http://richfaces.org/csv"
+ >
+<head>
+<title>panel</title>
+</head>
+<body>
+
+<composite:interface>
+ <composite:valueHolder targets="pass,conf" name="xxx" />
+</composite:interface>
+
+<composite:implementation>
+ #{cc.attrs.bean} a
+ <h:panelGrid columns="2">
+ <f:facet name="head">
+ <h:outputText value="Actual values in the
model"/>
+ </f:facet>
+ <h:outputText value="Password:"/><h:outputText
value="#{cc.attrs.bean.password}"/>
+ <h:outputText
value="Confirmation:"/><h:outputText
value="#{cc.attrs.bean.confirm}"/>
+ </h:panelGrid>
+
+ <h:panelGrid columns="3">
+ <h:outputText value="Enter new password:" />
+ <h:inputSecret value="#{cc.attrs.bean.password}" id="pass"
/>
+ <rich:message for="pass" />
+ <h:outputText value="Confirm the new password:" />
+ <h:inputSecret value="#{cc.attrs.bean.confirm}" id="conf"
/>
+ <rich:message for="conf" />
+ </h:panelGrid>
+</composite:implementation>
+</body>
+</html>