myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r681488 - /myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/focus/HtmlFocusRenderer.java
Date Thu, 31 Jul 2008 20:59:58 GMT
Author: lu4242
Date: Thu Jul 31 13:59:58 2008
New Revision: 681488

URL: http://svn.apache.org/viewvc?rev=681488&view=rev
Log:
TOMAHAWK-1300 Focus does not work for radio button or check box

Modified:
    myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/focus/HtmlFocusRenderer.java

Modified: myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/focus/HtmlFocusRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/focus/HtmlFocusRenderer.java?rev=681488&r1=681487&r2=681488&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/focus/HtmlFocusRenderer.java
(original)
+++ myfaces/tomahawk/trunk/sandbox/core/src/main/java/org/apache/myfaces/custom/focus/HtmlFocusRenderer.java
Thu Jul 31 13:59:58 2008
@@ -19,19 +19,25 @@
 package org.apache.myfaces.custom.focus;
 
 import java.io.IOException;
+import java.util.List;
 
+import javax.faces.component.NamingContainer;
 import javax.faces.component.UIComponent;
+import javax.faces.component.UISelectMany;
+import javax.faces.component.UISelectOne;
+import javax.faces.component.html.HtmlSelectManyCheckbox;
+import javax.faces.component.html.HtmlSelectOneRadio;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 import javax.faces.render.Renderer;
 
-import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
-import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
-import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
 import org.apache.myfaces.custom.date.HtmlDateRenderer;
 import org.apache.myfaces.custom.date.HtmlInputDate;
-import org.apache.myfaces.custom.dojo.DojoUtils;
 import org.apache.myfaces.custom.dojo.DojoConfig;
+import org.apache.myfaces.custom.dojo.DojoUtils;
+import org.apache.myfaces.shared_tomahawk.renderkit.JSFAttr;
+import org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils;
+import org.apache.myfaces.shared_tomahawk.renderkit.html.HTML;
 
 /**
  * 
@@ -81,6 +87,18 @@
             if(targetComponent instanceof HtmlInputDate)
             {
                 clientId = HtmlDateRenderer.getClientIdForDaySubcomponent(clientId);
+            } 
+            else if(targetComponent instanceof HtmlSelectOneRadio)
+            {
+                UISelectOne selectOne = (UISelectOne)targetComponent;
+                List selectItemList = org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getSelectItemList(selectOne);
+                clientId += getFirstChildId(selectItemList);
+            }
+            else if(targetComponent instanceof HtmlSelectManyCheckbox)
+            {
+                UISelectMany selectMany = (UISelectMany)targetComponent;
+                List selectItemList = org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getSelectItemList(selectMany);
+                clientId += getFirstChildId(selectItemList);
             }
             ResponseWriter writer = facesContext.getResponseWriter();
 
@@ -99,5 +117,13 @@
             }
         }
     }
-
+    
+    private String getFirstChildId(List selectItems) 
+    {
+        if(selectItems.size() > 0) 
+        {
+            return NamingContainer.SEPARATOR_CHAR + "0";
+        }
+        return "";
+    }
 }



Mime
View raw message