myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1239800 [1/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
Author: lu4242
Date: Thu Feb  2 20:01:25 2012
New Revision: 1239800

URL: http://svn.apache.org/viewvc?rev=1239800&view=rev
Log:
synch with impl shared

Added:
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventConstants.java   (with props)
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventUtils.java   (with props)
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlSelectableRendererBase.java   (with props)
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/SharedStringBuilder.java   (with props)
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/StreamCharBuffer.java   (with props)
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/StringCharArrayAccessor.java   (with props)
Modified:
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/NavigationUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/SubKeyMap.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlBodyRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlFormRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlGridRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlImageRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlJavaScriptUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlListboxRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMenuRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMessageRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlOutcomeTargetButtonRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRenderer.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRendererUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlResponseWriterImpl.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlSecretRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTableRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlTextareaRendererBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/JavascriptContext.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/HTMLEncoder.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/JavascriptUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/util/UnicodeEncoder.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ResourceLoaderWrapper.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ResourceValidationUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/resource/ValueExpressionFilterInputStream.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentELTagBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentELTagUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/UIComponentTagUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/taglib/core/SelectItemTagBase.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/StringUtils.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/io/DynamicPushbackInputStream.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/xml/MyFacesErrorHandler.java
    myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/util/xml/XmlUtils.java

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java?rev=1239800&r1=1239799&r2=1239800&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/DefaultViewHandlerSupport.java Thu Feb  2 20:01:25 2012
@@ -32,7 +32,9 @@ import javax.faces.context.FacesContext;
 import javax.faces.view.ViewDeclarationLanguage;
 
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFWebConfigParam;
+import org.apache.myfaces.shared.renderkit.html.util.SharedStringBuilder;
 import org.apache.myfaces.shared.util.ExternalContextUtils;
+import org.apache.myfaces.shared.util.StringUtils;
 import org.apache.myfaces.shared.util.WebConfigParamUtils;
 
 /**
@@ -73,6 +75,8 @@ public class DefaultViewHandlerSupport i
     private static final String CHECKED_VIEWID_CACHE_ENABLED_ATTRIBUTE = 
         "org.apache.myfaces.CHECKED_VIEWID_CACHE_ENABLED";
     private static final boolean CHECKED_VIEWID_CACHE_ENABLED_DEFAULT = true;
+    
+    private static final String VIEW_HANDLER_SUPPORT_SB = "oam.viewhandler.SUPPORT_SB";
 
     private Map<String, Boolean> _checkedViewIdMap = null;
     private Boolean _checkedViewIdCacheEnabled = null;
@@ -172,7 +176,9 @@ public class DefaultViewHandlerSupport i
         FacesServletMapping mapping = getFacesServletMapping(context);
         ExternalContext externalContext = context.getExternalContext();
         String contextPath = externalContext.getRequestContextPath();
-        StringBuilder builder = new StringBuilder(contextPath);
+        //StringBuilder builder = new StringBuilder(contextPath);
+        StringBuilder builder = SharedStringBuilder.get(context, VIEW_HANDLER_SUPPORT_SB);
+        builder.append(contextPath);
         if (mapping != null)
         {
             if (mapping.isExtensionMapping())
@@ -312,7 +318,7 @@ public class DefaultViewHandlerSupport i
         {
             defaultSuffix = ViewHandler.DEFAULT_SUFFIX;
         }
-        return defaultSuffix.split(" ");
+        return StringUtils.splitShortString(defaultSuffix, ' ');
     }
     
     protected String getFaceletsContextSuffix(FacesContext context)
@@ -336,7 +342,7 @@ public class DefaultViewHandlerSupport i
             faceletsViewMappings= context.getExternalContext().getInitParameter("facelets.VIEW_MAPPINGS");
         }
         
-        return faceletsViewMappings == null ? null : faceletsViewMappings.split(";");
+        return faceletsViewMappings == null ? null : StringUtils.splitShortString(faceletsViewMappings, ';');
     }
 
     /**
@@ -411,10 +417,14 @@ public class DefaultViewHandlerSupport i
         int slashPos = requestViewId.lastIndexOf('/');
         int extensionPos = requestViewId.lastIndexOf('.');
         
+        StringBuilder builder = SharedStringBuilder.get(context, VIEW_HANDLER_SUPPORT_SB);
+        
         //Try to locate any resource that match with the expected id
         for (String defaultSuffix : jspDefaultSuffixes)
         {
-            StringBuilder builder = new StringBuilder(requestViewId);
+            //StringBuilder builder = new StringBuilder(requestViewId);
+            builder.setLength(0);
+            builder.append(requestViewId);
            
             if (extensionPos > -1 && extensionPos > slashPos)
             {
@@ -475,7 +485,9 @@ public class DefaultViewHandlerSupport i
         }
         if (faceletsDefaultSuffix != null)
         {
-            StringBuilder builder = new StringBuilder(requestViewId);
+            //StringBuilder builder = new StringBuilder(requestViewId);
+            builder.setLength(0);
+            builder.append(requestViewId);
             
             if (extensionPos > -1 && extensionPos > slashPos)
             {

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/NavigationUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/NavigationUtils.java?rev=1239800&r1=1239799&r2=1239800&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/NavigationUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/application/NavigationUtils.java Thu Feb  2 20:01:25 2012
@@ -1,107 +1,107 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.shared.application;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-
-/**
- * 
- * @author Leonardo Uribe
- *
- */
-public class NavigationUtils
-{
-    /**
-     * Evaluate all EL expressions found as parameters and return a map that can be used for 
-     * redirect or render bookmark links
-     * 
-     * @param parameters parameter map retrieved from NavigationCase.getParameters()
-     * @return
-     */
-    public static Map<String, List<String> > getEvaluatedNavigationParameters(Map<String, List<String> > parameters)
-    {
-        Map<String,List<String>> evaluatedParameters = null;
-        if (parameters != null && parameters.size() > 0)
-        {
-            evaluatedParameters = new HashMap<String, List<String>>();
-            for (Map.Entry<String, List<String>> pair : parameters.entrySet())
-            {
-                boolean containsEL = false;
-                for (String value : pair.getValue())
-                {
-                    if (_isExpression(value))
-                    {
-                        containsEL = true;
-                        break;
-                    }
-                }
-                if (containsEL)
-                {
-                    evaluatedParameters.put(pair.getKey(), _evaluateValueExpressions(pair.getValue()));
-                }
-                else
-                {
-                    evaluatedParameters.put(pair.getKey(), pair.getValue());
-                }
-            }
-        }
-        else
-        {
-            evaluatedParameters = parameters;
-        }
-        return evaluatedParameters;
-    }
-    
-    /**
-     * Checks the Strings in the List for EL expressions and evaluates them.
-     * Note that the returned List will be a copy of the given List, because
-     * otherwise it will have unwanted side-effects.
-     * @param values
-     * @return
-     */
-    private static List<String> _evaluateValueExpressions(List<String> values)
-    {
-        // note that we have to create a new List here, because if we
-        // change any value on the given List, it will be changed in the
-        // NavigationCase too and the EL expression won't be evaluated again
-        List<String> target = new ArrayList<String>(values.size());
-        FacesContext context = FacesContext.getCurrentInstance();
-        for (String value : values)
-        {
-            if (_isExpression(value))
-            {
-                // evaluate the ValueExpression
-                value = context.getApplication().evaluateExpressionGet(context, value, String.class);
-            }
-            target.add(value);
-        }
-        return target;
-    }
-    
-    private static boolean _isExpression(String text)
-    {
-        return text.indexOf("#{") != -1;
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.shared.application;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+/**
+ * 
+ * @author Leonardo Uribe
+ *
+ */
+public class NavigationUtils
+{
+    /**
+     * Evaluate all EL expressions found as parameters and return a map that can be used for 
+     * redirect or render bookmark links
+     * 
+     * @param parameters parameter map retrieved from NavigationCase.getParameters()
+     * @return
+     */
+    public static Map<String, List<String> > getEvaluatedNavigationParameters(Map<String, List<String> > parameters)
+    {
+        Map<String,List<String>> evaluatedParameters = null;
+        if (parameters != null && parameters.size() > 0)
+        {
+            evaluatedParameters = new HashMap<String, List<String>>();
+            for (Map.Entry<String, List<String>> pair : parameters.entrySet())
+            {
+                boolean containsEL = false;
+                for (String value : pair.getValue())
+                {
+                    if (_isExpression(value))
+                    {
+                        containsEL = true;
+                        break;
+                    }
+                }
+                if (containsEL)
+                {
+                    evaluatedParameters.put(pair.getKey(), _evaluateValueExpressions(pair.getValue()));
+                }
+                else
+                {
+                    evaluatedParameters.put(pair.getKey(), pair.getValue());
+                }
+            }
+        }
+        else
+        {
+            evaluatedParameters = parameters;
+        }
+        return evaluatedParameters;
+    }
+    
+    /**
+     * Checks the Strings in the List for EL expressions and evaluates them.
+     * Note that the returned List will be a copy of the given List, because
+     * otherwise it will have unwanted side-effects.
+     * @param values
+     * @return
+     */
+    private static List<String> _evaluateValueExpressions(List<String> values)
+    {
+        // note that we have to create a new List here, because if we
+        // change any value on the given List, it will be changed in the
+        // NavigationCase too and the EL expression won't be evaluated again
+        List<String> target = new ArrayList<String>(values.size());
+        FacesContext context = FacesContext.getCurrentInstance();
+        for (String value : values)
+        {
+            if (_isExpression(value))
+            {
+                // evaluate the ValueExpression
+                value = context.getApplication().evaluateExpressionGet(context, value, String.class);
+            }
+            target.add(value);
+        }
+        return target;
+    }
+    
+    private static boolean _isExpression(String text)
+    {
+        return text.indexOf("#{") != -1;
+    }
+
+}

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java?rev=1239800&r1=1239799&r2=1239800&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/config/MyfacesConfig.java Thu Feb  2 20:01:25 2012
@@ -321,8 +321,8 @@ public class MyfacesConfig
      * Detect if a target (usually head) should be update for the current view in an ajax render 
      * operation. This is activated if a css or js resource is added dynamically by effect of a refresh 
      * (c:if, ui:include src="#{...}" or a manipulation of the tree). This ensures ajax updates of content 
-     * using ui:include will be consistent. Note this behavior is a myfaces specific extension, so to ensure strict compatibility with the spec, 
-     * set this param to false (default false).
+     * using ui:include will be consistent. Note this behavior is a myfaces specific extension, so to 
+     * ensure strict compatibility with the spec, set this param to false (default false).
      */
     @JSFWebConfigParam(since="2.0.10", expectedValues="true, false", defaultValue="false")
     public final static String INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX = 
@@ -330,14 +330,18 @@ public class MyfacesConfig
     public final static boolean INIT_PARAM_STRICT_JSF_2_REFRESH_TARGET_AJAX_DEFAULT = false;
     
     /**
-     * Change default getType() behavior for composite component EL resolver, from return null (see JSF 2_0 spec section 5_6_2_2) to
-     * use the metadata information added by composite:attribute, ensuring components working with chained EL expressions to find the
+     * Change default getType() behavior for composite component EL resolver, from return null 
+     * (see JSF 2_0 spec section 5_6_2_2) to
+     * use the metadata information added by composite:attribute, ensuring components working with 
+     * chained EL expressions to find the
      * right type when a getType() is called over the source EL expression.
      * 
-     * To ensure strict compatibility with the spec set this param to true (by default is false, so the change is enabled by default). 
+     * To ensure strict compatibility with the spec set this param to true (by default is false, 
+     * so the change is enabled by default). 
      */
     @JSFWebConfigParam(since="2.0.10", expectedValues="true, false", defaultValue="false", group="EL")
-    public final static String INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER = "org.apache.myfaces.STRICT_JSF_2_CC_EL_RESOLVER";
+    public final static String INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER = 
+        "org.apache.myfaces.STRICT_JSF_2_CC_EL_RESOLVER";
     public final static boolean INIT_PARAM_STRICT_JSF_2_CC_EL_RESOLVER_DEFAULT = false;
     
     /**

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/SubKeyMap.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/SubKeyMap.java?rev=1239800&r1=1239799&r2=1239800&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/SubKeyMap.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/flash/SubKeyMap.java Thu Feb  2 20:01:25 2012
@@ -65,6 +65,7 @@ final class SubKeyMap<V> extends Abstrac
             _base = base;
             _prefix = prefix;
         }
+        _keyBuffer = new StringBuilder(32);
     }
 
     @Override
@@ -122,7 +123,11 @@ final class SubKeyMap<V> extends Abstrac
             throw new NullPointerException();
         }
         // Yes, I want a ClassCastException if it's not a String
-        return _prefix + ((String) key);
+        //return _prefix + ((String) key);
+        _keyBuffer.setLength(0);
+        _keyBuffer.append(_prefix);
+        _keyBuffer.append((String) key);
+        return _keyBuffer.toString();
     }
 
     private List<String> _gatherKeys()
@@ -306,5 +311,6 @@ final class SubKeyMap<V> extends Abstrac
     private final Map<String, Object> _base;
     private final String _prefix;
     private Set<Map.Entry<String, V>> _entrySet;
+    private StringBuilder _keyBuffer;
 
 }

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java?rev=1239800&r1=1239799&r2=1239800&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/ContentTypeUtils.java Thu Feb  2 20:01:25 2012
@@ -1,133 +1,136 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.myfaces.shared.renderkit;
-
-import javax.faces.context.FacesContext;
-
-import org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils;
-import org.apache.myfaces.shared.util.StringUtils;
-
-/**
- * 
- * @author Leonardo Uribe
- *
- */
-public class ContentTypeUtils
-{
-    public static final String HTML_CONTENT_TYPE = "text/html";
-    public static final String TEXT_ANY_CONTENT_TYPE = "text/*";
-    public static final String ANY_CONTENT_TYPE = "*/*";
-
-    public static final String[] HTML_ALLOWED_CONTENT_TYPES = {HTML_CONTENT_TYPE, ANY_CONTENT_TYPE, TEXT_ANY_CONTENT_TYPE};
-    
-    public static final String XHTML_CONTENT_TYPE = "application/xhtml+xml";
-    public static final String APPLICATION_XML_CONTENT_TYPE = "application/xml";
-    public static final String TEXT_XML_CONTENT_TYPE = "text/xml";
-    
-    public static final String[] XHTML_ALLOWED_CONTENT_TYPES = {XHTML_CONTENT_TYPE, APPLICATION_XML_CONTENT_TYPE, TEXT_XML_CONTENT_TYPE};
-    
-    public static final String[] AJAX_XHTML_ALLOWED_CONTENT_TYPES = {XHTML_CONTENT_TYPE};
-
-
-    /**
-     * Indicate if the passes content type match one of the options passed. 
-     */
-    public static boolean containsContentType(String contentType, String[] allowedContentTypes)
-    {
-        if (allowedContentTypes == null)
-        {
-            return false;
-        }
-        for (int i = 0; i < allowedContentTypes.length; i++)
-        {
-            if (allowedContentTypes[i].indexOf(contentType) != -1)
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public static String chooseWriterContentType(String contentTypeListString, String[] htmlContentTypes, String[] xhtmlContentTypes)
-    {
-        String[] contentTypeList = splitContentTypeListString(contentTypeListString);
-        String[] supportedContentTypeArray = HtmlRendererUtils.getSupportedContentTypes();
-        String selectedContentType = null;
-        for (int i = 0; i < supportedContentTypeArray.length; i++)
-        {
-            String supportedContentType = supportedContentTypeArray[i].trim();
-
-            for (int j = 0; j < contentTypeList.length; j++)
-            {
-                String contentType = (String) contentTypeList[j];
-
-                if (contentType.indexOf(supportedContentType) != -1)
-                {
-                    if (containsContentType(contentType, htmlContentTypes))
-                    {
-                        selectedContentType = HTML_CONTENT_TYPE;
-                    }
-                    else if (containsContentType(contentType, xhtmlContentTypes))
-                    {
-                        selectedContentType = XHTML_CONTENT_TYPE;
-                    }
-                    break;
-                }
-            }
-            if (selectedContentType != null)
-            {
-                break;
-            }
-        }
-        return selectedContentType;
-    }
-    
-    public static String[] splitContentTypeListString(String contentTypeListString)
-    {
-        String[] splittedArray = StringUtils.splitShortString(contentTypeListString, ',');
-        for (int i = 0; i < splittedArray.length; i++)
-        {
-            int semicolonIndex = splittedArray[i].indexOf(";");
-            if (semicolonIndex != -1)
-            {
-                splittedArray[i] = splittedArray[i].substring(0,semicolonIndex);
-            }
-        }
-        return splittedArray;
-    }
-    
-    public static String getContentTypeFromAcceptHeader(FacesContext context)
-    {
-        String contentTypeListString = (String) context.getExternalContext()
-            .getRequestHeaderMap().get("Accept");
-        // There is a windows mobile IE client (6.12) sending
-        // "application/vnd.wap.mms-message;*/*"
-        // Note that the Accept header should be written as 
-        // "application/vnd.wap.mms-message,*/*" ,
-        // so this is bug of the client. Anyway, this is a workaround ...
-        if (contentTypeListString != null
-                && contentTypeListString
-                        .startsWith("application/vnd.wap.mms-message;*/*"))
-        {
-            contentTypeListString = "*/*";
-        }
-        return contentTypeListString;
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.shared.renderkit;
+
+import javax.faces.context.FacesContext;
+
+import org.apache.myfaces.shared.renderkit.html.HtmlRendererUtils;
+import org.apache.myfaces.shared.util.StringUtils;
+
+/**
+ * 
+ * @author Leonardo Uribe
+ *
+ */
+public class ContentTypeUtils
+{
+    public static final String HTML_CONTENT_TYPE = "text/html";
+    public static final String TEXT_ANY_CONTENT_TYPE = "text/*";
+    public static final String ANY_CONTENT_TYPE = "*/*";
+
+    public static final String[] HTML_ALLOWED_CONTENT_TYPES = {HTML_CONTENT_TYPE, 
+        ANY_CONTENT_TYPE, TEXT_ANY_CONTENT_TYPE};
+    
+    public static final String XHTML_CONTENT_TYPE = "application/xhtml+xml";
+    public static final String APPLICATION_XML_CONTENT_TYPE = "application/xml";
+    public static final String TEXT_XML_CONTENT_TYPE = "text/xml";
+    
+    public static final String[] XHTML_ALLOWED_CONTENT_TYPES = {XHTML_CONTENT_TYPE, 
+        APPLICATION_XML_CONTENT_TYPE, TEXT_XML_CONTENT_TYPE};
+    
+    public static final String[] AJAX_XHTML_ALLOWED_CONTENT_TYPES = {XHTML_CONTENT_TYPE};
+
+
+    /**
+     * Indicate if the passes content type match one of the options passed. 
+     */
+    public static boolean containsContentType(String contentType, String[] allowedContentTypes)
+    {
+        if (allowedContentTypes == null)
+        {
+            return false;
+        }
+        for (int i = 0; i < allowedContentTypes.length; i++)
+        {
+            if (allowedContentTypes[i].indexOf(contentType) != -1)
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static String chooseWriterContentType(String contentTypeListString, 
+            String[] htmlContentTypes, String[] xhtmlContentTypes)
+    {
+        String[] contentTypeList = splitContentTypeListString(contentTypeListString);
+        String[] supportedContentTypeArray = HtmlRendererUtils.getSupportedContentTypes();
+        String selectedContentType = null;
+        for (int i = 0; i < supportedContentTypeArray.length; i++)
+        {
+            String supportedContentType = supportedContentTypeArray[i].trim();
+
+            for (int j = 0; j < contentTypeList.length; j++)
+            {
+                String contentType = (String) contentTypeList[j];
+
+                if (contentType.indexOf(supportedContentType) != -1)
+                {
+                    if (containsContentType(contentType, htmlContentTypes))
+                    {
+                        selectedContentType = HTML_CONTENT_TYPE;
+                    }
+                    else if (containsContentType(contentType, xhtmlContentTypes))
+                    {
+                        selectedContentType = XHTML_CONTENT_TYPE;
+                    }
+                    break;
+                }
+            }
+            if (selectedContentType != null)
+            {
+                break;
+            }
+        }
+        return selectedContentType;
+    }
+    
+    public static String[] splitContentTypeListString(String contentTypeListString)
+    {
+        String[] splittedArray = StringUtils.splitShortString(contentTypeListString, ',');
+        for (int i = 0; i < splittedArray.length; i++)
+        {
+            int semicolonIndex = splittedArray[i].indexOf(";");
+            if (semicolonIndex != -1)
+            {
+                splittedArray[i] = splittedArray[i].substring(0,semicolonIndex);
+            }
+        }
+        return splittedArray;
+    }
+    
+    public static String getContentTypeFromAcceptHeader(FacesContext context)
+    {
+        String contentTypeListString = (String) context.getExternalContext()
+            .getRequestHeaderMap().get("Accept");
+        // There is a windows mobile IE client (6.12) sending
+        // "application/vnd.wap.mms-message;*/*"
+        // Note that the Accept header should be written as 
+        // "application/vnd.wap.mms-message,*/*" ,
+        // so this is bug of the client. Anyway, this is a workaround ...
+        if (contentTypeListString != null
+                && contentTypeListString
+                        .startsWith("application/vnd.wap.mms-message;*/*"))
+        {
+            contentTypeListString = "*/*";
+        }
+        return contentTypeListString;
+    }
+
+}

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java?rev=1239800&r1=1239799&r2=1239800&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java Thu Feb  2 20:01:25 2012
@@ -123,7 +123,7 @@ public final class RendererUtils
 
     public static String getPathToComponent(UIComponent component)
     {
-        StringBuffer buf = new StringBuffer();
+        StringBuilder buf = new StringBuilder();
 
         if (component == null)
         {
@@ -147,14 +147,14 @@ public final class RendererUtils
     }
 
     private static void getPathToComponent(UIComponent component,
-            StringBuffer buf)
+            StringBuilder buf)
     {
         if (component == null)
         {
             return;
         }
 
-        StringBuffer intBuf = new StringBuffer();
+        StringBuilder intBuf = new StringBuilder();
 
         intBuf.append("[Class: ");
         intBuf.append(component.getClass().getName());
@@ -196,7 +196,7 @@ public final class RendererUtils
             throw new NullPointerException("context");
         }
 
-        StringBuffer idBuf = new StringBuffer();
+        StringBuilder idBuf = new StringBuilder();
 
         idBuf.append(component.getId());
 

Added: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventConstants.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventConstants.java?rev=1239800&view=auto
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventConstants.java (added)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventConstants.java Thu Feb  2 20:01:25 2012
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.shared.renderkit.html;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.faces.component.UIComponent;
+
+/**
+ *
+ * @author lu4242
+ */
+public class CommonEventConstants
+{
+    public static final String COMMON_EVENTS_MARKED = "oam.COMMON_EVENTS_MARKED";
+    
+    public static final long ACTION_EVENT        = 0x1L;
+    public static final long CLICK_EVENT         = 0x2L;
+    public static final long DBLCLICK_EVENT      = 0x4L;
+    public static final long MOUSEDOWN_EVENT     = 0x8L;
+    public static final long MOUSEUP_EVENT       = 0x10L;
+    public static final long MOUSEOVER_EVENT     = 0x20L;
+    public static final long MOUSEMOVE_EVENT     = 0x40L;
+    public static final long MOUSEOUT_EVENT      = 0x80L;
+    public static final long KEYPRESS_EVENT      = 0x100L;
+    public static final long KEYDOWN_EVENT       = 0x200L;
+    public static final long KEYUP_EVENT         = 0x400L;
+    public static final long FOCUS_EVENT         = 0x800L;
+    public static final long BLUR_EVENT          = 0x1000L;
+    public static final long SELECT_EVENT        = 0x2000L;
+    public static final long CHANGE_EVENT        = 0x4000L;
+    public static final long VALUECHANGE_EVENT   = 0x8000L;
+    public static final long LOAD_EVENT          = 0x10000L;
+    public static final long UNLOAD_EVENT        = 0x20000L;
+    
+    public static final Map<String, Long> COMMON_EVENTS_KEY_BY_NAME = new HashMap<String, Long>(24,1);
+    
+    static
+    {
+        //EVENTS
+        COMMON_EVENTS_KEY_BY_NAME.put("change",   CHANGE_EVENT);
+        COMMON_EVENTS_KEY_BY_NAME.put("select",   SELECT_EVENT);
+        COMMON_EVENTS_KEY_BY_NAME.put("click",    CLICK_EVENT);
+        COMMON_EVENTS_KEY_BY_NAME.put("dblclick", DBLCLICK_EVENT);
+        COMMON_EVENTS_KEY_BY_NAME.put("mousedown",MOUSEDOWN_EVENT);
+        COMMON_EVENTS_KEY_BY_NAME.put("mouseup",  MOUSEUP_EVENT);
+        COMMON_EVENTS_KEY_BY_NAME.put("mouseover",MOUSEOVER_EVENT);
+        COMMON_EVENTS_KEY_BY_NAME.put("mousemove",MOUSEMOVE_EVENT);
+        COMMON_EVENTS_KEY_BY_NAME.put("mouseout", MOUSEOUT_EVENT);
+        COMMON_EVENTS_KEY_BY_NAME.put("keypress", KEYPRESS_EVENT);
+        COMMON_EVENTS_KEY_BY_NAME.put("keydown",  KEYDOWN_EVENT);
+        COMMON_EVENTS_KEY_BY_NAME.put("keyup",    KEYUP_EVENT);
+        COMMON_EVENTS_KEY_BY_NAME.put("focus",    FOCUS_EVENT);
+        COMMON_EVENTS_KEY_BY_NAME.put("blur",     BLUR_EVENT);
+        COMMON_EVENTS_KEY_BY_NAME.put("load",     LOAD_EVENT);
+        COMMON_EVENTS_KEY_BY_NAME.put("unload",   UNLOAD_EVENT);
+        //virtual
+        COMMON_EVENTS_KEY_BY_NAME.put("valueChange", VALUECHANGE_EVENT);
+        COMMON_EVENTS_KEY_BY_NAME.put("action", ACTION_EVENT);
+    }
+    
+    public static void markEvent(UIComponent component, String name)
+    {
+        Long propertyConstant = COMMON_EVENTS_KEY_BY_NAME.get(name);
+        if (propertyConstant == null)
+        {
+            return;
+        }
+        Long commonPropertiesSet = (Long) component.getAttributes().get(COMMON_EVENTS_MARKED);
+        if (commonPropertiesSet == null)
+        {
+            commonPropertiesSet = 0L;
+        }
+        component.getAttributes().put(COMMON_EVENTS_MARKED, commonPropertiesSet | propertyConstant);
+    }
+}

Propchange: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventUtils.java?rev=1239800&view=auto
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventUtils.java (added)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventUtils.java Thu Feb  2 20:01:25 2012
@@ -0,0 +1,541 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.shared.renderkit.html;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.ClientBehavior;
+import javax.faces.component.behavior.ClientBehaviorContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import org.apache.myfaces.shared.renderkit.ClientBehaviorEvents;
+
+/**
+ *
+ * @author Leonardo Uribe
+ */
+public class CommonEventUtils
+{
+    public static long getCommonEventsMarked(UIComponent component)
+    {
+        Long commonEvents = (Long) component.getAttributes().get(CommonEventConstants.COMMON_EVENTS_MARKED);
+        
+        if (commonEvents == null)
+        {
+            commonEvents = 0L;
+        }
+        return commonEvents;
+    }
+        
+    /**
+     * Render an attribute taking into account the passed event and
+     * the component property. It will be rendered as "componentProperty"
+     * attribute.
+     *
+     * @param facesContext
+     * @param writer
+     * @param componentProperty
+     * @param component
+     * @param eventName
+     * @param clientBehaviors
+     * @return
+     * @throws IOException
+     * @since 4.0.1
+     */
+    /*
+    public static boolean renderBehaviorizedAttribute(
+            FacesContext facesContext, ResponseWriter writer,
+            String componentProperty, UIComponent component, String eventName,
+            Map<String, List<ClientBehavior>> clientBehaviors)
+            throws IOException
+    {
+        return renderBehaviorizedAttribute(facesContext, writer,
+                componentProperty, component, eventName, clientBehaviors,
+                componentProperty);
+    }
+
+    public static boolean renderBehaviorizedAttribute(
+            FacesContext facesContext, ResponseWriter writer,
+            String componentProperty, UIComponent component,
+            String targetClientId, String eventName,
+            Map<String, List<ClientBehavior>> clientBehaviors)
+            throws IOException
+    {
+        return renderBehaviorizedAttribute(facesContext, writer,
+                componentProperty, component, targetClientId, eventName,
+                clientBehaviors, componentProperty);
+    }*/
+
+    /**
+     * Render an attribute taking into account the passed event and
+     * the component property. The event will be rendered on the selected
+     * htmlAttrName
+     *
+     * @param facesContext
+     * @param writer
+     * @param component
+     * @param clientBehaviors
+     * @param eventName
+     * @param componentProperty
+     * @param htmlAttrName
+     * @return
+     * @throws IOException
+     * @since 4.0.1
+     */
+    /*
+    public static boolean renderBehaviorizedAttribute(
+            FacesContext facesContext, ResponseWriter writer,
+            String componentProperty, UIComponent component, String eventName,
+            Map<String, List<ClientBehavior>> clientBehaviors,
+            String htmlAttrName) throws IOException
+    {
+        return renderBehaviorizedAttribute(facesContext, writer,
+                componentProperty, component, eventName, null, clientBehaviors,
+                htmlAttrName,
+                (String) component.getAttributes().get(componentProperty));
+    }*/
+
+    public static boolean renderBehaviorizedAttribute(
+            FacesContext facesContext, ResponseWriter writer,
+            String componentProperty, UIComponent component,
+            String targetClientId, String eventName,
+            Map<String, List<ClientBehavior>> clientBehaviors,
+            String htmlAttrName) throws IOException
+    {
+        return renderBehaviorizedAttribute(facesContext, writer,
+                componentProperty, component, targetClientId, eventName, null,
+                clientBehaviors, htmlAttrName, (String) component
+                        .getAttributes().get(componentProperty));
+    }
+
+    /**
+     * Render an attribute taking into account the passed event,
+     * the component property and the passed attribute value for the component
+     * property. The event will be rendered on the selected htmlAttrName.
+     *
+     * @param facesContext
+     * @param writer
+     * @param componentProperty
+     * @param component
+     * @param eventName
+     * @param clientBehaviors
+     * @param htmlAttrName
+     * @param attributeValue
+     * @return
+     * @throws IOException
+     */
+    public static boolean renderBehaviorizedAttribute(
+            FacesContext facesContext, ResponseWriter writer,
+            String componentProperty, UIComponent component, String eventName,
+            Collection<ClientBehaviorContext.Parameter> eventParameters,
+            Map<String, List<ClientBehavior>> clientBehaviors,
+            String htmlAttrName, String attributeValue) throws IOException
+    {
+        return renderBehaviorizedAttribute(facesContext, writer,
+                componentProperty, component,
+                component.getClientId(facesContext), eventName,
+                eventParameters, clientBehaviors, htmlAttrName, attributeValue);
+    }
+
+    public static boolean renderBehaviorizedAttribute(
+            FacesContext facesContext, ResponseWriter writer,
+            String componentProperty, UIComponent component,
+            String targetClientId, String eventName,
+            Collection<ClientBehaviorContext.Parameter> eventParameters,
+            Map<String, List<ClientBehavior>> clientBehaviors,
+            String htmlAttrName, String attributeValue) throws IOException
+    {
+
+        List<ClientBehavior> cbl = (clientBehaviors != null) ? clientBehaviors
+                .get(eventName) : null;
+
+        if (cbl == null || cbl.size() == 0)
+        {
+            return HtmlRendererUtils.renderHTMLStringAttribute(writer, componentProperty, htmlAttrName,
+                    attributeValue);
+        }
+
+        if (cbl.size() > 1 || (cbl.size() == 1 && attributeValue != null))
+        {
+            return HtmlRendererUtils.renderHTMLStringAttribute(writer, componentProperty, htmlAttrName,
+                    HtmlRendererUtils.buildBehaviorChain(facesContext,
+                            component, targetClientId, eventName,
+                            eventParameters, clientBehaviors, attributeValue,
+                            HtmlRendererUtils.STR_EMPTY));
+        }
+        else
+        {
+            //Only 1 behavior and attrValue == null, so just render it directly
+            return HtmlRendererUtils.renderHTMLStringAttribute(
+                    writer,
+                    componentProperty,
+                    htmlAttrName,
+                    cbl.get(0).getScript(
+                            ClientBehaviorContext.createClientBehaviorContext(
+                                    facesContext, component, eventName,
+                                    targetClientId, eventParameters)));
+        }
+    }
+
+    public static void renderBehaviorizedEventHandlers(
+            FacesContext facesContext, ResponseWriter writer,
+            long commonPropertiesMarked, long commonEventsMarked,
+            UIComponent uiComponent,
+            Map<String, List<ClientBehavior>> clientBehaviors)
+            throws IOException
+    {
+        renderBehaviorizedEventHandlers(facesContext, writer, 
+                commonPropertiesMarked, commonEventsMarked, uiComponent,
+                uiComponent.getClientId(facesContext), clientBehaviors);
+    }
+    
+    public static void renderBehaviorizedEventHandlers(
+            FacesContext facesContext, ResponseWriter writer,
+            long commonPropertiesMarked, long commonEventsMarked,
+            UIComponent uiComponent, String targetClientId,
+            Map<String, List<ClientBehavior>> clientBehaviors)
+            throws IOException
+    {
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONCLICK_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.CLICK_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONCLICK_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.CLICK,
+                    clientBehaviors, HTML.ONCLICK_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONDBLCLICK_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.DBLCLICK_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONDBLCLICK_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.DBLCLICK,
+                    clientBehaviors, HTML.ONDBLCLICK_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEDOWN_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.MOUSEDOWN_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer,
+                    HTML.ONMOUSEDOWN_ATTR, uiComponent, targetClientId,
+                    ClientBehaviorEvents.MOUSEDOWN, clientBehaviors,
+                    HTML.ONMOUSEDOWN_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEUP_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.MOUSEUP_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONMOUSEUP_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.MOUSEUP,
+                    clientBehaviors, HTML.ONMOUSEUP_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEOVER_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.MOUSEOVER_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer,
+                    HTML.ONMOUSEOVER_ATTR, uiComponent, targetClientId,
+                    ClientBehaviorEvents.MOUSEOVER, clientBehaviors,
+                    HTML.ONMOUSEOVER_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEMOVE_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.MOUSEMOVE_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer,
+                    HTML.ONMOUSEMOVE_ATTR, uiComponent, targetClientId,
+                    ClientBehaviorEvents.MOUSEMOVE, clientBehaviors,
+                    HTML.ONMOUSEMOVE_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEOUT_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.MOUSEOUT_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONMOUSEOUT_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.MOUSEOUT,
+                    clientBehaviors, HTML.ONMOUSEOUT_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONKEYPRESS_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.KEYPRESS_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONKEYPRESS_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.KEYPRESS,
+                    clientBehaviors, HTML.ONKEYPRESS_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONKEYDOWN_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.KEYDOWN_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONKEYDOWN_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.KEYDOWN,
+                    clientBehaviors, HTML.ONKEYDOWN_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONKEYUP_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.KEYUP_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONKEYUP_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.KEYUP,
+                    clientBehaviors, HTML.ONKEYUP_ATTR);
+        }
+    }
+
+    public static void renderBehaviorizedEventHandlersWithoutOnclick(
+            FacesContext facesContext, ResponseWriter writer,
+            long commonPropertiesMarked, long commonEventsMarked,
+            UIComponent uiComponent, 
+            Map<String, List<ClientBehavior>> clientBehaviors)
+            throws IOException
+    {
+        renderBehaviorizedEventHandlersWithoutOnclick(facesContext, writer, 
+                commonPropertiesMarked, commonEventsMarked, uiComponent,
+                uiComponent.getClientId(facesContext), clientBehaviors);
+    }
+
+    /**
+     * @param facesContext
+     * @param writer
+     * @param uiComponent
+     * @param clientBehaviors
+     * @throws IOException
+     * @since 4.0.0
+     */
+    public static void renderBehaviorizedEventHandlersWithoutOnclick(
+            FacesContext facesContext, ResponseWriter writer,
+            long commonPropertiesMarked, long commonEventsMarked,
+            UIComponent uiComponent, String targetClientId,
+            Map<String, List<ClientBehavior>> clientBehaviors)
+            throws IOException
+    {
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONDBLCLICK_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.DBLCLICK_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONDBLCLICK_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.DBLCLICK,
+                    clientBehaviors, HTML.ONDBLCLICK_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEDOWN_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.MOUSEDOWN_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer,
+                    HTML.ONMOUSEDOWN_ATTR, uiComponent, targetClientId,
+                    ClientBehaviorEvents.MOUSEDOWN, clientBehaviors,
+                    HTML.ONMOUSEDOWN_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEUP_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.MOUSEUP_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONMOUSEUP_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.MOUSEUP,
+                    clientBehaviors, HTML.ONMOUSEUP_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEOVER_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.MOUSEOVER_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer,
+                    HTML.ONMOUSEOVER_ATTR, uiComponent, targetClientId,
+                    ClientBehaviorEvents.MOUSEOVER, clientBehaviors,
+                    HTML.ONMOUSEOVER_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEMOVE_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.MOUSEMOVE_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer,
+                    HTML.ONMOUSEMOVE_ATTR, uiComponent, targetClientId,
+                    ClientBehaviorEvents.MOUSEMOVE, clientBehaviors,
+                    HTML.ONMOUSEMOVE_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEOUT_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.MOUSEOUT_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONMOUSEOUT_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.MOUSEOUT,
+                    clientBehaviors, HTML.ONMOUSEOUT_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONKEYPRESS_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.KEYPRESS_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONKEYPRESS_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.KEYPRESS,
+                    clientBehaviors, HTML.ONKEYPRESS_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONKEYDOWN_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.KEYDOWN_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONKEYDOWN_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.KEYDOWN,
+                    clientBehaviors, HTML.ONKEYDOWN_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONKEYUP_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.KEYUP_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONKEYUP_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.KEYUP,
+                    clientBehaviors, HTML.ONKEYUP_ATTR);
+        }
+    }
+
+    /**
+     * @param facesContext
+     * @param writer
+     * @param uiComponent
+     * @param clientBehaviors
+     * @throws IOException
+     * @since 4.0.0
+     */
+    public static void renderBehaviorizedFieldEventHandlers(
+            FacesContext facesContext, ResponseWriter writer,
+            long commonPropertiesMarked, long commonEventsMarked,
+            UIComponent uiComponent, String targetClientId,
+            Map<String, List<ClientBehavior>> clientBehaviors)
+            throws IOException
+    {
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONFOCUS_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.FOCUS_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONFOCUS_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.FOCUS, clientBehaviors,
+                    HTML.ONFOCUS_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONBLUR_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.BLUR_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONBLUR_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.BLUR, clientBehaviors,
+                    HTML.ONBLUR_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONCHANGE_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.CHANGE_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONCHANGE_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.CHANGE, clientBehaviors,
+                    HTML.ONCHANGE_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONSELECT_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.SELECT_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONSELECT_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.SELECT, clientBehaviors,
+                    HTML.ONSELECT_ATTR);
+        }
+    }
+
+    public static void renderBehaviorizedFieldEventHandlersWithoutOnfocus(
+            FacesContext facesContext, ResponseWriter writer,
+            long commonPropertiesMarked, long commonEventsMarked,
+            UIComponent uiComponent, String targetClientId,
+            Map<String, List<ClientBehavior>> clientBehaviors)
+            throws IOException
+    {
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONBLUR_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.BLUR_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONBLUR_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.BLUR, clientBehaviors,
+                    HTML.ONBLUR_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONCHANGE_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.CHANGE_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONCHANGE_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.CHANGE, clientBehaviors,
+                    HTML.ONCHANGE_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONSELECT_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.SELECT_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONSELECT_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.SELECT, clientBehaviors,
+                    HTML.ONSELECT_ATTR);
+        }
+    }
+
+    public static void renderBehaviorizedFieldEventHandlersWithoutOnchange(
+            FacesContext facesContext, ResponseWriter writer,
+            long commonPropertiesMarked, long commonEventsMarked,
+            UIComponent uiComponent, 
+            Map<String, List<ClientBehavior>> clientBehaviors)
+            throws IOException
+    {
+        renderBehaviorizedFieldEventHandlersWithoutOnchange(
+                facesContext, writer, commonPropertiesMarked, commonEventsMarked, 
+                uiComponent, uiComponent.getClientId(facesContext), clientBehaviors);
+    }
+    
+    public static void renderBehaviorizedFieldEventHandlersWithoutOnchange(
+            FacesContext facesContext, ResponseWriter writer,
+            long commonPropertiesMarked, long commonEventsMarked,
+            UIComponent uiComponent, String targetClientId,
+            Map<String, List<ClientBehavior>> clientBehaviors)
+            throws IOException
+    {
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONFOCUS_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.FOCUS_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONFOCUS_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.FOCUS, clientBehaviors,
+                    HTML.ONFOCUS_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONBLUR_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.BLUR_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONBLUR_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.BLUR, clientBehaviors,
+                    HTML.ONBLUR_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONSELECT_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.SELECT_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONSELECT_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.SELECT, clientBehaviors,
+                    HTML.ONSELECT_ATTR);
+        }
+    }
+
+    public static void renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
+            FacesContext facesContext, ResponseWriter writer,
+            long commonPropertiesMarked, long commonEventsMarked,
+            UIComponent uiComponent,
+            Map<String, List<ClientBehavior>> clientBehaviors)
+            throws IOException
+    {
+        renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
+                facesContext, writer, 
+                commonPropertiesMarked, commonEventsMarked, 
+                uiComponent, uiComponent.getClientId(facesContext), 
+                clientBehaviors);
+    }
+    
+    public static void renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(
+            FacesContext facesContext, ResponseWriter writer,
+            long commonPropertiesMarked, long commonEventsMarked,
+            UIComponent uiComponent, String targetClientId,
+            Map<String, List<ClientBehavior>> clientBehaviors)
+            throws IOException
+    {
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONFOCUS_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.FOCUS_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONFOCUS_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.FOCUS, clientBehaviors,
+                    HTML.ONFOCUS_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONBLUR_PROP) != 0 ||
+            (commonEventsMarked & CommonEventConstants.BLUR_EVENT) != 0)
+        {
+            renderBehaviorizedAttribute(facesContext, writer, HTML.ONBLUR_ATTR,
+                    uiComponent, targetClientId, ClientBehaviorEvents.BLUR, clientBehaviors,
+                    HTML.ONBLUR_ATTR);
+        }
+    }
+}

