myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bom...@apache.org
Subject svn commit: r582467 - /myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java
Date Sat, 06 Oct 2007 08:19:33 GMT
Author: bommel
Date: Sat Oct  6 01:19:32 2007
New Revision: 582467

URL: http://svn.apache.org/viewvc?rev=582467&view=rev
Log:
(TOBAGO-511) renderedPartially attribute did not support String value and null when using
valueBinding

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java?rev=582467&r1=582466&r2=582467&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UICommand.java
Sat Oct  6 01:19:32 2007
@@ -22,6 +22,8 @@
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_RENDERED_PARTIALLY;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TARGET;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TRANSITION;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -32,14 +34,17 @@
 import java.util.Iterator;
 
 /*
- * User: weber
  * Date: Apr 4, 2005
  * Time: 5:02:10 PM
+ * $Id$
  */
 public class UICommand extends javax.faces.component.UICommand {
 
   public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Command";
 
+  private static final Log LOG = LogFactory.getLog(UICommand.class);
+  private static final String [] RENDERED_PARTIALLY_DEFAULT = {};
+
   private Boolean defaultCommand;
   private Boolean disabled;
   private String[] renderedPartially;
@@ -68,10 +73,18 @@
     }
     ValueBinding vb = getValueBinding(ATTR_RENDERED_PARTIALLY);
     if (vb != null) {
-      return (String[]) vb.getValue(getFacesContext());
-    } else {
-      return new String[0];
+      Object value = vb.getValue(getFacesContext());
+      if (value != null) {
+        if (value instanceof String[]) {
+          return (String[]) value;
+        } else if (value instanceof String) {
+          return ((String) value).split(",");
+        } else {
+          LOG.error("Ignoring RenderedPartially value binding. Unknown instance " + value.getClass().getName());
+        }
+      }
     }
+    return RENDERED_PARTIALLY_DEFAULT;
   }
 
   public void setRenderedPartially(String renderedPartially) {



Mime
View raw message