[richfaces-svn-commits] JBoss Rich Faces SVN: r14388 - branches/community/3.3.X/ui/pickList/src/main/java/org/richfaces/renderkit.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Thu May 28 08:40:02 EDT 2009


Author: amarkhel
Date: 2009-05-28 08:40:02 -0400 (Thu, 28 May 2009)
New Revision: 14388

Modified:
   branches/community/3.3.X/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
Log:
Fix RF-4388

Modified: branches/community/3.3.X/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
===================================================================
--- branches/community/3.3.X/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java	2009-05-28 12:39:30 UTC (rev 14387)
+++ branches/community/3.3.X/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java	2009-05-28 12:40:02 UTC (rev 14388)
@@ -34,6 +34,7 @@
 
 import javax.faces.component.EditableValueHolder;
 import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
 import javax.faces.component.UIViewRoot;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
@@ -114,7 +115,7 @@
     	
     	List <Object> valuesList = new ArrayList<Object>();
     	
-    	Object value = pickList.getValue();
+    	Object value = getCurrentValue(FacesContext.getCurrentInstance(), pickList);
 
     	if(null == value || "".equals(value)) {
     		return valuesList;
@@ -148,6 +149,27 @@
     	
     }
 
+    /**
+     * @param context the FacesContext for the current request
+     * @param component the UIComponent whose value we're interested in
+     *
+     * @return the value to be rendered and formats it if required. Sets to
+     *  empty string if value is null.
+     */
+    protected Object getCurrentValue(FacesContext context,
+                                     UIComponent component) {
+
+        if (component instanceof UIInput) {
+            Object submittedValue = ((UIInput) component).getSubmittedValue();
+            if (submittedValue != null) {
+                return submittedValue;
+            }
+        }
+        Object currentValue = ((UIPickList)component).getValue();
+        return currentValue;
+
+    }
+    
     protected List <SelectItem> selectItemsForAvailableList(FacesContext facesContext, UIComponent uiComponent, List<SelectItem> selectItemList,
 	    List<SelectItem> selectItemsForSelectedList) {
     	    	




More information about the richfaces-svn-commits mailing list