Propchange: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonEventUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyUtils.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyUtils.java?rev=1239800&r1=1239799&r2=1239800&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyUtils.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/CommonPropertyUtils.java Thu Feb  2 20:01:25 2012
@@ -43,32 +43,23 @@ public final class CommonPropertyUtils
         return component.getId() != null && !component.getId().startsWith(UIViewRoot.UNIQUE_ID_PREFIX);
     }
 
-    public static final void renderHTMLStringAttribute(ResponseWriter writer,
-            UIComponent component, String componentProperty, String htmlAttrName)
-            throws IOException
-    {
-        String value = (String) component.getAttributes()
-                .get(componentProperty);
-        writer.writeAttribute(htmlAttrName, value, componentProperty);
-    }
-
     public static final void renderUniversalProperties(ResponseWriter writer,
             long commonPropertiesMarked, UIComponent component)
             throws IOException
     {
         if ((commonPropertiesMarked & CommonPropertyConstants.DIR_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.DIR_ATTR, HTML.DIR_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.LANG_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.LANG_ATTR, HTML.LANG_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.TITLE_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.TITLE_ATTR, HTML.TITLE_ATTR);
         }
     }
@@ -79,12 +70,12 @@ public final class CommonPropertyUtils
     {
         if ((commonPropertiesMarked & CommonPropertyConstants.DIR_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.DIR_ATTR, HTML.DIR_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.LANG_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.LANG_ATTR, HTML.LANG_ATTR);
         }
     }
