Author: ilya_shaikovsky
Date: 2010-11-05 07:55:06 -0400 (Fri, 05 Nov 2010)
New Revision: 19947
Added:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/validation/ValidationBean.java
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/clientValidation/
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/clientValidation/ajaxValidation.xhtml
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/clientValidation/samples/
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/clientValidation/samples/ajaxValidation-sample.xhtml
Modified:
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml
Log:
accordion switchtype changed to client for better performance of simple sample
Added:
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/validation/ValidationBean.java
===================================================================
---
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/validation/ValidationBean.java
(rev 0)
+++
trunk/examples/richfaces-showcase/src/main/java/org/richfaces/demo/validation/ValidationBean.java 2010-11-05
11:55:06 UTC (rev 19947)
@@ -0,0 +1,88 @@
+/**
+ *
+ */
+package org.richfaces.demo.validation;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.RequestScoped;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import javax.validation.groups.Default;
+
+import org.hibernate.validator.constraints.Email;
+import org.hibernate.validator.constraints.Length;
+import org.hibernate.validator.constraints.NotEmpty;
+
+/**
+ * @author Ilya Shaikovsky
+ *
+ */
+@ManagedBean
+@RequestScoped
+public class ValidationBean {
+ private static final Class<?>[] DEFAULT_GROUP = { Default.class };
+ private String progressString = "Fill the form please";
+
+ // @NotEmpty
+ // @Pattern(regexp=".*[^\\s].*", message="This string contain only
spaces")
+ @Length(min = 3, max = 12)
+ private String name;
+ @Email
+ @NotEmpty
+ private String email;
+
+ @NotNull
+ @Min(18)
+ @Max(100)
+ private Integer age;
+
+ public List<String> getRender() {
+ List<String> res = new ArrayList<String>();
+ res.add("msg");
+ return res;
+ }
+
+ public Class[] getGroups() {
+ return DEFAULT_GROUP;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public Integer getAge() {
+ return age;
+ }
+
+ public void setAge(Integer age) {
+ this.age = age;
+ }
+
+ public void success() {
+ setProgressString(getProgressString() + "(Strored successfully)");
+ }
+
+ public String getProgressString() {
+ return progressString;
+ }
+
+ public void setProgressString(String progressString) {
+ this.progressString = progressString;
+ }
+}
Modified:
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml
===================================================================
---
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml 2010-11-05
11:46:40 UTC (rev 19946)
+++
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/accordion/samples/simple-sample.xhtml 2010-11-05
11:55:06 UTC (rev 19947)
@@ -14,7 +14,7 @@
}
</style>
<h:form>
- <rich:accordion>
+ <rich:accordion switchType="client">
<rich:accordionItem header="Overview:">
<h:graphicImage value="/images/icons/common/rf.png"
style="float:right" />
Added:
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/clientValidation/ajaxValidation.xhtml
===================================================================
---
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/clientValidation/ajaxValidation.xhtml
(rev 0)
+++
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/clientValidation/ajaxValidation.xhtml 2010-11-05
11:55:06 UTC (rev 19947)
@@ -0,0 +1,19 @@
+<!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">
+
+<ui:composition>
+ <p>DESC</p>
+
+ <ui:include src="#{demoNavigator.sampleIncludeURI}" />
+ <ui:include src="/templates/includes/source-view.xhtml">
+ <ui:param name="src" value="#{demoNavigator.sampleIncludeURI}"
/>
+ <ui:param name="sourceType" value="xhtml" />
+ <ui:param name="openLabel" value="View Source" />
+ <ui:param name="hideLabel" value="Hide Source" />
+ </ui:include>
+</ui:composition>
+
+</html>
\ No newline at end of file
Added:
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/clientValidation/samples/ajaxValidation-sample.xhtml
===================================================================
---
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/clientValidation/samples/ajaxValidation-sample.xhtml
(rev 0)
+++
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/clientValidation/samples/ajaxValidation-sample.xhtml 2010-11-05
11:55:06 UTC (rev 19947)
@@ -0,0 +1,27 @@
+<!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:a4j="http://richfaces.org/a4j"
+
xmlns:rich="http://richfaces.org/rich">
+
+ <h:form id="clientValidatorForm2">
+ <a4j:outputPanel ajaxRendered="true">
+ <h:messages id="msg"/>
+ </a4j:outputPanel>
+ <rich:panel>
+ <f:facet name="header">
+ <h:outputText value="User Info:" />
+ </f:facet>
+ <h:panelGrid columns="3">
+ <h:outputText value="Name:" />
+ <h:inputText value="#{validationBean.name}"
id="name" required="true" >
+ <rich:validator groups="#{validationBean.groups}"
render="#{validationBean.render}"/>
+ </h:inputText>
+
+ </h:panelGrid>
+ </rich:panel>
+ </h:form>
+ <a4j:commandButton></a4j:commandButton>
+</ui:composition>
\ No newline at end of file