Author: ppitonak(a)redhat.com
Date: 2011-03-30 08:52:30 -0400 (Wed, 30 Mar 2011)
New Revision: 22337
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/validation/StringSizeBean.java
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richValidator/csv.xhtml
modules/tests/metamer/trunk/application/src/main/webapp/components/richValidator/jsr303.xhtml
Log:
rich:validator samples updated
Added:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/validation/StringSizeBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/validation/StringSizeBean.java
(rev 0)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/validation/StringSizeBean.java 2011-03-30
12:52:30 UTC (rev 22337)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.validation;
+
+import javax.faces.bean.ManagedBean;
+import javax.validation.constraints.Size;
+
+/**
+ * Helper bean for testing JSR-303.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+@ManagedBean
+public class StringSizeBean extends Validable<String> {
+
+ public StringSizeBean() {
+ value = "JSF";
+ }
+
+ @Size(min = 2, max = 4)
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ @Override
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String getDescription() {
+ return "String size, from 2 to 4";
+ }
+
+ @Override
+ public String getLabel() {
+ return "stringSize";
+ }
+}
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richValidator/csv.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richValidator/csv.xhtml 2011-03-30
12:30:54 UTC (rev 22336)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richValidator/csv.xhtml 2011-03-30
12:52:30 UTC (rev 22337)
@@ -65,6 +65,7 @@
$('input[id$=custom]').val('RichFaces');
$('input[id$=past]').val(inPast.format("d mmm yyyy"));
$('input[id$=future]').val(inFuture.format("d mmm
yyyy"));
+ $('input[id$=stringSize]').val('JSF');
$('input[value=A]')[0].checked=true
$('input[value=B]')[0].checked=true
$('input[value=C]')[0].checked=false
@@ -91,6 +92,7 @@
$('input[id$=custom]').val('@@@');
$('input[id$=past]').val(inFuture.format("d mmm
yyyy"));
$('input[id$=future]').val(inPast.format("d mmm
yyyy"));
+ $('input[id$=stringSize]').val('JSF 2');
$('input[value=A]')[0].checked=false
$('input[value=B]')[0].checked=false
$('input[value=C]')[0].checked=false
@@ -316,6 +318,22 @@
</h:inputText>
<rich:message id="futureMsg" for="future" />
+ <h:outputLabel for="stringSize"
value="#{stringSizeBean.description}" />
+ <h:inputText id="stringSize"
value="#{stringSizeBean.value}" label="#{stringSizeBean.label}" >
+ <rich:validator
data="#{richValidatorBean.attributes['data'].value}"
+
disabled="#{richValidatorBean.attributes['disabled'].value}"
+
immediate="#{richValidatorBean.attributes['immediate'].value}"
+
onbeforedomupdate="#{richValidatorBean.attributes['onbeforedomupdate'].value}"
+
onbeforesubmit="#{richValidatorBean.attributes['onbeforesubmit'].value}"
+
onbegin="#{richValidatorBean.attributes['onbegin'].value}"
+
oncomplete="#{richValidatorBean.attributes['oncomplete'].value}"
+
onerror="#{richValidatorBean.attributes['onerror'].value}"
+
queueId="#{richValidatorBean.attributes['queueId'].value}"
+
status="#{richValidatorBean.attributes['status'].value}"
+ />
+ </h:inputText>
+ <rich:message id="stringSizeMsg" for="stringSize"
/>
+
<h:outputLabel for="size"
value="#{sizeBean.description}" />
<h:selectManyCheckbox id="size"
value="#{sizeBean.value}" label="#{sizeBean.label}" >
<f:selectItem itemValue="A"
itemLabel="A"/>
@@ -324,6 +342,17 @@
<f:selectItem itemValue="D"
itemLabel="D"/>
<f:selectItem itemValue="E"
itemLabel="E"/>
<f:selectItem itemValue="F"
itemLabel="F"/>
+ <rich:validator
data="#{richValidatorBean.attributes['data'].value}"
+
disabled="#{richValidatorBean.attributes['disabled'].value}"
+
immediate="#{richValidatorBean.attributes['immediate'].value}"
+
onbeforedomupdate="#{richValidatorBean.attributes['onbeforedomupdate'].value}"
+
onbeforesubmit="#{richValidatorBean.attributes['onbeforesubmit'].value}"
+
onbegin="#{richValidatorBean.attributes['onbegin'].value}"
+
oncomplete="#{richValidatorBean.attributes['oncomplete'].value}"
+
onerror="#{richValidatorBean.attributes['onerror'].value}"
+
queueId="#{richValidatorBean.attributes['queueId'].value}"
+
status="#{richValidatorBean.attributes['status'].value}"
+ />
</h:selectManyCheckbox>
<rich:message id="sizeMsg" for="size" />
</h:panelGrid>
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richValidator/jsr303.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richValidator/jsr303.xhtml 2011-03-30
12:30:54 UTC (rev 22336)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richValidator/jsr303.xhtml 2011-03-30
12:52:30 UTC (rev 22337)
@@ -64,6 +64,7 @@
$('input[id$=pattern]').val('richFaces 4');
$('input[id$=past]').val(inPast.format("d mmm yyyy"));
$('input[id$=future]').val(inFuture.format("d mmm
yyyy"));
+ $('input[id$=stringSize]').val('JSF');
$('input[value=A]')[0].checked=true
$('input[value=B]')[0].checked=true
$('input[value=C]')[0].checked=false
@@ -90,6 +91,7 @@
$('input[id$=custom]').val('@@@');
$('input[id$=past]').val(inFuture.format("d mmm
yyyy"));
$('input[id$=future]').val(inPast.format("d mmm
yyyy"));
+ $('input[id$=stringSize]').val('JSF 2');
$('input[value=A]')[0].checked=false
$('input[value=B]')[0].checked=false
$('input[value=C]')[0].checked=false
@@ -162,6 +164,10 @@
</h:inputText>
<rich:message id="futureMsg" for="future" />
+ <h:outputLabel for="stringSize"
value="#{stringSizeBean.description}" />
+ <h:inputText id="stringSize"
value="#{stringSizeBean.value}" label="#{stringSizeBean.label}" />
+ <rich:message id="stringSizeMsg" for="stringSize"
/>
+
<h:outputLabel for="size"
value="#{sizeBean.description}" />
<h:selectManyCheckbox id="size"
value="#{sizeBean.value}" label="#{sizeBean.label}" >
<f:selectItem itemValue="A"
itemLabel="A"/>