@@ -95,12 +86,12 @@ public final class CommonPropertyUtils
     {
         if ((commonPropertiesMarked & CommonPropertyConstants.STYLE_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.STYLE_ATTR, HTML.STYLE_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.STYLECLASS_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.STYLE_CLASS_ATTR, HTML.CLASS_ATTR);
         }
     }
@@ -111,7 +102,7 @@ public final class CommonPropertyUtils
     {
         if ((commonPropertiesMarked & CommonPropertyConstants.ONCLICK_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ONCLICK_ATTR, HTML.ONCLICK_ATTR);
         }
         renderEventPropertiesWithoutOnclick(writer, commonPropertiesMarked, component);
@@ -123,47 +114,47 @@ public final class CommonPropertyUtils
     {
         if ((commonPropertiesMarked & CommonPropertyConstants.ONDBLCLICK_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ONDBLCLICK_ATTR, HTML.ONDBLCLICK_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEDOWN_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ONMOUSEDOWN_ATTR, HTML.ONMOUSEDOWN_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEUP_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ONMOUSEUP_ATTR, HTML.ONMOUSEUP_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEOVER_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ONMOUSEOVER_ATTR, HTML.ONMOUSEOVER_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEMOVE_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ONMOUSEMOVE_ATTR, HTML.ONMOUSEMOVE_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.ONMOUSEOUT_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ONMOUSEOUT_ATTR, HTML.ONMOUSEOUT_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.ONKEYPRESS_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ONKEYPRESS_ATTR, HTML.ONKEYPRESS_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.ONKEYDOWN_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ONKEYDOWN_ATTR, HTML.ONKEYDOWN_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.ONKEYUP_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ONKEYUP_ATTR, HTML.ONKEYUP_ATTR);
         }
     }
@@ -175,12 +166,12 @@ public final class CommonPropertyUtils
     {
         if ((commonPropertiesMarked & CommonPropertyConstants.ONCHANGE_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ONCHANGE_ATTR, HTML.ONCHANGE_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.ONSELECT_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ONSELECT_ATTR, HTML.ONSELECT_ATTR);
         }
     }
@@ -191,28 +182,73 @@ public final class CommonPropertyUtils
     {
         if ((commonPropertiesMarked & CommonPropertyConstants.ONFOCUS_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ONFOCUS_ATTR, HTML.ONFOCUS_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.ONBLUR_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ONBLUR_ATTR, HTML.ONBLUR_ATTR);
         }
     }
     
+    public static final void renderFieldEventPropertiesWithoutOnchangeAndOnselect(ResponseWriter writer,
+            long commonPropertiesMarked, UIComponent component) throws IOException
+    {
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONFOCUS_PROP) != 0)
+        {
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
+                    HTML.ONFOCUS_ATTR, HTML.ONFOCUS_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONBLUR_PROP) != 0)
+        {
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
+                    HTML.ONBLUR_ATTR, HTML.ONBLUR_ATTR);
+        }
+    }
+    
+    public static final void renderFieldEventPropertiesWithoutOnchange(ResponseWriter writer,
+            long commonPropertiesMarked, UIComponent component) throws IOException
+    {
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONFOCUS_PROP) != 0)
+        {
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
+                    HTML.ONFOCUS_ATTR, HTML.ONFOCUS_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONBLUR_PROP) != 0)
+        {
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
+                    HTML.ONBLUR_ATTR, HTML.ONBLUR_ATTR);
+        }
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONSELECT_PROP) != 0)
+        {
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
+                    HTML.ONSELECT_ATTR, HTML.ONSELECT_ATTR);
+        }
+    }
+    
+    public static final void renderChangeEventProperty(ResponseWriter writer,
+            long commonPropertiesMarked, UIComponent component) throws IOException
+    {
+        if ((commonPropertiesMarked & CommonPropertyConstants.ONCHANGE_PROP) != 0)
+        {
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
+                    HTML.ONCHANGE_ATTR, HTML.ONCHANGE_ATTR);
+        }
+    }
+    
     public static void renderAccesskeyTabindexProperties(ResponseWriter writer,
             long commonPropertiesMarked, UIComponent component)
             throws IOException
     {
         if ((commonPropertiesMarked & CommonPropertyConstants.ACCESSKEY_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ACCESSKEY_ATTR, HTML.ACCESSKEY_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.TABINDEX_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.TABINDEX_ATTR, HTML.TABINDEX_ATTR);
         }
     }
