Author: alexsmirnov
Date: 2008-03-20 17:19:43 -0400 (Thu, 20 Mar 2008)
New Revision: 7034
Modified:
trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ajax_component_attributes.ent
trunk/framework/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java
trunk/framework/api/src/main/java/org/ajax4jsf/context/AjaxContext.java
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
trunk/framework/test/src/test/java/org/ajax4jsf/context/MockAjaxContext.java
trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java
trunk/ui/tabPanel/src/test/java/org/richfaces/component/UITabTest.java
Log:
First implementation for a
http://jira.jboss.com/jira/browse/RF-1151
Modified:
trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ajax_component_attributes.ent
===================================================================
---
trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ajax_component_attributes.ent 2008-03-20
19:50:46 UTC (rev 7033)
+++
trunk/cdk/generator/src/main/resources/META-INF/schema/entities/ajax_component_attributes.ent 2008-03-20
21:19:43 UTC (rev 7034)
@@ -36,6 +36,12 @@
<description>Id['s] (in format of call UIComponent.findComponent()) of
components, rendered in case of AjaxRequest caused by this component. Can be single id,
comma-separated list of Id's, or EL Expression with array or
Collection</description>
</property>
+ <property >
+ <name>process</name>
+ <classname>java.lang.Object</classname>
+ <description>Id['s] (in format of call UIComponent.findComponent()) of
components, processed at the phases 2-5 in case of AjaxRequest caused by this component.
Can be single id, comma-separated list of Id's, or EL Expression with array or
Collection</description>
+ </property>
+
<property >
<name>status</name>
<classname>java.lang.String</classname>
Modified: trunk/framework/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java
===================================================================
--- trunk/framework/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java 2008-03-20
19:50:46 UTC (rev 7033)
+++ trunk/framework/api/src/main/java/org/ajax4jsf/component/AjaxComponent.java 2008-03-20
21:19:43 UTC (rev 7034)
@@ -47,6 +47,18 @@
/**
* setter method for property
+ * @param new value of String, <code>Collection</code> or array of
component's Id , processed at the phases 2-5
+ * in the case of Ajax request by parent component. to set
+ */
+ public abstract void setProcess(Object targetId);
+
+ /**
+ * @return value or result of valueBinding of String,
<code>Collection</code> or array of component's Id , processed at the
phases 2-5 in case of Ajax request by parent component.
+ */
+ public abstract Object getProcess();
+
+ /**
+ * setter method for property
* @param new value of ajaxType of control component - link or input to set
*/
// public abstract void setAjaxType(String ajaxType);
Modified: trunk/framework/api/src/main/java/org/ajax4jsf/context/AjaxContext.java
===================================================================
--- trunk/framework/api/src/main/java/org/ajax4jsf/context/AjaxContext.java 2008-03-20
19:50:46 UTC (rev 7033)
+++ trunk/framework/api/src/main/java/org/ajax4jsf/context/AjaxContext.java 2008-03-20
21:19:43 UTC (rev 7034)
@@ -59,6 +59,8 @@
public abstract Set<String> getAjaxAreasToRender();
+ public abstract Set<String> getAjaxAreasToProcess();
+
public abstract boolean isAjaxRequest();
public abstract void processHeadResources(FacesContext context)
@@ -92,6 +94,8 @@
public abstract String getAjaxSingleClientId();
+ public abstract void setAjaxAreasToProcess(Set<String> ajaxAreasToProcess);
+
/**
* Get instance of current AJAX Context. Instance get by
* variable {@link AjaxContext#AJAX_CONTEXT_KEY}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2008-03-20
19:50:46 UTC (rev 7033)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2008-03-20
21:19:43 UTC (rev 7034)
@@ -26,6 +26,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
+import java.util.Set;
import javax.el.MethodExpression;
import javax.faces.FacesException;
@@ -234,6 +235,12 @@
}
} else {
invokeOnComponent(context, ajaxSingleClientId, callback);
+ Set<String> areasToProcess = ajaxContext.getAjaxAreasToProcess();
+ if(null != areasToProcess){
+ for (String areaId : areasToProcess) {
+ invokeOnComponent(context, areaId, callback);
+ }
+ }
}
}
}
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2008-03-20
19:50:46 UTC (rev 7033)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/context/AjaxContextImpl.java 2008-03-20
21:19:43 UTC (rev 7034)
@@ -102,6 +102,8 @@
Set<String> ajaxAreasToRender = new HashSet<String>();
+ Set<String> ajaxAreasToProcess = null;
+
Set<String> ajaxRenderedAreas = new LinkedHashSet<String>();
boolean ajaxRequest = false;
@@ -129,6 +131,8 @@
public void release() {
ajaxAreasToRender = new HashSet<String>();
+
+ ajaxAreasToProcess = null;
ajaxRenderedAreas = new LinkedHashSet<String>();
@@ -532,6 +536,22 @@
}
/**
+ * @return the ajaxAreasToProcess
+ */
+ @Override
+ public Set<String> getAjaxAreasToProcess() {
+ return ajaxAreasToProcess;
+ }
+
+ /**
+ * @param ajaxAreasToProcess the ajaxAreasToProcess to set
+ */
+ @Override
+ public void setAjaxAreasToProcess(Set<String> ajaxAreasToProcess) {
+ this.ajaxAreasToProcess = ajaxAreasToProcess;
+ }
+
+ /**
* Add affected regions's ID to ajaxView component.
*
* @param component
Modified: trunk/framework/test/src/test/java/org/ajax4jsf/context/MockAjaxContext.java
===================================================================
---
trunk/framework/test/src/test/java/org/ajax4jsf/context/MockAjaxContext.java 2008-03-20
19:50:46 UTC (rev 7033)
+++
trunk/framework/test/src/test/java/org/ajax4jsf/context/MockAjaxContext.java 2008-03-20
21:19:43 UTC (rev 7034)
@@ -306,4 +306,13 @@
}
+ public void setAjaxAreasToProcess(Set<String> ajaxAreasToProcess) {
+ }
+
+ @Override
+ public Set<String> getAjaxAreasToProcess() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java
===================================================================
--- trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java 2008-03-20
19:50:46 UTC (rev 7033)
+++ trunk/ui/core/src/main/java/org/ajax4jsf/component/UIAjaxRegion.java 2008-03-20
21:19:43 UTC (rev 7034)
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.util.Iterator;
+import java.util.Set;
import javax.el.MethodExpression;
import javax.faces.FacesException;
@@ -92,6 +93,12 @@
}
if (ajaxContext.isAjaxRequest() && null != ajaxSingleClientId) {
invokeOnComponent(context, ajaxSingleClientId, decodeCallback);
+ Set<String> areasToProcess = ajaxContext.getAjaxAreasToProcess();
+ if(null != areasToProcess){
+ for (String areaId : areasToProcess) {
+ invokeOnComponent(context, areaId, decodeCallback);
+ }
+ }
} else {
// Process all facets and children of this component
Iterator<UIComponent> kids = getFacetsAndChildren();
@@ -108,6 +115,12 @@
String ajaxSingleClientId = ajaxContext.getAjaxSingleClientId();
if (ajaxContext.isAjaxRequest() && null != ajaxSingleClientId) {
invokeOnComponent(context, ajaxSingleClientId, validateCallback);
+ Set<String> areasToProcess = ajaxContext.getAjaxAreasToProcess();
+ if(null != areasToProcess){
+ for (String areaId : areasToProcess) {
+ invokeOnComponent(context, areaId, validateCallback);
+ }
+ }
} else {
super.processValidators(context);
}
@@ -119,6 +132,12 @@
String ajaxSingleClientId = ajaxContext.getAjaxSingleClientId();
if (ajaxContext.isAjaxRequest() && null != ajaxSingleClientId) {
invokeOnComponent(context, ajaxSingleClientId, updateCallback);
+ Set<String> areasToProcess = ajaxContext.getAjaxAreasToProcess();
+ if(null != areasToProcess){
+ for (String areaId : areasToProcess) {
+ invokeOnComponent(context, areaId, updateCallback);
+ }
+ }
} else {
super.processUpdates(context);
}
Modified: trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java
===================================================================
---
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java 2008-03-20
19:50:46 UTC (rev 7033)
+++
trunk/ui/core/src/main/java/org/ajax4jsf/renderkit/AjaxCommandRendererBase.java 2008-03-20
21:19:43 UTC (rev 7034)
@@ -22,7 +22,9 @@
package org.ajax4jsf.renderkit;
import java.io.IOException;
+import java.util.HashSet;
import java.util.Map;
+import java.util.Set;
import javax.faces.component.UIComponent;
import javax.faces.component.ValueHolder;
@@ -30,6 +32,7 @@
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
+import org.ajax4jsf.component.AjaxComponent;
import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.event.AjaxEvent;
import org.apache.commons.logging.Log;
@@ -52,8 +55,25 @@
ActionEvent event;
event = new ActionEvent(uiComponent);
uiComponent.queueEvent(event);
-
uiComponent.queueEvent(new AjaxEvent(uiComponent));
+ // Check areas for processing
+ if (uiComponent instanceof AjaxComponent) {
+ AjaxComponent ajaxComponent = (AjaxComponent) uiComponent;
+ Set<String> toProcess = AjaxRendererUtils.asSet(ajaxComponent
+ .getProcess());
+ if (null != toProcess) {
+ HashSet<String> componentIdsToProcess = new HashSet<String>();
+ for (String componentId : toProcess) {
+ UIComponent component = getUtils().findComponentFor(uiComponent, componentId);
+ if(null != component){
+ componentIdsToProcess.add(component.getClientId(facesContext));
+ } else {
+ componentIdsToProcess.add(componentId);
+ }
+ }
+ AjaxContext.getCurrentInstance(facesContext).setAjaxAreasToProcess(componentIdsToProcess);
+ }
+ }
}
}
Modified: trunk/ui/tabPanel/src/test/java/org/richfaces/component/UITabTest.java
===================================================================
--- trunk/ui/tabPanel/src/test/java/org/richfaces/component/UITabTest.java 2008-03-20
19:50:46 UTC (rev 7033)
+++ trunk/ui/tabPanel/src/test/java/org/richfaces/component/UITabTest.java 2008-03-20
21:19:43 UTC (rev 7034)
@@ -275,5 +275,15 @@
public void setOnbeforedomupdate(String beforeUpdate) {
}
+
+ public Object getProcess() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setProcess(Object targetId) {
+ // TODO Auto-generated method stub
+
+ }
}
}