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 Mon, 03 Dec 2018 15:42:59 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 3d876b9  refactored
3d876b9 is described below

commit 3d876b9f24c6a45b5e4720d14e53b88b6d743c89
Author: Thomas Andraschko <tandraschko@apache.org>
AuthorDate: Mon Dec 3 16:42:54 2018 +0100

    refactored
---
 .../servlet/ServletExternalContextImpl.java        |  3 +-
 .../myfaces/renderkit/html/base/HtmlRenderer.java  | 49 ++++++++++------------
 2 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
b/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
index 6ffd2ab..051a7d2 100755
--- a/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
+++ b/impl/src/main/java/org/apache/myfaces/context/servlet/ServletExternalContextImpl.java
@@ -936,7 +936,6 @@ public final class ServletExternalContextImpl extends ServletExternalContextImpl
         ClientWindow window = facesContext.getExternalContext().getClientWindow();
         if (window != null)
         {
-            //TODO: Use StringBuilder or some optimization.
             if (window.isClientWindowRenderModeEnabled(facesContext))
             {
                 Map<String, String> map = window.getQueryURLParameters(facesContext);
@@ -944,7 +943,7 @@ public final class ServletExternalContextImpl extends ServletExternalContextImpl
                 {
                     for (Map.Entry<String , String> entry : map.entrySet())
                     {
-                        ArrayList<String> value = new ArrayList<String>(1);
+                        ArrayList<String> value = new ArrayList<>(1);
                         value.add(entry.getValue());
                         if (paramMap == null)
                         {
diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlRenderer.java b/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlRenderer.java
index 942dae3..416b4d5 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlRenderer.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlRenderer.java
@@ -76,52 +76,45 @@ public abstract class HtmlRenderer
     /**
      * Renders the client ID as an "id".
      */
-    protected void renderId(
-      FacesContext context,
-      UIComponent  component) throws IOException
+    protected void renderId(FacesContext context, UIComponent  component) throws IOException
     {
-      if (shouldRenderId(context, component))
-      {
-        String clientId = getClientId(context, component);
-        context.getResponseWriter().writeAttribute(HTML.ID_ATTR, clientId, JSFAttr.ID_ATTR);
-      }
+        if (shouldRenderId(context, component))
+        {
+            String clientId = getClientId(context, component);
+            context.getResponseWriter().writeAttribute(HTML.ID_ATTR, clientId, JSFAttr.ID_ATTR);
+        }
     }
 
     /**
      * Returns the client ID that should be used for rendering (if
      * {@link #shouldRenderId} returns true).
      */
-    protected String getClientId(
-      FacesContext context,
-      UIComponent  component)
+    protected String getClientId(FacesContext context, UIComponent component)
     {
-      return component.getClientId(context);
+        return component.getClientId(context);
     }
 
     /**
      * Returns true if the component should render an ID.  Components
      * that deliver events should always return "true".
-     * TODO: Is this a bottleneck?  If so, optimize!
      */
-    protected boolean shouldRenderId(
-      FacesContext context,
-      UIComponent  component)
+    protected boolean shouldRenderId(FacesContext context, UIComponent  component)
     {
-      String id = component.getId();
+        String id = component.getId();
 
-      // Otherwise, if ID isn't set, don't bother
-      if (id == null)
-      {
-          return false;
-      }
+        // Otherwise, if ID isn't set, don't bother
+        if (id == null)
+        {
+            return false;
+        }
 
-      // ... or if the ID was generated, don't bother
-      if (id.startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
-      {
-          return false;
-      }
+        // ... or if the ID was generated, don't bother
+        if (id.startsWith(UIViewRoot.UNIQUE_ID_PREFIX))
+        {
+            return false;
+        }
 
-      return true;
+        return true;
     }
     
     protected boolean isCommonPropertiesOptimizationEnabled(FacesContext facesContext)


Mime
View raw message