You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2008/11/26 12:32:40 UTC
svn commit: r720812 - in /myfaces/core/branches/2_0_0:
api/src/main/java/javax/faces/context/FacesContext.java
impl/src/main/java/org/apache/myfaces/context/servlet/FacesContextImpl.java
impl/src/test/java/org/apache/myfaces/context/IsRenderedTest.java
Author: werpu
Date: Wed Nov 26 03:32:11 2008
New Revision: 720812
URL: http://svn.apache.org/viewvc?rev=720812&view=rev
Log:
commit for https://issues.apache.org/jira/browse/MYFACES-1994
Modified:
myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/FacesContext.java
myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/FacesContextImpl.java
myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/IsRenderedTest.java
Modified: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/FacesContext.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/FacesContext.java?rev=720812&r1=720811&r2=720812&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/FacesContext.java (original)
+++ myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/context/FacesContext.java Wed Nov 26 03:32:11 2008
@@ -18,6 +18,7 @@
*/
package javax.faces.context;
+import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -40,7 +41,7 @@
public static final String NO_PARTIAL_PHASE_CLIENT_IDS = "none";
public static final String PARTIAL_EXECUTE_PARAM_NAME = "javax.faces.partial.execute";
public static final String PARTIAL_RENDER_PARAM_NAME = "javax.faces.partial.render";
-
+
/**
* Return the context within which all EL-expressions are evaluated.
* <p>
@@ -150,8 +151,15 @@
public List<String> getRenderPhaseClientIds()
{
+ //according to the spec the getRenderPhaseClientIds
+ //always at least must return an empty list
+ //according to the specs isRenderAll must
+ //check for an empty list as result of
+ //the call on this method
+ //the null value is not stated!
+
// TODO: JSF 2.0 #59
- return null;
+ return (List<String>) Collections.EMPTY_LIST;
}
public abstract boolean getResponseComplete();
Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/FacesContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/FacesContextImpl.java?rev=720812&r1=720811&r2=720812&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/FacesContextImpl.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/context/servlet/FacesContextImpl.java Wed Nov 26 03:32:11 2008
@@ -82,6 +82,8 @@
private List<String> _renderPhaseClientIds = null;
private List<String> _executePhaseClientIds = null;
+ private Boolean _renderAll = null;
+
// ~ Constructors -------------------------------------------------------------------------------
public FacesContextImpl(final ServletContext servletContext, final ServletRequest servletRequest,
final ServletResponse servletResponse) {
@@ -403,7 +405,7 @@
}
/**
- * @returns the list of client ids to be processed in the execute phase
+ * @return the list of client ids to be processed in the execute phase
* null if all have to be processed
*/
@Override
@@ -412,7 +414,7 @@
}
/**
- * @returns the list of client ids to be processed in the
+ * @return the list of client ids to be processed in the
* render phase null if all have to be processed
*/
@Override
@@ -457,9 +459,9 @@
/**
- * @returns is render none return true if PARTIAL_EXECUTE_PARAM_NAME is set in the current request
+ * @return is render none return true if {@link #PARTIAL_EXECUTE_PARAM_NAME} is set in the current request
* map!
- * and the value is set to NO_PARTIAL_PHASE_CLIENT_IDS. Otherwise return false!
+ * and the value is set to {@link #NO_PARTIAL_PHASE_CLIENT_IDS}. Otherwise return false!
*/
@Override
public boolean isExecuteNone() {
@@ -470,7 +472,7 @@
/**
- * @returns true in case of PARTIAL_RENDER_PARAM_NAME being set and its value is
+ * @return true in case of PARTIAL_RENDER_PARAM_NAME being set and its value is
* NO_PARTIAL_PHASE_CLIENT_IDS. Otherwise return false
*/
@Override
@@ -480,5 +482,41 @@
return NO_PARTIAL_PHASE_CLIENT_IDS.equals(param);
}
+ /**
+ * @return true in case of {@link javax.faces.context.FacesContext.isAjaxRequest()} returns true,
+ * {@link javax.faces.context.FacesContext.isRenderNone()} returns false and
+ * {@link javax.faces.context.FacesContext.getRenderPhaseClientIds()} returns also
+ * an empty list
+ */
+ @Override
+ public boolean isRenderAll() {
+ if(_renderAll != null) {
+ return _renderAll;
+ }
+ //I assume doing the check once per request is correct
+ //there is no way to determine if there was an override
+ //of the renderAll according to the spec!
+ List renderClientIds = getRenderPhaseClientIds();
+ _renderAll = renderClientIds.isEmpty() && isAjaxRequest() && !isRenderNone();
+ return _renderAll;
+ }
+
+ /**
+ * override for the isRenderall determination mechanism
+ * if set to true the isRenderAll() must! return
+ * true!
+ * If nothing is set the isRenderall() does a fallback into
+ * its renderall determination algorithm!
+ *
+ * @param renderAll if set to true isRenderAll() will return
+ * true on the subsequent calls in the request!
+ */
+ @Override
+ public void setRenderAll(boolean renderAll) {
+ _renderAll = renderAll;//autoboxing does the conversation here, no need to do casting
+ }
+
+
+
}
Modified: myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/IsRenderedTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/IsRenderedTest.java?rev=720812&r1=720811&r2=720812&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/IsRenderedTest.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/IsRenderedTest.java Wed Nov 26 03:32:11 2008
@@ -96,4 +96,21 @@
assertFalse("Render none wrong value", context.isRenderNone());
}
+
+ /**
+ * tests the basic render all mechanism,
+ * no render all due to defaults
+ * or a renderAll which
+ */
+ public void testRenderAll1() {
+ FacesContext context = new FacesContextImpl(servletContext, request, response);
+ context.setRenderAll(true);
+ assertTrue("override should trigger no matter which condition we have", context.isRenderAll());
+
+ context = new FacesContextImpl(servletContext, request, response);
+ context.setRenderAll(false);
+ assertFalse("override should trigger no matter which condition we have", context.isRenderAll());
+ }
+
+
}