Author: craigmcc
Date: Fri May 27 18:28:30 2005
New Revision: 178850

URL: http://svn.apache.org/viewcvs?rev=178850&view=rev
Log:
Support constant strings for the action property of components that
implement ActionSource.

PR:  Bugzilla #34820
Submitted by:  Manfred Klug <manklu AT web.de>

Thanks for the patch (and the previous one, which I neglected to acknowledge
in the CVS commit).

Modified:
    
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/PropertyActionCommand.java

Modified: 
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/PropertyActionCommand.java
URL: 
http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/PropertyActionCommand.java?rev=178850&r1=178849&r2=178850&view=diff
==============================================================================
--- 
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/PropertyActionCommand.java
 (original)
+++ 
struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/PropertyActionCommand.java
 Fri May 27 18:28:30 2005
@@ -21,7 +21,7 @@
 import javax.faces.component.ActionSource;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
-import javax.faces.el.MethodBinding;
+import javax.faces.webapp.UIComponentTag;
 
 import org.apache.commons.chain.Command;
 import org.apache.commons.chain.Context;
@@ -29,6 +29,8 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.shale.clay.config.beans.AttributeBean;
 import org.apache.shale.clay.config.beans.ComponentBean;
+import org.apache.shale.faces.ShaleConstants;
+import org.apache.shale.util.Tags;
 
 /**
  * <p>
@@ -76,6 +78,15 @@
         FacesContext facesContext = clayContext.getFacesContext();
         if (facesContext == null)
             throw new 
NullPointerException(messages.getMessage("clay.null.facesContext"));
+
+        Tags tagUtils = (org.apache.shale.util.Tags)facesContext
+                            .getApplication()
+                            .getVariableResolver()
+                            .resolveVariable(facesContext,
+                                    ShaleConstants.TAG_UTILITY_BEAN);
+        if (tagUtils == null)
+            throw new 
NullPointerException(messages.getMessage("clay.null.tagUtils"));
+
         if (attributeBean.getName().equals("action")) {
             isFinal = true;
             
@@ -84,12 +95,14 @@
                 throw new 
NullPointerException(messages.getMessage("clay.null.childComponent"));
             
             if (child instanceof ActionSource) {
+                String expr = null;
                 
-                String expr = replaceMnemonic(clayContext);
-                MethodBinding binding = facesContext.getApplication()
-                .createMethodBinding(expr, null);
-                
-                ((ActionSource) child).setAction((MethodBinding) binding);
+                if (UIComponentTag.isValueReference(attributeBean.getValue()))
+                    expr = replaceMnemonic(clayContext);
+                else
+                    expr = attributeBean.getValue();
+
+                tagUtils.setAction(child, expr);
             } else {
                 log.error(messages.getMessage("property.action.error", new 
Object[] {attributeBean}));
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to