myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1349673 - in /myfaces/shared/trunk_4.0.x/core: ./ src/main/java/org/apache/myfaces/shared/renderkit/ src/main/java/org/apache/myfaces/shared/renderkit/html/
Date Wed, 13 Jun 2012 08:14:15 GMT
Author: lu4242
Date: Wed Jun 13 08:14:15 2012
New Revision: 1349673

URL: http://svn.apache.org/viewvc?rev=1349673&view=rev
Log:
synch with shared in core

Modified:
    myfaces/shared/trunk_4.0.x/core/pom.xml
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlImageRendererBase.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java

Modified: myfaces/shared/trunk_4.0.x/core/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/pom.xml?rev=1349673&r1=1349672&r2=1349673&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/pom.xml (original)
+++ myfaces/shared/trunk_4.0.x/core/pom.xml Wed Jun 13 08:14:15 2012
@@ -143,7 +143,7 @@
     <profile>
       <id>synch-myfaces-impl-shared</id>
       <properties>
-        <myfaces.impl.shared.version>2.0.13-SNAPSHOT</myfaces.impl.shared.version>
+        <myfaces.impl.shared.version>2.0.14-SNAPSHOT</myfaces.impl.shared.version>
       </properties>
       <activation>
         <property>

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java?rev=1349673&r1=1349672&r2=1349673&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
Wed Jun 13 08:14:15 2012
@@ -292,106 +292,95 @@ public final class RendererUtils
     public static String getStringValue(FacesContext facesContext,
             UIComponent component)
     {
-        try
+        if (!(component instanceof ValueHolder))
         {
-            if (!(component instanceof ValueHolder))
-            {
-                throw new IllegalArgumentException("Component : "
-                        + getPathToComponent(component)
-                        + "is not a ValueHolder");
-            }
+            throw new IllegalArgumentException("Component : "
+                    + getPathToComponent(component)
+                    + "is not a ValueHolder");
+        }
 
-            if (component instanceof EditableValueHolder)
+        if (component instanceof EditableValueHolder)
+        {
+            Object submittedValue = ((EditableValueHolder) component)
+                    .getSubmittedValue();
+            if (submittedValue != null)
             {
-                Object submittedValue = ((EditableValueHolder) component)
-                        .getSubmittedValue();
-                if (submittedValue != null)
+                if (log.isLoggable(Level.FINE))
                 {
-                    if (log.isLoggable(Level.FINE))
-                    {
-                        log.fine("returning 1 '" + submittedValue + "'");
-                    }
-                    return submittedValue.toString();
+                    log.fine("returning 1 '" + submittedValue + "'");
                 }
+                return submittedValue.toString();
             }
+        }
 
-            Object value;
+        Object value;
 
-            if (component instanceof EditableValueHolder)
-            {
+        if (component instanceof EditableValueHolder)
+        {
 
-                EditableValueHolder holder = (EditableValueHolder) component;
+            EditableValueHolder holder = (EditableValueHolder) component;
 
-                if (holder.isLocalValueSet())
-                {
-                    value = holder.getLocalValue();
-                }
-                else
-                {
-                    value = getValue(component);
-                }
+            if (holder.isLocalValueSet())
+            {
+                value = holder.getLocalValue();
             }
             else
             {
                 value = getValue(component);
             }
+        }
+        else
+        {
+            value = getValue(component);
+        }
 
-            Converter converter = ((ValueHolder) component).getConverter();
-            if (converter == null && value != null)
-            {
+        Converter converter = ((ValueHolder) component).getConverter();
+        if (converter == null && value != null)
+        {
 
-                try
-                {
-                    converter = facesContext.getApplication().createConverter(
-                            value.getClass());
-                    if (log.isLoggable(Level.FINE))
-                    {
-                        log.fine("the created converter is " + converter);
-                    }
-                }
-                catch (FacesException e)
+            try
+            {
+                converter = facesContext.getApplication().createConverter(
+                        value.getClass());
+                if (log.isLoggable(Level.FINE))
                 {
-                    log.log(Level.SEVERE, "No converter for class "
-                            + value.getClass().getName()
-                            + " found (component id=" + component.getId()
-                            + ").", e);
-                    // converter stays null
+                    log.fine("the created converter is " + converter);
                 }
             }
-
-            if (converter == null)
+            catch (FacesException e)
             {
-                if (value == null)
-                {
-                    if (log.isLoggable(Level.FINE))
-                    {
-                        log.fine("returning an empty string");
-                    }
-                    return "";
-                }
+                log.log(Level.SEVERE, "No converter for class "
+                        + value.getClass().getName()
+                        + " found (component id=" + component.getId()
+                        + ").", e);
+                // converter stays null
+            }
+        }
 
+        if (converter == null)
+        {
+            if (value == null)
+            {
                 if (log.isLoggable(Level.FINE))
                 {
-                    log.fine("returning an .toString");
+                    log.fine("returning an empty string");
                 }
-                return value.toString();
-
+                return "";
             }
 
             if (log.isLoggable(Level.FINE))
             {
-                log.fine("returning converter get as string " + converter);
+                log.fine("returning an .toString");
             }
-            return converter.getAsString(facesContext, component, value);
+            return value.toString();
 
         }
-        catch (PropertyNotFoundException ex)
-        {
-            log.log(Level.SEVERE, "Property not found - called by component : "
-                    + getPathToComponent(component), ex);
 
-            throw ex;
+        if (log.isLoggable(Level.FINE))
+        {
+            log.fine("returning converter get as string " + converter);
         }
+        return converter.getAsString(facesContext, component, value);
     }
 
     public static String getStringFromSubmittedValueOrLocalValueReturnNull(
@@ -499,17 +488,7 @@ public final class RendererUtils
 
     private static Object getValue(UIComponent component)
     {
-        Object value;
-        try
-        {
-            value = ((ValueHolder) component).getValue();
-        }
-        catch (Exception ex)
-        {
-            throw new FacesException(
-                    "Could not retrieve value of component with path : "
-                            + getPathToComponent(component), ex);
-        }
+        Object value = ((ValueHolder) component).getValue();
         return value;
     }
 

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java?rev=1349673&r1=1349672&r2=1349673&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/_SharedRendererUtils.java
Wed Jun 13 08:14:15 2012
@@ -78,7 +78,7 @@ class _SharedRendererUtils
             return null;
         }
 
-        Class valueType = expression.getType(facesContext.getELContext());
+        Class<?> valueType = expression.getType(facesContext.getELContext());
         if (valueType == null)
         {
             return null;
@@ -101,6 +101,13 @@ class _SharedRendererUtils
         }
     }
 
+    static Object getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany component,
+            String[] submittedValue) throws ConverterException
+    {
+        return  getConvertedUISelectManyValue(facesContext, component,
+            submittedValue, false);
+    }
+
     /**
      * Gets the converted value of a UISelectMany component.
      * If the considerValueType is true, this method will also consider the

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java?rev=1349673&r1=1349672&r2=1349673&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
Wed Jun 13 08:14:15 2012
@@ -103,7 +103,7 @@ public class HtmlButtonRendererBase
         if (formInfo != null)
         {
             hiddenLink = (String) facesContext.getExternalContext().getRequestParameterMap().get(
-                HtmlRendererUtils.getHiddenCommandLinkFieldName(formInfo));
+                HtmlRendererUtils.getHiddenCommandLinkFieldName(formInfo, facesContext));
         }
         return paramMap.containsKey(clientId) || paramMap.containsKey(clientId + IMAGE_BUTTON_SUFFIX_X)

             || paramMap.containsKey(clientId + IMAGE_BUTTON_SUFFIX_Y)
@@ -622,7 +622,8 @@ public class HtmlButtonRendererBase
                 if (MyfacesConfig.getCurrentInstance(
                         facesContext.getExternalContext()).isRenderHiddenFieldsForLinkParams())
                 {
-                    String hiddenFieldName = HtmlRendererUtils.getHiddenCommandLinkFieldName(nestedFormInfo);
+                    String hiddenFieldName = HtmlRendererUtils.getHiddenCommandLinkFieldName(
+                            nestedFormInfo, facesContext);
                     addHiddenCommandParameter(facesContext, nestedFormInfo.getForm(), hiddenFieldName);
                 }
             }

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlImageRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlImageRendererBase.java?rev=1349673&r1=1349672&r2=1349673&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlImageRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlImageRendererBase.java
Wed Jun 13 08:14:15 2012
@@ -109,7 +109,7 @@ public class HtmlImageRendererBase
          */                
         if (uiComponent.getAttributes().get(HTML.ALT_ATTR) == null) 
         {
-            if(!facesContext.isProjectStage(ProjectStage.Development) && log.isLoggable(Level.WARNING))
+            if(facesContext.isProjectStage(ProjectStage.Development) && log.isLoggable(Level.WARNING))
             {
                 log.warning("Component UIGraphic " + uiComponent.getClientId(facesContext)

                         + " has no attribute alt or attribute resolves to null. Path to component
" 

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java?rev=1349673&r1=1349672&r2=1349673&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
Wed Jun 13 08:14:15 2012
@@ -87,7 +87,7 @@ public abstract class HtmlLinkRendererBa
             if (formInfo != null)
             {
                 String reqValue = (String) facesContext.getExternalContext().getRequestParameterMap().get(
-                        HtmlRendererUtils.getHiddenCommandLinkFieldName(formInfo));
+                        HtmlRendererUtils.getHiddenCommandLinkFieldName(formInfo, facesContext));
                 if (reqValue != null && reqValue.equals(clientId)
                     || HtmlRendererUtils.isPartialOrBehaviorSubmit(facesContext, clientId))
                 {
@@ -475,7 +475,8 @@ public abstract class HtmlLinkRendererBa
             if (MyfacesConfig.getCurrentInstance(
                     facesContext.getExternalContext()).isRenderHiddenFieldsForLinkParams())
             {
-                String hiddenFieldName = HtmlRendererUtils.getHiddenCommandLinkFieldName(formInfo);
+                String hiddenFieldName = HtmlRendererUtils.getHiddenCommandLinkFieldName(
+                        formInfo, facesContext);
                 addHiddenCommandParameter(facesContext, nestingForm, hiddenFieldName);
             }
 
@@ -790,7 +791,8 @@ public abstract class HtmlLinkRendererBa
                 hrefBuf.append('&');
             }
         }
-        String hiddenFieldName = HtmlRendererUtils.getHiddenCommandLinkFieldName(formInfo);
+        String hiddenFieldName = HtmlRendererUtils.getHiddenCommandLinkFieldName(
+                formInfo, facesContext);
         hrefBuf.append(hiddenFieldName);
         hrefBuf.append('=');
         hrefBuf.append(clientId);

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java?rev=1349673&r1=1349672&r2=1349673&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
Wed Jun 13 08:14:15 2012
@@ -1586,6 +1586,17 @@ public final class HtmlRendererUtils
         return formInfo.getFormName() + UINamingContainer.getSeparatorChar(FacesContext
                         .getCurrentInstance()) + HIDDEN_COMMANDLINK_FIELD_NAME;
     }
+    
+    public static String getHiddenCommandLinkFieldName(
+            FormInfo formInfo, FacesContext facesContext)
+    {
+        if (RendererUtils.isAdfOrTrinidadForm(formInfo.getForm()))
+        {
+            return HIDDEN_COMMANDLINK_FIELD_NAME_TRINIDAD;
+        }
+        return formInfo.getFormName() + UINamingContainer.getSeparatorChar(facesContext)
+                + HIDDEN_COMMANDLINK_FIELD_NAME;
+    }
 
     public static boolean isPartialOrBehaviorSubmit(FacesContext facesContext,
             String clientId)
@@ -1614,11 +1625,6 @@ public final class HtmlRendererUtils
         return partialOrBehaviorSubmit;
     }
 
-    /**
-     * @param formInfo
-     * @return
-     * @deprecated Use getHiddenCommandLinkFieldNameMyfaces(FormInfo) instead
-     */
     public static String getHiddenCommandLinkFieldNameMyfacesOld(
             FormInfo formInfo)
     {
@@ -1729,18 +1735,15 @@ public final class HtmlRendererUtils
     private static final String HTML_CONTENT_TYPE = "text/html";
     private static final String TEXT_ANY_CONTENT_TYPE = "text/*";
     private static final String ANY_CONTENT_TYPE = "*/*";
-
     public static final String DEFAULT_CHAR_ENCODING = "ISO-8859-1";
     private static final String XHTML_CONTENT_TYPE = "application/xhtml+xml";
     private static final String APPLICATION_XML_CONTENT_TYPE = "application/xml";
     private static final String TEXT_XML_CONTENT_TYPE = "text/xml";
-
     // The order is important in this case.
     private static final String[] SUPPORTED_CONTENT_TYPES = {
             HTML_CONTENT_TYPE, //Prefer this over any other, because IE does not support
XHTML content type
             XHTML_CONTENT_TYPE, APPLICATION_XML_CONTENT_TYPE,
             TEXT_XML_CONTENT_TYPE, TEXT_ANY_CONTENT_TYPE, ANY_CONTENT_TYPE };
-
     /**
      * @deprecated use ContentTypeUtils instead
      */
@@ -2942,7 +2945,6 @@ public final class HtmlRendererUtils
 
     /**
      * Returns the value of the hideNoSelectionOption attribute of the given UIComponent
-     *
      * @param component
      * @return
      */
@@ -2959,7 +2961,6 @@ public final class HtmlRendererUtils
     /**
      * Renders all FacesMessages which have not been rendered yet with
      * the help of a HtmlMessages component.
-     *
      * @param facesContext
      */
     public static void renderUnhandledFacesMessages(FacesContext facesContext)



Mime
View raw message