@@ -223,12 +259,12 @@ public final class CommonPropertyUtils
     {
         if ((commonPropertiesMarked & CommonPropertyConstants.ALIGN_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ALIGN_ATTR, HTML.ALIGN_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.ALT_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ALT_ATTR, HTML.ALT_ATTR);
         }
     }
@@ -244,7 +280,7 @@ public final class CommonPropertyUtils
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.ALT_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ALT_ATTR, HTML.ALT_ATTR);
         }
         if ((commonPropertiesMarked & CommonPropertyConstants.CHECKED_PROP) != 0)
@@ -276,42 +312,42 @@ public final class CommonPropertyUtils
         renderAccesskeyTabindexProperties(writer, commonPropertiesMarked, component);
         if ((commonPropertiesMarked & CommonPropertyConstants.CHARSET_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.CHARSET_ATTR, HTML.CHARSET_ATTR);
         }        
         if ((commonPropertiesMarked & CommonPropertyConstants.COORDS_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.COORDS_ATTR, HTML.COORDS_ATTR);
         }        
         if ((commonPropertiesMarked & CommonPropertyConstants.HREFLANG_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.HREFLANG_ATTR, HTML.HREFLANG_ATTR);
         }        
         if ((commonPropertiesMarked & CommonPropertyConstants.REL_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.REL_ATTR, HTML.REL_ATTR);
         }        
         if ((commonPropertiesMarked & CommonPropertyConstants.REV_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.REV_ATTR, HTML.REV_ATTR);
         }        
         if ((commonPropertiesMarked & CommonPropertyConstants.SHAPE_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.SHAPE_ATTR, HTML.SHAPE_ATTR);
         }        
         if ((commonPropertiesMarked & CommonPropertyConstants.TARGET_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.TARGET_ATTR, HTML.TARGET_ATTR);
         }        
         if ((commonPropertiesMarked & CommonPropertyConstants.TYPE_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.TYPE_ATTR, HTML.TYPE_ATTR);
         }        
     }
