myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1239800 [3/8] - in /myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared: application/ config/ context/flash/ renderkit/ renderkit/html/ renderkit/html/util/ resource/ taglib/ taglib/core/ util/ util/io/ util/xml/
Date Thu, 02 Feb 2012 20:01:26 GMT
Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java?rev=1239800&r1=1239799&r2=1239800&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
(original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
Thu Feb  2 20:01:25 2012
@@ -24,6 +24,7 @@ import java.net.URLEncoder;
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
+import java.util.RandomAccess;
 
 import javax.faces.application.ViewHandler;
 import javax.faces.component.UICommand;
@@ -244,13 +245,39 @@ public abstract class HtmlLinkRendererBa
                 {
                     HtmlRendererUtils.writeIdIfNecessary(writer, component, facesContext);
                 }
-                HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, component,
behaviors);
-                HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
-                        facesContext, writer, component, behaviors);
+                long commonPropertiesMarked = 0L;
+                if (isCommonPropertiesOptimizationEnabled(facesContext))
+                {
+                    commonPropertiesMarked = CommonPropertyUtils.getCommonPropertiesMarked(component);
+                }
+                if (behaviors.isEmpty() && isCommonPropertiesOptimizationEnabled(facesContext))
+                {
+                    CommonPropertyUtils.renderEventProperties(writer, 
+                            commonPropertiesMarked, component);
+                    CommonPropertyUtils.renderFocusBlurEventProperties(writer,
+                            commonPropertiesMarked, component);
+                }
+                else
+                {
+                    if (isCommonEventsOptimizationEnabled(facesContext))
+                    {
+                        Long commonEventsMarked = CommonEventUtils.getCommonEventsMarked(component);
+                        CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer,

+                                commonPropertiesMarked, commonEventsMarked, component, behaviors);
+                        CommonEventUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
+                            facesContext, writer, commonPropertiesMarked, commonEventsMarked,
component, behaviors);
+                    }
+                    else
+                    {
+                        HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer,
component, behaviors);
+                        HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
+                                facesContext, writer, component, behaviors);
+                    }
+                }
                 if (isCommonPropertiesOptimizationEnabled(facesContext))
                 {
                     CommonPropertyUtils.renderAnchorPassthroughPropertiesWithoutEvents(writer,

-                            CommonPropertyUtils.getCommonPropertiesMarked(component), component);
+                            commonPropertiesMarked, component);
                 }
                 else
                 {
@@ -290,14 +317,29 @@ public abstract class HtmlLinkRendererBa
                     {
                         HtmlRendererUtils.writeIdIfNecessary(writer, component, facesContext);
                     }
-                    HtmlRendererUtils.renderBehaviorizedEventHandlersWithoutOnclick(
-                            facesContext, writer, component, behaviors);
-                    HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
-                            facesContext, writer, component, behaviors);
+                    long commonPropertiesMarked = 0L;
+                    if (isCommonPropertiesOptimizationEnabled(facesContext))
+                    {
+                        commonPropertiesMarked = CommonPropertyUtils.getCommonPropertiesMarked(component);
+                    }
+                    if (behaviors.isEmpty() && isCommonPropertiesOptimizationEnabled(facesContext))
+                    {
+                        CommonPropertyUtils.renderEventPropertiesWithoutOnclick(writer,
+                            commonPropertiesMarked, component);
+                        CommonPropertyUtils.renderFocusBlurEventProperties(writer,
+                                commonPropertiesMarked, component);
+                    }
+                    else
+                    {
+                        HtmlRendererUtils.renderBehaviorizedEventHandlersWithoutOnclick(
+                                facesContext, writer, component, behaviors);
+                        HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
+                                facesContext, writer, component, behaviors);
+                    }
                     if (isCommonPropertiesOptimizationEnabled(facesContext))
                     {
                         CommonPropertyUtils.renderAnchorPassthroughPropertiesWithoutStyleAndEvents(writer,

-                                CommonPropertyUtils.getCommonPropertiesMarked(component),
component);
+                                commonPropertiesMarked, component);
                     }
                     else
                     {
@@ -368,7 +410,7 @@ public abstract class HtmlLinkRendererBa
         UIComponent nestingForm = formInfo.getForm();
         String formName = formInfo.getFormName();
 
-        StringBuffer onClick = new StringBuffer();
+        StringBuilder onClick = new StringBuilder();
 
         String commandOnclick;
         if (component instanceof HtmlCommandLink)
@@ -400,7 +442,7 @@ public abstract class HtmlLinkRendererBa
         {
             HtmlRendererUtils.renderFormSubmitScript(facesContext);
 
-            StringBuffer params = addChildParameters(facesContext, component, nestingForm);
+            StringBuilder params = addChildParameters(facesContext, component, nestingForm);
 
             String target = getTarget(component);
 
@@ -511,11 +553,28 @@ public abstract class HtmlLinkRendererBa
         List<ClientBehavior> eventBehaviors = clientBehaviors.get(eventName);
         if (eventBehaviors != null && !eventBehaviors.isEmpty())
         {
-            for (ClientBehavior behavior : eventBehaviors)
+            // perf: in 99% cases is  eventBehaviors javax.faces.component._DeltaList._DeltaList(int)
= RandomAccess
+            // instance created in javax.faces.component.UIComponentBase.addClientBehavior(String,
ClientBehavior), but
+            // component libraries can provide own implementation
+            if (eventBehaviors instanceof RandomAccess)
             {
-                if (behavior.getHints().contains(ClientBehaviorHint.SUBMITTING))
+                for (int i = 0, size = eventBehaviors.size(); i < size; i++)
                 {
-                    return true;
+                    ClientBehavior behavior = eventBehaviors.get(i);
+                    if (behavior.getHints().contains(ClientBehaviorHint.SUBMITTING))
+                    {
+                        return true;
+                    }
+                }
+            }
+            else
+            {
+                for (ClientBehavior behavior : eventBehaviors)
+                {
+                    if (behavior.getHints().contains(ClientBehaviorHint.SUBMITTING))
+                    {
+                        return true;
+                    }
                 }
             }
         }
@@ -528,7 +587,7 @@ public abstract class HtmlLinkRendererBa
         UIComponent nestingForm = formInfo.getForm();
         String formName = formInfo.getFormName();
 
-        StringBuffer onClick = new StringBuffer();
+        StringBuilder onClick = new StringBuilder();
 
         if (RendererUtils.isAdfOrTrinidadForm(formInfo.getForm()))
         {
@@ -542,7 +601,7 @@ public abstract class HtmlLinkRendererBa
         {
             HtmlRendererUtils.renderFormSubmitScript(facesContext);
 
-            StringBuffer params = addChildParameters(facesContext, component, nestingForm);
+            StringBuilder params = addChildParameters(facesContext, component, nestingForm);
 
             String target = getTarget(component);
 
@@ -594,16 +653,17 @@ public abstract class HtmlLinkRendererBa
         return target;
     }
 
-    private StringBuffer addChildParameters(FacesContext context, UIComponent component,
UIComponent nestingForm)
+    private StringBuilder addChildParameters(FacesContext context, UIComponent component,
UIComponent nestingForm)
     {
         //add child parameters
-        StringBuffer params = new StringBuffer();
+        StringBuilder params = new StringBuilder();
         params.append("[");
         
         List<UIParameter> validParams = HtmlRendererUtils.getValidUIParameterChildren(
                 FacesContext.getCurrentInstance(), getChildren(component), false, false);
-        for (UIParameter param : validParams) 
+        for (int j = 0, size = validParams.size(); j < size; j++) 
         {
+            UIParameter param = validParams.get(j);
             String name = param.getName();
 
             //Not necessary, since we are using oamSetHiddenInput to create hidden fields
@@ -628,7 +688,7 @@ public abstract class HtmlLinkRendererBa
             if (value != null)
             {
                 strParamValue = value.toString();
-                StringBuffer buff = null;
+                StringBuilder buff = null;
                 for (int i = 0; i < strParamValue.length(); i++)
                 {
                     char c = strParamValue.charAt(i); 
@@ -636,7 +696,7 @@ public abstract class HtmlLinkRendererBa
                     {
                         if (buff == null)
                         {
-                            buff = new StringBuffer();
+                            buff = new StringBuilder();
                             buff.append(strParamValue.substring(0,i));
                         }
                         buff.append('\\');
@@ -701,7 +761,7 @@ public abstract class HtmlLinkRendererBa
         boolean strictXhtmlLinks
                 = MyfacesConfig.getCurrentInstance(facesContext.getExternalContext()).isStrictXhtmlLinks();
 
-        StringBuffer hrefBuf = new StringBuffer(path);
+        StringBuilder hrefBuf = new StringBuilder(path);
 
         //add clientId parameter for decode
 
@@ -741,7 +801,7 @@ public abstract class HtmlLinkRendererBa
 
     private void addChildParametersToHref(FacesContext facesContext,
                                           UIComponent linkComponent,
-                                          StringBuffer hrefBuf,
+                                          StringBuilder hrefBuf,
                                           boolean firstParameter,
                                           String charEncoding)
             throws IOException
@@ -751,8 +811,10 @@ public abstract class HtmlLinkRendererBa
         
         List<UIParameter> validParams = HtmlRendererUtils.getValidUIParameterChildren(
                 facesContext, getChildren(linkComponent), false, false);
-        for (UIParameter param : validParams)
+        
+        for (int i = 0, size = validParams.size(); i < size; i++)
         {
+            UIParameter param = validParams.get(i);
             String name = param.getName();
             Object value = param.getValue();
             addParameterToHref(name, value, hrefBuf, firstParameter, charEncoding, strictXhtmlLinks);
@@ -781,13 +843,40 @@ public abstract class HtmlLinkRendererBa
                 {
                     HtmlRendererUtils.writeIdIfNecessary(writer, output, facesContext);
                 }
-                HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, output,
behaviors);
-                HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
-                        facesContext, writer, output, behaviors);
+                long commonPropertiesMarked = 0L;
+                if (isCommonPropertiesOptimizationEnabled(facesContext))
+                {
+                    commonPropertiesMarked = CommonPropertyUtils.getCommonPropertiesMarked(output);
+                }
+
+                if (behaviors.isEmpty() && isCommonPropertiesOptimizationEnabled(facesContext))
+                {
+                    CommonPropertyUtils.renderEventProperties(writer, 
+                            commonPropertiesMarked, output);
+                    CommonPropertyUtils.renderFocusBlurEventProperties(writer,
+                            commonPropertiesMarked, output);
+                }
+                else
+                {
+                    if (isCommonEventsOptimizationEnabled(facesContext))
+                    {
+                        Long commonEventsMarked = CommonEventUtils.getCommonEventsMarked(output);
+                        CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer,

+                                commonPropertiesMarked, commonEventsMarked, output, behaviors);
+                        CommonEventUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
+                            facesContext, writer, commonPropertiesMarked, commonEventsMarked,
output, behaviors);
+                    }
+                    else
+                    {
+                        HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer,
output, behaviors);
+                        HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
+                                facesContext, writer, output, behaviors);
+                    }
+                }
                 if (isCommonPropertiesOptimizationEnabled(facesContext))
                 {
                     CommonPropertyUtils.renderAnchorPassthroughPropertiesWithoutEvents(writer,

-                            CommonPropertyUtils.getCommonPropertiesMarked(output), output);
+                            commonPropertiesMarked, output);
                 }
                 else
                 {
@@ -826,7 +915,7 @@ public abstract class HtmlLinkRendererBa
             }
             if (getChildCount(output) > 0)
             {
-                StringBuffer hrefBuf = new StringBuffer(href);
+                StringBuilder hrefBuf = new StringBuilder(href);
                 addChildParametersToHref(facesContext, output, hrefBuf,
                                      (href.indexOf('?') == -1), //first url parameter?
                                      writer.getCharacterEncoding());
@@ -867,13 +956,39 @@ public abstract class HtmlLinkRendererBa
                 {
                     HtmlRendererUtils.writeIdAndNameIfNecessary(writer, output, facesContext);
                 }
-                HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, output,
behaviors);
-                HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
-                        facesContext, writer, output, behaviors);
+                long commonPropertiesMarked = 0L;
+                if (isCommonPropertiesOptimizationEnabled(facesContext))
+                {
+                    commonPropertiesMarked = CommonPropertyUtils.getCommonPropertiesMarked(output);
+                }
+                if (behaviors.isEmpty() && isCommonPropertiesOptimizationEnabled(facesContext))
+                {
+                    CommonPropertyUtils.renderEventProperties(writer, 
+                            commonPropertiesMarked, output);
+                    CommonPropertyUtils.renderFocusBlurEventProperties(writer,
+                            commonPropertiesMarked, output);
+                }
+                else
+                {
+                    if (isCommonEventsOptimizationEnabled(facesContext))
+                    {
+                        Long commonEventsMarked = CommonEventUtils.getCommonEventsMarked(output);
+                        CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer,

+                                commonPropertiesMarked, commonEventsMarked, output, behaviors);
+                        CommonEventUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
+                            facesContext, writer, commonPropertiesMarked, commonEventsMarked,
output, behaviors);
+                    }
+                    else
+                    {
+                        HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer,
output, behaviors);
+                        HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
+                                facesContext, writer, output, behaviors);
+                    }
+                }
                 if (isCommonPropertiesOptimizationEnabled(facesContext))
                 {
                     CommonPropertyUtils.renderAnchorPassthroughPropertiesWithoutEvents(writer,

-                            CommonPropertyUtils.getCommonPropertiesMarked(output), output);
+                            commonPropertiesMarked, output);
                 }
                 else
                 {
@@ -923,13 +1038,39 @@ public abstract class HtmlLinkRendererBa
                 {
                     HtmlRendererUtils.writeIdIfNecessary(writer, output, facesContext);
                 }
-                HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, output,
behaviors);
-                HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
-                        facesContext, writer, output, behaviors);
+                long commonPropertiesMarked = 0L;
+                if (isCommonPropertiesOptimizationEnabled(facesContext))
+                {
+                    commonPropertiesMarked = CommonPropertyUtils.getCommonPropertiesMarked(output);
+                }
+                if (behaviors.isEmpty() && isCommonPropertiesOptimizationEnabled(facesContext))
+                {
+                    CommonPropertyUtils.renderEventProperties(writer, 
+                            commonPropertiesMarked, output);
+                    CommonPropertyUtils.renderFocusBlurEventProperties(writer,
+                            commonPropertiesMarked, output);
+                }
+                else
+                {
+                    if (isCommonEventsOptimizationEnabled(facesContext))
+                    {
+                        Long commonEventsMarked = CommonEventUtils.getCommonEventsMarked(output);
+                        CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer,

+                                commonPropertiesMarked, commonEventsMarked, output, behaviors);
+                        CommonEventUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
+                            facesContext, writer, commonPropertiesMarked, commonEventsMarked,
output, behaviors);
+                    }
+                    else
+                    {
+                        HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer,
output, behaviors);
+                        HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
+                                facesContext, writer, output, behaviors);
+                    }
+                }
                 if (isCommonPropertiesOptimizationEnabled(facesContext))
                 {
                     CommonPropertyUtils.renderAnchorPassthroughPropertiesWithoutEvents(writer,

-                            CommonPropertyUtils.getCommonPropertiesMarked(output), output);
+                            commonPropertiesMarked, output);
                 }
                 else
                 {
@@ -975,13 +1116,39 @@ public abstract class HtmlLinkRendererBa
                 {
                     HtmlRendererUtils.writeIdAndNameIfNecessary(writer, output, facesContext);
                 }
-                HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, output,
behaviors);
-                HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
-                        facesContext, writer, output, behaviors);
+                long commonPropertiesMarked = 0L;
+                if (isCommonPropertiesOptimizationEnabled(facesContext))
+                {
+                    commonPropertiesMarked = CommonPropertyUtils.getCommonPropertiesMarked(output);
+                }
+                if (behaviors.isEmpty() && isCommonPropertiesOptimizationEnabled(facesContext))
+                {
+                    CommonPropertyUtils.renderEventProperties(writer, 
+                            commonPropertiesMarked, output);
+                    CommonPropertyUtils.renderFocusBlurEventProperties(writer,
+                            commonPropertiesMarked, output);
+                }
+                else
+                {
+                    if (isCommonEventsOptimizationEnabled(facesContext))
+                    {
+                        Long commonEventsMarked = CommonEventUtils.getCommonEventsMarked(output);
+                        CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer,

+                                commonPropertiesMarked, commonEventsMarked, output, behaviors);
+                        CommonEventUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
+                            facesContext, writer, commonPropertiesMarked, commonEventsMarked,
output, behaviors);
+                    }
+                    else
+                    {
+                        HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer,
output, behaviors);
+                        HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
+                                facesContext, writer, output, behaviors);
+                    }
+                }
                 if (isCommonPropertiesOptimizationEnabled(facesContext))
                 {
                     CommonPropertyUtils.renderAnchorPassthroughPropertiesWithoutEvents(writer,

-                            CommonPropertyUtils.getCommonPropertiesMarked(output), output);
+                            commonPropertiesMarked, output);
                 }
                 else
                 {
@@ -1011,7 +1178,7 @@ public abstract class HtmlLinkRendererBa
 
     private void renderLinkParameter(String name,
                                      Object value,
-                                     StringBuffer onClick,
+                                     StringBuilder onClick,
                                      String jsForm,
                                      UIComponent nestingForm)
     {
@@ -1031,7 +1198,7 @@ public abstract class HtmlLinkRendererBa
 
     private static void addParameterToHref(String name,
                                            Object value,
-                                           StringBuffer hrefBuf,
+                                           StringBuilder hrefBuf,
                                            boolean firstParameter,
                                            String charEncoding,
                                            boolean strictXhtmlLinks) throws UnsupportedEncodingException

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java?rev=1239800&r1=1239799&r2=1239800&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java
(original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java
Thu Feb  2 20:01:25 2012
@@ -43,7 +43,7 @@ import java.util.Map;
  * @version $Revision$ $Date$
  */
 public class HtmlListboxRendererBase
-        extends HtmlRenderer
+        extends HtmlSelectableRendererBase
 {
     public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
             throws IOException
@@ -69,14 +69,14 @@ public class HtmlListboxRendererBase
 
         if (uiComponent instanceof UISelectMany)
         {
-            HtmlRendererUtils.renderListbox(facesContext,
+            renderListbox(facesContext,
                                             (UISelectMany)uiComponent,
                                             isDisabled(facesContext, uiComponent),
                                             size, getConverter(facesContext, uiComponent));
         }
         else if (uiComponent instanceof HtmlSelectOneListbox)
         {
-            HtmlRendererUtils.renderListbox(facesContext,
+            renderListbox(facesContext,
                                             (UISelectOne)uiComponent,
                                             isDisabled(facesContext, uiComponent),
                                             size, getConverter(facesContext, uiComponent));
@@ -86,6 +86,22 @@ public class HtmlListboxRendererBase
             throw new IllegalArgumentException("Unsupported component class " + uiComponent.getClass().getName());
         }
     }
+    
+    protected void renderListbox(FacesContext facesContext,
+            UISelectOne selectOne, boolean disabled, int size,
+            Converter converter) throws IOException
+    {
+        internalRenderSelect(facesContext, selectOne, disabled, size, false,
+                converter);
+    }
+
+    protected void renderListbox(FacesContext facesContext,
+            UISelectMany selectMany, boolean disabled, int size,
+            Converter converter) throws IOException
+    {
+        internalRenderSelect(facesContext, selectMany, disabled, size, true,
+                converter);
+    }
 
     protected boolean isDisabled(FacesContext facesContext, UIComponent uiComponent)
     {

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java?rev=1239800&r1=1239799&r2=1239800&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java
(original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java
Thu Feb  2 20:01:25 2012
@@ -44,7 +44,7 @@ import org.apache.myfaces.shared.renderk
  * @version $Revision$ $Date$
  */
 public class HtmlMenuRendererBase
-        extends HtmlRenderer
+        extends HtmlSelectableRendererBase
 {
     //private static final Log log = LogFactory.getLog(HtmlMenuRenderer.class);
 
@@ -66,14 +66,14 @@ public class HtmlMenuRendererBase
 
         if (component instanceof UISelectMany)
         {
-            HtmlRendererUtils.renderMenu(facesContext,
+            renderMenu(facesContext,
                                          (UISelectMany)component,
                                          isDisabled(facesContext, component),
                                          getConverter(facesContext, component));
         }
         else if (component instanceof UISelectOne)
         {
-            HtmlRendererUtils.renderMenu(facesContext,
+            renderMenu(facesContext,
                                          (UISelectOne)component,
                                          isDisabled(facesContext, component),
                                          getConverter(facesContext, component));
@@ -83,6 +83,22 @@ public class HtmlMenuRendererBase
             throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName());
         }
     }
+    
+    protected void renderMenu(FacesContext facesContext,
+            UISelectOne selectOne, boolean disabled, Converter converter)
+            throws IOException
+    {
+        internalRenderSelect(facesContext, selectOne, disabled, 1, false,
+                converter);
+    }
+
+    protected void renderMenu(FacesContext facesContext,
+            UISelectMany selectMany, boolean disabled, Converter converter)
+            throws IOException
+    {
+        internalRenderSelect(facesContext, selectMany, disabled, 1, true,
+                converter);
+    }
 
     protected boolean isDisabled(FacesContext facesContext, UIComponent uiComponent)
     {

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMessageRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMessageRendererBase.java?rev=1239800&r1=1239799&r2=1239800&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMessageRendererBase.java
(original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMessageRendererBase.java
Thu Feb  2 20:01:25 2012
@@ -109,8 +109,8 @@ public abstract class HtmlMessageRendere
                 ResponseWriter writer = facesContext.getResponseWriter();
                 writer.startElement(HTML.SPAN_ELEM, null);
                 writer.writeAttribute(HTML.ID_ATTR, clientId + "_msgFor", null);
-                HtmlRendererUtils.renderHTMLAttribute(writer, message, JSFAttr.STYLE_ATTR,
HTML.STYLE_ATTR);
-                HtmlRendererUtils.renderHTMLAttribute(writer, message, JSFAttr.STYLE_CLASS_ATTR,
HTML.CLASS_ATTR);
+                HtmlRendererUtils.renderHTMLStringAttribute(writer, message, JSFAttr.STYLE_ATTR,
HTML.STYLE_ATTR);
+                HtmlRendererUtils.renderHTMLStringAttribute(writer, message, JSFAttr.STYLE_CLASS_ATTR,
HTML.CLASS_ATTR);
                 writer.endElement(HTML.SPAN_ELEM);
             }
             else if (renderDivWhenNoMessagesAndIdSet && message.getId() != null &&

@@ -247,7 +247,24 @@ public abstract class HtmlMessageRendere
                     facesContext.getExternalContext()))
             {
                 behaviors = ((ClientBehaviorHolder) message).getClientBehaviors();
-                HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, message,
behaviors);
+                if (behaviors.isEmpty() && isCommonPropertiesOptimizationEnabled(facesContext))
+                {
+                    CommonPropertyUtils.renderEventProperties(writer, 
+                            CommonPropertyUtils.getCommonPropertiesMarked(message), message);
+                }
+                else
+                {
+                    if (isCommonEventsOptimizationEnabled(facesContext))
+                    {
+                        CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer,

+                               CommonPropertyUtils.getCommonPropertiesMarked(message),
+                               CommonEventUtils.getCommonEventsMarked(message), message,
behaviors);
+                    }
+                    else
+                    {
+                        HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer,
message, behaviors);
+                    }
+                }
                 HtmlRendererUtils.renderHTMLAttributes(writer, message, 
                         HTML.UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE_AND_TITLE);
             }

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlOutcomeTargetButtonRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlOutcomeTargetButtonRendererBase.java?rev=1239800&r1=1239799&r2=1239800&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlOutcomeTargetButtonRendererBase.java
(original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlOutcomeTargetButtonRendererBase.java
Thu Feb  2 20:01:25 2012
@@ -119,7 +119,7 @@ public class HtmlOutcomeTargetButtonRend
             }
             else
             {
-                StringBuffer onClick = new StringBuffer();
+                StringBuilder onClick = new StringBuilder();
     
                 if (commandOnClick != null)
                 {
@@ -162,7 +162,7 @@ public class HtmlOutcomeTargetButtonRend
                     writer, commonPropertiesMarked, uiComponent);
             if ((commonPropertiesMarked & CommonPropertyConstants.ALT_PROP) != 0)
             {
-                CommonPropertyUtils.renderHTMLStringAttribute(writer, uiComponent,
+                HtmlRendererUtils.renderHTMLStringAttribute(writer, uiComponent,
                         HTML.ALT_ATTR, HTML.ALT_ATTR);
             }
         }
@@ -186,7 +186,7 @@ public class HtmlOutcomeTargetButtonRend
             }
             HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent,
                     HTML.COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_EVENTS);
-            HtmlRendererUtils.renderHTMLAttribute(writer, uiComponent,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, uiComponent,
                     HTML.ALT_ATTR, HTML.ALT_ATTR);
         }
 

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java?rev=1239800&r1=1239799&r2=1239800&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
(original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
Thu Feb  2 20:01:25 2012
@@ -355,10 +355,38 @@ public class HtmlRadioRendererBase
         {
             behaviors = ((ClientBehaviorHolder) uiComponent).getClientBehaviors();
             
-            HtmlRendererUtils.renderBehaviorizedOnchangeEventHandler(facesContext, writer,
uiComponent, behaviors);
-            HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, uiComponent,
behaviors);
-            HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
-                    facesContext, writer, uiComponent, behaviors);
+            long commonPropertiesMarked = 0L;
+            if (isCommonPropertiesOptimizationEnabled(facesContext))
+            {
+                commonPropertiesMarked = CommonPropertyUtils.getCommonPropertiesMarked(uiComponent);
+            }
+            if (behaviors.isEmpty() && isCommonPropertiesOptimizationEnabled(facesContext))
+            {
+                CommonPropertyUtils.renderChangeEventProperty(writer, 
+                        commonPropertiesMarked, uiComponent);
+                CommonPropertyUtils.renderEventProperties(writer, 
+                        commonPropertiesMarked, uiComponent);
+                CommonPropertyUtils.renderFieldEventPropertiesWithoutOnchange(writer, 
+                        commonPropertiesMarked, uiComponent);
+            }
+            else
+            {
+                HtmlRendererUtils.renderBehaviorizedOnchangeEventHandler(facesContext, writer,
uiComponent, behaviors);
+                if (isCommonEventsOptimizationEnabled(facesContext))
+                {
+                    Long commonEventsMarked = CommonEventUtils.getCommonEventsMarked(uiComponent);
+                    CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer,

+                            commonPropertiesMarked, commonEventsMarked, uiComponent, behaviors);
+                    CommonEventUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
+                        facesContext, writer, commonPropertiesMarked, commonEventsMarked,
uiComponent, behaviors);
+                }
+                else
+                {
+                    HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer,
uiComponent, behaviors);
+                    HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchange(
+                            facesContext, writer, uiComponent, behaviors);
+                }
+            }
             HtmlRendererUtils.renderHTMLAttributes(writer, uiComponent, 
                     HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED_AND_STYLE_AND_EVENTS);
         }

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRenderer.java?rev=1239800&r1=1239799&r2=1239800&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRenderer.java
(original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRenderer.java
Thu Feb  2 20:01:25 2012
@@ -160,4 +160,9 @@ public abstract class HtmlRenderer
     {
         return false;
     }
+    
+    protected boolean isCommonEventsOptimizationEnabled(FacesContext facesContext)
+    {
+        return false;
+    }
 }



Mime
View raw message