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 2014/09/16 22:09:24 UTC

svn commit: r1625369 - in /myfaces/shared/trunk_4.1.x/core: ./ src/main/java/org/apache/myfaces/shared/context/ src/main/java/org/apache/myfaces/shared/renderkit/html/

Author: lu4242
Date: Tue Sep 16 20:09:24 2014
New Revision: 1625369

URL: http://svn.apache.org/r1625369
Log:
update shared for 2.1.16 release

Modified:
    myfaces/shared/trunk_4.1.x/core/pom.xml
    myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/context/SwitchAjaxExceptionHandlerWrapperImpl.java
    myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java
    myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
    myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java

Modified: myfaces/shared/trunk_4.1.x/core/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.1.x/core/pom.xml?rev=1625369&r1=1625368&r2=1625369&view=diff
==============================================================================
--- myfaces/shared/trunk_4.1.x/core/pom.xml (original)
+++ myfaces/shared/trunk_4.1.x/core/pom.xml Tue Sep 16 20:09:24 2014
@@ -143,7 +143,7 @@
     <profile>
       <id>synch-myfaces-impl-shared</id>
       <properties>
-        <myfaces.impl.shared.version>2.1.14-SNAPSHOT</myfaces.impl.shared.version>
+        <myfaces.impl.shared.version>2.1.16-SNAPSHOT</myfaces.impl.shared.version>
       </properties>
       <activation>
         <property>

Modified: myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/context/SwitchAjaxExceptionHandlerWrapperImpl.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/context/SwitchAjaxExceptionHandlerWrapperImpl.java?rev=1625369&r1=1625368&r2=1625369&view=diff
==============================================================================
--- myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/context/SwitchAjaxExceptionHandlerWrapperImpl.java (original)
+++ myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/context/SwitchAjaxExceptionHandlerWrapperImpl.java Tue Sep 16 20:09:24 2014
@@ -21,6 +21,7 @@ package org.apache.myfaces.shared.contex
 import javax.faces.context.ExceptionHandler;
 import javax.faces.context.ExceptionHandlerWrapper;
 import javax.faces.context.FacesContext;
+import javax.faces.context.PartialViewContext;
 import javax.faces.event.AbortProcessingException;
 import javax.faces.event.ExceptionQueuedEvent;
 import javax.faces.event.ExceptionQueuedEventContext;
@@ -31,9 +32,6 @@ import javax.faces.event.SystemEvent;
  * normal exceptionHandler wrapping, because FacesContext is initialized after
  * ExceptionHandler, so it is not safe to get it when
  * ExceptionHandlerFactory.getExceptionHandler() is called.
- * 
- * @author Leonardo Uribe
- *
  */
 public class SwitchAjaxExceptionHandlerWrapperImpl extends ExceptionHandlerWrapper
 {
@@ -85,7 +83,12 @@ public class SwitchAjaxExceptionHandlerW
         if (_isAjaxRequest == null)
         {
             facesContext = (facesContext == null) ? FacesContext.getCurrentInstance() : facesContext;
-            _isAjaxRequest = facesContext.getPartialViewContext().isAjaxRequest();
+            PartialViewContext pvc = facesContext.getPartialViewContext();
+            if (pvc == null)
+            {
+                return false;
+            }
+            _isAjaxRequest = pvc.isAjaxRequest();
         }
         return _isAjaxRequest;
     }
@@ -95,7 +98,12 @@ public class SwitchAjaxExceptionHandlerW
         if (_isAjaxRequest == null)
         {
             FacesContext facesContext = FacesContext.getCurrentInstance();
-            _isAjaxRequest = facesContext.getPartialViewContext().isAjaxRequest();
+            PartialViewContext pvc = facesContext.getPartialViewContext();
+            if (pvc == null)
+            {
+                return false;
+            }
+            _isAjaxRequest = pvc.isAjaxRequest();
         }
         return _isAjaxRequest;
     }

