You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by cr...@apache.org on 2005/05/28 03:09:09 UTC

svn commit: r178848 [1/2] - /struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain

Author: craigmcc
Date: Fri May 27 18:09:07 2005
New Revision: 178848

URL: http://svn.apache.org/viewcvs?rev=178848&view=rev
Log:
No substantive change, just switch line endings to Unix style.

Modified:
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignActionListenersCommand.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignChildrenCommand.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignConverterCommand.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignPropertiesCommand.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignValidatorsCommand.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignValueChangeListenersCommand.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/ClayContext.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateActionListenerCommand.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateComponentCommand.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateConverterCommand.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateValidatorCommand.java
    struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateValueChangeListenerCommand.java

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignActionListenersCommand.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignActionListenersCommand.java?rev=178848&r1=178847&r2=178848&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignActionListenersCommand.java (original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignActionListenersCommand.java Fri May 27 18:09:07 2005
@@ -1,104 +1,104 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id$
- */
-
-package org.apache.shale.clay.component.chain;
-
-import java.util.Iterator;
-
-import javax.faces.component.ActionSource;
-import javax.faces.component.UIComponent;
-
-import org.apache.commons.chain.Catalog;
-import org.apache.commons.chain.Command;
-import org.apache.commons.chain.Context;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.shale.clay.config.Globals;
-import org.apache.shale.clay.config.beans.ActionListenerBean;
-import org.apache.shale.clay.config.beans.ComponentBean;
-
-/**
- * <p>
- * Iterates over the action listeners defined in the {@link ComponentBean}
- * invoking {@link CreateActionListenerCommand}
- * </p>
- */
-public class AssignActionListenersCommand extends AbstractCommand {
-    
-    /**
-     * <p>
-     * Common logger utility
-     * </p>
-     */
-    private static Log log;
-    static {
-        log = LogFactory.getLog(AssignActionListenersCommand.class);
-    }
-    
-    /**
-     * <p>
-     * This {@link Command} will use the {@link ClayContext} to invoke the
-     * <code>Globals.ADD_ACTION_LISTENER_COMMAND_NAME</code>
-     */
-    public boolean execute(Context context) throws Exception {
-        
-        boolean isFinal = false;
-        
-        ClayContext clayContext = (ClayContext) context;
-        if (clayContext == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.clayContext"));
-        
-        UIComponent child = (UIComponent) clayContext.getChild();
-        if (child == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.childComponent"));
-        
-        ComponentBean displayElement = clayContext.getDisplayElement();
-        if (displayElement == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.componentBean"));
-        
-        if (displayElement.getActionListeners().size() > 0) {
-            if (child instanceof ActionSource) {
-                
-                Iterator vi = displayElement.getActionListenerIterator();
-                while (vi.hasNext()) {
-                    ActionListenerBean actionListener = (ActionListenerBean) vi
-                            .next();
-                    
-                    ClayContext subContext = (ClayContext) clayContext.clone();
-                    subContext.setDisplayElement(actionListener);
-                    subContext.setParent(child);
-                    
-                    Catalog catalog = getCatalog();
-                    Command command = catalog
-                            .getCommand(Globals.ADD_ACTION_LISTENER_COMMAND_NAME);
-                    command.execute(subContext);
-                    
-                }
-            } else {
-                log.error(messages.getMessage("assign.action.listener.error",
-                        new Object[] { displayElement }));
-            }
-        }
-        
-        return isFinal;
-    }
-    
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.clay.component.chain;
+
+import java.util.Iterator;
+
+import javax.faces.component.ActionSource;
+import javax.faces.component.UIComponent;
+
+import org.apache.commons.chain.Catalog;
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.shale.clay.config.Globals;
+import org.apache.shale.clay.config.beans.ActionListenerBean;
+import org.apache.shale.clay.config.beans.ComponentBean;
+
+/**
+ * <p>
+ * Iterates over the action listeners defined in the {@link ComponentBean}
+ * invoking {@link CreateActionListenerCommand}
+ * </p>
+ */
+public class AssignActionListenersCommand extends AbstractCommand {
+    
+    /**
+     * <p>
+     * Common logger utility
+     * </p>
+     */
+    private static Log log;
+    static {
+        log = LogFactory.getLog(AssignActionListenersCommand.class);
+    }
+    
+    /**
+     * <p>
+     * This {@link Command} will use the {@link ClayContext} to invoke the
+     * <code>Globals.ADD_ACTION_LISTENER_COMMAND_NAME</code>
+     */
+    public boolean execute(Context context) throws Exception {
+        
+        boolean isFinal = false;
+        
+        ClayContext clayContext = (ClayContext) context;
+        if (clayContext == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.clayContext"));
+        
+        UIComponent child = (UIComponent) clayContext.getChild();
+        if (child == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.childComponent"));
+        
+        ComponentBean displayElement = clayContext.getDisplayElement();
+        if (displayElement == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.componentBean"));
+        
+        if (displayElement.getActionListeners().size() > 0) {
+            if (child instanceof ActionSource) {
+                
+                Iterator vi = displayElement.getActionListenerIterator();
+                while (vi.hasNext()) {
+                    ActionListenerBean actionListener = (ActionListenerBean) vi
+                            .next();
+                    
+                    ClayContext subContext = (ClayContext) clayContext.clone();
+                    subContext.setDisplayElement(actionListener);
+                    subContext.setParent(child);
+                    
+                    Catalog catalog = getCatalog();
+                    Command command = catalog
+                            .getCommand(Globals.ADD_ACTION_LISTENER_COMMAND_NAME);
+                    command.execute(subContext);
+                    
+                }
+            } else {
+                log.error(messages.getMessage("assign.action.listener.error",
+                        new Object[] { displayElement }));
+            }
+        }
+        
+        return isFinal;
+    }
+    
+}

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignChildrenCommand.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignChildrenCommand.java?rev=178848&r1=178847&r2=178848&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignChildrenCommand.java (original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignChildrenCommand.java Fri May 27 18:09:07 2005
@@ -1,93 +1,93 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id$
- */
-
-package org.apache.shale.clay.component.chain;
-
-import java.util.Iterator;
-
-import javax.faces.component.UIComponent;
-
-import org.apache.commons.chain.Catalog;
-import org.apache.commons.chain.Command;
-import org.apache.commons.chain.Context;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.shale.clay.config.Globals;
-import org.apache.shale.clay.config.beans.ComponentBean;
-
-/**
- * <p>
- * Iterates over the child {@link org.apache.shale.clay.config.beans.ElementBean} collection of a
- * {@link ComponentBean}, and invokes the {@link CreateComponentCommand} for
- * each.
- * <p>
- */
-public class AssignChildrenCommand extends AbstractCommand {
-    
-    private static Log log;
-    static {
-        log = LogFactory.getLog(AssignChildrenCommand.class);
-    }
-    
-    /**
-     * <p>
-     * This {@link Command} iterates over the {@link ComponentBean}
-     * <code>children</code> collection and invokes the
-     * <code>Globals.ADD_COMPONENT_COMMAND_NAME</code> for each
-     * {@link org.apache.shale.clay.config.beans.ElementBean}.
-     * </p>
-     */
-    public boolean execute(Context context) throws Exception {
-        
-        boolean isFinal = false;
-        
-        ClayContext clayContext = (ClayContext) context;
-        if (clayContext == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.clayContext"));
-        
-        UIComponent child = (UIComponent) clayContext.getChild();
-        if (child == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.childComponent"));
-        
-        ComponentBean displayElement = clayContext.getDisplayElement();
-        if (displayElement == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.componentBean"));
-        
-        Iterator vi = displayElement.getChildrenIterator();
-        while (vi.hasNext()) {
-            ComponentBean childDisplayElement = (ComponentBean) vi.next();
-            
-            ClayContext subContext = (ClayContext) clayContext.clone();
-            subContext.setDisplayElement(childDisplayElement);
-            subContext.setParent(child);
-            subContext.setChild(null);
-            
-            Catalog catalog = getCatalog();
-            Command command = catalog
-                    .getCommand(Globals.ADD_COMPONENT_COMMAND_NAME);
-            command.execute(subContext);
-            
-        }
-        
-        return isFinal;
-    }
-    
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.clay.component.chain;
+
+import java.util.Iterator;
+
+import javax.faces.component.UIComponent;
+
+import org.apache.commons.chain.Catalog;
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.shale.clay.config.Globals;
+import org.apache.shale.clay.config.beans.ComponentBean;
+
+/**
+ * <p>
+ * Iterates over the child {@link org.apache.shale.clay.config.beans.ElementBean} collection of a
+ * {@link ComponentBean}, and invokes the {@link CreateComponentCommand} for
+ * each.
+ * <p>
+ */
+public class AssignChildrenCommand extends AbstractCommand {
+    
+    private static Log log;
+    static {
+        log = LogFactory.getLog(AssignChildrenCommand.class);
+    }
+    
+    /**
+     * <p>
+     * This {@link Command} iterates over the {@link ComponentBean}
+     * <code>children</code> collection and invokes the
+     * <code>Globals.ADD_COMPONENT_COMMAND_NAME</code> for each
+     * {@link org.apache.shale.clay.config.beans.ElementBean}.
+     * </p>
+     */
+    public boolean execute(Context context) throws Exception {
+        
+        boolean isFinal = false;
+        
+        ClayContext clayContext = (ClayContext) context;
+        if (clayContext == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.clayContext"));
+        
+        UIComponent child = (UIComponent) clayContext.getChild();
+        if (child == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.childComponent"));
+        
+        ComponentBean displayElement = clayContext.getDisplayElement();
+        if (displayElement == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.componentBean"));
+        
+        Iterator vi = displayElement.getChildrenIterator();
+        while (vi.hasNext()) {
+            ComponentBean childDisplayElement = (ComponentBean) vi.next();
+            
+            ClayContext subContext = (ClayContext) clayContext.clone();
+            subContext.setDisplayElement(childDisplayElement);
+            subContext.setParent(child);
+            subContext.setChild(null);
+            
+            Catalog catalog = getCatalog();
+            Command command = catalog
+                    .getCommand(Globals.ADD_COMPONENT_COMMAND_NAME);
+            command.execute(subContext);
+            
+        }
+        
+        return isFinal;
+    }
+    
+}

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignConverterCommand.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignConverterCommand.java?rev=178848&r1=178847&r2=178848&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignConverterCommand.java (original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignConverterCommand.java Fri May 27 18:09:07 2005
@@ -1,96 +1,96 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id$
- */
-
-package org.apache.shale.clay.component.chain;
-
-import javax.faces.component.UIComponent;
-import javax.faces.component.ValueHolder;
-
-import org.apache.commons.chain.Catalog;
-import org.apache.commons.chain.Command;
-import org.apache.commons.chain.Context;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.shale.clay.config.Globals;
-import org.apache.shale.clay.config.beans.ComponentBean;
-
-/**
- * <p>
- * Determines if the {@link ComponentBean} has a {@link org.apache.shale.clay.config.beans.ConverterBean} assigned.
- * A <code>Converter</code> is created by invoking the {@link org.apache.shale.clay.component.chain.CreateConverterCommand}.
- * </p>
- */
-public class AssignConverterCommand extends AbstractCommand {
-    
-    /**
-     * <p>
-     * Common Logging utility
-     * </p>
-     */
-    private static Log log;
-    static {
-        log = LogFactory.getLog(AssignConverterCommand.class);
-    }
-    
-    /**
-     * <p>
-     * Checks to see if the {@link org.apache.shale.clay.config.beans.ComponentBean} has a {@link org.apache.shale.clay.config.beans.ConverterBean}
-     * assigned. The <code>Globals.ADD_CONVERTER_COMMAND_NAME</code> is
-     * invoked to create a <code>Converter</code>.
-     */
-    public boolean execute(Context context) throws Exception {
-        
-        boolean isFinal = false;
-        
-        ClayContext clayContext = (ClayContext) context;
-        if (clayContext == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.clayContext"));
-        
-        UIComponent child = (UIComponent) clayContext.getChild();
-        if (child == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.childComponent"));
-        
-        ComponentBean displayElement = clayContext.getDisplayElement();
-        if (displayElement == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.componentBean"));
-        
-        if (displayElement.getConverter() != null) {
-            if (child instanceof ValueHolder) {
-                
-                ClayContext subContext = (ClayContext) clayContext.clone();
-                subContext.setDisplayElement(displayElement.getConverter());
-                subContext.setParent(child);
-                
-                Catalog catalog = getCatalog();
-                Command command = catalog
-                        .getCommand(Globals.ADD_CONVERTER_COMMAND_NAME);
-                command.execute(subContext);
-                
-            } else {
-                log.error(messages.getMessage("assign.converter.error",
-                        new Object[] { displayElement }));
-            }
-        }
-        
-        return isFinal;
-    }
-    
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.clay.component.chain;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.ValueHolder;
+
+import org.apache.commons.chain.Catalog;
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.shale.clay.config.Globals;
+import org.apache.shale.clay.config.beans.ComponentBean;
+
+/**
+ * <p>
+ * Determines if the {@link ComponentBean} has a {@link org.apache.shale.clay.config.beans.ConverterBean} assigned.
+ * A <code>Converter</code> is created by invoking the {@link org.apache.shale.clay.component.chain.CreateConverterCommand}.
+ * </p>
+ */
+public class AssignConverterCommand extends AbstractCommand {
+    
+    /**
+     * <p>
+     * Common Logging utility
+     * </p>
+     */
+    private static Log log;
+    static {
+        log = LogFactory.getLog(AssignConverterCommand.class);
+    }
+    
+    /**
+     * <p>
+     * Checks to see if the {@link org.apache.shale.clay.config.beans.ComponentBean} has a {@link org.apache.shale.clay.config.beans.ConverterBean}
+     * assigned. The <code>Globals.ADD_CONVERTER_COMMAND_NAME</code> is
+     * invoked to create a <code>Converter</code>.
+     */
+    public boolean execute(Context context) throws Exception {
+        
+        boolean isFinal = false;
+        
+        ClayContext clayContext = (ClayContext) context;
+        if (clayContext == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.clayContext"));
+        
+        UIComponent child = (UIComponent) clayContext.getChild();
+        if (child == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.childComponent"));
+        
+        ComponentBean displayElement = clayContext.getDisplayElement();
+        if (displayElement == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.componentBean"));
+        
+        if (displayElement.getConverter() != null) {
+            if (child instanceof ValueHolder) {
+                
+                ClayContext subContext = (ClayContext) clayContext.clone();
+                subContext.setDisplayElement(displayElement.getConverter());
+                subContext.setParent(child);
+                
+                Catalog catalog = getCatalog();
+                Command command = catalog
+                        .getCommand(Globals.ADD_CONVERTER_COMMAND_NAME);
+                command.execute(subContext);
+                
+            } else {
+                log.error(messages.getMessage("assign.converter.error",
+                        new Object[] { displayElement }));
+            }
+        }
+        
+        return isFinal;
+    }
+    
+}

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignPropertiesCommand.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignPropertiesCommand.java?rev=178848&r1=178847&r2=178848&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignPropertiesCommand.java (original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignPropertiesCommand.java Fri May 27 18:09:07 2005
@@ -1,102 +1,102 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id$
- */
-
-package org.apache.shale.clay.component.chain;
-
-import java.util.Iterator;
-
-import org.apache.commons.chain.Catalog;
-import org.apache.commons.chain.Command;
-import org.apache.commons.chain.Context;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.shale.clay.config.Globals;
-import org.apache.shale.clay.config.beans.AttributeBean;
-import org.apache.shale.clay.config.beans.ComponentBean;
-
-/**
- * <p>
- * Sets the <code>UIComponent</code> properties using the attributes collection of
- * {@link org.apache.shale.clay.config.beans.AttributeBean} by invoking the
- * <code>Globals.SET_ATTRIBUTE_COMMAND_NAME</code> <code>Chain</code>.
- * </p>
- */
-public class AssignPropertiesCommand extends AbstractCommand {
-    
-    /**
-     * <p>
-     * Common logger utility
-     * </p>
-     */
-    private static Log log;
-    static {
-        log = LogFactory.getLog(AssignPropertiesCommand.class);
-    }
-    
-    /**
-     * <p>
-     * Invokes a chain that fires several Commands.
-     * <dl>
-     * <dt>Associated Property Commands
-     * <dd>{@link org.apache.shale.clay.component.chain.PropertyActionCommand}
-     * <dd>{@link org.apache.shale.clay.component.chain.PropertyActionListenerCommand}
-     * <dd>{@link org.apache.shale.clay.component.chain.PropertyValidatorCommand}
-     * <dd>{@link org.apache.shale.clay.component.chain.PropertyValueChangeListenerCommand}
-     * <dd>{@link org.apache.shale.clay.component.chain.PropertyValueCommand}
-     * </dl>
-     * </p>
-     *
-     */
-    public boolean execute(Context context) throws Exception {
-        
-        boolean isFinal = false;
-        
-        ClayContext clayContext = (ClayContext) context;
-        if (clayContext == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.clayContext"));
-        
-        ComponentBean displayElement = clayContext.getDisplayElement();
-        if (displayElement == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.componentBean"));
-        
-        Iterator ai = displayElement.getAttributeIterator();
-        Catalog catalog = getCatalog();
-        Command command = catalog
-                .getCommand(Globals.SET_ATTRIBUTE_COMMAND_NAME);
-        while (ai.hasNext()) {
-            AttributeBean a = (AttributeBean) ai.next();
-            clayContext.setAttribute(a);
-            
-            try {
-                command.execute(clayContext);
-            } catch (Exception e) {
-                log.error(messages.getMessage("assign.property.error",
-                        new Object[] { a }), e);
-                        throw e;
-                        
-            }
-            
-        }
-        ai = null;
-        
-        return isFinal;
-    }
-    
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.clay.component.chain;
+
+import java.util.Iterator;
+
+import org.apache.commons.chain.Catalog;
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.shale.clay.config.Globals;
+import org.apache.shale.clay.config.beans.AttributeBean;
+import org.apache.shale.clay.config.beans.ComponentBean;
+
+/**
+ * <p>
+ * Sets the <code>UIComponent</code> properties using the attributes collection of
+ * {@link org.apache.shale.clay.config.beans.AttributeBean} by invoking the
+ * <code>Globals.SET_ATTRIBUTE_COMMAND_NAME</code> <code>Chain</code>.
+ * </p>
+ */
+public class AssignPropertiesCommand extends AbstractCommand {
+    
+    /**
+     * <p>
+     * Common logger utility
+     * </p>
+     */
+    private static Log log;
+    static {
+        log = LogFactory.getLog(AssignPropertiesCommand.class);
+    }
+    
+    /**
+     * <p>
+     * Invokes a chain that fires several Commands.
+     * <dl>
+     * <dt>Associated Property Commands
+     * <dd>{@link org.apache.shale.clay.component.chain.PropertyActionCommand}
+     * <dd>{@link org.apache.shale.clay.component.chain.PropertyActionListenerCommand}
+     * <dd>{@link org.apache.shale.clay.component.chain.PropertyValidatorCommand}
+     * <dd>{@link org.apache.shale.clay.component.chain.PropertyValueChangeListenerCommand}
+     * <dd>{@link org.apache.shale.clay.component.chain.PropertyValueCommand}
+     * </dl>
+     * </p>
+     *
+     */
+    public boolean execute(Context context) throws Exception {
+        
+        boolean isFinal = false;
+        
+        ClayContext clayContext = (ClayContext) context;
+        if (clayContext == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.clayContext"));
+        
+        ComponentBean displayElement = clayContext.getDisplayElement();
+        if (displayElement == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.componentBean"));
+        
+        Iterator ai = displayElement.getAttributeIterator();
+        Catalog catalog = getCatalog();
+        Command command = catalog
+                .getCommand(Globals.SET_ATTRIBUTE_COMMAND_NAME);
+        while (ai.hasNext()) {
+            AttributeBean a = (AttributeBean) ai.next();
+            clayContext.setAttribute(a);
+            
+            try {
+                command.execute(clayContext);
+            } catch (Exception e) {
+                log.error(messages.getMessage("assign.property.error",
+                        new Object[] { a }), e);
+                        throw e;
+                        
+            }
+            
+        }
+        ai = null;
+        
+        return isFinal;
+    }
+    
+}

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignValidatorsCommand.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignValidatorsCommand.java?rev=178848&r1=178847&r2=178848&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignValidatorsCommand.java (original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignValidatorsCommand.java Fri May 27 18:09:07 2005
@@ -1,104 +1,104 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id$
- */
-
-package org.apache.shale.clay.component.chain;
-
-import java.util.Iterator;
-
-import javax.faces.component.EditableValueHolder;
-import javax.faces.component.UIComponent;
-
-import org.apache.commons.chain.Catalog;
-import org.apache.commons.chain.Command;
-import org.apache.commons.chain.Context;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.shale.clay.config.Globals;
-import org.apache.shale.clay.config.beans.ComponentBean;
-import org.apache.shale.clay.config.beans.ValidatorBean;
-
-/**
- * <p>
- * If the {@link ComponentBean} has a {@link ValidatorBean} assigned, the
- * {@link CreateValidatorCommand} is invoked.
- * </p>
- */
-public class AssignValidatorsCommand extends AbstractCommand {
-    
-    /**
-     * <p>
-     * Common Logging utility
-     * </p>
-     */
-    private static Log log;
-    static {
-        log = LogFactory.getLog(AssignValidatorsCommand.class);
-    }
-    
-    /**
-     * <p>
-     * Executes the {@link org.apache.shale.clay.component.chain.CreateValidatorCommand} using the
-     * <code>Globals.ADD_VALIDATOR_COMMAND_NAME</code> command to create a
-     * <code>Validator</code>.
-     */
-    public boolean execute(Context context) throws Exception {
-        
-        boolean isFinal = false;
-        
-        ClayContext clayContext = (ClayContext) context;
-        if (clayContext == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.clayContext"));
-        
-        UIComponent child = (UIComponent) clayContext.getChild();
-        if (child == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.childComponent"));
-        
-        ComponentBean displayElement = clayContext.getDisplayElement();
-        if (displayElement == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.componentBean"));
-        
-        if (displayElement.getValidators().size() > 0) {
-            if (child instanceof EditableValueHolder) {
-                
-                Iterator vi = displayElement.getValidatorIterator();
-                while (vi.hasNext()) {
-                    ValidatorBean validator = (ValidatorBean) vi.next();
-                    
-                    ClayContext subContext = (ClayContext) clayContext.clone();
-                    subContext.setDisplayElement(validator);
-                    subContext.setParent(child);
-                    
-                    Catalog catalog = getCatalog();
-                    Command command = catalog
-                            .getCommand(Globals.ADD_VALIDATOR_COMMAND_NAME);
-                    command.execute(subContext);
-                    
-                }
-            } else {
-                log.error(messages.getMessage("assign.validator.error",
-                        new Object[] { displayElement }));
-            }
-        }
-        
-        return isFinal;
-    }
-    
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.clay.component.chain;
+
+import java.util.Iterator;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+
+import org.apache.commons.chain.Catalog;
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.shale.clay.config.Globals;
+import org.apache.shale.clay.config.beans.ComponentBean;
+import org.apache.shale.clay.config.beans.ValidatorBean;
+
+/**
+ * <p>
+ * If the {@link ComponentBean} has a {@link ValidatorBean} assigned, the
+ * {@link CreateValidatorCommand} is invoked.
+ * </p>
+ */
+public class AssignValidatorsCommand extends AbstractCommand {
+    
+    /**
+     * <p>
+     * Common Logging utility
+     * </p>
+     */
+    private static Log log;
+    static {
+        log = LogFactory.getLog(AssignValidatorsCommand.class);
+    }
+    
+    /**
+     * <p>
+     * Executes the {@link org.apache.shale.clay.component.chain.CreateValidatorCommand} using the
+     * <code>Globals.ADD_VALIDATOR_COMMAND_NAME</code> command to create a
+     * <code>Validator</code>.
+     */
+    public boolean execute(Context context) throws Exception {
+        
+        boolean isFinal = false;
+        
+        ClayContext clayContext = (ClayContext) context;
+        if (clayContext == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.clayContext"));
+        
+        UIComponent child = (UIComponent) clayContext.getChild();
+        if (child == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.childComponent"));
+        
+        ComponentBean displayElement = clayContext.getDisplayElement();
+        if (displayElement == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.componentBean"));
+        
+        if (displayElement.getValidators().size() > 0) {
+            if (child instanceof EditableValueHolder) {
+                
+                Iterator vi = displayElement.getValidatorIterator();
+                while (vi.hasNext()) {
+                    ValidatorBean validator = (ValidatorBean) vi.next();
+                    
+                    ClayContext subContext = (ClayContext) clayContext.clone();
+                    subContext.setDisplayElement(validator);
+                    subContext.setParent(child);
+                    
+                    Catalog catalog = getCatalog();
+                    Command command = catalog
+                            .getCommand(Globals.ADD_VALIDATOR_COMMAND_NAME);
+                    command.execute(subContext);
+                    
+                }
+            } else {
+                log.error(messages.getMessage("assign.validator.error",
+                        new Object[] { displayElement }));
+            }
+        }
+        
+        return isFinal;
+    }
+    
+}

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignValueChangeListenersCommand.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignValueChangeListenersCommand.java?rev=178848&r1=178847&r2=178848&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignValueChangeListenersCommand.java (original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/AssignValueChangeListenersCommand.java Fri May 27 18:09:07 2005
@@ -1,106 +1,106 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id$
- */
-
-package org.apache.shale.clay.component.chain;
-
-import java.util.Iterator;
-
-import javax.faces.component.EditableValueHolder;
-import javax.faces.component.UIComponent;
-
-import org.apache.commons.chain.Catalog;
-import org.apache.commons.chain.Command;
-import org.apache.commons.chain.Context;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.shale.clay.config.Globals;
-import org.apache.shale.clay.config.beans.ComponentBean;
-import org.apache.shale.clay.config.beans.ValueChangeListenerBean;
-
-/**
- * <p>
- * For each {@link org.apache.shale.clay.config.beans.ValueChangeListenerBean} in the
- * <code>valueChangeListeners</code> collection, the
- * {@link org.apache.shale.clay.component.chain.CreateValueChangeListenerCommand} command will be invoked
- * </p>
- */
-public class AssignValueChangeListenersCommand extends AbstractCommand {
-    
-    /**
-     * <p>
-     * Common Loggin utility
-     * </p>
-     */
-    private static Log log;
-    static {
-        log = LogFactory.getLog(AssignValueChangeListenersCommand.class);
-    }
-    
-    /**
-     * <p>
-     * Uses the <code>Globals.ADD_VALUE_CHANGE_LISTENER_COMMAND_NAME</code>
-     * command to create a <code>ValueChangeListener</code>.
-     */
-    public boolean execute(Context context) throws Exception {
-        
-        boolean isFinal = false;
-        
-        ClayContext clayContext = (ClayContext) context;
-        if (clayContext == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.clayContext"));
-        
-        UIComponent child = (UIComponent) clayContext.getChild();
-        if (child == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.childComponent"));
-        
-        ComponentBean displayElement = clayContext.getDisplayElement();
-        if (displayElement == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.componentBean"));
-        
-        if (displayElement.getValueChangeListeners().size() > 0) {
-            if (child instanceof EditableValueHolder) {
-                
-                Iterator vi = displayElement.getValueChangeListenerIterator();
-                while (vi.hasNext()) {
-                    ValueChangeListenerBean valueChangeListener = (ValueChangeListenerBean) vi
-                            .next();
-                    
-                    ClayContext subContext = (ClayContext) clayContext.clone();
-                    subContext.setDisplayElement(valueChangeListener);
-                    subContext.setParent(child);
-                    
-                    Catalog catalog = getCatalog();
-                    Command command = catalog
-                            .getCommand(Globals.ADD_VALUE_CHANGE_LISTENER_COMMAND_NAME);
-                    command.execute(subContext);
-                    
-                }
-            } else {
-                log.error(messages.getMessage(
-                        "assign.valueChangeListener.error",
-                        new Object[] { displayElement }));
-            }
-        }
-        
-        return isFinal;
-    }
-    
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.clay.component.chain;
+
+import java.util.Iterator;
+
+import javax.faces.component.EditableValueHolder;
+import javax.faces.component.UIComponent;
+
+import org.apache.commons.chain.Catalog;
+import org.apache.commons.chain.Command;
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.shale.clay.config.Globals;
+import org.apache.shale.clay.config.beans.ComponentBean;
+import org.apache.shale.clay.config.beans.ValueChangeListenerBean;
+
+/**
+ * <p>
+ * For each {@link org.apache.shale.clay.config.beans.ValueChangeListenerBean} in the
+ * <code>valueChangeListeners</code> collection, the
+ * {@link org.apache.shale.clay.component.chain.CreateValueChangeListenerCommand} command will be invoked
+ * </p>
+ */
+public class AssignValueChangeListenersCommand extends AbstractCommand {
+    
+    /**
+     * <p>
+     * Common Loggin utility
+     * </p>
+     */
+    private static Log log;
+    static {
+        log = LogFactory.getLog(AssignValueChangeListenersCommand.class);
+    }
+    
+    /**
+     * <p>
+     * Uses the <code>Globals.ADD_VALUE_CHANGE_LISTENER_COMMAND_NAME</code>
+     * command to create a <code>ValueChangeListener</code>.
+     */
+    public boolean execute(Context context) throws Exception {
+        
+        boolean isFinal = false;
+        
+        ClayContext clayContext = (ClayContext) context;
+        if (clayContext == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.clayContext"));
+        
+        UIComponent child = (UIComponent) clayContext.getChild();
+        if (child == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.childComponent"));
+        
+        ComponentBean displayElement = clayContext.getDisplayElement();
+        if (displayElement == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.componentBean"));
+        
+        if (displayElement.getValueChangeListeners().size() > 0) {
+            if (child instanceof EditableValueHolder) {
+                
+                Iterator vi = displayElement.getValueChangeListenerIterator();
+                while (vi.hasNext()) {
+                    ValueChangeListenerBean valueChangeListener = (ValueChangeListenerBean) vi
+                            .next();
+                    
+                    ClayContext subContext = (ClayContext) clayContext.clone();
+                    subContext.setDisplayElement(valueChangeListener);
+                    subContext.setParent(child);
+                    
+                    Catalog catalog = getCatalog();
+                    Command command = catalog
+                            .getCommand(Globals.ADD_VALUE_CHANGE_LISTENER_COMMAND_NAME);
+                    command.execute(subContext);
+                    
+                }
+            } else {
+                log.error(messages.getMessage(
+                        "assign.valueChangeListener.error",
+                        new Object[] { displayElement }));
+            }
+        }
+        
+        return isFinal;
+    }
+    
+}

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/ClayContext.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/ClayContext.java?rev=178848&r1=178847&r2=178848&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/ClayContext.java (original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/ClayContext.java Fri May 27 18:09:07 2005
@@ -1,230 +1,230 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id$
- */
-
-package org.apache.shale.clay.component.chain;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.apache.commons.chain.impl.ContextBase;
-import org.apache.shale.clay.config.beans.AttributeBean;
-import org.apache.shale.clay.config.beans.ComponentBean;
-
-/**
- * <p>This context is passed to all the commands in this package
- * used to create the sub component tree for the clay component.
- * The use of the context object promotes a reusable logic
- * fragments that are loosely coupled and kind of snap togather.
- * </p>
- */
-public class ClayContext extends ContextBase {
-    
-    /**
-     * <p>The name of the ViewController or back bean that
-     * is bound to the {@link org.apache.shale.clay.component.Clay} component.
-     * </p>
-     */
-    private String managedBeanName = null;
-    
-    /**
-     * <p>Returns the managed bean name that will replace the
-     * literal string <strong>managed-bean-name</strong> in
-     * value and action component expressions.
-     * </p>
-     */
-    public String getManagedBeanName() {
-        return managedBeanName;
-    }
-    
-    /**
-     * <p>Sets the managed bean name that the {@link org.apache.shale.clay.component.Clay} component
-     * and all sub components are bound to.
-     * </p>
-     */
-    public void setManagedBeanName(String managedBeanName) {
-        this.managedBeanName = managedBeanName;
-    }
-    
-    /**
-     * <p>Unique identifier for a component metadata definition.</p>
-     */
-    private String jsfid = null;
-    
-    /**
-     * <p>Returns the unique identifier for a component metadata definition</p>
-     */
-    public String getJsfid() {
-        return jsfid;
-    }
-    
-    /**
-     * <p>Sets the unique identifier for a component metadata definition</p>
-     */
-    public void setJsfid(String jsfid) {
-        this.jsfid = jsfid;
-    }
-    
-    /**
-     * <p>A <strong>child</strong> component is a faces Component, Validator,
-     * Listener or Converter that has a parent.  Because a {@link org.apache.shale.clay.component.Clay} component
-     * is nested within a JSF/JSP page, it will should always have a parent.
-     * </p>
-     */
-    private Object child = null;
-    
-    /**
-     * <b>Returns a child component that can be a UIComponent, Validator,
-     * Listener or Converter.
-     * </b>
-     */
-    public Object getChild() {
-        return child;
-    }
-    
-    /**
-     * <p>Sets a child component that can be a UIComponent, Validator,
-     * Listener or Converter.
-     * </p>
-     */
-    public void setChild(Object child) {
-        this.child = child;
-    }
-    
-    /**
-     * <p>The root of a {@link org.apache.shale.clay.component.Clay} component defined by a
-     * {@link org.apache.shale.clay.taglib.ClayTag} has a base metadata object of type
-     * {@link org.apache.shale.clay.config.beans.ComponentBean}.  It can be defined in an XML
-     * file or dynamically built from a HTML fragment or defined
-     * at runtime.</p>
-     */
-    private ComponentBean rootElement = null;
-    
-    /**
-     * <p>Returns the root config object used to construct the
-     * {@link org.apache.shale.clay.component.Clay} component subtree.
-     * </p>
-     */
-    public ComponentBean getRootElement() {
-        return rootElement;
-    }
-    
-    /**
-     * <p>Sets the root config object used to construct the
-     * {@link org.apache.shale.clay.component.Clay} component subtree.
-     * </p>
-     */
-    public void setRootElement(ComponentBean rootElement) {
-        this.rootElement = rootElement;
-    }
-    
-    /**
-     * <p>An attribute that is the current index in the
-     * <code>attributes</code> collection of the {@link org.apache.shale.clay.config.beans.ComponentBean}
-     * object. There are five <code>Command</code> object that use the
-     * <code>attribute</code> property in the context.
-     * <dl>
-     * <dd>{@link org.apache.shale.clay.component.chain.PropertyActionCommand}
-     * <dd>{@link org.apache.shale.clay.component.chain.PropertyActionListenerCommand}
-     * <dd>{@link org.apache.shale.clay.component.chain.PropertyValidatorCommand}
-     * <dd>{@link org.apache.shale.clay.component.chain.PropertyValueChangeListenerCommand}
-     * <dd>{@link org.apache.shale.clay.component.chain.PropertyValueCommand}
-     * </dl>
-     *
-     */
-    private AttributeBean attribute = null;
-    
-    /**
-     * <p>Sets the current attribute for each in {@link org.apache.shale.clay.component.chain.AssignPropertiesCommand}</p>
-     */
-    public void setAttribute(AttributeBean attribute) {
-        this.attribute = attribute;
-    }
-    
-    /**
-     * <p>Gets the current attribute for each in {@link org.apache.shale.clay.component.chain.AssignPropertiesCommand}</p>
-     */
-    public AttributeBean getAttribute() {
-        return attribute;
-    }
-    
-    /**
-     * <p>Represents the current component metadata use to build
-     * an associated JSF resource</p>
-     */
-    private ComponentBean displayElement = null;
-    
-    /**
-     * <p>Returns the current component metadata used to build
-     * a JSF resource.
-     * </p>
-     */
-    public ComponentBean getDisplayElement() {
-        return displayElement;
-    }
-    
-    /**
-     * <p>Sets the current component metadata used to build
-     * a JSF resource.
-     * </p>
-     */
-    public void setDisplayElement(ComponentBean displayElement) {
-        this.displayElement = displayElement;
-    }
-    
-    /**
-     * <p>Reference to the current {@link FacesContext}</p>
-     */
-    private FacesContext facesContext = null;
-    
-    /**
-     * <p>Returns the current faces Context</p>
-     */
-    public FacesContext getFacesContext() {
-        return facesContext;
-    }
-    
-    /**
-     * <p>Sets the current faces Context</p>
-     */
-    public void setFacesContext(FacesContext facesContext) {
-        this.facesContext = facesContext;
-    }
-    
-    /**
-     * <p>The <strong>parent</storng> of the <strong>child</strong>
-     * component.  The <strong>parent</strong> can be something other
-     * than a subclass of <code>UIComponent</code>.
-     * </p>
-     */
-    private UIComponent parent = null;
-    
-    /**
-     * <p>Returns the <strong>parent</strong> of the <strong>child</strong></p>
-     */
-    public UIComponent getParent() {
-        return parent;
-    }
-    
-    /**
-     * <p>Sets the <strong>parent</strong> of the <strong>child</strong></p>
-     */
-    public void setParent(UIComponent parent) {
-        this.parent = parent;
-    }
-    
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.clay.component.chain;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.apache.commons.chain.impl.ContextBase;
+import org.apache.shale.clay.config.beans.AttributeBean;
+import org.apache.shale.clay.config.beans.ComponentBean;
+
+/**
+ * <p>This context is passed to all the commands in this package
+ * used to create the sub component tree for the clay component.
+ * The use of the context object promotes a reusable logic
+ * fragments that are loosely coupled and kind of snap togather.
+ * </p>
+ */
+public class ClayContext extends ContextBase {
+    
+    /**
+     * <p>The name of the ViewController or back bean that
+     * is bound to the {@link org.apache.shale.clay.component.Clay} component.
+     * </p>
+     */
+    private String managedBeanName = null;
+    
+    /**
+     * <p>Returns the managed bean name that will replace the
+     * literal string <strong>managed-bean-name</strong> in
+     * value and action component expressions.
+     * </p>
+     */
+    public String getManagedBeanName() {
+        return managedBeanName;
+    }
+    
+    /**
+     * <p>Sets the managed bean name that the {@link org.apache.shale.clay.component.Clay} component
+     * and all sub components are bound to.
+     * </p>
+     */
+    public void setManagedBeanName(String managedBeanName) {
+        this.managedBeanName = managedBeanName;
+    }
+    
+    /**
+     * <p>Unique identifier for a component metadata definition.</p>
+     */
+    private String jsfid = null;
+    
+    /**
+     * <p>Returns the unique identifier for a component metadata definition</p>
+     */
+    public String getJsfid() {
+        return jsfid;
+    }
+    
+    /**
+     * <p>Sets the unique identifier for a component metadata definition</p>
+     */
+    public void setJsfid(String jsfid) {
+        this.jsfid = jsfid;
+    }
+    
+    /**
+     * <p>A <strong>child</strong> component is a faces Component, Validator,
+     * Listener or Converter that has a parent.  Because a {@link org.apache.shale.clay.component.Clay} component
+     * is nested within a JSF/JSP page, it will should always have a parent.
+     * </p>
+     */
+    private Object child = null;
+    
+    /**
+     * <b>Returns a child component that can be a UIComponent, Validator,
+     * Listener or Converter.
+     * </b>
+     */
+    public Object getChild() {
+        return child;
+    }
+    
+    /**
+     * <p>Sets a child component that can be a UIComponent, Validator,
+     * Listener or Converter.
+     * </p>
+     */
+    public void setChild(Object child) {
+        this.child = child;
+    }
+    
+    /**
+     * <p>The root of a {@link org.apache.shale.clay.component.Clay} component defined by a
+     * {@link org.apache.shale.clay.taglib.ClayTag} has a base metadata object of type
+     * {@link org.apache.shale.clay.config.beans.ComponentBean}.  It can be defined in an XML
+     * file or dynamically built from a HTML fragment or defined
+     * at runtime.</p>
+     */
+    private ComponentBean rootElement = null;
+    
+    /**
+     * <p>Returns the root config object used to construct the
+     * {@link org.apache.shale.clay.component.Clay} component subtree.
+     * </p>
+     */
+    public ComponentBean getRootElement() {
+        return rootElement;
+    }
+    
+    /**
+     * <p>Sets the root config object used to construct the
+     * {@link org.apache.shale.clay.component.Clay} component subtree.
+     * </p>
+     */
+    public void setRootElement(ComponentBean rootElement) {
+        this.rootElement = rootElement;
+    }
+    
+    /**
+     * <p>An attribute that is the current index in the
+     * <code>attributes</code> collection of the {@link org.apache.shale.clay.config.beans.ComponentBean}
+     * object. There are five <code>Command</code> object that use the
+     * <code>attribute</code> property in the context.
+     * <dl>
+     * <dd>{@link org.apache.shale.clay.component.chain.PropertyActionCommand}
+     * <dd>{@link org.apache.shale.clay.component.chain.PropertyActionListenerCommand}
+     * <dd>{@link org.apache.shale.clay.component.chain.PropertyValidatorCommand}
+     * <dd>{@link org.apache.shale.clay.component.chain.PropertyValueChangeListenerCommand}
+     * <dd>{@link org.apache.shale.clay.component.chain.PropertyValueCommand}
+     * </dl>
+     *
+     */
+    private AttributeBean attribute = null;
+    
+    /**
+     * <p>Sets the current attribute for each in {@link org.apache.shale.clay.component.chain.AssignPropertiesCommand}</p>
+     */
+    public void setAttribute(AttributeBean attribute) {
+        this.attribute = attribute;
+    }
+    
+    /**
+     * <p>Gets the current attribute for each in {@link org.apache.shale.clay.component.chain.AssignPropertiesCommand}</p>
+     */
+    public AttributeBean getAttribute() {
+        return attribute;
+    }
+    
+    /**
+     * <p>Represents the current component metadata use to build
+     * an associated JSF resource</p>
+     */
+    private ComponentBean displayElement = null;
+    
+    /**
+     * <p>Returns the current component metadata used to build
+     * a JSF resource.
+     * </p>
+     */
+    public ComponentBean getDisplayElement() {
+        return displayElement;
+    }
+    
+    /**
+     * <p>Sets the current component metadata used to build
+     * a JSF resource.
+     * </p>
+     */
+    public void setDisplayElement(ComponentBean displayElement) {
+        this.displayElement = displayElement;
+    }
+    
+    /**
+     * <p>Reference to the current {@link FacesContext}</p>
+     */
+    private FacesContext facesContext = null;
+    
+    /**
+     * <p>Returns the current faces Context</p>
+     */
+    public FacesContext getFacesContext() {
+        return facesContext;
+    }
+    
+    /**
+     * <p>Sets the current faces Context</p>
+     */
+    public void setFacesContext(FacesContext facesContext) {
+        this.facesContext = facesContext;
+    }
+    
+    /**
+     * <p>The <strong>parent</storng> of the <strong>child</strong>
+     * component.  The <strong>parent</strong> can be something other
+     * than a subclass of <code>UIComponent</code>.
+     * </p>
+     */
+    private UIComponent parent = null;
+    
+    /**
+     * <p>Returns the <strong>parent</strong> of the <strong>child</strong></p>
+     */
+    public UIComponent getParent() {
+        return parent;
+    }
+    
+    /**
+     * <p>Sets the <strong>parent</strong> of the <strong>child</strong></p>
+     */
+    public void setParent(UIComponent parent) {
+        this.parent = parent;
+    }
+    
+}

Modified: struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateActionListenerCommand.java
URL: http://svn.apache.org/viewcvs/struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateActionListenerCommand.java?rev=178848&r1=178847&r2=178848&view=diff
==============================================================================
--- struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateActionListenerCommand.java (original)
+++ struts/shale/trunk/clay-plugin/src/java/org/apache/shale/clay/component/chain/CreateActionListenerCommand.java Fri May 27 18:09:07 2005
@@ -1,112 +1,112 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id$
- */
-
-package org.apache.shale.clay.component.chain;
-
-import javax.faces.component.ActionSource;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.event.ActionListener;
-
-import org.apache.commons.chain.Context;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.shale.clay.config.beans.ComponentBean;
-
-/**
- * <p>
- * This <code>Command</code> will create a <code>ActonListener</code> and assign it to the
- * <code>parent</code>. The construction of the <code>ActionListener</code>
- * is based on the current <code>displayElement</code> in the
- * {@link org.apache.shale.clay.component.chain.ClayContext}
- * </p>
- */
-public class CreateActionListenerCommand extends AbstractCommand {
-    
-    /**
-     * <p>
-     * Common Logger utility
-     * </p>
-     */
-    private static Log log;
-    static {
-        log = LogFactory.getLog(CreateActionListenerCommand.class);
-    }
-    
-    /**
-     * <p>
-     * Uses the {@link ClayContext} to build a <code>ActionListener</code> and
-     * assign it to the context <code>parent</code> using the context
-     * <code>displayElement</code> that is derived from type
-     * {@link ComponentBean}.
-     * </p>
-     */
-    public boolean execute(Context context) throws Exception {
-        
-        boolean isFinal = false;
-        
-        ClayContext clayContext = (ClayContext) context;
-        if (clayContext == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.clayContext"));
-        
-        UIComponent child = (UIComponent) clayContext.getChild();
-        if (child == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.childComponent"));
-        
-        ComponentBean displayElement = clayContext.getDisplayElement();
-        if (displayElement == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.componentBean"));
-        
-        ActionSource parent = (ActionSource) clayContext.getParent();
-        if (parent == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.parentComponent"));
-        
-        FacesContext facesContext = clayContext.getFacesContext();
-        if (facesContext == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.facesContext"));
-        
-        ActionListener listener = null;
-        try {
-            
-            ClassLoader loader = Thread.currentThread().getContextClassLoader();
-            if (loader == null)
-                loader = getClass().getClassLoader();
-            
-            listener = (ActionListener) loader.loadClass(
-                    displayElement.getComponentType()).newInstance();
-            
-            loader = null;
-        } catch (Exception e) {
-            log.error(messages.getMessage("create.actionListener.error",
-                    new Object[] { displayElement }), e);
-                    throw e;
-        }
-        parent.addActionListener(listener);
-        // reassign the child to the ActionListener for the
-        // AssignPropertiesCommand
-        clayContext.setChild(listener);
-        
-        return isFinal;
-    }
-    
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.clay.component.chain;
+
+import javax.faces.component.ActionSource;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.event.ActionListener;
+
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.shale.clay.config.beans.ComponentBean;
+
+/**
+ * <p>
+ * This <code>Command</code> will create a <code>ActonListener</code> and assign it to the
+ * <code>parent</code>. The construction of the <code>ActionListener</code>
+ * is based on the current <code>displayElement</code> in the
+ * {@link org.apache.shale.clay.component.chain.ClayContext}
+ * </p>
+ */
+public class CreateActionListenerCommand extends AbstractCommand {
+    
+    /**
+     * <p>
+     * Common Logger utility
+     * </p>
+     */
+    private static Log log;
+    static {
+        log = LogFactory.getLog(CreateActionListenerCommand.class);
+    }
+    
+    /**
+     * <p>
+     * Uses the {@link ClayContext} to build a <code>ActionListener</code> and
+     * assign it to the context <code>parent</code> using the context
+     * <code>displayElement</code> that is derived from type
+     * {@link ComponentBean}.
+     * </p>
+     */
+    public boolean execute(Context context) throws Exception {
+        
+        boolean isFinal = false;
+        
+        ClayContext clayContext = (ClayContext) context;
+        if (clayContext == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.clayContext"));
+        
+        UIComponent child = (UIComponent) clayContext.getChild();
+        if (child == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.childComponent"));
+        
+        ComponentBean displayElement = clayContext.getDisplayElement();
+        if (displayElement == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.componentBean"));
+        
+        ActionSource parent = (ActionSource) clayContext.getParent();
+        if (parent == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.parentComponent"));
+        
+        FacesContext facesContext = clayContext.getFacesContext();
+        if (facesContext == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.facesContext"));
+        
+        ActionListener listener = null;
+        try {
+            
+            ClassLoader loader = Thread.currentThread().getContextClassLoader();
+            if (loader == null)
+                loader = getClass().getClassLoader();
+            
+            listener = (ActionListener) loader.loadClass(
+                    displayElement.getComponentType()).newInstance();
+            
+            loader = null;
+        } catch (Exception e) {
+            log.error(messages.getMessage("create.actionListener.error",
+                    new Object[] { displayElement }), e);
+                    throw e;
+        }
+        parent.addActionListener(listener);
+        // reassign the child to the ActionListener for the
+        // AssignPropertiesCommand
+        clayContext.setChild(listener);
+        
+        return isFinal;
+    }
+    
+}

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=178848&r1=178847&r2=178848&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 Fri May 27 18:09:07 2005
@@ -1,121 +1,121 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * $Id$
- */
-
-package org.apache.shale.clay.component.chain;
-
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-
-import org.apache.commons.chain.Context;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.shale.clay.config.Globals;
-import org.apache.shale.clay.config.beans.AttributeBean;
-import org.apache.shale.clay.config.beans.ComponentBean;
-
-/**
- * <p>
- * This <code>Command</code> is used to build <strong>parent</strong> and
- * <strong>child</strong> <code>UIComponent</code>'s from the
- * <code>displayElement</code> in the {@link org.apache.shale.clay.component.chain.ClayContext}.
- * </p>
- */
-public class CreateComponentCommand extends AbstractCommand {
-    
-    /**
-     * <p>
-     * Common Logger utility
-     * </p>
-     */
-    private static Log log;
-    static {
-        log = LogFactory.getLog(CreateComponentCommand.class);
-    }
-    
-    /**
-     * <p>
-     * Creates a new faces component from the component metadata.
-     * </p>
-     */
-    public boolean execute(Context context) throws Exception {
-        
-        boolean isFinal = true;
-        
-        ClayContext clayContext = (ClayContext) context;
-        if (clayContext == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.clayContext"));
-        
-        ComponentBean displayElement = clayContext.getDisplayElement();
-        if (displayElement == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.componentBean"));
-        
-        UIComponent parent = (UIComponent) clayContext.getParent();
-        if (parent == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.parentBean"));
-        
-        FacesContext facesContext = clayContext.getFacesContext();
-        if (facesContext == null)
-            throw new NullPointerException(messages
-                    .getMessage("clay.null.facesContext"));
-        
-        String id = null;
-        if ((id = displayElement.getId()) == null)
-            id = facesContext.getViewRoot().createUniqueId();
-        
-        UIComponent child = null;
-        AttributeBean facetName = null;
-        if ((facetName = displayElement
-                .getAttribute(Globals.CLAY_FACET_ATTRIBUTE_NAME)) != null)
-            child = parent.getFacet(facetName.getValue());
-        else
-            child = parent.findComponent(id);
-        if (child == null) {
-            try {
-                child = facesContext.getApplication().createComponent(
-                        displayElement.getComponentType());
-            } catch (Exception e) {
-                log.error(messages.getMessage("create.component.error",
-                        new Object[] { displayElement }), e);
-                        throw e;
-            }
-            
-            child.setId(id);
-            if (facetName != null)
-                parent.getFacets().put(facetName.getValue(), child);
-            else
-                parent.getChildren().add(parent.getChildren().size(), child);
-            
-            // reassign the child to the converter for the
-            // AssignPropertiesCommand
-            clayContext.setChild(child);
-            
-            // continue with the addComponent chain
-            isFinal = false;
-        } else {
-            if (log.isDebugEnabled())
-                log.debug(messages.getMessage("create.component.exists",
-                        new Object[] { displayElement.getJsfid() }));
-        }
-        
-        return isFinal;
-    }
-    
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Id$
+ */
+
+package org.apache.shale.clay.component.chain;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import org.apache.commons.chain.Context;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.shale.clay.config.Globals;
+import org.apache.shale.clay.config.beans.AttributeBean;
+import org.apache.shale.clay.config.beans.ComponentBean;
+
+/**
+ * <p>
+ * This <code>Command</code> is used to build <strong>parent</strong> and
+ * <strong>child</strong> <code>UIComponent</code>'s from the
+ * <code>displayElement</code> in the {@link org.apache.shale.clay.component.chain.ClayContext}.
+ * </p>
+ */
+public class CreateComponentCommand extends AbstractCommand {
+    
+    /**
+     * <p>
+     * Common Logger utility
+     * </p>
+     */
+    private static Log log;
+    static {
+        log = LogFactory.getLog(CreateComponentCommand.class);
+    }
+    
+    /**
+     * <p>
+     * Creates a new faces component from the component metadata.
+     * </p>
+     */
+    public boolean execute(Context context) throws Exception {
+        
+        boolean isFinal = true;
+        
+        ClayContext clayContext = (ClayContext) context;
+        if (clayContext == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.clayContext"));
+        
+        ComponentBean displayElement = clayContext.getDisplayElement();
+        if (displayElement == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.componentBean"));
+        
+        UIComponent parent = (UIComponent) clayContext.getParent();
+        if (parent == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.parentBean"));
+        
+        FacesContext facesContext = clayContext.getFacesContext();
+        if (facesContext == null)
+            throw new NullPointerException(messages
+                    .getMessage("clay.null.facesContext"));
+        
+        String id = null;
+        if ((id = displayElement.getId()) == null)
+            id = facesContext.getViewRoot().createUniqueId();
+        
+        UIComponent child = null;
+        AttributeBean facetName = null;
+        if ((facetName = displayElement
+                .getAttribute(Globals.CLAY_FACET_ATTRIBUTE_NAME)) != null)
+            child = parent.getFacet(facetName.getValue());
+        else
+            child = parent.findComponent(id);
+        if (child == null) {
+            try {
+                child = facesContext.getApplication().createComponent(
+                        displayElement.getComponentType());
+            } catch (Exception e) {
+                log.error(messages.getMessage("create.component.error",
+                        new Object[] { displayElement }), e);
+                        throw e;
+            }
+            
+            child.setId(id);
+            if (facetName != null)
+                parent.getFacets().put(facetName.getValue(), child);
+            else
+                parent.getChildren().add(parent.getChildren().size(), child);
+            
+            // reassign the child to the converter for the
+            // AssignPropertiesCommand
+            clayContext.setChild(child);
+            
+            // continue with the addComponent chain
+            isFinal = false;
+        } else {
+            if (log.isDebugEnabled())
+                log.debug(messages.getMessage("create.component.exists",
+                        new Object[] { displayElement.getJsfid() }));
+        }
+        
+        return isFinal;
+    }
+    
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org