Author: jjamrich
Date: 2011-05-10 11:15:46 -0400 (Tue, 10 May 2011)
New Revision: 22481
Removed:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/validation/groups/ValidableGroupNumericInputs.java
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichGraphValidatorBean.java
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/validation/groups/ValidationGroupNumericInputs.java
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichGraphValidatorBean.properties
modules/tests/metamer/trunk/application/src/main/webapp/components/richGraphValidator/all.xhtml
Log:
Get groups attr in graphValidator working!
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichGraphValidatorBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichGraphValidatorBean.java 2011-05-09
21:11:13 UTC (rev 22480)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichGraphValidatorBean.java 2011-05-10
15:15:46 UTC (rev 22481)
@@ -33,10 +33,13 @@
import javax.faces.model.SelectItem;
import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.NotNull;
+import javax.validation.groups.Default;
import org.hibernate.validator.constraints.NotEmpty;
import org.richfaces.component.UIGraphValidator;
+import org.richfaces.tests.metamer.Attribute;
import org.richfaces.tests.metamer.Attributes;
+import org.richfaces.tests.metamer.validation.groups.ValidationGroupAllComponents;
import org.richfaces.tests.metamer.validation.groups.ValidationGroupBooleanInputs;
import org.richfaces.tests.metamer.validation.groups.ValidationGroupNumericInputs;
import org.slf4j.Logger;
@@ -114,15 +117,17 @@
attributes.setAttribute("type",
"org.richfaces.BeanValidator");
}
- @AssertTrue(message = "One of following inputs doesn't contain smile or
numeric value 10!")
- public boolean isAllInputsCorrect(){
+ @AssertTrue(message = "One of following inputs doesn't contain smile or
numeric value "
+ + REQUIRED_INT_VALUE + "!",
+ groups = {Default.class, ValidationGroupAllComponents.class})
+ public boolean isAllInputsCorrect() {
return autocompleteInput.contains(smile)
&& inplaceSelect.contains(smile)
&& inplaceInput.contains(smile)
&& select.contains(smile)
- && inputNumberSlider.equals(new Integer(10))
- && inputNumberSpinner.equals(new Integer(10))
+ && inputNumberSlider.equals(new Integer(REQUIRED_INT_VALUE))
+ && inputNumberSpinner.equals(new Integer(REQUIRED_INT_VALUE))
&& inputText.contains(smile)
&& inputSecret.contains(smile)
&& inputTextarea.contains(smile)
@@ -135,18 +140,18 @@
&& selectOneRadio.contains(smile);
}
- @AssertTrue(message = "One of following inputs doesn't contain smile",
+ @AssertTrue(message = "One of following numeric inputs doesn't contain value
"
+ + REQUIRED_INT_VALUE + "!",
groups = {ValidationGroupNumericInputs.class})
public boolean isAllTextInputsCorrect() {
- return inputNumberSlider.equals(new Integer(10))
- && inputNumberSpinner.equals(new Integer(10));
+ return inputNumberSlider.equals(new Integer(REQUIRED_INT_VALUE))
+ && inputNumberSpinner.equals(new Integer(REQUIRED_INT_VALUE));
}
- @AssertTrue(message = "One of following inputs doesn't contain smile",
+ @AssertTrue(message = "Select Boolean Checkbox isn't checked!",
groups = {ValidationGroupBooleanInputs.class})
public boolean isAllBooleanInputsCorrect() {
- return inputNumberSlider.equals(new Integer(10))
- && inputNumberSpinner.equals(new Integer(10));
+ return selectBooleanCheckbox.booleanValue();
}
public void anotherActionOnAllComponents() {
@@ -165,8 +170,15 @@
return result;
}
- public Class<?> getValidationGroups() {
- return ValidationGroupNumericInputs.class;
+ public Class<?>[] getValidationGroups() throws ClassNotFoundException {
+ Attribute groups = attributes.get("groups");
+ Class<?> group;
+ if (groups.getValue() != null && !"".equals(groups.getValue()))
{
+ group = Class.forName(groups.getValue().toString());
+ } else {
+ group = Default.class;
+ }
+ return new Class[]{group};
}
public Attributes getAttributes() {
Deleted:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/validation/groups/ValidableGroupNumericInputs.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/validation/groups/ValidableGroupNumericInputs.java 2011-05-09
21:11:13 UTC (rev 22480)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/validation/groups/ValidableGroupNumericInputs.java 2011-05-10
15:15:46 UTC (rev 22481)
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * 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.groups;
-
-/**
- * Validation Group for Numeric Inputs
- *
- * @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
- * @version $Revision$
- */
-public interface ValidableGroupNumericInputs {
-
-}
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/validation/groups/ValidationGroupNumericInputs.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/validation/groups/ValidationGroupNumericInputs.java 2011-05-09
21:11:13 UTC (rev 22480)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/validation/groups/ValidationGroupNumericInputs.java 2011-05-10
15:15:46 UTC (rev 22481)
@@ -22,11 +22,11 @@
package org.richfaces.tests.metamer.validation.groups;
/**
- * Implementation test
+ * Validation Group for Numeric Inputs
*
* @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
* @version $Revision$
*/
-public class ValidationGroupNumericInputs implements ValidableGroupNumericInputs {
+public interface ValidationGroupNumericInputs {
}
Modified:
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichGraphValidatorBean.properties
===================================================================
---
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichGraphValidatorBean.properties 2011-05-09
21:11:13 UTC (rev 22480)
+++
modules/tests/metamer/trunk/application/src/main/resources/org/richfaces/tests/metamer/bean/rich/RichGraphValidatorBean.properties 2011-05-10
15:15:46 UTC (rev 22481)
@@ -1,2 +1,7 @@
attr.type.BeanValidator=org.richfaces.BeanValidator
+attr.groups.null=
+attr.groups.Default=javax.validation.groups.Default
+attr.groups.ValidationGroupAllComponents=org.richfaces.tests.metamer.validation.groups.ValidationGroupAllComponents
+attr.groups.ValidationGroupBooleanInputs=org.richfaces.tests.metamer.validation.groups.ValidationGroupBooleanInputs
+attr.groups.ValidationGroupNumericInputs=org.richfaces.tests.metamer.validation.groups.ValidationGroupNumericInputs
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richGraphValidator/all.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richGraphValidator/all.xhtml 2011-05-09
21:11:13 UTC (rev 22480)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richGraphValidator/all.xhtml 2011-05-10
15:15:46 UTC (rev 22481)
@@ -55,14 +55,16 @@
|| richGraphValidatorBean.attributes['summary'].value==''}"
>
<rich:graphValidator id="gv1"
value="#{richGraphValidatorBean}"
-
groups="#{richGraphValidatorBean.attributes['groups'].value}"
+ groups="#{richGraphValidatorBean.validationGroups}"
type="#{richGraphValidatorBean.attributes['type'].value}"
rendered="#{richGraphValidatorBean.attributes['rendered'].value}"
>
<rich:panel header="Many rich components within rich:graphValidator"
style="width:500px">
+ <rich:messages for="gv1" />
<rich:messages globalOnly="true" />
<h:panelGrid columns="3">
<h:outputText for="inplaceSelect" value="Inplace Select"
/>
- <rich:inplaceSelect id="inplaceSelect"
value="#{richGraphValidatorBean.inplaceSelect}" >
+ <rich:inplaceSelect id="inplaceSelect"
value="#{richGraphValidatorBean.inplaceSelect}"
+ defaultLabel="Write smile here..." >
<f:selectItems value="#{richGraphValidatorBean.selectItems}" />
</rich:inplaceSelect>
<rich:message for="inplaceSelect" />