@@ -438,7 +474,7 @@ public final class CommonPropertyUtils
         renderFocusBlurEventProperties(writer, commonPropertiesMarked, component);
         if ((commonPropertiesMarked & CommonPropertyConstants.ACCESSKEY_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ACCESSKEY_ATTR, HTML.ACCESSKEY_ATTR);
         }
     }
@@ -458,9 +494,23 @@ public final class CommonPropertyUtils
     {
         if ((commonPropertiesMarked & CommonPropertyConstants.ACCESSKEY_PROP) != 0)
         {
-            renderHTMLStringAttribute(writer, component,
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component,
                     HTML.ACCESSKEY_ATTR, HTML.ACCESSKEY_ATTR);
         }
         renderCommonPassthroughPropertiesWithoutEvents(writer, commonPropertiesMarked, component);
     }
+    
+    public static final void renderSelectPassthroughPropertiesWithoutDisabled(ResponseWriter writer,
+            long commonPropertiesMarked, UIComponent component)
+            throws IOException
+    {
+        renderCommonFieldPassthroughPropertiesWithoutDisabled(writer, commonPropertiesMarked, component);
+    }
+    
+    public static final void renderSelectPassthroughPropertiesWithoutDisabledAndEvents(ResponseWriter writer,
+            long commonPropertiesMarked, UIComponent component)
+            throws IOException
+    {
+        renderCommonFieldPassthroughPropertiesWithoutDisabledAndEvents(writer, commonPropertiesMarked, component);
+    }
 }

