You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2023/02/28 14:03:15 UTC

[myfaces] branch 2.3-next updated: MYFACES-4576

This is an automated email from the ASF dual-hosted git repository.

tandraschko pushed a commit to branch 2.3-next
in repository https://gitbox.apache.org/repos/asf/myfaces.git


The following commit(s) were added to refs/heads/2.3-next by this push:
     new f84d7d5b9 MYFACES-4576
f84d7d5b9 is described below

commit f84d7d5b90a1a7d6edad64b215e5f7074a261b50
Author: Thomas Andraschko <ta...@apache.org>
AuthorDate: Tue Feb 28 15:02:59 2023 +0100

    MYFACES-4576
---
 .../myfaces/renderkit/html/base/HtmlRadioRendererBase.java    | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlRadioRendererBase.java b/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlRadioRendererBase.java
index 5b50ec02c..e26122305 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlRadioRendererBase.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/html/base/HtmlRadioRendererBase.java
@@ -61,14 +61,13 @@ public class HtmlRadioRendererBase extends HtmlRenderer
 {
     private static final Logger log = Logger.getLogger(HtmlRadioRendererBase.class.getName());
 
+    private static final String ATTR_GROUP_FIRST = HtmlRadioRendererBase.class.getName() + "#groupFirst";
     private static final String PAGE_DIRECTION = "pageDirection";
     private static final String LINE_DIRECTION = "lineDirection";
     
     private static final Set<VisitHint> FIND_SELECT_LIST_HINTS = 
             Collections.unmodifiableSet(EnumSet.of(VisitHint.SKIP_UNRENDERED, VisitHint.SKIP_ITERATION));
 
-    private Map<String, UISelectOne> groupFirst = new HashMap<String, UISelectOne>();
-    
     @Override
     public void encodeEnd(FacesContext facesContext, UIComponent uiComponent) throws IOException
     {
@@ -111,6 +110,14 @@ public class HtmlRadioRendererBase extends HtmlRenderer
         String group = selectOne instanceof HtmlSelectOneRadio ? ((HtmlSelectOneRadio) selectOne).getGroup() : null;
         if (group != null && !group.isEmpty())
         {
+            Map<String, UISelectOne> groupFirst = (Map<String, UISelectOne>) facesContext.getAttributes()
+                    .get(ATTR_GROUP_FIRST);
+            if (groupFirst == null)
+            {
+                groupFirst = new HashMap<>();
+                facesContext.getAttributes().put(ATTR_GROUP_FIRST, groupFirst);
+            }
+
             if (!groupFirst.containsKey(group)) 
             {
                 groupFirst.put(group, selectOne);