myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r1138538 - in /myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html: HtmlCheckboxRendererBase.java HtmlMessagesRendererBase.java HtmlRadioRendererBase.java
Date Wed, 22 Jun 2011 16:24:33 GMT
Author: lu4242
Date: Wed Jun 22 16:24:32 2011
New Revision: 1138538

URL: http://svn.apache.org/viewvc?rev=1138538&view=rev
Log:
MYFACES-3184 h:selectOneRadio cannot support f:ajax if @id not set

Modified:
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMessagesRendererBase.java
    myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java?rev=1138538&r1=1138537&r2=1138538&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java
Wed Jun 22 16:24:32 2011
@@ -109,7 +109,20 @@ public class HtmlCheckboxRendererBase ex
         HtmlRendererUtils.renderHTMLAttributes(writer, selectMany,
                 HTML.SELECT_TABLE_PASSTHROUGH_ATTRIBUTES);
         
-        HtmlRendererUtils.writeIdIfNecessary(writer, selectMany, facesContext);
+        Map<String, List<ClientBehavior>> behaviors = null;
+        if (selectMany instanceof ClientBehaviorHolder)
+        {
+            behaviors = ((ClientBehaviorHolder) selectMany).getClientBehaviors();
+        }
+        
+        if (behaviors != null && !behaviors.isEmpty())
+        {
+            writer.writeAttribute(HTML.ID_ATTR, selectMany.getClientId(facesContext), null);
+        }
+        else
+        {
+            HtmlRendererUtils.writeIdIfNecessary(writer, selectMany, facesContext);
+        }        
 
         if (!pageDirectionLayout)
             writer.startElement(HTML.TR_ELEM, selectMany);

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMessagesRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMessagesRendererBase.java?rev=1138538&r1=1138537&r2=1138538&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMessagesRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlMessagesRendererBase.java
Wed Jun 22 16:24:32 2011
@@ -20,6 +20,7 @@ package org.apache.myfaces.shared.render
 
 import java.io.IOException;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.logging.Level;
@@ -29,6 +30,8 @@ import javax.faces.application.FacesMess
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIMessages;
 import javax.faces.component.UIViewRoot;
+import javax.faces.component.behavior.ClientBehavior;
+import javax.faces.component.behavior.ClientBehaviorHolder;
 import javax.faces.component.html.HtmlMessages;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
@@ -147,7 +150,21 @@ public abstract class HtmlMessagesRender
         ResponseWriter writer = facesContext.getResponseWriter();
 
         writer.startElement(HTML.UL_ELEM, messages);
-        HtmlRendererUtils.writeIdIfNecessary(writer, messages, facesContext);
+
+        Map<String, List<ClientBehavior>> behaviors = null;
+        if (messages instanceof ClientBehaviorHolder)
+        {
+            behaviors = ((ClientBehaviorHolder) messages).getClientBehaviors();
+        }
+        
+        if (behaviors != null && !behaviors.isEmpty())
+        {
+            writer.writeAttribute(HTML.ID_ATTR, messages.getClientId(facesContext), null);
+        }
+        else
+        {
+            HtmlRendererUtils.writeIdIfNecessary(writer, messages, facesContext);
+        }         
         HtmlRendererUtils.renderHTMLAttributes(writer, messages, HTML.UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE);
 
         HtmlRendererUtils.renderHTMLAttribute(writer, HTML.STYLE_ATTR, HTML.STYLE_ATTR, getComponentStyle(messages));
@@ -185,7 +202,21 @@ public abstract class HtmlMessagesRender
         ResponseWriter writer = facesContext.getResponseWriter();
 
         writer.startElement(HTML.TABLE_ELEM, messages);
-        HtmlRendererUtils.writeIdIfNecessary(writer, messages, facesContext);
+        
+        Map<String, List<ClientBehavior>> behaviors = null;
+        if (messages instanceof ClientBehaviorHolder)
+        {
+            behaviors = ((ClientBehaviorHolder) messages).getClientBehaviors();
+        }
+        
+        if (behaviors != null && !behaviors.isEmpty())
+        {
+            writer.writeAttribute(HTML.ID_ATTR, messages.getClientId(facesContext), null);
+        }
+        else
+        {
+            HtmlRendererUtils.writeIdIfNecessary(writer, messages, facesContext);
+        }         
         HtmlRendererUtils.renderHTMLAttributes(writer, messages, HTML.UNIVERSAL_ATTRIBUTES_WITHOUT_STYLE);
         
         HtmlRendererUtils.renderHTMLAttribute(writer, HTML.STYLE_ATTR, HTML.STYLE_ATTR, getComponentStyle(messages));

Modified: myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java?rev=1138538&r1=1138537&r2=1138538&view=diff
==============================================================================
--- myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
(original)
+++ myfaces/shared/trunk_4.0.x/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlRadioRendererBase.java
Wed Jun 22 16:24:32 2011
@@ -99,7 +99,15 @@ public class HtmlRadioRendererBase
         writer.startElement(HTML.TABLE_ELEM, selectOne);
         HtmlRendererUtils.renderHTMLAttributes(writer, selectOne,
                                                HTML.SELECT_TABLE_PASSTHROUGH_ATTRIBUTES);
-        HtmlRendererUtils.writeIdIfNecessary(writer, uiComponent, facesContext); 
+        
+        if (behaviors != null && !behaviors.isEmpty())
+        {
+            writer.writeAttribute(HTML.ID_ATTR, selectOne.getClientId(facesContext), null);
+        }
+        else
+        {
+            HtmlRendererUtils.writeIdIfNecessary(writer, selectOne, facesContext); 
+        }        
 
         if (!pageDirectionLayout) writer.startElement(HTML.TR_ELEM, selectOne);
 



Mime
View raw message