You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gm...@apache.org on 2008/01/21 15:25:50 UTC

svn commit: r613900 - /myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPhaseListener.java

Author: gmuellan
Date: Mon Jan 21 06:25:50 2008
New Revision: 613900

URL: http://svn.apache.org/viewvc?rev=613900&view=rev
Log:
handling stateUpdate attribute of pprPanelGroup also on server side (not only when updating the dom tree via js)

Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPhaseListener.java

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPhaseListener.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPhaseListener.java?rev=613900&r1=613899&r2=613900&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPhaseListener.java (original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/ppr/PPRPhaseListener.java Mon Jan 21 06:25:50 2008
@@ -261,6 +261,7 @@
 		StringTokenizer st = new StringTokenizer(triggeredComponents, ",", false);
 		String clientId;
 		UIComponent component;
+		boolean handleState = true;
 		// Iterate over the individual client IDs
 		while(st.hasMoreTokens())
 		{
@@ -268,6 +269,14 @@
 			component = viewRoot.findComponent(clientId);
 			if(component != null)
 			{
+				//get info about state writing/rendering
+				//if at least one ppr does not update the state
+				//the response will not include state information
+				PPRPanelGroup ppr = (PPRPanelGroup) component;
+				if(ppr.getStateUpdate().booleanValue() == false)
+				{
+					handleState = false;
+				}
 				// Write a component tag which contains a CDATA section whith
 				// the rendered HTML
 				// of the component children
@@ -290,21 +299,24 @@
 				log.debug("PPRPhaseListener component with id" + clientId + "not found!");
 			}
 		}
-		// Write the serialized state into a separate XML element
-		out.print("<state>");
-		FacesContext facesContext = FacesContext.getCurrentInstance();
-		StateManager stateManager = facesContext.getApplication().getStateManager();
-		StateManager.SerializedView serializedView = stateManager.saveSerializedView(facesContext);
-		try
-		{
-			stateManager.writeState(facesContext, serializedView);
-		}
-		catch(IOException e)
+
+		if(handleState)
 		{
-			throw new FacesException(e);
+			// Write the serialized state into a separate XML element
+			out.print("<state>");
+			FacesContext facesContext = FacesContext.getCurrentInstance();
+			StateManager stateManager = facesContext.getApplication().getStateManager();
+			StateManager.SerializedView serializedView = stateManager.saveSerializedView(facesContext);
+			try
+			{
+				stateManager.writeState(facesContext, serializedView);
+			}
+			catch(IOException e)
+			{
+				throw new FacesException(e);
+			}
+			out.print("</state>");
 		}
-
-		out.print("</state>");
 
 	}