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 13:59:39 UTC

[myfaces] branch main updated: MYFACES-4576

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 15baed38b MYFACES-4576
15baed38b is described below

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

    MYFACES-4576
---
 .../myfaces/renderkit/html/base/HtmlRadioRendererBase.java  | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 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 109a4737b..f19353f84 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
@@ -62,15 +62,14 @@ 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 String LAYOUT_LIST = "list";
-    
+
     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
     {
@@ -117,6 +116,14 @@ public class HtmlRadioRendererBase extends HtmlRenderer
         String group = selectOne instanceof 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);