Author: abelevich
Date: 2008-07-14 11:15:25 -0400 (Mon, 14 Jul 2008)
New Revision: 9577
Added:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/ContextCallbackWrapper.java
trunk/framework/impl/src/main/java/org/ajax4jsf/component/InvokerCallbackWrapper.java
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
Log:
http://jira.jboss.com/jira/browse/RF-3626
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2008-07-14
15:13:38 UTC (rev 9576)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/component/AjaxViewRoot.java 2008-07-14
15:15:25 UTC (rev 9577)
@@ -402,7 +402,7 @@
public void processDecodes(FacesContext context) {
if (context == null)
throw new NullPointerException("context");
- processPhase(context, PhaseId.APPLY_REQUEST_VALUES, _decodeInvoker);
+ processPhase(context, PhaseId.APPLY_REQUEST_VALUES, new
InvokerCallbackWrapper(_decodeInvoker));
}
private InvokerCallback _updatesInvoker = new InvokerCallback() {
@@ -425,7 +425,7 @@
public void processUpdates(FacesContext context) {
if (context == null)
throw new NullPointerException("context");
- processPhase(context, PhaseId.UPDATE_MODEL_VALUES, _updatesInvoker);
+ processPhase(context, PhaseId.UPDATE_MODEL_VALUES, new
InvokerCallbackWrapper(_updatesInvoker));
}
private InvokerCallback _validatorsInvoker = new InvokerCallback() {
@@ -448,7 +448,7 @@
public void processValidators(FacesContext context) {
if (context == null)
throw new NullPointerException("context");
- processPhase(context, PhaseId.PROCESS_VALIDATIONS, _validatorsInvoker);
+ processPhase(context, PhaseId.PROCESS_VALIDATIONS, new
InvokerCallbackWrapper(_validatorsInvoker));
}
/*
@@ -538,8 +538,7 @@
.getSubmittedRegionClientId();
if (submittedRegionClientId != null
&& !submittedRegionClientId.equals(getClientId(context))) {
- invokeOnComponent(context, submittedRegionClientId,
- _ajaxInvoker);
+ invokeOnComponent(context, submittedRegionClientId, new
ContextCallbackWrapper(_ajaxInvoker));
} else {
encodeAjax(context);
}
Added:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/ContextCallbackWrapper.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/component/ContextCallbackWrapper.java
(rev 0)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/component/ContextCallbackWrapper.java 2008-07-14
15:15:25 UTC (rev 9577)
@@ -0,0 +1,46 @@
+package org.ajax4jsf.component;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.faces.component.ContextCallback;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+public class ContextCallbackWrapper implements ContextCallback {
+
+ ContextCallback callback;
+
+ public ContextCallbackWrapper(ContextCallback callback) {
+ this.callback = callback;
+ }
+
+ public void invokeContextCallback(FacesContext context, UIComponent target) {
+ if(isParentRendered(target)) {
+ callback.invokeContextCallback(context, target);
+ }
+ }
+
+ public boolean isParentRendered( UIComponent target) {
+
+ List <UIComponent> componentsList = new ArrayList<UIComponent>();
+ UIComponent component = target;
+
+ while (component != null) {
+ componentsList.add(component);
+ component = component.getParent();
+ }
+
+ for (int i = 0; i < componentsList.size(); i++) {
+ UIComponent parent = componentsList.get(i);
+ if(!parent.isRendered()) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
Added:
trunk/framework/impl/src/main/java/org/ajax4jsf/component/InvokerCallbackWrapper.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/component/InvokerCallbackWrapper.java
(rev 0)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/component/InvokerCallbackWrapper.java 2008-07-14
15:15:25 UTC (rev 9577)
@@ -0,0 +1,27 @@
+/**
+ *
+ */
+package org.ajax4jsf.component;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.context.InvokerCallback;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+public class InvokerCallbackWrapper extends ContextCallbackWrapper implements
InvokerCallback {
+
+ public InvokerCallbackWrapper(InvokerCallback invokerCallback) {
+ super(invokerCallback);
+ }
+
+ /*
+ * @see
org.ajax4jsf.context.InvokerCallback#invokeRoot(javax.faces.context.FacesContext)
+ */
+ public void invokeRoot(FacesContext context) {
+ ((InvokerCallback)this.callback).invokeRoot(context);
+ }
+
+}