Author: dsvyatobatsko
Date: 2008-07-08 13:03:25 -0400 (Tue, 08 Jul 2008)
New Revision: 9460
Modified:
trunk/sandbox/ui/beanValidator/src/main/java/org/richfaces/component/UIBeanValidator.java
Log:
Modified:
trunk/sandbox/ui/beanValidator/src/main/java/org/richfaces/component/UIBeanValidator.java
===================================================================
---
trunk/sandbox/ui/beanValidator/src/main/java/org/richfaces/component/UIBeanValidator.java 2008-07-08
15:40:53 UTC (rev 9459)
+++
trunk/sandbox/ui/beanValidator/src/main/java/org/richfaces/component/UIBeanValidator.java 2008-07-08
17:03:25 UTC (rev 9460)
@@ -22,9 +22,9 @@
*/
public abstract class UIBeanValidator extends UIComponentBase {
- public static final String COMPONENT_TYPE =
"org.richfaces.ui.BeanValidator";
+ public static final String COMPONENT_TYPE = "org.richfaces.BeanValidator";
- public static final String COMPONENT_FAMILY =
"org.richfaces.ui.BeanValidator";
+ public static final String COMPONENT_FAMILY =
"org.richfaces.BeanValidator";
public abstract String getEvent();
@@ -41,38 +41,34 @@
public void setParent(UIComponent parent) {
super.setParent(parent);
- if (null != parent && parent.getFamily() != null) {
+ if (!(parent instanceof EditableValueHolder)) {
+ throw new FaceletException("Parent component must be an
EditableValueHolder");
+ }
- if (!(parent instanceof EditableValueHolder)) {
- throw new FaceletException("Parent component must be an
EditableValueHolder");
- }
+ Validator[] validators = ((EditableValueHolder) parent).getValidators();
- Validator[] validators = ((EditableValueHolder) parent).getValidators();
-
- boolean isFacesValidatorPresent = false;
- for (Validator validator : validators) {
- if (validator instanceof FacesBeanValidator) {
- isFacesValidatorPresent = true;
- break;
- }
+ boolean isFacesValidatorPresent = false;
+ for (Validator validator : validators) {
+ if (validator instanceof FacesBeanValidator) {
+ isFacesValidatorPresent = true;
+ break;
}
+ }
- if (!isFacesValidatorPresent) {
- FacesBeanValidator validator = (FacesBeanValidator)
FacesContext.getCurrentInstance().getApplication()
- .createValidator("org.richfaces.BeanValidator");
- ((EditableValueHolder) parent).addValidator(validator);
- }
+ if (!isFacesValidatorPresent) {
+ FacesBeanValidator validator = (FacesBeanValidator)
FacesContext.getCurrentInstance().getApplication()
+ .createValidator("org.richfaces.BeanValidator");
+ ((EditableValueHolder) parent).addValidator(validator);
+ }
- FacesContext ctx = FacesContext.getCurrentInstance();
- ValueExpression binding =
ctx.getApplication().getExpressionFactory().createValueExpression(
- ctx.getELContext(), getEventString(), String.class);
+ FacesContext ctx = FacesContext.getCurrentInstance();
+ ValueExpression binding =
ctx.getApplication().getExpressionFactory().createValueExpression(ctx.getELContext(),
+ getEventString(), String.class);
- parent.setValueExpression(getEvent(), binding);
- }
+ parent.setValueExpression(getEvent(), binding);
}
- private String getEventString()
- {
+ private String getEventString() {
StringBuffer buildOnEvent = new StringBuffer();
buildOnEvent.append(AjaxRendererUtils.buildOnEvent(this, getFacesContext(),
getEvent()));
return buildOnEvent.toString();
Show replies by date