myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hno...@apache.org
Subject svn commit: r1790255 - /myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
Date Wed, 05 Apr 2017 13:39:06 GMT
Author: hnoeth
Date: Wed Apr  5 13:39:06 2017
New Revision: 1790255

URL: http://svn.apache.org/viewvc?rev=1790255&view=rev
Log:
TOBAGO-1721 Optimize HTML output when two renderer are involved
* optimized HTML output for <tc:in>

Modified:
    myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java

Modified: myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java?rev=1790255&r1=1790254&r2=1790255&view=diff
==============================================================================
--- myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
(original)
+++ myfaces/tobago/branches/TOBAGO-1719/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/renderkit/renderer/InRenderer.java
Wed Apr  5 13:39:06 2017
@@ -21,8 +21,10 @@ package org.apache.myfaces.tobago.intern
 
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.Facets;
+import org.apache.myfaces.tobago.component.RendererTypes;
 import org.apache.myfaces.tobago.internal.component.AbstractUIButton;
 import org.apache.myfaces.tobago.internal.component.AbstractUIInput;
+import org.apache.myfaces.tobago.internal.component.AbstractUISelectOneChoice;
 import org.apache.myfaces.tobago.internal.util.AccessKeyLogger;
 import org.apache.myfaces.tobago.internal.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.internal.util.JsonUtils;
@@ -30,6 +32,7 @@ import org.apache.myfaces.tobago.interna
 import org.apache.myfaces.tobago.internal.util.StringUtils;
 import org.apache.myfaces.tobago.renderkit.css.BootstrapClass;
 import org.apache.myfaces.tobago.renderkit.css.Classes;
+import org.apache.myfaces.tobago.renderkit.css.CssItem;
 import org.apache.myfaces.tobago.renderkit.css.TobagoClass;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
@@ -154,12 +157,26 @@ public class InRenderer extends MessageL
         children = Collections.singletonList(addon);
       }
       for (UIComponent child : children) {
-        writer.startElement(HtmlElements.SPAN);
-        final BootstrapClass css
-            = child instanceof AbstractUIButton ? BootstrapClass.INPUT_GROUP_BTN : BootstrapClass.INPUT_GROUP_ADDON;
-        writer.writeClassAttribute(css);
-        RenderUtils.encode(facesContext, child);
-        writer.endElement(HtmlElements.SPAN);
+        if (child instanceof AbstractUIButton && ((AbstractUIButton) child).isParentOfCommands())
{
+          child.setRendererType(RendererTypes.BUTTON_ALTERNATIVE_IN);
+          RenderUtils.encode(facesContext, child);
+        } else {
+          writer.startElement(HtmlElements.SPAN);
+
+          final CssItem cssItem;
+          if (child instanceof AbstractUIButton) {
+            cssItem = BootstrapClass.INPUT_GROUP_BTN;
+          } else if (child instanceof AbstractUISelectOneChoice) {
+            cssItem = BootstrapClass.INPUT_GROUP_BTN;
+            child.setRendererType(RendererTypes.SELECT_ONE_CHOICE_ALTERNATIVE_IN);
+          } else {
+            cssItem = BootstrapClass.INPUT_GROUP_ADDON;
+          }
+
+          writer.writeClassAttribute(cssItem);
+          RenderUtils.encode(facesContext, child);
+          writer.endElement(HtmlElements.SPAN);
+        }
       }
     }
   }
@@ -173,27 +190,3 @@ public class InRenderer extends MessageL
       throws IOException {
   }
 }
-/*
-for (UIComponent child : children) {
-    if (child instanceof AbstractUIButton && ((AbstractUIButton) child).isParentOfCommands())
{
-    child.setRendererType(RendererTypes.BUTTON_ALTERNATIVE_IN);
-    RenderUtils.encode(facesContext, child);
-    } else {
-    writer.startElement(HtmlElements.SPAN);
-
-final CssItem cssItem;
-    if (child instanceof AbstractUIButton) {
-    cssItem = BootstrapClass.INPUT_GROUP_BTN;
-    } else if (child instanceof AbstractUISelectOneChoice) {
-    cssItem = BootstrapClass.INPUT_GROUP_BTN;
-    child.setRendererType(RendererTypes.SELECT_ONE_CHOICE_ALTERNATIVE_IN);
-    } else {
-    cssItem = BootstrapClass.INPUT_GROUP_ADDON;
-    }
-
-    writer.writeClassAttribute(cssItem);
-    RenderUtils.encode(facesContext, child);
-    writer.endElement(HtmlElements.SPAN);
-    }
-    }
-*/



Mime
View raw message