You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2009/09/10 21:55:26 UTC
svn commit: r813566 - in /myfaces/core/trunk/impl/src:
main/java/org/apache/myfaces/context/servlet/
test/java/org/apache/myfaces/context/
Author: lu4242
Date: Thu Sep 10 19:55:25 2009
New Revision: 813566
URL: http://svn.apache.org/viewvc?rev=813566&view=rev
Log:
MYFACES-2116 TODO 65: Partial View Lifecycle (client ids are separated by spaces, not by commas)
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/context/ExecutePhaseClientIdsTest.java
myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/context/RenderPhaseClientIdsTest.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java?rev=813566&r1=813565&r2=813566&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java Thu Sep 10 19:55:25 2009
@@ -145,11 +145,18 @@
if (executeMode != null && !"".equals(executeMode) &&
!PartialViewContext.NO_PARTIAL_PHASE_CLIENT_IDS.equals(executeMode) &&
!PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(executeMode)) {
- String[] clientIds = StringUtils.splitShortString(executeMode.replaceAll("[ \\t\\n]*", ""), ',');
+
+ String[] clientIds = StringUtils.splitShortString(_replaceTabOrEnterCharactersWithSpaces(executeMode), ' ');
//The collection must be mutable
List<String> tempList = new ArrayList<String>();
- Collections.addAll(tempList, clientIds);
+ for (String clientId : clientIds)
+ {
+ if (clientId.length() > 0)
+ {
+ tempList.add(clientId);
+ }
+ }
_executeClientIds = tempList;
} else {
_executeClientIds = new ArrayList<String>();
@@ -157,6 +164,24 @@
}
return _executeClientIds;
}
+
+ private String _replaceTabOrEnterCharactersWithSpaces(String mode)
+ {
+ StringBuilder builder = new StringBuilder(mode.length());
+ for (int i = 0; i < mode.length(); i++)
+ {
+ if (mode.charAt(i) == '\t' ||
+ mode.charAt(i) == '\n')
+ {
+ builder.append(' ');
+ }
+ else
+ {
+ builder.append(mode.charAt(i));
+ }
+ }
+ return builder.toString();
+ }
@Override
public Collection<String> getRenderIds() {
@@ -169,12 +194,19 @@
if (renderMode != null && !"".equals(renderMode) &&
!PartialViewContext.NO_PARTIAL_PHASE_CLIENT_IDS.equals(renderMode) &&
- !PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(renderMode)) {
- String[] clientIds = StringUtils.splitShortString(renderMode.replaceAll("[ \\t\\n]*", ""), ',');
+ !PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals(renderMode))
+ {
+ String[] clientIds = StringUtils.splitShortString(_replaceTabOrEnterCharactersWithSpaces(renderMode), ' ');
//The collection must be mutable
List<String> tempList = new ArrayList<String>();
- Collections.addAll(tempList, clientIds);
+ for (String clientId : clientIds)
+ {
+ if (clientId.length() > 0)
+ {
+ tempList.add(clientId);
+ }
+ }
_renderClientIds = tempList;
} else {
_renderClientIds = new ArrayList<String>();
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/context/ExecutePhaseClientIdsTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/context/ExecutePhaseClientIdsTest.java?rev=813566&r1=813565&r2=813566&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/context/ExecutePhaseClientIdsTest.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/context/ExecutePhaseClientIdsTest.java Thu Sep 10 19:55:25 2009
@@ -113,7 +113,7 @@
* blank chars
*/
public void testRequestParams6() {
- String params = " view1:panel1:_component1,view1:panel1:_component2 \n , component3, component4 ";
+ String params = " view1:panel1:_component1 view1:panel1:_component2 \n component3 component4 ";
Map<String, String> requestParamMap = new HashMap<String, String>();
requestParamMap.put(PartialViewContext.PARTIAL_EXECUTE_PARAM_NAME, params);
ContextTestRequestWrapper wrapper = new ContextTestRequestWrapper(request, requestParamMap);
Modified: myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/context/RenderPhaseClientIdsTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/context/RenderPhaseClientIdsTest.java?rev=813566&r1=813565&r2=813566&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/context/RenderPhaseClientIdsTest.java (original)
+++ myfaces/core/trunk/impl/src/test/java/org/apache/myfaces/context/RenderPhaseClientIdsTest.java Thu Sep 10 19:55:25 2009
@@ -117,7 +117,7 @@
* blank chars
*/
public void testRequestParams6() {
- String params = " view1:panel1:_component1,view1:panel1:_component2 \n , component3, component4 ";
+ String params = " view1:panel1:_component1 view1:panel1:_component2 \n component3 component4 ";
Map<String, String> requestParamMap = new HashMap<String, String>();
requestParamMap.put(PartialViewContext.PARTIAL_RENDER_PARAM_NAME, params);
ContextTestRequestWrapper wrapper = new ContextTestRequestWrapper(request, requestParamMap);