Modified: myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlBodyRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlBodyRendererBase.java?rev=1239800&r1=1239799&r2=1239800&view=diff
==============================================================================
--- myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlBodyRendererBase.java (original)
+++ myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlBodyRendererBase.java Thu Feb  2 20:01:25 2012
@@ -80,7 +80,24 @@ public class HtmlBodyRendererBase extend
             {
                 HtmlRendererUtils.writeIdIfNecessary(writer, component, facesContext);
             }
-            HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, component, behaviors);
+            if (behaviors.isEmpty() && isCommonPropertiesOptimizationEnabled(facesContext))
+            {
+                CommonPropertyUtils.renderEventProperties(writer, 
+                        CommonPropertyUtils.getCommonPropertiesMarked(component), component);
+            }
+            else
+            {
+                if (isCommonEventsOptimizationEnabled(facesContext))
+                {
+                    CommonEventUtils.renderBehaviorizedEventHandlers(facesContext, writer, 
+                           CommonPropertyUtils.getCommonPropertiesMarked(component),
+                           CommonEventUtils.getCommonEventsMarked(component), component, behaviors);
+                }
+                else
+                {
+                    HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, component, behaviors);
+                }
+            }
             HtmlRendererUtils.renderBehaviorizedAttribute(facesContext, writer, HTML.ONLOAD_ATTR, component,
                     ClientBehaviorEvents.LOAD, behaviors, HTML.ONLOAD_ATTR);
             HtmlRendererUtils.renderBehaviorizedAttribute(facesContext, writer, HTML.ONUNLOAD_ATTR, component,
@@ -97,7 +114,7 @@ public class HtmlBodyRendererBase extend
                 HtmlRendererUtils.renderHTMLAttributes(writer, component,
                         HTML.BODY_PASSTHROUGH_ATTRIBUTES_WITHOUT_EVENTS);
             }
