Author: jjamrich
Date: 2011-08-01 15:35:05 -0400 (Mon, 01 Aug 2011)
New Revision: 22579
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichEditorBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richEditor/simple.xhtml
Log:
Add validator attribute testing into rich:editor
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichEditorBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichEditorBean.java 2011-08-01
18:42:52 UTC (rev 22578)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichEditorBean.java 2011-08-01
19:35:05 UTC (rev 22579)
@@ -24,8 +24,12 @@
import java.io.Serializable;
import javax.annotation.PostConstruct;
+import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.ValidatorException;
import org.richfaces.component.UIEditor;
import org.richfaces.tests.metamer.Attributes;
@@ -59,6 +63,21 @@
attributes.remove("validator");
attributes.remove("validatorMessage");
}
+
+ /**
+ * Test method for verify validator attribute
+ * @param context
+ * @param component
+ * @param value
+ */
+ public void validateEditorValue(FacesContext context, UIComponent component, Object
value) {
+ String testValue = value.toString();
+ if (testValue != null && testValue.contains("#")) {
+ throw new ValidatorException(
+ new FacesMessage(FacesMessage.SEVERITY_ERROR,
+ "Editor must not contains '#' value!", "Editor
must not contains '#' value!"));
+ }
+ }
public Attributes getAttributes() {
return attributes;
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richEditor/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richEditor/simple.xhtml 2011-08-01
18:42:52 UTC (rev 22578)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richEditor/simple.xhtml 2011-08-01
19:35:05 UTC (rev 22579)
@@ -54,6 +54,7 @@
styleClass="#{richEditorBean.attributes['styleClass'].value}"
title="#{richEditorBean.attributes['title'].value}"
toolbar="#{richEditorBean.attributes['toolbar'].value}"
+ validator="#{richEditorBean.validateEditorValue}"
value="#{richEditorBean.attributes['value'].value}"
valueChangeListener="#{richBean.valueChangeListenerImproved}"
width="#{richEditorBean.attributes['width'].value}"
/>
Show replies by date