Author: nbelaevski
Date: 2008-07-24 14:32:24 -0400 (Thu, 24 Jul 2008)
New Revision: 9775
Modified:
trunk/ui/beanValidator/src/main/config/component/beanValidator.xml
trunk/ui/beanValidator/src/main/java/org/richfaces/component/UIBeanValidator.java
Log:
https://jira.jboss.org/jira/browse/RF-3927
Modified: trunk/ui/beanValidator/src/main/config/component/beanValidator.xml
===================================================================
--- trunk/ui/beanValidator/src/main/config/component/beanValidator.xml 2008-07-24 17:23:13
UTC (rev 9774)
+++ trunk/ui/beanValidator/src/main/config/component/beanValidator.xml 2008-07-24 18:32:24
UTC (rev 9775)
@@ -50,7 +50,14 @@
</description>
<defaultvalue>true</defaultvalue>
</property>
- <property disabled="true">
+ <property elonly="true" el="true"
attachedstate="true" >
+ <name>ajaxListener</name>
+ <classname>javax.el.MethodExpression</classname>
+ <description> MethodExpression representing an action listener method that
will be notified when this component is activated by the ajax Request and handle it. The
expression must evaluate to a public method that takes an AjaxEvent parameter, with a
return type of void</description>
+ <defaultvalue>null</defaultvalue>
+ <methodargs>org.ajax4jsf.event.AjaxEvent</methodargs>
+ </property>
+ <property disabled="true">
<name>bypassUpdates</name>
<classname>boolean</classname>
<description>
@@ -96,5 +103,4 @@
<superclass>javax.faces.webapp.ValidatorELTag</superclass>
</tag>
</validator>
-
</components>
Modified:
trunk/ui/beanValidator/src/main/java/org/richfaces/component/UIBeanValidator.java
===================================================================
---
trunk/ui/beanValidator/src/main/java/org/richfaces/component/UIBeanValidator.java 2008-07-24
17:23:13 UTC (rev 9774)
+++
trunk/ui/beanValidator/src/main/java/org/richfaces/component/UIBeanValidator.java 2008-07-24
18:32:24 UTC (rev 9775)
@@ -10,6 +10,7 @@
import java.util.List;
import java.util.Set;
+import javax.el.MethodExpression;
import javax.el.ValueExpression;
import javax.faces.FacesException;
import javax.faces.component.EditableValueHolder;
@@ -30,6 +31,7 @@
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;
import com.sun.facelets.FaceletException;
@@ -174,8 +176,7 @@
* @see
org.ajax4jsf.event.AjaxSource#addAjaxListener(org.ajax4jsf.event.AjaxListener)
*/
public void addAjaxListener(AjaxListener listener) {
- // TODO Auto-generated method stub
-
+ addFacesListener(listener);
}
/*
@@ -184,16 +185,49 @@
* @see org.ajax4jsf.event.AjaxSource#getAjaxListeners()
*/
public AjaxListener[] getAjaxListeners() {
- // TODO Auto-generated method stub
- return null;
+ return (AjaxListener[]) getFacesListeners(AjaxListener.class);
}
/* (non-Javadoc)
* @see
org.ajax4jsf.event.AjaxSource#removeAjaxListener(org.ajax4jsf.event.AjaxListener)
*/
public void removeAjaxListener(AjaxListener listener) {
- // TODO Auto-generated method stub
+ 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;
+ }
}