-            HtmlRendererUtils.renderHTMLAttribute(writer, component, HTML.XMLNS_ATTR , HTML.XMLNS_ATTR);
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component, HTML.XMLNS_ATTR , HTML.XMLNS_ATTR);
             
         }
         else
@@ -116,7 +133,7 @@ public class HtmlBodyRendererBase extend
                 HtmlRendererUtils.renderHTMLAttributes(writer, component,
                         HTML.BODY_PASSTHROUGH_ATTRIBUTES);
             }
-            HtmlRendererUtils.renderHTMLAttribute(writer, component, HTML.XMLNS_ATTR , HTML.XMLNS_ATTR);
+            HtmlRendererUtils.renderHTMLStringAttribute(writer, component, HTML.XMLNS_ATTR , HTML.XMLNS_ATTR);
         }
     }
 
@@ -128,10 +145,18 @@ public class HtmlBodyRendererBase extend
 
         ResponseWriter writer = facesContext.getResponseWriter();
         UIViewRoot root = facesContext.getViewRoot();
-        for (UIComponent child : root.getComponentResources(facesContext,
-                HTML.BODY_TARGET))
+        // Perf: use indexes for iteration over children,
+        // componentResources are javax.faces.component._ComponentChildrenList._ComponentChildrenList(UIComponent)  
+        List<UIComponent> componentResources = root.getComponentResources(facesContext,
+                HTML.BODY_TARGET);
+        int childrenCount = componentResources.size();
+        if (childrenCount > 0)
         {
-            child.encodeAll(facesContext);
+            for (int i = 0; i < childrenCount; i++)
+            {
+                UIComponent child = componentResources.get(i);
+                child.encodeAll(facesContext);
+            }
         }
         
         // render all unhandled FacesMessages when ProjectStage is Development



Mime
View raw message