JBoss Rich Faces SVN: r14275 - in branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext: tags and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-05-22 05:39:30 -0400 (Fri, 22 May 2009)
New Revision: 14275
Added:
branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/ParagraphTag.java
Modified:
branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/HtmlToSeamTransformer.java
branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/HtmlTag.java
branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/LineTag.java
branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/TagFactory.java
Log:
Editor: "Preformatted" format problem in seamTextMode
https://jira.jboss.org/jira/browse/RF-7030
Modified: branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/HtmlToSeamTransformer.java
===================================================================
--- branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/HtmlToSeamTransformer.java 2009-05-22 09:01:35 UTC (rev 14274)
+++ branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/HtmlToSeamTransformer.java 2009-05-22 09:39:30 UTC (rev 14275)
@@ -35,8 +35,6 @@
private HtmlTag currentTag = null;
- private boolean isHeaderProcessed = false;
-
private boolean isFirstChars = false;
public Stack<HtmlTag> getHtmlElementStack() {
@@ -107,70 +105,80 @@
return false;
}
- public void text(char[] text, int start, int length) {
- if (isFirstChars) {
-// append(htmlElementStack.peek().printStartSuffix());
+ class StringCollector {
+ private int start = -1;
- while (text[start] == '\n' && length > 0) {
- start++;
- length--;
- }
- isFirstChars = false;
+ public StringCollector(int start) {
+ this.start = start;
}
+
+ public void inc() {
+ start++;
+ }
+
+ public void dec() {
+ start--;
+ }
+
+ public void clear() {
+ start = -1;
+ }
+
+ public int getStart() {
+ return start;
+ }
+ }
+
+ public void text(char[] text, int start, int length) {
+ int localStart = -1;
+
+ while (length > 0) {
+ switch (text[start]) {
+ case '*': case '|': case '^' : case '+':
+ case '=': case '#': case '\\': case '~':
+ case '[': case ']': case '`' :
+ case '<': case '>': case '&':
+ if (localStart != -1) {
+ out(text, localStart, start - localStart);
+ localStart = -1;
+ }
+
+ seamCharacters(text, start, 1);
+ break;
+ case '\n': case '\r':
+ if (localStart != -1) {
+ out(text, localStart, start - localStart);
+ localStart = -1;
+ }
- while (length > 0) {
- processChar(text, start, 1);
+ final HtmlTag token = htmlElementStack.peek();
+ if (!(HtmlToSeamSAXParser.ROOT_TAG_NAME.equals(token.getName())
+ || token.isList())) {
+ out(text, start, 1);
+ }
- setHeaderProcessed();
+ break;
+ default:
+ if (localStart == -1) {
+ localStart = start;
+ }
+ }
start ++;
length --;
}
+
+ if (localStart != -1) {
+ out(text, localStart, start - localStart);
+ localStart = -1;
+ }
}
- private void setHeaderProcessed() {
- final HtmlTag token = htmlElementStack.peek();
- if (!token.isParagraph() && isHeaderProcessed) {
- isHeaderProcessed = false;
- }
- }
-
- private void processChar(final char[] text, final int start, final int localLength) {
- switch (text[start]) {
- case '*': case '|': case '^' : case '+':
- case '=': case '#': case '\\': case '~':
- case '[': case ']': case '`' :
- case '<': case '>': case '&':
- seamCharacters(text, start, localLength);
- break;
-
- case '\n':
- final HtmlTag token = htmlElementStack.peek();
- if (!(/*token.isParagraph()
- ||*/ isHeaderProcessed
- || HtmlToSeamSAXParser.ROOT_TAG_NAME.equals(token.getName())
- || token.isList())) {
- out(text, start, localLength);
- }
-
- break;
- default:
- out(text, start, localLength);
- break;
- }
- }
-
public void seamCharacters(char[] text, int start, int length) {
appendBody(escapeSeamText(new String(text, start, length), preformatted));
}
- public void plain(char[] text, int start, int length) {
- out(text, start, length);
-
- setHeaderProcessed();
- }
-
public void out(char[] text, int start, int length) {
appendBody(new String(text, start, length));
}
@@ -228,11 +236,7 @@
if (tag.isLink()) {
value = "";
- } else if (tag.isParagraph()) {
- isHeaderProcessed = false;
- } else if (tag.isHeader()) {
- isHeaderProcessed = true;
- }
+ }
appendBody(value);
appendEnd();
Modified: branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/HtmlTag.java
===================================================================
--- branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/HtmlTag.java 2009-05-22 09:01:35 UTC (rev 14274)
+++ branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/HtmlTag.java 2009-05-22 09:39:30 UTC (rev 14275)
@@ -64,11 +64,12 @@
}
protected boolean isBreakLineChild(Object child) {
- if (!(child instanceof String)) {
+ if (child == null || !(child instanceof String)) {
return false;
}
+
final String str = (String) child;
- return "\r".equals(str) || "\n".equals(str) || "\r\n".equals(str);
+ return str.endsWith("\r") || str.endsWith("\n");
}
protected String printPlainStart(){
Modified: branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/LineTag.java
===================================================================
--- branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/LineTag.java 2009-05-22 09:01:35 UTC (rev 14274)
+++ branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/LineTag.java 2009-05-22 09:39:30 UTC (rev 14275)
@@ -26,7 +26,29 @@
return super.printPlain();
}
+ private boolean isFirstChars = true;
+
@Override
+ public void appendBody(String str) {
+ if (isFirstChars) {
+ char text[] = str.toCharArray();
+ int i = 0;
+ while (i < text.length && (text[i] == '\r' || text[i] == '\n')) {
+ i++;
+ }
+
+ if (i < text.length) {
+ super.appendBody(str.substring(i));
+ isFirstChars = false;
+ } else {
+ return;
+ }
+ } else {
+ super.appendBody(str);
+ }
+ }
+
+ @Override
protected void appendChildTag(StringBuilder res, HtmlTag child) {
if (child instanceof LineTag) {
res.append(((LineTag)child).printPlain());
@@ -36,6 +58,15 @@
}
@Override
+ protected String printBody() {
+ while (!isBodyEmpty() && isBreakLineChild(body.getLast())) {
+ body.removeLast();
+ }
+
+ return super.printBody();
+ }
+
+ @Override
public String printEnd() {
return "\n";
}
Added: branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/ParagraphTag.java
===================================================================
--- branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/ParagraphTag.java (rev 0)
+++ branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/ParagraphTag.java 2009-05-22 09:39:30 UTC (rev 14275)
@@ -0,0 +1,25 @@
+package org.richfaces.convert.seamtext.tags;
+
+public class ParagraphTag extends LineTag {
+
+ private static final long serialVersionUID = 1720000557944774249L;
+
+ protected ParagraphTag() {
+ super(P);
+ }
+
+ @Override
+ public String printStart() {
+ return "";
+ }
+
+ @Override
+ public String printEnd() {
+ return "\n\n";
+ }
+
+ @Override
+ public String printStartSuffix() {
+ return "";
+ }
+}
Modified: branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/TagFactory.java
===================================================================
--- branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/TagFactory.java 2009-05-22 09:01:35 UTC (rev 14274)
+++ branches/community/3.3.X/ui/editor/src/main/java/org/richfaces/convert/seamtext/tags/TagFactory.java 2009-05-22 09:39:30 UTC (rev 14275)
@@ -55,31 +55,7 @@
}
},
- new HtmlTag(P) {
- @Override
- public String printStart() {
- return "";
- }
-
- @Override
- protected String printBody() {
- while (isBreakLineChild(body.getLast())) {
- body.removeLast();
- }
-
- return super.printBody();
- }
-
- @Override
- public String printEnd() {
- return "\n\n";
- }
-
- @Override
- public String printStartSuffix() {
- return "";
- }
- },
+ new ParagraphTag(),
new FormattingTag(I, SEAM_STAR),
new FormattingTag(DEL, SEAM_TWIDDLE),
15 years, 1 month
JBoss Rich Faces SVN: r14274 - branches/community/3.3.X/ui/colorPicker/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-05-22 05:01:35 -0400 (Fri, 22 May 2009)
New Revision: 14274
Modified:
branches/community/3.3.X/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx
Log:
change alt="icon" to alt=""
Modified: branches/community/3.3.X/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx
===================================================================
--- branches/community/3.3.X/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx 2009-05-22 00:28:52 UTC (rev 14273)
+++ branches/community/3.3.X/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx 2009-05-22 09:01:35 UTC (rev 14274)
@@ -36,7 +36,7 @@
<jsp:scriptlet><![CDATA[
}else{
]]></jsp:scriptlet>
- <img src="#{arrow}" class="rich-color-picker-icon #{component.attributes['iconClass']}" style="#{component.attributes['iconStyle']}" alt="icon"/>
+ <img src="#{arrow}" class="rich-color-picker-icon #{component.attributes['iconClass']}" style="#{component.attributes['iconStyle']}" alt=""/>
<jsp:scriptlet><![CDATA[
}
]]></jsp:scriptlet>
15 years, 1 month
JBoss Rich Faces SVN: r14273 - in branches/community/3.3.X: samples/beanValidatorSample/src/main/java/org/richfaces and 17 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2009-05-21 20:28:52 -0400 (Thu, 21 May 2009)
New Revision: 14273
Added:
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/Bean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/DataBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/GraphValidatorBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/LengthBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/MaxBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/MinBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/MinMaxBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/NotEmptyBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/NotNullBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/DataBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/LengthBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/MaxBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/MinBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/MinMaxBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/NotEmptyBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/NotNullBean.java
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/component/UIAjaxValidator.java
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/AjaxValidatorRenderer.java
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/GraphValidatorHandler.java
Removed:
branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/DataBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/LengthBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/MaxBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/MinBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/MinMaxBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/NotEmptyBean.java
branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/NotNullBean.java
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/component/UIBeanValidator.java
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/BeanValidatorRenderer.java
Modified:
branches/community/3.3.X/samples/beanValidatorSample/pom.xml
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/WEB-INF/faces-config.xml
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/pages/ajaxValidation.xhtml
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/pages/beanValidation.xhtml
branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/pages/graphValidation.xhtml
branches/community/3.3.X/ui/assembly/styles.txt
branches/community/3.3.X/ui/beanValidator/pom.xml
branches/community/3.3.X/ui/beanValidator/src/main/config/component/beanValidator.xml
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/component/UIGraphValidator.java
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/AjaxValidatorHandler.java
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/AjaxValidatorTagBase.java
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/BeanValidatorHandler.java
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/BeanValidatorTag.java
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/BeanValidator.java
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/FacesBeanValidator.java
branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/GraphValidator.java
branches/community/3.3.X/ui/beanValidator/src/main/templates/org/richfaces/ui/htmlBeanValidator.jspx
branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/component/BeanValidatorComponentTest.java
Log:
Fix Jsr-299 compatibility
Modified: branches/community/3.3.X/samples/beanValidatorSample/pom.xml
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/pom.xml 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/samples/beanValidatorSample/pom.xml 2009-05-22 00:28:52 UTC (rev 14273)
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
-<project>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>samples</artifactId>
<groupId>org.richfaces</groupId>
@@ -21,25 +22,6 @@
<target>1.5</target>
</configuration>
</plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin
- </artifactId>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>src/main/webapp/src</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
<dependencies>
@@ -55,19 +37,6 @@
<version>3.3.2-SNAPSHOT</version> </dependency>
-->
<dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-validator</artifactId>
- <version>3.1.0.GA</version>
- <exclusions>
- <!--
- <exclusion> <artifactId>hibernate-core</artifactId>
- <groupId>org.hibernate</groupId> </exclusion> <exclusion>
- <artifactId>slf4j-api</artifactId> <groupId>org.slf4j</groupId>
- </exclusion>
- -->
- </exclusions>
- </dependency>
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jcl</artifactId>
<version>1.4.2</version>
@@ -83,4 +52,88 @@
<version>1.0</version>
</dependency>
</dependencies>
+ <profiles>
+ <profile>
+ <id>hibernate</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin
+ </artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/main/webapp/src</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>3.1.0.GA</version>
+ <exclusions>
+ <!--
+ <exclusion> <artifactId>hibernate-core</artifactId>
+ <groupId>org.hibernate</groupId> </exclusion> <exclusion>
+ <artifactId>slf4j-api</artifactId> <groupId>org.slf4j</groupId>
+ </exclusion>
+ -->
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jsr299</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin
+ </artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/main/webapp/jsr299src</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <version>1.0.CR2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.0.0.Beta1</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
</project>
\ No newline at end of file
Deleted: branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/DataBean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/DataBean.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/DataBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -1,52 +0,0 @@
-/**
- *
- */
-package org.richfaces;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.ajax4jsf.event.AjaxEvent;
-import org.hibernate.validator.Max;
-import org.hibernate.validator.Valid;
-
-/**
- * @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;
- }
-
- public void ajaxListener(AjaxEvent ajaxEvent) {
- System.out.println("DataBean.ajaxListener()");
- }
-
-}
Deleted: branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/LengthBean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/LengthBean.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/LengthBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -1,65 +0,0 @@
-/**
- *
- */
-package org.richfaces;
-
-import org.hibernate.validator.Length;
-import org.hibernate.validator.NotEmpty;
-import org.hibernate.validator.NotNull;
-
-/**
- * @author asmirnov
- *
- */
-public class LengthBean implements Validable {
-
- @Length(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/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/MaxBean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/MaxBean.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/MaxBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -1,72 +0,0 @@
-/**
- *
- */
-package org.richfaces;
-
-import org.hibernate.validator.CreditCardNumber;
-import org.hibernate.validator.Length;
-import org.hibernate.validator.Max;
-import org.hibernate.validator.Min;
-import org.hibernate.validator.NotEmpty;
-import org.hibernate.validator.NotNull;
-
-/**
- * @author asmirnov
- *
- */
-public class MaxBean implements Validable {
-
- private String text;
-
- @Max(10)
- private int intValue;
-
- /**
- * @return the text
- */
- @CreditCardNumber
- 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/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/MinBean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/MinBean.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/MinBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -1,69 +0,0 @@
-/**
- *
- */
-package org.richfaces;
-
-import org.hibernate.validator.Length;
-import org.hibernate.validator.Min;
-import org.hibernate.validator.NotEmpty;
-import org.hibernate.validator.NotNull;
-
-/**
- * @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/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/MinMaxBean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/MinMaxBean.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/MinMaxBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -1,71 +0,0 @@
-/**
- *
- */
-package org.richfaces;
-
-import org.hibernate.validator.Length;
-import org.hibernate.validator.Max;
-import org.hibernate.validator.Min;
-import org.hibernate.validator.NotEmpty;
-import org.hibernate.validator.NotNull;
-
-/**
- * @author asmirnov
- *
- */
-public class MinMaxBean implements Validable {
-
- private String text;
-
- @Min(2)
- @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/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/NotEmptyBean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/NotEmptyBean.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/NotEmptyBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -1,67 +0,0 @@
-/**
- *
- */
-package org.richfaces;
-
-import org.hibernate.validator.NotEmpty;
-import org.hibernate.validator.NotNull;
-
-/**
- * @author asmirnov
- *
- */
-public class NotEmptyBean implements Validable {
-
- @NotEmpty
- 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/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/NotNullBean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/NotNullBean.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/NotNullBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -1,66 +0,0 @@
-/**
- *
- */
-package org.richfaces;
-
-import org.hibernate.validator.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";
- }
-
-}
Modified: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/WEB-INF/faces-config.xml 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/WEB-INF/faces-config.xml 2009-05-22 00:28:52 UTC (rev 14273)
@@ -9,17 +9,17 @@
</managed-bean>
<managed-bean>
<managed-bean-name>data</managed-bean-name>
- <managed-bean-class>org.richfaces.DataBean</managed-bean-class>
+ <managed-bean-class>org.richfaces.example.DataBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>lengthBean</managed-bean-name>
- <managed-bean-class>org.richfaces.LengthBean</managed-bean-class>
+ <managed-bean-class>org.richfaces.example.LengthBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>minMaxBean</managed-bean-name>
- <managed-bean-class>org.richfaces.MinMaxBean</managed-bean-class>
+ <managed-bean-class>org.richfaces.example.MinMaxBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
Added: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/Bean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/Bean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/Bean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,73 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.example;
+
+import javax.validation.constraints.Pattern;
+
+import org.hibernate.validation.constraints.NotEmpty;
+
+
+/**
+ * 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
+ */
+ @NotEmpty
+// @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
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/Bean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/DataBean.java (from rev 14267, branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/DataBean.java)
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/DataBean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/DataBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,54 @@
+/**
+ *
+ */
+package org.richfaces.example;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.validation.Valid;
+import javax.validation.constraints.Max;
+
+import org.ajax4jsf.event.AjaxEvent;
+import org.richfaces.Validable;
+
+/**
+ * @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;
+ }
+
+ public void ajaxListener(AjaxEvent ajaxEvent) {
+ System.out.println("DataBean.ajaxListener()");
+ }
+
+}
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/DataBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/GraphValidatorBean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/GraphValidatorBean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/GraphValidatorBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,98 @@
+/**
+ *
+ */
+package org.richfaces.example;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+
+
+/**
+ * @author asmirnov
+ *
+ */
+public class GraphValidatorBean {
+
+ @Min(0)
+ @Max(10)
+ private int first ;
+
+ @Min(0)
+ @Max(10)
+ private int second ;
+ @Min(0)
+ @Max(10)
+ 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";
+ }
+}
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/GraphValidatorBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/LengthBean.java (from rev 14267, branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/LengthBean.java)
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/LengthBean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/LengthBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,64 @@
+/**
+ *
+ */
+package org.richfaces.example;
+
+import org.hibernate.validation.constraints.Length;
+import org.richfaces.Validable;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class LengthBean implements Validable {
+
+ @Length(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";
+ }
+
+}
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/LengthBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/MaxBean.java (from rev 14267, branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/MaxBean.java)
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/MaxBean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/MaxBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,71 @@
+/**
+ *
+ */
+package org.richfaces.example;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Pattern;
+
+import org.richfaces.Validable;
+
+/**
+ * @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";
+ }
+
+}
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/MaxBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/MinBean.java (from rev 14267, branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/MinBean.java)
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/MinBean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/MinBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,68 @@
+/**
+ *
+ */
+package org.richfaces.example;
+
+import javax.validation.constraints.Min;
+
+import org.richfaces.Validable;
+
+/**
+ * @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;
+ }
+
+}
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/MinBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/MinMaxBean.java (from rev 14267, branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/MinMaxBean.java)
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/MinMaxBean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/MinMaxBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,70 @@
+/**
+ *
+ */
+package org.richfaces.example;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+
+import org.richfaces.Validable;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class MinMaxBean implements Validable {
+
+ private String text;
+
+ @Min(2)
+ @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;
+ }
+
+}
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/MinMaxBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/NotEmptyBean.java (from rev 14267, branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/NotEmptyBean.java)
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/NotEmptyBean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/NotEmptyBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,67 @@
+/**
+ *
+ */
+package org.richfaces.example;
+
+import org.hibernate.validation.constraints.NotEmpty;
+import org.richfaces.Validable;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class NotEmptyBean implements Validable {
+
+ @NotEmpty
+ 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";
+ }
+
+}
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/NotEmptyBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/NotNullBean.java (from rev 14267, branches/community/3.3.X/samples/beanValidatorSample/src/main/java/org/richfaces/NotNullBean.java)
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/NotNullBean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/NotNullBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,68 @@
+/**
+ *
+ */
+package org.richfaces.example;
+
+import javax.validation.constraints.NotNull;
+
+import org.richfaces.Validable;
+
+/**
+ * @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";
+ }
+
+}
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/jsr299src/org/richfaces/example/NotNullBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/pages/ajaxValidation.xhtml
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/pages/ajaxValidation.xhtml 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/pages/ajaxValidation.xhtml 2009-05-22 00:28:52 UTC (rev 14273)
@@ -20,12 +20,12 @@
<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"/>
+ <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"/>
+ <rich:ajaxValidator event="onkeyup" summary="Invalid credit card number" profiles="javax.validation.groups.Default"/>
</h:inputText>
<rich:message for="card"/>
</h:panelGrid>
Modified: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/pages/beanValidation.xhtml
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/pages/beanValidation.xhtml 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/pages/beanValidation.xhtml 2009-05-22 00:28:52 UTC (rev 14273)
@@ -20,12 +20,12 @@
<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"/>
+ <rich:beanValidator 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:beanValidator summary="Invalid credit card number"/>
+ <rich:beanValidator summary="Invalid credit card number" profiles="javax.validation.groups.Default"/>
</h:inputText>
<rich:message for="card"/>
</h:panelGrid>
Modified: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/pages/graphValidation.xhtml
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/pages/graphValidation.xhtml 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/pages/graphValidation.xhtml 2009-05-22 00:28:52 UTC (rev 14273)
@@ -17,7 +17,7 @@
<!-- content -->
<ui:define name="content">
<h:form id="form">
- <rich:graphValidator value="#{graphValidatorBean}" id="validator">
+ <rich:graphValidator value="#{graphValidatorBean}" id="validator" profiles="javax.validation.groups.Default">
<h:panelGrid columns="3">
<h:outputLabel for="value0" value="First value:" />
<h:inputText id="value0" value="#{graphValidatorBean.first}" label="First" />
Added: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/DataBean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/DataBean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/DataBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,53 @@
+/**
+ *
+ */
+package org.richfaces.example;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.ajax4jsf.event.AjaxEvent;
+import org.hibernate.validator.Max;
+import org.hibernate.validator.Valid;
+import org.richfaces.Validable;
+
+/**
+ * @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;
+ }
+
+ public void ajaxListener(AjaxEvent ajaxEvent) {
+ System.out.println("DataBean.ajaxListener()");
+ }
+
+}
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/DataBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/LengthBean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/LengthBean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/LengthBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,66 @@
+/**
+ *
+ */
+package org.richfaces.example;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.NotEmpty;
+import org.hibernate.validator.NotNull;
+import org.richfaces.Validable;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class LengthBean implements Validable {
+
+ @Length(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";
+ }
+
+}
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/LengthBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/MaxBean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/MaxBean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/MaxBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,73 @@
+/**
+ *
+ */
+package org.richfaces.example;
+
+import org.hibernate.validator.CreditCardNumber;
+import org.hibernate.validator.Length;
+import org.hibernate.validator.Max;
+import org.hibernate.validator.Min;
+import org.hibernate.validator.NotEmpty;
+import org.hibernate.validator.NotNull;
+import org.richfaces.Validable;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class MaxBean implements Validable {
+
+ private String text;
+
+ @Max(10)
+ private int intValue;
+
+ /**
+ * @return the text
+ */
+ @CreditCardNumber
+ 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";
+ }
+
+}
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/MaxBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/MinBean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/MinBean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/MinBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,70 @@
+/**
+ *
+ */
+package org.richfaces.example;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.Min;
+import org.hibernate.validator.NotEmpty;
+import org.hibernate.validator.NotNull;
+import org.richfaces.Validable;
+
+/**
+ * @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;
+ }
+
+}
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/MinBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/MinMaxBean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/MinMaxBean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/MinMaxBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,72 @@
+/**
+ *
+ */
+package org.richfaces.example;
+
+import org.hibernate.validator.Length;
+import org.hibernate.validator.Max;
+import org.hibernate.validator.Min;
+import org.hibernate.validator.NotEmpty;
+import org.hibernate.validator.NotNull;
+import org.richfaces.Validable;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class MinMaxBean implements Validable {
+
+ private String text;
+
+ @Min(2)
+ @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;
+ }
+
+}
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/MinMaxBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/NotEmptyBean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/NotEmptyBean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/NotEmptyBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,68 @@
+/**
+ *
+ */
+package org.richfaces.example;
+
+import org.hibernate.validator.NotEmpty;
+import org.hibernate.validator.NotNull;
+import org.richfaces.Validable;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class NotEmptyBean implements Validable {
+
+ @NotEmpty
+ 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";
+ }
+
+}
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/NotEmptyBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/NotNullBean.java
===================================================================
--- branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/NotNullBean.java (rev 0)
+++ branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/NotNullBean.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,67 @@
+/**
+ *
+ */
+package org.richfaces.example;
+
+import org.hibernate.validator.NotNull;
+import org.richfaces.Validable;
+
+/**
+ * @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";
+ }
+
+}
Property changes on: branches/community/3.3.X/samples/beanValidatorSample/src/main/webapp/src/org/richfaces/example/NotNullBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/community/3.3.X/ui/assembly/styles.txt
===================================================================
--- branches/community/3.3.X/ui/assembly/styles.txt 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/ui/assembly/styles.txt 2009-05-22 00:28:52 UTC (rev 14273)
@@ -21,3 +21,4 @@
./org/richfaces/renderkit/html/css/panelMenu.xcss
./org/richfaces/renderkit/html/css/suggestionbox.xcss
./org/richfaces/renderkit/html/css/dataFilterSlider.xcss
+./org/richfaces/renderkit/html/css/page.xcss
Modified: branches/community/3.3.X/ui/beanValidator/pom.xml
===================================================================
--- branches/community/3.3.X/ui/beanValidator/pom.xml 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/ui/beanValidator/pom.xml 2009-05-22 00:28:52 UTC (rev 14273)
@@ -1,5 +1,6 @@
<?xml version="1.0"?>
-<project>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>ui</artifactId>
<groupId>org.richfaces</groupId>
Modified: branches/community/3.3.X/ui/beanValidator/src/main/config/component/beanValidator.xml
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/config/component/beanValidator.xml 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/ui/beanValidator/src/main/config/component/beanValidator.xml 2009-05-22 00:28:52 UTC (rev 14273)
@@ -5,16 +5,16 @@
<!--AJAX VALIDATOR-->
<component>
- <name>org.richfaces.BeanValidator</name>
- <family>org.richfaces.BeanValidator</family>
+ <name>org.richfaces.AjaxValidator</name>
+ <family>org.richfaces.AjaxValidator</family>
<classname>
- org.richfaces.component.html.HtmlBeanValidator
+ org.richfaces.component.html.HtmlAjaxValidator
</classname>
- <superclass>org.richfaces.component.UIBeanValidator</superclass>
+ <superclass>org.richfaces.component.UIAjaxValidator</superclass>
<description><![CDATA[The <rich:ajaxValidator> is a component designed to provide ajax validation inside for JSF inputs.]]></description>
<renderer generate="false" override="true">
- <name>org.richfaces.BeanValidatorRenderer</name>
- <classname>org.richfaces.renderkit.html.BeanValidatorRenderer</classname>
+ <name>org.richfaces.AjaxValidatorRenderer</name>
+ <classname>org.richfaces.renderkit.html.AjaxValidatorRenderer</classname>
</renderer>
<tag>
<name>ajaxValidator</name>
@@ -44,6 +44,13 @@
Summary message for a validation errors.
</description>
</property>
+ <property >
+ <name>profiles</name>
+ <classname>java.lang.Object</classname>
+ <description>
+ This attribute defines JavaBean Validation 'groups' feature (JSR-303). It is ignored if Hibernate Validator is used.
+ </description>
+ </property>
<property>
<name>onsubmit</name>
<classname>java.lang.String</classname>
@@ -134,6 +141,9 @@
<icon>icon</icon>
<test />
</tag>
+ <taghandler>
+ <classname>org.richfaces.taglib.GraphValidatorHandler</classname>
+ </taghandler>
&ui_component_attributes;
<property hidden="true">
@@ -141,10 +151,10 @@
</property>
<property >
- <name>profile</name>
-
+ <name>profiles</name>
+ <classname>java.lang.Object</classname>
<description>
- This attribute is reserved till the implementation of JavaBean Validation feature (JSR-303).
+ This attribute defines JavaBean Validation 'groups' feature (JSR-303). It is ignored if Hibernate Validator is used.
</description>
</property>
@@ -207,6 +217,13 @@
</description>
</property>
<property exist="true">
+ <name>profiles</name>
+ <classname>java.lang.Object</classname>
+ <description>
+ This attribute defines JavaBean Validation 'groups' feature (JSR-303). It is ignored if Hibernate Validator is used.
+ </description>
+ </property>
+ <property exist="true">
<name>binding</name>
<classname>org.richfaces.validator.FacesBeanValidator</classname>
<description>
Copied: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/component/UIAjaxValidator.java (from rev 14267, branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/component/UIBeanValidator.java)
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/component/UIAjaxValidator.java (rev 0)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/component/UIAjaxValidator.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,290 @@
+/**
+ * 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 java.io.IOException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.NamingContainer;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIComponentBase;
+import javax.faces.component.UIInput;
+import javax.faces.component.UIMessage;
+import javax.faces.component.UIMessages;
+import javax.faces.context.FacesContext;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+import org.ajax4jsf.component.AjaxComponent;
+import org.ajax4jsf.component.AjaxContainer;
+import org.ajax4jsf.component.AjaxSupport;
+import org.ajax4jsf.component.EventValueExpression;
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.event.AjaxEvent;
+import org.ajax4jsf.event.AjaxListener;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.webapp.taglib.MethodExpressionAjaxListener;
+import org.richfaces.event.ValidationEvent;
+
+/**
+ * JSF component class
+ *
+ */
+public abstract class UIAjaxValidator extends UIComponentBase implements
+ AjaxComponent, AjaxSupport, AjaxContainer {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.AjaxValidator";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.AjaxValidator";
+
+ public static final String BEAN_VALIDATOR_FACET = "org.richfaces.validator.";
+
+ @Override
+ public void setParent(UIComponent parent) {
+ super.setParent(parent);
+
+ if (null != parent && parent instanceof EditableValueHolder) {
+ setParentProperties(parent);
+ }
+ }
+
+ /**
+ * @param parent
+ * @throws FacesException
+ */
+ public void setParentProperties(UIComponent parent) throws FacesException {
+ if (!(parent instanceof EditableValueHolder)) {
+ throw new FacesException(
+ "Parent component must be an EditableValueHolder");
+ }
+
+ if (null != getEvent()) {
+ ValueExpression binding = new EventValueExpression(this);
+ parent.setValueExpression(getEvent(), binding);
+ }
+ }
+
+ @Override
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ super.broadcast(event);
+ if (event.getComponent() == this) {
+ FacesContext context = getFacesContext();
+ if (event instanceof ValidationEvent) {
+ // ByPass UpdateModelValue
+ context.renderResponse();
+ } else if (event instanceof AjaxEvent) {
+ // TODO - find all UIMessages components for a parent UIInput.
+ // for an ajaxSingle component, re-render only target message.
+ AjaxContext ajaxContext = AjaxContext
+ .getCurrentInstance(context);
+ ajaxContext.setSubmittedRegionClientId(this
+ .getClientId(context));
+ }
+ }
+ }
+
+ @Override
+ public void queueEvent(FacesEvent event) {
+ if (event instanceof ValidationEvent && event.getComponent() == this) {
+ UIComponent parent = getParent();
+ if (parent instanceof UIInput) {
+ UIInput input = (UIInput) parent;
+ if (input.isImmediate()) {
+ event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
+ } else {
+ event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
+ }
+ }
+ }
+ super.queueEvent(event);
+ }
+
+ public String getEventString() {
+ StringBuffer buildOnEvent = new StringBuffer();
+ String onsubmit = getOnsubmit();
+ // Insert script to call before submit ajax request.
+ if (null != onsubmit) {
+ buildOnEvent.append(onsubmit).append(";");
+ }
+ buildOnEvent.append(AjaxRendererUtils.buildOnEvent(this,
+ getFacesContext(), getEvent()));
+ String script = buildOnEvent.toString();
+ return script;
+ }
+
+ public UIComponent getSingleComponent() {
+ return getParent();
+ }
+
+ public void encodeAjax(FacesContext context) throws IOException {
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ Set<String> renderedAreas = ajaxContext.getAjaxRenderedAreas();
+ for (UIComponent message : getMessages(context)) {
+ if (message.isRendered()) {
+ message.encodeAll(context);
+ renderedAreas.add(message.getClientId(context));
+ }
+ }
+ // Write information about encoded areas after submission.
+ AjaxRendererUtils.encodeAreas(context, this);
+ }
+
+ public Set<UIComponent> getMessages(FacesContext context) {
+ Set<UIComponent> messages = new HashSet<UIComponent>();
+ findMessages(this.getParent(), this, messages,false);
+ findRichMessages(context, context.getViewRoot(), messages);
+ return messages;
+ }
+
+
+ /**
+ * Find all instances of the {@link UIRichMessages} and update list of the rendered messages.
+ * @param context
+ * @param component
+ * @param messages
+ */
+ protected void findRichMessages(FacesContext context,UIComponent component, Set<UIComponent> messages) {
+ Iterator<UIComponent> facetsAndChildren = component.getFacetsAndChildren();
+ while (facetsAndChildren.hasNext()) {
+ UIComponent child = (UIComponent) facetsAndChildren.next();
+ if (child instanceof UIRichMessages) {
+ UIRichMessages richMessage = (UIRichMessages) child;
+ if(null == richMessage.getFor()){
+ richMessage.updateMessages(context, this.getParent().getClientId(context));
+ messages.add(richMessage);
+ }
+ } else {
+ findRichMessages(context, child, messages);
+ }
+ }
+ }
+
+ /**
+ * Recursive search messages for the parent component.
+ * @param parent
+ * @param component
+ * @param messages
+ * @return
+ */
+ protected boolean findMessages(UIComponent parent, UIComponent component,
+ Set<UIComponent> messages,boolean found) {
+ Iterator<UIComponent> facetsAndChildren = parent.getFacetsAndChildren();
+ while (facetsAndChildren.hasNext()) {
+ UIComponent child = (UIComponent) facetsAndChildren.next();
+ if (child != component) {
+ if (child instanceof UIMessage || child instanceof UIMessages) {
+ UIComponent message = (UIComponent) child;
+ Object targetId = message.getAttributes().get("for");
+ if (null != targetId
+ && targetId.equals(getParent().getId())) {
+ messages.add(message);
+ found = true;
+ }
+ } else {
+ found |= findMessages(child, null, messages,found);
+ }
+ }
+ }
+ if(!(found && parent instanceof NamingContainer) && component != null){
+ UIComponent newParent = parent.getParent();
+ if(null != newParent){
+ found = findMessages(newParent, parent, messages,found);
+ }
+ }
+ return found;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.ajax4jsf.event.AjaxSource#addAjaxListener(org.ajax4jsf.event.AjaxListener
+ * )
+ */
+ public void addAjaxListener(AjaxListener listener) {
+ addFacesListener(listener);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.event.AjaxSource#getAjaxListeners()
+ */
+ public AjaxListener[] getAjaxListeners() {
+ return (AjaxListener[]) getFacesListeners(AjaxListener.class);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.ajax4jsf.event.AjaxSource#removeAjaxListener(org.ajax4jsf.event.
+ * AjaxListener)
+ */
+ public void removeAjaxListener(AjaxListener listener) {
+ removeFacesListener(listener);
+ }
+
+ public void setAjaxListener(MethodExpression listener) {
+ AjaxListener[] ajaxListeners = getAjaxListeners();
+ for (int i = 0; i < ajaxListeners.length; i++) {
+ AjaxListener ajaxListener = ajaxListeners[i];
+ if (ajaxListener.getClass().equals(
+ MethodExpressionAjaxListener.class)) {
+ MethodExpressionAjaxListener expressionListener = (MethodExpressionAjaxListener) ajaxListener;
+ if (expressionListener.getExpression() != listener) {
+ removeAjaxListener(ajaxListener);
+
+ if (listener == null) {
+
+ return;
+ } else {
+
+ break;
+ }
+ }
+ }
+ }
+
+ addAjaxListener(new MethodExpressionAjaxListener(listener));
+ }
+
+ public MethodExpression getAjaxListener() {
+ AjaxListener[] ajaxListeners = getAjaxListeners();
+ for (int i = 0; i < ajaxListeners.length; i++) {
+ AjaxListener ajaxListener = ajaxListeners[i];
+ if (ajaxListener.getClass().equals(
+ MethodExpressionAjaxListener.class)) {
+ MethodExpressionAjaxListener expressionListener = (MethodExpressionAjaxListener) ajaxListener;
+ return expressionListener.getExpression();
+ }
+ }
+
+ return null;
+ }
+}
Property changes on: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/component/UIAjaxValidator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/component/UIBeanValidator.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/component/UIBeanValidator.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/component/UIBeanValidator.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -1,290 +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 java.io.IOException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.el.MethodExpression;
-import javax.el.ValueExpression;
-import javax.faces.FacesException;
-import javax.faces.component.EditableValueHolder;
-import javax.faces.component.NamingContainer;
-import javax.faces.component.UIComponent;
-import javax.faces.component.UIComponentBase;
-import javax.faces.component.UIInput;
-import javax.faces.component.UIMessage;
-import javax.faces.component.UIMessages;
-import javax.faces.context.FacesContext;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.PhaseId;
-
-import org.ajax4jsf.component.AjaxComponent;
-import org.ajax4jsf.component.AjaxContainer;
-import org.ajax4jsf.component.AjaxSupport;
-import org.ajax4jsf.component.EventValueExpression;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.event.AjaxEvent;
-import org.ajax4jsf.event.AjaxListener;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.ajax4jsf.webapp.taglib.MethodExpressionAjaxListener;
-import org.richfaces.event.ValidationEvent;
-
-/**
- * JSF component class
- *
- */
-public abstract class UIBeanValidator extends UIComponentBase implements
- AjaxComponent, AjaxSupport, AjaxContainer {
-
- public static final String COMPONENT_TYPE = "org.richfaces.BeanValidator";
-
- public static final String COMPONENT_FAMILY = "org.richfaces.BeanValidator";
-
- public static final String BEAN_VALIDATOR_FACET = "org.richfaces.validator.";
-
- @Override
- public void setParent(UIComponent parent) {
- super.setParent(parent);
-
- if (null != parent && parent instanceof EditableValueHolder) {
- setParentProperties(parent);
- }
- }
-
- /**
- * @param parent
- * @throws FacesException
- */
- public void setParentProperties(UIComponent parent) throws FacesException {
- if (!(parent instanceof EditableValueHolder)) {
- throw new FacesException(
- "Parent component must be an EditableValueHolder");
- }
-
- if (null != getEvent()) {
- ValueExpression binding = new EventValueExpression(this);
- parent.setValueExpression(getEvent(), binding);
- }
- }
-
- @Override
- public void broadcast(FacesEvent event) throws AbortProcessingException {
- super.broadcast(event);
- if (event.getComponent() == this) {
- FacesContext context = getFacesContext();
- if (event instanceof ValidationEvent) {
- // ByPass UpdateModelValue
- context.renderResponse();
- } else if (event instanceof AjaxEvent) {
- // TODO - find all UIMessages components for a parent UIInput.
- // for an ajaxSingle component, re-render only target message.
- AjaxContext ajaxContext = AjaxContext
- .getCurrentInstance(context);
- ajaxContext.setSubmittedRegionClientId(this
- .getClientId(context));
- }
- }
- }
-
- @Override
- public void queueEvent(FacesEvent event) {
- if (event instanceof ValidationEvent && event.getComponent() == this) {
- UIComponent parent = getParent();
- if (parent instanceof UIInput) {
- UIInput input = (UIInput) parent;
- if (input.isImmediate()) {
- event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
- } else {
- event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
- }
- }
- }
- super.queueEvent(event);
- }
-
- public String getEventString() {
- StringBuffer buildOnEvent = new StringBuffer();
- String onsubmit = getOnsubmit();
- // Insert script to call before submit ajax request.
- if (null != onsubmit) {
- buildOnEvent.append(onsubmit).append(";");
- }
- buildOnEvent.append(AjaxRendererUtils.buildOnEvent(this,
- getFacesContext(), getEvent()));
- String script = buildOnEvent.toString();
- return script;
- }
-
- public UIComponent getSingleComponent() {
- return getParent();
- }
-
- public void encodeAjax(FacesContext context) throws IOException {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- Set<String> renderedAreas = ajaxContext.getAjaxRenderedAreas();
- for (UIComponent message : getMessages(context)) {
- if (message.isRendered()) {
- message.encodeAll(context);
- renderedAreas.add(message.getClientId(context));
- }
- }
- // Write information about encoded areas after submission.
- AjaxRendererUtils.encodeAreas(context, this);
- }
-
- public Set<UIComponent> getMessages(FacesContext context) {
- Set<UIComponent> messages = new HashSet<UIComponent>();
- findMessages(this.getParent(), this, messages,false);
- findRichMessages(context, context.getViewRoot(), messages);
- return messages;
- }
-
-
- /**
- * Find all instances of the {@link UIRichMessages} and update list of the rendered messages.
- * @param context
- * @param component
- * @param messages
- */
- protected void findRichMessages(FacesContext context,UIComponent component, Set<UIComponent> messages) {
- Iterator<UIComponent> facetsAndChildren = component.getFacetsAndChildren();
- while (facetsAndChildren.hasNext()) {
- UIComponent child = (UIComponent) facetsAndChildren.next();
- if (child instanceof UIRichMessages) {
- UIRichMessages richMessage = (UIRichMessages) child;
- if(null == richMessage.getFor()){
- richMessage.updateMessages(context, this.getParent().getClientId(context));
- messages.add(richMessage);
- }
- } else {
- findRichMessages(context, child, messages);
- }
- }
- }
-
- /**
- * Recursive search messages for the parent component.
- * @param parent
- * @param component
- * @param messages
- * @return
- */
- protected boolean findMessages(UIComponent parent, UIComponent component,
- Set<UIComponent> messages,boolean found) {
- Iterator<UIComponent> facetsAndChildren = parent.getFacetsAndChildren();
- while (facetsAndChildren.hasNext()) {
- UIComponent child = (UIComponent) facetsAndChildren.next();
- if (child != component) {
- if (child instanceof UIMessage || child instanceof UIMessages) {
- UIComponent message = (UIComponent) child;
- Object targetId = message.getAttributes().get("for");
- if (null != targetId
- && targetId.equals(getParent().getId())) {
- messages.add(message);
- found = true;
- }
- } else {
- found |= findMessages(child, null, messages,found);
- }
- }
- }
- if(!(found && parent instanceof NamingContainer) && component != null){
- UIComponent newParent = parent.getParent();
- if(null != newParent){
- found = findMessages(newParent, parent, messages,found);
- }
- }
- return found;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.ajax4jsf.event.AjaxSource#addAjaxListener(org.ajax4jsf.event.AjaxListener
- * )
- */
- public void addAjaxListener(AjaxListener listener) {
- addFacesListener(listener);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.ajax4jsf.event.AjaxSource#getAjaxListeners()
- */
- public AjaxListener[] getAjaxListeners() {
- return (AjaxListener[]) getFacesListeners(AjaxListener.class);
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.ajax4jsf.event.AjaxSource#removeAjaxListener(org.ajax4jsf.event.
- * AjaxListener)
- */
- public void removeAjaxListener(AjaxListener listener) {
- removeFacesListener(listener);
- }
-
- public void setAjaxListener(MethodExpression listener) {
- AjaxListener[] ajaxListeners = getAjaxListeners();
- for (int i = 0; i < ajaxListeners.length; i++) {
- AjaxListener ajaxListener = ajaxListeners[i];
- if (ajaxListener.getClass().equals(
- MethodExpressionAjaxListener.class)) {
- MethodExpressionAjaxListener expressionListener = (MethodExpressionAjaxListener) ajaxListener;
- if (expressionListener.getExpression() != listener) {
- removeAjaxListener(ajaxListener);
-
- if (listener == null) {
-
- return;
- } else {
-
- break;
- }
- }
- }
- }
-
- addAjaxListener(new MethodExpressionAjaxListener(listener));
- }
-
- public MethodExpression getAjaxListener() {
- AjaxListener[] ajaxListeners = getAjaxListeners();
- for (int i = 0; i < ajaxListeners.length; i++) {
- AjaxListener ajaxListener = ajaxListeners[i];
- if (ajaxListener.getClass().equals(
- MethodExpressionAjaxListener.class)) {
- MethodExpressionAjaxListener expressionListener = (MethodExpressionAjaxListener) ajaxListener;
- return expressionListener.getExpression();
- }
- }
-
- return null;
- }
-}
Modified: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/component/UIGraphValidator.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/component/UIGraphValidator.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/component/UIGraphValidator.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -99,14 +99,14 @@
*
* @return
*/
- public abstract Set<String> getProfile();
+ public abstract Object getProfiles();
/**
* Set set of profiles for validation
*
* @param newvalue
*/
- public abstract void setProfile(Set<String> newvalue);
+ public abstract void setProfiles(Object newvalue);
/**
* Get graph validator Id.
@@ -130,7 +130,7 @@
Validator validator = context.getApplication().createValidator(getType());
if (validator instanceof GraphValidator) {
GraphValidator graphValidator = (GraphValidator) validator;
- String[] messages = graphValidator.validateGraph(context,this, value,getProfile());
+ String[] messages = graphValidator.validateGraph(context,this, value,getProfiles());
if (null != messages) {
context.renderResponse();
// send all validation messages.
@@ -155,6 +155,12 @@
super.encodeBegin(context);
FacesBeanValidator validator = (FacesBeanValidator)context.getApplication().createValidator(getType());
validator.setSummary(getSummary());
+ ValueExpression expression = getValueExpression("profiles");
+ if(null != expression){
+ validator.setProfiles(expression);
+ } else {
+ validator.setProfiles(getProfiles());
+ }
setupValidators(this,validator);
}
Copied: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/AjaxValidatorRenderer.java (from rev 14267, branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/BeanValidatorRenderer.java)
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/AjaxValidatorRenderer.java (rev 0)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/AjaxValidatorRenderer.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,110 @@
+/**
+ * License Agreement.
+ *
+ * Ajax4jsf 1.1 - 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.renderkit.html;
+
+
+//
+// Imports
+//
+import java.io.IOException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.event.ActionEvent;
+
+import org.ajax4jsf.component.AjaxComponent;
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.event.AjaxEvent;
+import org.ajax4jsf.renderkit.AjaxComponentRendererBase;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.renderkit.ComponentVariables;
+import org.ajax4jsf.renderkit.ComponentsVariableResolver;
+import org.richfaces.event.ValidationEvent;
+
+
+
+/**
+ * Renderer for component class org.richfaces.renderkit.html.AjaxValidatorRenderer
+ */
+public class AjaxValidatorRenderer extends AjaxComponentRendererBase {
+
+
+ public static final String RENDERER_TYPE = "org.richfaces.BeanValidatorRenderer";
+ public AjaxValidatorRenderer () {
+ super();
+ }
+
+ protected void doDecode(FacesContext facesContext, UIComponent uiComponent) {
+
+ // super.decode must not be called, because value is handled here
+ if (isSubmitted(facesContext, uiComponent)) {
+ uiComponent.queueEvent(new ValidationEvent(uiComponent));
+ uiComponent.queueEvent(new AjaxEvent(uiComponent));
+ // Check areas for processing
+ if (uiComponent instanceof AjaxComponent) {
+ AjaxComponent ajaxComponent = (AjaxComponent) uiComponent;
+ Set<String> toProcess = AjaxRendererUtils.asSet(ajaxComponent
+ .getProcess());
+ if (null != toProcess) {
+ HashSet<String> componentIdsToProcess = new HashSet<String>();
+ for (String componentId : toProcess) {
+ UIComponent component = getUtils().findComponentFor(uiComponent, componentId);
+ if(null != component){
+ componentIdsToProcess.add(component.getClientId(facesContext));
+ } else {
+ componentIdsToProcess.add(componentId);
+ }
+ }
+ AjaxContext.getCurrentInstance(facesContext).setAjaxAreasToProcess(componentIdsToProcess);
+ }
+ }
+ }
+ }
+
+ protected boolean isSubmitted(FacesContext facesContext,
+ UIComponent uiComponent) {
+ // Componet accept only ajax requests.
+ if (!AjaxContext.getCurrentInstance(facesContext).isAjaxRequest()) {
+ return false;
+ }
+ String clientId = uiComponent.getClientId(facesContext);
+ Map<String, String> paramMap = facesContext.getExternalContext()
+ .getRequestParameterMap();
+ String value = paramMap.get(clientId);
+ boolean submitted = null != value;
+ return submitted;
+ }
+ /**
+ * Get base component class, targetted for this renderer. Used for check arguments in decode/encode.
+ * @return
+ */
+ protected Class<? extends UIComponent> getComponentClass() {
+ return org.richfaces.component.UIAjaxValidator.class;
+ }
+
+
+}
Property changes on: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/AjaxValidatorRenderer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/BeanValidatorRenderer.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/BeanValidatorRenderer.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/renderkit/html/BeanValidatorRenderer.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -1,110 +0,0 @@
-/**
- * License Agreement.
- *
- * Ajax4jsf 1.1 - 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.renderkit.html;
-
-
-//
-// Imports
-//
-import java.io.IOException;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.event.ActionEvent;
-
-import org.ajax4jsf.component.AjaxComponent;
-import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.event.AjaxEvent;
-import org.ajax4jsf.renderkit.AjaxComponentRendererBase;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.ajax4jsf.renderkit.ComponentVariables;
-import org.ajax4jsf.renderkit.ComponentsVariableResolver;
-import org.richfaces.event.ValidationEvent;
-
-
-
-/**
- * Renderer for component class org.richfaces.renderkit.html.BeanValidatorRenderer
- */
-public class BeanValidatorRenderer extends AjaxComponentRendererBase {
-
-
- public static final String RENDERER_TYPE = "org.richfaces.BeanValidatorRenderer";
- public BeanValidatorRenderer () {
- super();
- }
-
- protected void doDecode(FacesContext facesContext, UIComponent uiComponent) {
-
- // super.decode must not be called, because value is handled here
- if (isSubmitted(facesContext, uiComponent)) {
- uiComponent.queueEvent(new ValidationEvent(uiComponent));
- uiComponent.queueEvent(new AjaxEvent(uiComponent));
- // Check areas for processing
- if (uiComponent instanceof AjaxComponent) {
- AjaxComponent ajaxComponent = (AjaxComponent) uiComponent;
- Set<String> toProcess = AjaxRendererUtils.asSet(ajaxComponent
- .getProcess());
- if (null != toProcess) {
- HashSet<String> componentIdsToProcess = new HashSet<String>();
- for (String componentId : toProcess) {
- UIComponent component = getUtils().findComponentFor(uiComponent, componentId);
- if(null != component){
- componentIdsToProcess.add(component.getClientId(facesContext));
- } else {
- componentIdsToProcess.add(componentId);
- }
- }
- AjaxContext.getCurrentInstance(facesContext).setAjaxAreasToProcess(componentIdsToProcess);
- }
- }
- }
- }
-
- protected boolean isSubmitted(FacesContext facesContext,
- UIComponent uiComponent) {
- // Componet accept only ajax requests.
- if (!AjaxContext.getCurrentInstance(facesContext).isAjaxRequest()) {
- return false;
- }
- String clientId = uiComponent.getClientId(facesContext);
- Map<String, String> paramMap = facesContext.getExternalContext()
- .getRequestParameterMap();
- String value = paramMap.get(clientId);
- boolean submitted = null != value;
- return submitted;
- }
- /**
- * Get base component class, targetted for this renderer. Used for check arguments in decode/encode.
- * @return
- */
- protected Class<? extends UIComponent> getComponentClass() {
- return org.richfaces.component.UIBeanValidator.class;
- }
-
-
-}
Modified: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/AjaxValidatorHandler.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/AjaxValidatorHandler.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/AjaxValidatorHandler.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -32,11 +32,12 @@
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.webapp.taglib.AjaxComponentHandler;
-import org.richfaces.component.UIBeanValidator;
+import org.richfaces.component.UIAjaxValidator;
import org.richfaces.validator.FacesBeanValidator;
import com.sun.facelets.FaceletContext;
import com.sun.facelets.FaceletException;
+import com.sun.facelets.tag.MetaRuleset;
import com.sun.facelets.tag.TagAttribute;
import com.sun.facelets.tag.TagException;
import com.sun.facelets.tag.TagHandler;
@@ -74,9 +75,15 @@
_event = getAttribute("event");
_summary = getAttribute("summary");
_profiles = getAttribute("profiles");
- _validatorHandler = new AjaxComponentHandler(config);
+ _validatorHandler = new AjaxComponentHandler(config){
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ return super.createMetaRuleset(type).ignore("summary").ignore("profiles");
+ }
+ };
}
+
/*
* (non-Javadoc)
*
@@ -107,7 +114,7 @@
}
if( null != _profiles){
if(_profiles.isLiteral()){
- validator.setProfiles(AjaxRendererUtils.asSet(_profiles.getValue()));
+ validator.setProfiles(_profiles.getValue());
} else {
validator.setProfiles(_profiles.getValueExpression(ctx, Set.class));
}
@@ -119,7 +126,7 @@
UIFacet facet = new UIFacet();
// Find facet for client validation component
String eventName = _event.getValue();
- String facetName = UIBeanValidator.BEAN_VALIDATOR_FACET + eventName;
+ String facetName = UIAjaxValidator.BEAN_VALIDATOR_FACET + eventName;
c = parent.getFacet(facetName);
if (null != c) {
parent.getFacets().remove(facetName);
Modified: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/AjaxValidatorTagBase.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/AjaxValidatorTagBase.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/AjaxValidatorTagBase.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -28,8 +28,8 @@
import javax.servlet.jsp.JspException;
import org.ajax4jsf.webapp.taglib.UIComponentTagBase;
-import org.richfaces.component.UIBeanValidator;
-import org.richfaces.renderkit.html.BeanValidatorRenderer;
+import org.richfaces.component.UIAjaxValidator;
+import org.richfaces.renderkit.html.AjaxValidatorRenderer;
import org.richfaces.validator.FacesBeanValidator;
/**
@@ -45,6 +45,7 @@
private ValueExpression summary = null;
+ private ValueExpression profiles = null;
/*
* (non-Javadoc)
*
@@ -52,7 +53,7 @@
*/
@Override
public String getComponentType() {
- return UIBeanValidator.COMPONENT_TYPE;
+ return UIAjaxValidator.COMPONENT_TYPE;
}
/**
@@ -98,8 +99,19 @@
.getApplication().createValidator(
FacesBeanValidator.BEAN_VALIDATOR_TYPE);
if (null != summary) {
- validator.setSummary(summary);
+ if(summary.isLiteralText()){
+ validator.setSummary(summary.getExpressionString());
+ } else {
+ validator.setSummary(summary);
+ }
}
+ if(null != profiles){
+ if(profiles.isLiteralText()){
+ validator.setProfiles(profiles.getExpressionString());
+ } else {
+ validator.setProfiles(profiles);
+ }
+ }
((EditableValueHolder) component).addValidator(validator);
}
@@ -117,6 +129,7 @@
super.release();
event = null;
summary = null;
+ profiles = null;
}
/*
@@ -126,12 +139,12 @@
*/
@Override
public String getRendererType() {
- return BeanValidatorRenderer.RENDERER_TYPE;
+ return AjaxValidatorRenderer.RENDERER_TYPE;
}
@Override
protected String getFacetName() {
- return UIBeanValidator.BEAN_VALIDATOR_FACET
+ return UIAjaxValidator.BEAN_VALIDATOR_FACET
+ (null == event ? "" : event);
}
}
Modified: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/BeanValidatorHandler.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/BeanValidatorHandler.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/BeanValidatorHandler.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -20,11 +20,15 @@
*/
package org.richfaces.taglib;
+import java.util.Set;
+
import javax.faces.validator.Validator;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.richfaces.validator.FacesBeanValidator;
import com.sun.facelets.FaceletContext;
+import com.sun.facelets.tag.MetaRuleset;
import com.sun.facelets.tag.TagAttribute;
import com.sun.facelets.tag.TagConfig;
import com.sun.facelets.tag.jsf.ValidateHandler;
@@ -36,14 +40,17 @@
*/
public class BeanValidatorHandler extends ValidateHandler {
- private TagAttribute _summary;
+ private TagAttribute _profiles;
+
+
+
/**
* @param config
*/
- public BeanValidatorHandler(TagConfig config) {
+ public BeanValidatorHandler(ValidatorConfig config) {
super(config);
- _summary = getAttribute("summary");
+ _profiles = getAttribute("profiles");
}
@Override
@@ -51,9 +58,12 @@
FacesBeanValidator validator = (FacesBeanValidator) ctx.getFacesContext()
.getApplication().createValidator(
FacesBeanValidator.BEAN_VALIDATOR_TYPE);
- if (null != _summary) {
- validator
- .setSummary(_summary.getValueExpression(ctx, String.class));
+ if(null != _profiles){
+ if(_profiles.isLiteral()){
+ validator.setProfiles(AjaxRendererUtils.asSet(_profiles.getValue()));
+ } else {
+ validator.setProfiles(_profiles.getValueExpression(ctx, Set.class));
+ }
}
return validator;
}
Modified: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/BeanValidatorTag.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/BeanValidatorTag.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/BeanValidatorTag.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -48,6 +48,9 @@
* implements {@link HibernateValidator}.</p>
*/
private ValueExpression binding = null;
+
+
+ private ValueExpression profiles = null;
/**
* Summary message for a validation errors. Setter for summary
@@ -70,6 +73,13 @@
this.binding = binding;
}
+ /**
+ * @param profiles the profiles to set
+ */
+ public void setProfiles(ValueExpression profiles) {
+ this.profiles = profiles;
+ }
+
protected Validator createValidator() throws JspException {
ValueExpression ve = this.binding;
@@ -101,13 +111,29 @@
return validator;
}
+ @Override
+ public void release() {
+ this.binding = null;
+ this._summary = null;
+ this.profiles = null;
+ super.release();
+ }
// Support method to wire in properties
private void _setProperties(FacesBeanValidator validator)
throws JspException {
if (_summary != null) {
- if (_summary instanceof ValueExpression) {
+ if (_summary.isLiteralText()) {
+ validator.setSummary(_summary.getExpressionString());
+ } else {
validator.setSummary(_summary);
}
}
+ if(null != profiles){
+ if(profiles.isLiteralText()){
+ validator.setProfiles(profiles.getExpressionString());
+ } else {
+ validator.setProfiles(profiles);
+ }
}
+ }
}
Added: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/GraphValidatorHandler.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/GraphValidatorHandler.java (rev 0)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/GraphValidatorHandler.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -0,0 +1,57 @@
+/**
+ *
+ */
+package org.richfaces.taglib;
+
+import java.util.Set;
+
+import javax.faces.component.UIComponent;
+
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.richfaces.component.UIGraphValidator;
+
+import com.sun.facelets.FaceletContext;
+import com.sun.facelets.tag.MetaRuleset;
+import com.sun.facelets.tag.TagAttribute;
+import com.sun.facelets.tag.jsf.ComponentConfig;
+import com.sun.facelets.tag.jsf.ComponentHandler;
+
+/**
+ * @author asmirnov
+ *
+ */
+public class GraphValidatorHandler extends ComponentHandler {
+
+ private TagAttribute _profiles;
+
+ /**
+ * @param config
+ */
+ public GraphValidatorHandler(ComponentConfig config) {
+ super(config);
+ _profiles = getAttribute("profiles");
+ }
+
+ @Override
+ protected MetaRuleset createMetaRuleset(Class type) {
+ return super.createMetaRuleset(type).ignore("profiles");
+ }
+
+
+ @Override
+ protected void onComponentCreated(FaceletContext ctx, UIComponent c,
+ UIComponent parent) {
+ super.onComponentCreated(ctx, c, parent);
+ if (c instanceof UIGraphValidator) {
+ UIGraphValidator graphValidator = (UIGraphValidator) c;
+ if(null != _profiles){
+ if (_profiles.isLiteral()) {
+ graphValidator.setProfiles(AjaxRendererUtils.asSet(_profiles.getValue()));
+ } else {
+ graphValidator.setValueExpression("profiles", _profiles.getValueExpression(ctx, Set.class));
+ }
+ }
+
+ }
+ }
+}
Property changes on: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/taglib/GraphValidatorHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/BeanValidator.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/BeanValidator.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/BeanValidator.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -15,6 +15,7 @@
import javax.validation.Validator;
import javax.validation.ValidatorContext;
import javax.validation.ValidatorFactory;
+import javax.validation.groups.Default;
/**
* @author asmirnov
@@ -22,6 +23,7 @@
*/
public class BeanValidator extends ObjectValidator {
+ private static final Class[] DEFAULT_PROFILE = new Class[] {};
private volatile ValidatorFactory validatorFactory = null;
BeanValidator() {
@@ -38,8 +40,10 @@
@Override
protected String[] validate(Object base, String property, Object value,
Locale locale, Set<String> profiles) {
- return extractMessages(getValidator(locale).validateProperty(base,
- property, getGroups(profiles)));
+ Class beanType = base.getClass();
+ Set<ConstraintViolation<Object>> constrains = getValidator(locale)
+ .validateValue(beanType, property, value, getGroups(profiles));
+ return extractMessages(constrains);
}
/*
@@ -79,6 +83,8 @@
i++;
}
+ } else {
+ groups = DEFAULT_PROFILE;
}
return groups;
}
@@ -88,7 +94,7 @@
if (null != violations && violations.size() > 0) {
messages = new String[violations.size()];
int i = 0;
- for (ConstraintViolation<Object> constraintViolation : violations) {
+ for (ConstraintViolation<? extends Object> constraintViolation : violations) {
messages[i++] = constraintViolation.getMessage();
}
@@ -97,7 +103,6 @@
}
protected Validator getValidator(Locale locale) {
- validatorFactory = null;
if (null == validatorFactory) {
synchronized (this) {
if (null == validatorFactory) {
@@ -134,7 +139,13 @@
}
public String interpolate(String messageTemplate, Context context) {
- return delegate.interpolate(messageTemplate, context, this.locale);
+
+ if (null != locale) {
+ return delegate.interpolate(messageTemplate, context,
+ this.locale);
+ } else {
+ return delegate.interpolate(messageTemplate, context);
+ }
}
public String interpolate(String messageTemplate, Context context,
Modified: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/FacesBeanValidator.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/FacesBeanValidator.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/FacesBeanValidator.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -33,6 +33,8 @@
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+
/**
* Implementation of the JSF validator to use with Bean Validation / Hibernate
* validator
@@ -54,7 +56,7 @@
private ValueExpression profilesExpression = null;
- private Set<String> profiles = null;
+ private Object profiles = null;
/**
* @return the summary
*/
@@ -119,30 +121,29 @@
}
public String[] validateGraph(FacesContext context, UIComponent component,
- Object value, Set<String> profiles) throws ValidatorException {
+ Object value, Object profiles) throws ValidatorException {
ObjectValidator beanValidator = HibernateValidator.getInstance(context);
- String[] messages = beanValidator.validateGraph(context, value,profiles);
+ String[] messages = beanValidator.validateGraph(context, value,AjaxRendererUtils.asSet(profiles));
return messages;
}
/**
* @return the profiles
*/
- @SuppressWarnings("unchecked")
public Set<String> getProfiles() {
- Set<String> profiles;
+ Object profiles;
if(null != profilesExpression){
- profiles = (Set<String>) profilesExpression.getValue(FacesContext.getCurrentInstance().getELContext());
+ profiles = profilesExpression.getValue(FacesContext.getCurrentInstance().getELContext());
}else {
profiles = this.profiles;
}
- return profiles;
+ return AjaxRendererUtils.asSet(profiles);
}
/**
* @param profiles the profiles to set
*/
- public void setProfiles(Set<String> profiles) {
+ public void setProfiles(Object profiles) {
this.profiles = profiles;
}
Modified: branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/GraphValidator.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/GraphValidator.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/ui/beanValidator/src/main/java/org/richfaces/validator/GraphValidator.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -19,6 +19,6 @@
public interface GraphValidator {
public String[] validateGraph(FacesContext context, UIComponent component, Object value,
- Set<String> profiles) throws ValidatorException ;
+ Object profiles) throws ValidatorException ;
}
Modified: branches/community/3.3.X/ui/beanValidator/src/main/templates/org/richfaces/ui/htmlBeanValidator.jspx
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/main/templates/org/richfaces/ui/htmlBeanValidator.jspx 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/ui/beanValidator/src/main/templates/org/richfaces/ui/htmlBeanValidator.jspx 2009-05-22 00:28:52 UTC (rev 14273)
@@ -5,9 +5,9 @@
xmlns:ui=" http://ajax4jsf.org/cdk/ui"
xmlns:u=" http://ajax4jsf.org/cdk/u"
xmlns:x=" http://ajax4jsf.org/cdk/x"
- class="org.richfaces.renderkit.html.BeanValidatorRenderer"
+ class="org.richfaces.renderkit.html.AjaxValidatorRenderer"
baseclass="org.ajax4jsf.renderkit.AjaxComponentRendererBase"
- component="org.richfaces.component.UIBeanValidator"
+ component="org.richfaces.component.UIAjaxValidator"
>
<f:clientid var="clientId"/>
<div id="#{clientId}"
Modified: branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/component/BeanValidatorComponentTest.java
===================================================================
--- branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/component/BeanValidatorComponentTest.java 2009-05-21 18:33:06 UTC (rev 14272)
+++ branches/community/3.3.X/ui/beanValidator/src/test/java/org/richfaces/component/BeanValidatorComponentTest.java 2009-05-22 00:28:52 UTC (rev 14273)
@@ -48,7 +48,7 @@
public class BeanValidatorComponentTest extends AbstractAjax4JsfTestCase {
UIForm form = null;
- UIBeanValidator validator = null;
+ UIAjaxValidator validator = null;
HtmlInputText input = null;
UIMessages messages = null;
private UIMessage message;
@@ -63,7 +63,7 @@
form.setId("form");
facesContext.getViewRoot().getChildren().add(form);
input = (HtmlInputText)application.createComponent(HtmlInputText.COMPONENT_TYPE);
- validator = (UIBeanValidator)application.createComponent(UIBeanValidator.COMPONENT_TYPE);
+ validator = (UIAjaxValidator)application.createComponent(UIAjaxValidator.COMPONENT_TYPE);
validator.setId("validator");
input.setId("input");
15 years, 1 month
JBoss Rich Faces SVN: r14272 - branches/community/3.3.X/ui/tabPanel/src/main/templates.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-05-21 14:33:06 -0400 (Thu, 21 May 2009)
New Revision: 14272
Modified:
branches/community/3.3.X/ui/tabPanel/src/main/templates/tab.jspx
Log:
https://jira.jboss.org/jira/browse/RF-4568
Modified: branches/community/3.3.X/ui/tabPanel/src/main/templates/tab.jspx
===================================================================
--- branches/community/3.3.X/ui/tabPanel/src/main/templates/tab.jspx 2009-05-21 18:10:32 UTC (rev 14271)
+++ branches/community/3.3.X/ui/tabPanel/src/main/templates/tab.jspx 2009-05-21 18:33:06 UTC (rev 14272)
@@ -19,7 +19,7 @@
<table border="0" cellpadding="10" cellspacing="0" width="100%" class="dr-tbpnl-cntnt-pstn rich-tabpanel-content-position" style="">
<tr>
<td class="dr-tbpnl-cntnt rich-tabpanel-content #{component.pane.attributes['contentClass']} #{component.attributes['styleClass']}"
- style="#{component.attributes['contentStyle']}; #{component.attributes['style']}"
+ style="#{component.pane.attributes['contentStyle']}; #{component.attributes['style']}"
x:passThruWithExclusions="class,style,styleClass,id"
>
<vcp:body />
15 years, 1 month
JBoss Rich Faces SVN: r14271 - branches/community/3.3.X/framework/impl/src/main/javascript/ajaxjsf.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2009-05-21 14:10:32 -0400 (Thu, 21 May 2009)
New Revision: 14271
Modified:
branches/community/3.3.X/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
Log:
https://jira.jboss.org/jira/browse/RF-5313
https://jira.jboss.org/jira/browse/RF-7227
Modified: branches/community/3.3.X/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2009-05-21 18:03:13 UTC (rev 14270)
+++ branches/community/3.3.X/framework/impl/src/main/javascript/ajaxjsf/JSFAJAX.js 2009-05-21 18:10:32 UTC (rev 14271)
@@ -1193,6 +1193,8 @@
LOG.debug("Input in response: "+newinput.getAttribute("name"));
for(var j = 0 ; j < inputs.length; j++){
var input = inputs[j];
+ input.setAttribute("autocomplete", "off");
+
if(input.name == newinput.getAttribute("name")){
LOG.debug("Found same input on page with type: "+input.type);
input.value = newinput.getAttribute("value");
15 years, 1 month
JBoss Rich Faces SVN: r14270 - in branches/community/3.3.X/docs/userguide/en/src/main: resources/images and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2009-05-21 14:03:13 -0400 (Thu, 21 May 2009)
New Revision: 14270
Modified:
branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/colorPicker.xml
branches/community/3.3.X/docs/userguide/en/src/main/resources/images/colorPicker_cn.png
Log:
https://jira.jboss.org/jira/browse/RF-6986 - all rich-colorpicker-* classes were renamed
Modified: branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/colorPicker.xml
===================================================================
--- branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/colorPicker.xml 2009-05-21 16:32:51 UTC (rev 14269)
+++ branches/community/3.3.X/docs/userguide/en/src/main/docbook/included/colorPicker.xml 2009-05-21 18:03:13 UTC (rev 14270)
@@ -370,11 +370,11 @@
</thead>
<tbody>
<row>
- <entry>.rich-colorPicker-span input</entry>
+ <entry>.rich-colorpicker-span input</entry>
<entry>Defines styles for the input field that contains selected color</entry>
</row>
<row>
- <entry>.rich-colorPicker-icon</entry>
+ <entry>.rich-colorpicker-icon</entry>
<entry>Defines styles for the icon</entry>
</row>
</tbody>
@@ -391,23 +391,23 @@
</thead>
<tbody>
<row>
- <entry>.rich-colorPicker-ext</entry>
+ <entry>.rich-colorpicker-ext</entry>
<entry>Defines styles for the wrapper <div> element of a widget</entry>
</row>
<row>
- <entry>.rich-colorPicker-color</entry>
+ <entry>.rich-colorpicker-color</entry>
<entry>Defines styles for the color palette</entry>
</row>
<row>
- <entry>.rich-colorPicker-current-color</entry>
+ <entry>.rich-colorpicker-current-color</entry>
<entry>Defines styles for the currently selected color</entry>
</row>
<row>
- <entry>.rich-colorPicker-new-color</entry>
+ <entry>.rich-colorpicker-new-color</entry>
<entry>Defines styles for the already selected color</entry>
</row>
<row>
- <entry>.rich-colorPicker-colors-input</entry>
+ <entry>.rich-colorpicker-colors-input</entry>
<entry>Defines styles for the hex, RGB, and HSB input fileds</entry>
</row>
</tbody>
@@ -424,11 +424,11 @@
</thead>
<tbody>
<row>
- <entry>.rich-colorPicker-submit</entry>
+ <entry>.rich-colorpicker-submit</entry>
<entry>Defines styles for the "Apply" button</entry>
</row>
<row>
- <entry>.rich-colorPicker-cancel</entry>
+ <entry>.rich-colorpicker-cancel</entry>
<entry>Defines styles for the "Cancel" button</entry>
</row>
</tbody>
Modified: branches/community/3.3.X/docs/userguide/en/src/main/resources/images/colorPicker_cn.png
===================================================================
(Binary files differ)
15 years, 1 month
JBoss Rich Faces SVN: r14269 - branches/community/3.3.X/ui/colorPicker/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-05-21 12:32:51 -0400 (Thu, 21 May 2009)
New Revision: 14269
Modified:
branches/community/3.3.X/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx
Log:
ColorPicker does not output valid XHTML
https://jira.jboss.org/jira/browse/RF-7088
Modified: branches/community/3.3.X/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx
===================================================================
--- branches/community/3.3.X/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx 2009-05-21 16:14:17 UTC (rev 14268)
+++ branches/community/3.3.X/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx 2009-05-21 16:32:51 UTC (rev 14269)
@@ -36,7 +36,7 @@
<jsp:scriptlet><![CDATA[
}else{
]]></jsp:scriptlet>
- <img src="#{arrow}" class="rich-color-picker-icon #{component.attributes['iconClass']}" style="#{component.attributes['iconStyle']}" vertical-align="middle"/>
+ <img src="#{arrow}" class="rich-color-picker-icon #{component.attributes['iconClass']}" style="#{component.attributes['iconStyle']}" alt="icon"/>
<jsp:scriptlet><![CDATA[
}
]]></jsp:scriptlet>
@@ -72,31 +72,31 @@
<div class="rich-color-picker-new-color"></div>
<div class="rich-color-picker-current-color"></div>
<div class="rich-color-picker-hex-wrapper">
- <label for="rich-color-picker-hex-wrapper" title="hex">#:</label>
+ <label for="#{clientId}-colorPicker-hex" title="hex">#:</label>
<input id="#{clientId}-colorPicker-hex" class="rich-color-picker-colors-input" type="text" maxlength="6" size="6" />
</div>
<div class="rich-color-picker-rgb-wrapper rich-color-picker-rgb-r">
- <label for="rgb">R:</label>
+ <label for="#{clientId}-colorPicker-rgb-r">R:</label>
<input id="#{clientId}-colorPicker-rgb-r" class="rich-color-picker-colors-input" type="text" maxlength="3" size="2" />
</div>
<div class="rich-color-picker-rgb-wrapper rich-color-picker-rgb-g">
- <label for="rgb-g">G:</label>
+ <label for="#{clientId}-colorPicker-rgb-g">G:</label>
<input id="#{clientId}-colorPicker-rgb-g" class="rich-color-picker-colors-input" type="text" maxlength="3" size="2" />
</div>
<div class="rich-color-picker-rgb-wrapper rich-color-picker-rgb-b">
- <label for="rgb-b">B:</label>
+ <label for="#{clientId}-colorPicker-rgb-b">B:</label>
<input id="#{clientId}-colorPicker-rgb-b" class="rich-color-picker-colors-input" type="text" maxlength="3" size="2" />
</div>
<div class="rich-color-picker-hsb-h rich-color-picker-hsb-wrapper">
- <label for="hsb-h">H:</label>
+ <label for="#{clientId}-colorPicker-hsb-h">H:</label>
<input id="#{clientId}-colorPicker-hsb-h" class="rich-color-picker-colors-input" type="text" maxlength="3" size="2" />
</div>
<div class="rich-color-picker-hsb-s rich-color-picker-hsb-wrapper">
- <label for="hsb-s">S:</label>
+ <label for="#{clientId}-colorPicker-hsb-s">S:</label>
<input id="#{clientId}-colorPicker-hsb-s" class="rich-color-picker-colors-input" type="text" maxlength="3" size="2" />
</div>
<div class="rich-color-picker-hsb-b rich-color-picker-hsb-wrapper">
- <label for="hsb-b">B:</label>
+ <label for="#{clientId}-colorPicker-hsb-b">B:</label>
<input id="#{clientId}-colorPicker-hsb-b" class="rich-color-picker-colors-input" type="text" maxlength="3" size="2" />
</div>
<button type="button" class="rich-color-picker-submit" name="submit">Apply</button>
15 years, 1 month
JBoss Rich Faces SVN: r14268 - in branches/community/3.3.X: ui/colorPicker/src/main/config/component and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: Alex.Kolonitsky
Date: 2009-05-21 12:14:17 -0400 (Thu, 21 May 2009)
New Revision: 14268
Modified:
branches/community/3.3.X/samples/colorPickerDemo/src/main/webapp/pages/index.jsp
branches/community/3.3.X/ui/colorPicker/src/main/config/component/colorPicker.xml
branches/community/3.3.X/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx
Log:
Colorpicker: add "inputSize" attribute
https://jira.jboss.org/jira/browse/RF-7191
Modified: branches/community/3.3.X/samples/colorPickerDemo/src/main/webapp/pages/index.jsp
===================================================================
--- branches/community/3.3.X/samples/colorPickerDemo/src/main/webapp/pages/index.jsp 2009-05-21 13:54:19 UTC (rev 14267)
+++ branches/community/3.3.X/samples/colorPickerDemo/src/main/webapp/pages/index.jsp 2009-05-21 16:14:17 UTC (rev 14268)
@@ -24,7 +24,7 @@
<h:outputText value="Data Table" />
</f:facet>
- <colorPicker:colorPicker id="cp" value="#ff0000" />
+ <colorPicker:colorPicker id="cp" value="#ff0000" inputSize="3"/>
<h:outputText value="#{row}"/>
</rich:column>
Modified: branches/community/3.3.X/ui/colorPicker/src/main/config/component/colorPicker.xml
===================================================================
--- branches/community/3.3.X/ui/colorPicker/src/main/config/component/colorPicker.xml 2009-05-21 13:54:19 UTC (rev 14267)
+++ branches/community/3.3.X/ui/colorPicker/src/main/config/component/colorPicker.xml 2009-05-21 16:14:17 UTC (rev 14268)
@@ -56,6 +56,13 @@
</description>
<defaultvalue><![CDATA["#ffffff"]]></defaultvalue>
</property>
+ <property>
+ <name>inputSize</name>
+ <classname>java.lang.Integer</classname>
+ <description>
+ inputSize - way to set the size of the edit box
+ </description>
+ </property>
&ui_component_attributes;
&html_events;
Modified: branches/community/3.3.X/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx
===================================================================
--- branches/community/3.3.X/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx 2009-05-21 13:54:19 UTC (rev 14267)
+++ branches/community/3.3.X/ui/colorPicker/src/main/templates/org/richfaces/htmlColorPicker.jspx 2009-05-21 16:14:17 UTC (rev 14268)
@@ -28,7 +28,7 @@
<f:call name="addPopupToAjaxRendered" />
<span id="#{clientId}" class="rich-color-picker-span" x:passThruWithExclusions="value,name,type,id,styleClass,class,style">
- <input readonly="readonly" type="text" name="#{clientId}" value="#{value}"/>
+ <input readonly="readonly" type="text" name="#{clientId}" value="#{value}" size="#{component.attributes['inputSize']}"/>
<jsp:scriptlet><![CDATA[
if(component.getFacet("icon")!=null && component.getFacet("icon").isRendered()) {
]]></jsp:scriptlet>
15 years, 1 month
JBoss Rich Faces SVN: r14267 - branches/community/3.3.X/docs/photo_album_app_guide/en/src/main/docbook.
by richfaces-svn-commits@lists.jboss.org
Author: ochikvina
Date: 2009-05-21 09:54:19 -0400 (Thu, 21 May 2009)
New Revision: 14267
Modified:
branches/community/3.3.X/docs/photo_album_app_guide/en/src/main/docbook/master.xml
Log:
https://jira.jboss.org/jira/browse/RF-7014 - adding the RF logo to PDF;
Modified: branches/community/3.3.X/docs/photo_album_app_guide/en/src/main/docbook/master.xml
===================================================================
--- branches/community/3.3.X/docs/photo_album_app_guide/en/src/main/docbook/master.xml 2009-05-21 13:53:54 UTC (rev 14266)
+++ branches/community/3.3.X/docs/photo_album_app_guide/en/src/main/docbook/master.xml 2009-05-21 13:54:19 UTC (rev 14267)
@@ -27,6 +27,16 @@
<book>
<bookinfo>
<title>RichFaces Photo Album Application Guide</title>
+ <corpauthor>
+ <inlinemediaobject>
+ <imageobject role="fo">
+ <imagedata format="PNG" fileref="images/richfaces_logo.png" />
+ </imageobject>
+ <imageobject role="html">
+ <imagedata/>
+ </imageobject>
+ </inlinemediaobject>
+ </corpauthor>
<subtitle>This documentation is work in progress, thus some mistakes or incompleteness is possible</subtitle>
<author>
<firstname>Alex</firstname>
15 years, 1 month
JBoss Rich Faces SVN: r14266 - branches/community/3.3.X/docs/photo_album_app_guide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: ochikvina
Date: 2009-05-21 09:53:54 -0400 (Thu, 21 May 2009)
New Revision: 14266
Added:
branches/community/3.3.X/docs/photo_album_app_guide/en/src/main/resources/images/richfaces_logo.png
Log:
https://jira.jboss.org/jira/browse/RF-7014 - adding the RF logo image;
Added: branches/community/3.3.X/docs/photo_album_app_guide/en/src/main/resources/images/richfaces_logo.png
===================================================================
(Binary files differ)
Property changes on: branches/community/3.3.X/docs/photo_album_app_guide/en/src/main/resources/images/richfaces_logo.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
15 years, 1 month