Modified: myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java?rev=1625369&r1=1625368&r2=1625369&view=diff
==============================================================================
--- myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java (original)
+++ myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java Tue Sep 16 20:09:24 2014
@@ -156,9 +156,9 @@ public final class HtmlJavaScriptUtils
     private static void prepareScript(FacesContext facesContext,
             ScriptContext context, boolean autoScroll)
     {
-
-        final char separatorChar = UINamingContainer
-                .getSeparatorChar(facesContext);
+        // MYFACES-3919 remember idcl separator char is special and always should be ':',
+        // because it should be hardcoded into the js file.
+        final char idclSeparatorChar = ':';
         context.prettyLine();
 
         //render a function to create a hidden input, if it doesn't exist
@@ -302,7 +302,7 @@ public final class HtmlJavaScriptUtils
         context.prettyLine();
 
         context.append(SET_HIDDEN_INPUT_FN_NAME);
-        context.append("(formName,formName +'" + separatorChar + "'+'"
+        context.append("(formName,formName +'" + idclSeparatorChar + "'+'"
                 + HtmlRendererUtils.HIDDEN_COMMANDLINK_FIELD_NAME
                 + "',linkId);");
 
@@ -355,7 +355,7 @@ public final class HtmlJavaScriptUtils
         context.prettyLine();
 
         context.append(CLEAR_HIDDEN_INPUT_FN_NAME);
-        context.append("(formName,formName +'" + separatorChar + "'+'"
+        context.append("(formName,formName +'" + idclSeparatorChar + "'+'"
                 + HtmlRendererUtils.HIDDEN_COMMANDLINK_FIELD_NAME
                 + "',linkId);");
 

Modified: myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java?rev=1625369&r1=1625368&r2=1625369&view=diff
==============================================================================
--- myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java (original)
+++ myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java Tue Sep 16 20:09:24 2014
@@ -42,7 +42,6 @@ import javax.faces.application.ViewHandl
 import javax.faces.component.EditableValueHolder;
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIInput;
-import javax.faces.component.UINamingContainer;
 import javax.faces.component.UIOutcomeTarget;
 import javax.faces.component.UIOutput;
 import javax.faces.component.UIParameter;
@@ -1581,8 +1580,8 @@ public final class HtmlRendererUtils
         {
             return HIDDEN_COMMANDLINK_FIELD_NAME_TRINIDAD;
         }
-        return formInfo.getFormName() + UINamingContainer.getSeparatorChar(FacesContext
-                        .getCurrentInstance()) + HIDDEN_COMMANDLINK_FIELD_NAME;
+        return formInfo.getFormName() + ':' 
+                + HIDDEN_COMMANDLINK_FIELD_NAME;
     }
     
     public static String getHiddenCommandLinkFieldName(
@@ -1592,7 +1591,7 @@ public final class HtmlRendererUtils
         {
             return HIDDEN_COMMANDLINK_FIELD_NAME_TRINIDAD;
         }
-        return formInfo.getFormName() + UINamingContainer.getSeparatorChar(facesContext)
+        return formInfo.getFormName() + ':'
                 + HIDDEN_COMMANDLINK_FIELD_NAME;
     }
 
@@ -1626,7 +1625,7 @@ public final class HtmlRendererUtils
     public static String getHiddenCommandLinkFieldNameMyfacesOld(
             FormInfo formInfo)
     {
-        return formInfo.getFormName() + UINamingContainer.getSeparatorChar(FacesContext.getCurrentInstance())
+        return formInfo.getFormName() + ':'
                 + HIDDEN_COMMANDLINK_FIELD_NAME_MYFACES_OLD;
     }
 

Modified: myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java?rev=1625369&r1=1625368&r2=1625369&view=diff
==============================================================================
--- myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java (original)
+++ myfaces/shared/trunk_4.1.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java Tue Sep 16 20:09:24 2014
@@ -45,6 +45,8 @@ import org.apache.myfaces.shared.renderk
 public class HtmlTextareaRendererBase
         extends HtmlRenderer
 {
+    private static final String ADD_NEW_LINE_AT_START_ATTR = "org.apache.myfaces.addNewLineAtStart";
+    
     public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
             throws IOException
     {
@@ -167,6 +169,25 @@ public class HtmlTextareaRendererBase
     protected void renderTextAreaValue(FacesContext facesContext, UIComponent uiComponent) throws IOException
     {
         ResponseWriter writer = facesContext.getResponseWriter();
+        
+        Object addNewLineAtStart = uiComponent.getAttributes().get(ADD_NEW_LINE_AT_START_ATTR);
+        if (addNewLineAtStart != null)
+        {
+            boolean addNewLineAtStartBoolean = false;
+            if (addNewLineAtStart instanceof String)
+            {
+                addNewLineAtStartBoolean = Boolean.valueOf((String)addNewLineAtStart);
+            }
+            else if (addNewLineAtStart instanceof Boolean)
+            {
+                addNewLineAtStartBoolean = (Boolean) addNewLineAtStart;
+            }
+            if (addNewLineAtStartBoolean)
+            {
+                writer.writeText("\n", null);
+            }
+        }
+        
         String strValue = org.apache.myfaces.shared.renderkit.RendererUtils.getStringValue(facesContext, uiComponent);
         writer.writeText(strValue, org.apache.myfaces.shared.renderkit.JSFAttr.VALUE_ATTR);
     }