Author: gvanmatre Date: Tue Feb 7 19:35:05 2006 New Revision: 375839 URL: http://svn.apache.org/viewcvs?rev=375839&view=rev Log: Fix for Bug#: 38542 - [shale] clay not handling binding attribute correctly.
Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java?rev=375839&r1=375838&r2=375839&view=diff ============================================================================== --- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java (original) +++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java Tue Feb 7 19:35:05 2006 @@ -23,13 +23,17 @@ import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; +import javax.faces.el.ValueBinding; import org.apache.commons.chain.Context; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.shale.clay.component.Clay; import org.apache.shale.clay.config.Globals; +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> @@ -78,7 +82,7 @@ if (facesContext == null) throw new NullPointerException(messages .getMessage("clay.null.facesContext")); - + // create a new scoped symbol table Map symbolTable = new TreeMap(); // inherit the parents symbols @@ -115,8 +119,23 @@ if (child == null) { try { - child = facesContext.getApplication().createComponent( + AttributeBean attr = null; + if ((attr = displayElement.getAttribute("binding")) != null + && attr.getValue() != null) { + + clayContext.setAttribute(attr); + String expr = replaceMnemonic(clayContext); + ValueBinding vb = facesContext.getApplication().createValueBinding(expr); + child = facesContext.getApplication().createComponent(vb, facesContext, + displayElement.getComponentType()); + child.setValueBinding("binding", vb); + + } else { + + child = facesContext.getApplication().createComponent( displayElement.getComponentType()); + } + } catch (Exception e) { log.error(messages.getMessage("create.component.error", new Object[] { displayElement }), e); @@ -147,8 +166,8 @@ child.getAttributes().put(Globals.CLAY_RESERVED_ATTRIBUTE, displayElement); } - // continue with the addComponent chain - isFinal = false; + // continue with the addComponent chain if not a bound component + isFinal = (child.getValueBinding("binding") != null); } else { if (log.isDebugEnabled()) log.debug(messages.getMessage("create.component.exists", --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]