Author: apetrelli
Date: Mon Feb  5 08:56:09 2007
New Revision: 503766

URL: http://svn.apache.org/viewvc?view=rev&rev=503766
Log:
Added the support to insert an unnamed attribute.

Modified:
    
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/ComponentListAttribute.java
    
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/taglib/InsertAttributeTag.java
    
tiles/framework/trunk/tiles-core/src/main/resources/META-INF/tld/tiles-core.tld

Modified: 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/ComponentListAttribute.java
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/ComponentListAttribute.java?view=diff&rev=503766&r1=503765&r2=503766
==============================================================================
--- 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/ComponentListAttribute.java
 (original)
+++ 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/context/ComponentListAttribute.java
 Mon Feb  5 08:56:09 2007
@@ -69,7 +69,7 @@
      * @param element XmlAttribute to add.
      */
     public void add(ComponentAttribute element) {
-        list.add(element.getValue());
+        list.add(element);
     }
 
     /**

Modified: 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/taglib/InsertAttributeTag.java
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/taglib/InsertAttributeTag.java?view=diff&rev=503766&r1=503765&r2=503766
==============================================================================
--- 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/taglib/InsertAttributeTag.java
 (original)
+++ 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/taglib/InsertAttributeTag.java
 Mon Feb  5 08:56:09 2007
@@ -44,6 +44,8 @@
      * Name to insert.
      */
     protected String name;
+    
+    protected Object value = null;
 
     public void setName(String value) {
         this.name = value;
@@ -53,14 +55,36 @@
         return name;
     }
 
+    /**
+     * Get the value.
+     *
+     * @return The value.
+     */
+    public Object getValue() {
+        return value;
+    }
+
+    /**
+     * Set the value.
+     *
+     * @param value The new value
+     */
+    public void setValue(Object value) {
+        this.value = value;
+    }
+
     public void release() {
         super.release();
         this.name = null;
+        this.value = null;
     }
 
     protected void render() throws JspException, TilesException, IOException {
         ComponentContext context = container.getComponentContext(pageContext);
-        ComponentAttribute attr = context.getAttribute(name);
+        ComponentAttribute attr = (ComponentAttribute) value;
+        if (attr == null) {
+            attr = context.getAttribute(name);
+        }
         if (attr == null && ignore) {
             return;
         }

Modified: 
tiles/framework/trunk/tiles-core/src/main/resources/META-INF/tld/tiles-core.tld
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/resources/META-INF/tld/tiles-core.tld?view=diff&rev=503766&r1=503765&r2=503766
==============================================================================
--- 
tiles/framework/trunk/tiles-core/src/main/resources/META-INF/tld/tiles-core.tld 
(original)
+++ 
tiles/framework/trunk/tiles-core/src/main/resources/META-INF/tld/tiles-core.tld 
Mon Feb  5 08:56:09 2007
@@ -238,11 +238,23 @@
       </description>
       <attribute>
          <name>name</name>
-         <required>true</required>
+         <required>false</required>
          <rtexprvalue>true</rtexprvalue>
          <description>
          <![CDATA[
-         <p>Name of the attribute to insert.</p>
+         <p>Name of the attribute to insert. This attribute will be ignored if
+         the <code>value</code> attribute is specified.</p>
+         ]]>
+         </description>
+      </attribute>
+      <attribute>
+         <name>value</name>
+         <required>false</required>
+         <rtexprvalue>true</rtexprvalue>
+         <description>
+         <![CDATA[
+         <p>Attribute object to render directly. If it specified, the 
<code>name</code>
+         attribute will be ignored.</p>
          ]]>
          </description>
       </attribute>


Reply via email to