[richfaces-svn-commits] JBoss Rich Faces SVN: r15308 - in root/ui/trunk/components/core/src/main/java/org: ajax4jsf/facelets/tag and 2 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Wed Aug 26 07:20:28 EDT 2009


Author: abelevich
Date: 2009-08-26 07:20:28 -0400 (Wed, 26 Aug 2009)
New Revision: 15308

Modified:
   root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/behavior/AjaxBehavior.java
   root/ui/trunk/components/core/src/main/java/org/ajax4jsf/facelets/tag/AjaxHandler.java
   root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxBehaviorRenderer.java
   root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxFunctionRendererBase.java
Log:


Modified: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/behavior/AjaxBehavior.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/behavior/AjaxBehavior.java	2009-08-26 10:53:57 UTC (rev 15307)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/component/behavior/AjaxBehavior.java	2009-08-26 11:20:28 UTC (rev 15308)
@@ -22,9 +22,8 @@
 	
 	private static enum Attributes {
 		
-		limitRender, queueId, statusId, render, execute, similarityGroupingId,  other;
+		limitRender, queueId, statusId, render, execute, similarityGroupingId, oncomplete, onbegin, onbeforedomupdate, other;		
 		
-		
 		public static Attributes toAttribute(String name) {
 			
 			try {
@@ -47,11 +46,77 @@
 	
 	private Set <String> execute;
 	
+	private String oncomplete;
 	
+	private String onbeforedomupdate;
+	
+	private String onbegin;
+	
 	protected Set<String> asSet(Object render) {
 		return AjaxRendererUtils.asSet(render);
 	}
 	
+	public void setOnbegin(String onbegin) {
+		this.onbegin = onbegin;
+		clearInitialState();
+	}
+	
+	public String getOnbegin() {
+		if(this.onbegin != null) {
+			return this.onbegin;
+		}
+		
+		ValueExpression ve = getValueExpression(Attributes.onbegin.toString());
+		if(ve != null) {
+			ELContext elContext = FacesContext.getCurrentInstance().getELContext();
+			String value = ((String)ve.getValue(elContext));
+			return value;
+		}
+		
+		return this.onbegin;
+	}
+	
+	public void setOnBeforeDomUpdate(String onbeforedomupdate) {
+		this.onbeforedomupdate = onbeforedomupdate;
+		clearInitialState();
+	}
+	
+	public String getOnBeforeDomUpdate() {
+		if(this.onbeforedomupdate != null) {
+			return this.onbeforedomupdate;
+		}
+		
+		ValueExpression ve = getValueExpression(Attributes.onbeforedomupdate.toString());
+		if(ve != null) {
+			ELContext elContext = FacesContext.getCurrentInstance().getELContext();
+			String value = ((String)ve.getValue(elContext));
+			return value;
+		}
+		
+		return this.onbeforedomupdate;
+	}
+
+	
+	public void setOncomplete(String oncomplete) {
+		this.oncomplete = oncomplete;
+		clearInitialState();
+	}
+	
+	public String getOncomplete() {
+		if(this.oncomplete != null) {
+			return this.oncomplete;
+		}
+		
+		ValueExpression ve = getValueExpression(Attributes.oncomplete.toString());
+		if(ve != null) {
+			ELContext elContext = FacesContext.getCurrentInstance().getELContext();
+			String value = ((String)ve.getValue(elContext));
+			return value;
+		}
+		
+		return this.oncomplete;
+	}
+	
 	public void setRender(Collection<String> render) {
 		this.render = asSet(render);
 		clearInitialState();

Modified: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/facelets/tag/AjaxHandler.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/facelets/tag/AjaxHandler.java	2009-08-26 10:53:57 UTC (rev 15307)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/facelets/tag/AjaxHandler.java	2009-08-26 11:20:28 UTC (rev 15308)
@@ -29,8 +29,6 @@
 	private final TagAttribute event;
 	private final TagAttribute execute;
 	private final TagAttribute render;
-	private final TagAttribute onevent;
-	private final TagAttribute onerror;
 	private final TagAttribute disabled;
 	private final TagAttribute immediate;
 	private final TagAttribute listener;
@@ -38,6 +36,11 @@
 	private final TagAttribute queueId;
 	private final TagAttribute statusId;
 	private final TagAttribute similarityGroupingId;
+	private final TagAttribute onevent;
+	private final TagAttribute onerror;
+	private final TagAttribute onbegin;
+	private final TagAttribute oncomplete;
+	private final TagAttribute onbeforedomupdate;
     private final boolean wrapping;
 
 	
@@ -46,8 +49,6 @@
 		this.event = this.getAttribute("event");
 		this.execute = this.getAttribute("execute");
 		this.render = this.getAttribute("render");
-		this.onevent = this.getAttribute("onevent");
-		this.onerror = this.getAttribute("onerror");
 		this.disabled = this.getAttribute("disabled");
 		this.immediate = this.getAttribute("immediate");
 		this.listener = this.getAttribute("listener");
@@ -55,7 +56,12 @@
 		this.queueId = this.getAttribute("queueId");
 		this.statusId = this.getAttribute("statusId");
 		this.similarityGroupingId = this.getAttribute("similarityGroupingId");
-        this.wrapping = isWrapping();
+		this.onevent = this.getAttribute("onevent");
+		this.onerror = this.getAttribute("onerror");
+		this.onbegin = this.getAttribute("onbegin");
+		this.oncomplete = this.getAttribute("oncomplete");
+		this.onbeforedomupdate = this.getAttribute("onBeforeDomUpdate");
+		this.wrapping = isWrapping();
 	}
 
 	public void apply(FaceletContext fContext, UIComponent parent) throws IOException {
@@ -151,8 +157,6 @@
 		Application application = fContext.getFacesContext().getApplication();
 		AjaxBehavior ajaxBehavior = (AjaxBehavior)application.createBehavior(AjaxBehavior.BEHAVIOR_ID);
 		
-		setBehaviorAttribute(fContext, ajaxBehavior, this.onevent, String.class);
-		setBehaviorAttribute(fContext, ajaxBehavior, this.onerror, String.class);
 		setBehaviorAttribute(fContext, ajaxBehavior, this.disabled, Boolean.class);
 		setBehaviorAttribute(fContext, ajaxBehavior, this.immediate, Boolean.class);
 		setBehaviorAttribute(fContext, ajaxBehavior, this.execute, Object.class);
@@ -161,6 +165,11 @@
 		setBehaviorAttribute(fContext, ajaxBehavior, this.queueId, String.class);
 		setBehaviorAttribute(fContext, ajaxBehavior, this.statusId, String.class);
 		setBehaviorAttribute(fContext, ajaxBehavior, this.similarityGroupingId, String.class);
+		setBehaviorAttribute(fContext, ajaxBehavior, this.onevent, String.class);
+		setBehaviorAttribute(fContext, ajaxBehavior, this.onerror, String.class);
+		setBehaviorAttribute(fContext, ajaxBehavior, this.onbegin, String.class);
+		setBehaviorAttribute(fContext, ajaxBehavior, this.oncomplete, String.class);
+		setBehaviorAttribute(fContext, ajaxBehavior, this.onbeforedomupdate, String.class);
 		
 		registerBehaviorListener(fContext, ajaxBehavior, listener);
 

Modified: root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxBehaviorRenderer.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxBehaviorRenderer.java	2009-08-26 10:53:57 UTC (rev 15307)
+++ root/ui/trunk/components/core/src/main/java/org/ajax4jsf/renderkit/AjaxBehaviorRenderer.java	2009-08-26 11:20:28 UTC (rev 15308)
@@ -14,6 +14,7 @@
 import javax.faces.render.FacesBehaviorRenderer;
 import javax.faces.render.RenderKitFactory;
 
+import org.ajax4jsf.component.AjaxClientBehavior;
 import org.ajax4jsf.component.behavior.AjaxBehavior;
 import org.ajax4jsf.javascript.JSFunction;
 import org.richfaces.context.PartialViewContextFactoryImpl;
@@ -86,19 +87,20 @@
 		
 		JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(parent, context, AjaxRendererUtils.AJAX_FUNCTION_NAME);
 	
-		AjaxEventOptions options = buildOptions(context, bContext);
+		AjaxEventOptions options = buildOptions(context, bContext, behavior);
 		ajaxFunction.addParameter(options);
 	
 		return ajaxFunction.toString();
 	}
 	
-	public AjaxEventOptions buildOptions(FacesContext context, ClientBehaviorContext bContext) {
+	public AjaxEventOptions buildOptions(FacesContext context, ClientBehaviorContext bContext, AjaxClientBehavior behavior) {
 		UIComponent parent = bContext.getComponent();
 		String eventName = bContext.getEventName();
-		
-		AjaxEventOptions options = AjaxRendererUtils.buildEventOptions(context, parent);
+		AjaxEventOptions options = AjaxRendererUtils.buildEventOptions(context, behavior, parent);
 		options.setParameter(PartialViewContextImpl.BEHAVIOR_EVENT_PARAMETER, eventName);
 		options.setParameter(PartialViewContextFactoryImpl.RICHFACES_AJAX, parent.getClientId());
+		
 		return options;
 	}
+	
 }

Modified: root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxFunctionRendererBase.java
===================================================================
--- root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxFunctionRendererBase.java	2009-08-26 10:53:57 UTC (rev 15307)
+++ root/ui/trunk/components/core/src/main/java/org/richfaces/renderkit/AjaxFunctionRendererBase.java	2009-08-26 11:20:28 UTC (rev 15308)
@@ -54,7 +54,7 @@
 		// Create AJAX Submit function.
 		JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(
 				component, context, AjaxRendererUtils.AJAX_FUNCTION_NAME);
-		AjaxEventOptions options = AjaxRendererUtils.buildEventOptions(context, component);
+		AjaxEventOptions options = AjaxRendererUtils.buildEventOptions(context, null, component);
 		ajaxFunction.addParameter(options);
 
 		Map<String, Object> parameters = options.getParameters();



More information about the richfaces-svn-commits mailing list