myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [myfaces] branch master updated: refactored
Date Wed, 02 Oct 2019 10:46:03 GMT
This is an automated email from the ASF dual-hosted git repository.

tandraschko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/master by this push:
     new 5755f05  refactored
5755f05 is described below

commit 5755f05299580c74dd1f49dc8c74c513fd5fc391
Author: Thomas Andraschko <tandraschko@apache.org>
AuthorDate: Wed Oct 2 12:45:55 2019 +0200

    refactored
---
 .../apache/myfaces/renderkit/RendererUtils.java    |  8 +++---
 ...RendererUtils.java => SharedRendererUtils.java} |  6 ++--
 .../html/util/ClientBehaviorRendererUtils.java     |  2 --
 .../renderkit/html/util/CommonEventUtils.java      | 15 ++++------
 .../renderkit/html/util/OutcomeTargetUtils.java    | 33 ++++++++++++----------
 5 files changed, 31 insertions(+), 33 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/RendererUtils.java b/impl/src/main/java/org/apache/myfaces/renderkit/RendererUtils.java
index 610ebd8..895352a 100755
--- a/impl/src/main/java/org/apache/myfaces/renderkit/RendererUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/RendererUtils.java
@@ -442,7 +442,7 @@ public final class RendererUtils
         if (considerValueType)
         {
             // try to get a converter from the valueType attribute
-            converter = _SharedRendererUtils.getValueTypeConverter(facesContext, component);
+            converter = SharedRendererUtils.getValueTypeConverter(facesContext, component);
             if (converter != null)
             {
                 return converter;
@@ -472,7 +472,7 @@ public final class RendererUtils
         if (Collection.class.isAssignableFrom(valueType) || Object.class.equals(valueType))
         {
             // try to get the by-type-converter from the type of the SelectItems
-            return _SharedRendererUtils.getSelectItemsValueConverter(
+            return SharedRendererUtils.getSelectItemsValueConverter(
                     new SelectItemsIterator(component, facesContext),
                     facesContext);
         }
@@ -495,7 +495,7 @@ public final class RendererUtils
         {
             // There is no converter for Object class
             // try to get the by-type-converter from the type of the SelectItems
-            return _SharedRendererUtils.getSelectItemsValueConverter(
+            return SharedRendererUtils.getSelectItemsValueConverter(
                     new SelectItemsIterator(component, facesContext),
                     facesContext);
         }
@@ -848,7 +848,7 @@ public final class RendererUtils
                             + ComponentUtils.getPathToComponent(selectMany) + "expected");
         }
 
-        return _SharedRendererUtils.getConvertedUISelectManyValue(facesContext,
+        return SharedRendererUtils.getConvertedUISelectManyValue(facesContext,
                 selectMany, (String[]) submittedValue, considerValueType);
     }
 
diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/_SharedRendererUtils.java b/impl/src/main/java/org/apache/myfaces/renderkit/SharedRendererUtils.java
similarity index 99%
rename from impl/src/main/java/org/apache/myfaces/renderkit/_SharedRendererUtils.java
rename to impl/src/main/java/org/apache/myfaces/renderkit/SharedRendererUtils.java
index 7f6665f..18ec48c 100755
--- a/impl/src/main/java/org/apache/myfaces/renderkit/_SharedRendererUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/SharedRendererUtils.java
@@ -41,9 +41,9 @@ import javax.faces.convert.Converter;
 import javax.faces.convert.ConverterException;
 import javax.faces.model.SelectItem;
 import javax.faces.model.SelectItemGroup;
+import org.apache.myfaces.renderkit.html.util.SelectItemsIterator;
 
 import org.apache.myfaces.util.ComponentUtils;
-import org.apache.myfaces.renderkit.html.util.SelectItemsIterator;
 import org.apache.myfaces.util.lang.Assert;
 import org.apache.myfaces.util.lang.ClassUtils;
 
@@ -52,7 +52,7 @@ import org.apache.myfaces.util.lang.ClassUtils;
  * the org.apache.myfaces.renderkit package.
  * Please note: Any changes here must also apply to the class in the other package!
  */
-class _SharedRendererUtils
+public class SharedRendererUtils
 {
     static final String COLLECTION_TYPE_KEY = "collectionType";
     static final String VALUE_TYPE_KEY = "valueType";
@@ -434,7 +434,7 @@ class _SharedRendererUtils
         return converter;
     }
 
-    private static final Logger log = Logger.getLogger(_SharedRendererUtils.class.getName());
+    private static final Logger log = Logger.getLogger(SharedRendererUtils.class.getName());
 
     /**
      * This method is different in the two versions of _SharedRendererUtils.
diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/util/ClientBehaviorRendererUtils.java
b/impl/src/main/java/org/apache/myfaces/renderkit/html/util/ClientBehaviorRendererUtils.java
index 04d5f74..42e2619 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/util/ClientBehaviorRendererUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/html/util/ClientBehaviorRendererUtils.java
@@ -36,8 +36,6 @@ import org.apache.myfaces.util.lang.StringUtils;
 
 public class ClientBehaviorRendererUtils
 {
-    private static final boolean RENDER_AS_STRING = false;
-    
     public static void decodeClientBehaviors(FacesContext facesContext, UIComponent component)
     {
         if (!(component instanceof ClientBehaviorHolder))
diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/util/CommonEventUtils.java
b/impl/src/main/java/org/apache/myfaces/renderkit/html/util/CommonEventUtils.java
index c0005e5..69dcd60 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/util/CommonEventUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/html/util/CommonEventUtils.java
@@ -94,13 +94,11 @@ public class CommonEventUtils
             String htmlAttrName, String attributeValue) throws IOException
     {
 
-        List<ClientBehavior> cbl = (clientBehaviors != null) ? clientBehaviors
-                .get(eventName) : null;
-
+        List<ClientBehavior> cbl = (clientBehaviors != null) ? clientBehaviors.get(eventName)
: null;
         if (cbl == null || cbl.isEmpty())
         {
-            return HtmlRendererUtils.renderHTMLStringAttribute(writer, componentProperty,
htmlAttrName,
-                    attributeValue);
+            return HtmlRendererUtils.renderHTMLStringAttribute(writer, componentProperty,
+                    htmlAttrName, attributeValue);
         }
 
         if (cbl.size() > 1 || (cbl.size() == 1 && attributeValue != null))
@@ -114,14 +112,13 @@ public class CommonEventUtils
         else
         {
             //Only 1 behavior and attrValue == null, so just render it directly
+            ClientBehaviorContext ctx = ClientBehaviorContext.createClientBehaviorContext(
+                                    facesContext, component, eventName,sourceId, eventParameters);
             return HtmlRendererUtils.renderHTMLStringAttribute(
                     writer,
                     componentProperty,
                     htmlAttrName,
-                    cbl.get(0).getScript(
-                            ClientBehaviorContext.createClientBehaviorContext(
-                                    facesContext, component, eventName,
-                                    sourceId, eventParameters)));
+                    cbl.get(0).getScript(ctx));
         }
     }
 
diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/util/OutcomeTargetUtils.java
b/impl/src/main/java/org/apache/myfaces/renderkit/html/util/OutcomeTargetUtils.java
index a820656..3653395 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/util/OutcomeTargetUtils.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/html/util/OutcomeTargetUtils.java
@@ -96,24 +96,27 @@ public class OutcomeTargetUtils
         {
             List<UIParameter> validParams = getValidUIParameterChildren(facesContext,
component.getChildren(),
                     true, false);
-            if (validParams.size() > 0)
+
+            int size = validParams.size();
+            if (size > 0)
             {
                 parameters = new HashMap<>(5, 1f);
-            }
-            for (int i = 0, size = validParams.size(); i < size; i++)
-            {
-                UIParameter param = validParams.get(i);
-                String name = param.getName();
-                Object value = param.getValue();
-                if (parameters.containsKey(name))
-                {
-                    parameters.get(name).add(value.toString());
-                }
-                else
+
+                for (int i = 0; i < size; i++)
                 {
-                    List<String> list = new ArrayList<>(1);
-                    list.add(value.toString());
-                    parameters.put(name, list);
+                    UIParameter param = validParams.get(i);
+                    String name = param.getName();
+                    Object value = param.getValue();
+                    if (parameters.containsKey(name))
+                    {
+                        parameters.get(name).add(value.toString());
+                    }
+                    else
+                    {
+                        List<String> list = new ArrayList<>(1);
+                        list.add(value.toString());
+                        parameters.put(name, list);
+                    }
                 }
             }
         }


Mime
View raw message