Author: greddin
Date: Tue Mar 21 10:06:42 2006
New Revision: 387594

URL: http://svn.apache.org/viewcvs?rev=387594&view=rev
Log:
Ticket #38252. Fixed processObjectValue and processTypedAttribute methods.

Modified:
    struts/sandbox/trunk/tiles/src/java/org/apache/tiles/taglib/InsertTag.java

Modified: 
struts/sandbox/trunk/tiles/src/java/org/apache/tiles/taglib/InsertTag.java
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/tiles/src/java/org/apache/tiles/taglib/InsertTag.java?rev=387594&r1=387593&r2=387594&view=diff
==============================================================================
--- struts/sandbox/trunk/tiles/src/java/org/apache/tiles/taglib/InsertTag.java 
(original)
+++ struts/sandbox/trunk/tiles/src/java/org/apache/tiles/taglib/InsertTag.java 
Tue Mar 21 10:06:42 2006
@@ -31,6 +31,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.tiles.ComponentAttribute;
 import org.apache.tiles.taglib.util.TagUtils;
 import org.apache.tiles.ComponentContext;
 import org.apache.tiles.ComponentDefinition;
@@ -492,15 +493,13 @@
         */
        public TagHandler processObjectValue(Object value) throws JspException {
                // First, check if value is one of the Typed Attribute
-            /* FIXME
-               if (value instanceof AttributeDefinition) {
+               if (value instanceof ComponentAttribute) {
                        // We have a type => return appropriate IncludeType
-                       return processTypedAttribute((AttributeDefinition) 
value);
+                       return processTypedAttribute((ComponentAttribute) 
value);
 
                } else if (value instanceof ComponentDefinition) {
                        return processDefinition((ComponentDefinition) value);
                }
-             */
 
                // Value must denote a valid String
                return processAsDefinitionOrURL(value.toString());
@@ -726,25 +725,29 @@
         * @return appropriate TagHandler.
         * @throws JspException - Throws by underlying nested call to 
processDefinitionName()
         */
-        /* FIXME
-       public TagHandler processTypedAttribute(AttributeDefinition value)
+       public TagHandler processTypedAttribute(ComponentAttribute value)
                throws JspException {
-               if (value instanceof DirectStringAttribute) {
-                       return new DirectStringHandler((String) 
value.getValue());
+            
+            if (value == null) {
+                // FIXME.
+                return null;
+            } 
+            
+            String type = value.getType();
+            if (type == null) {
+                // FIXME
+                return null;
+            }
+            
+            if (type.equalsIgnoreCase("string")) {
+               return new DirectStringHandler((String) value.getValue());
+            } else if (type.equalsIgnoreCase("definition")) {
+               return processDefinition((ComponentDefinition) 
value.getValue());
+            } 
 
-               } else if (value instanceof DefinitionAttribute) {
-                       return processDefinition((ComponentDefinition) 
value.getValue());
-
-               } else if (value instanceof DefinitionNameAttribute) {
-                       return processDefinitionName((String) value.getValue());
-               }
-
-               return new InsertHandler(
-                       (String) value.getValue(),
-                       role,
-                       getController());
+            return new InsertHandler((String) value.getValue(),
+                       role, getController());
        }
-        */
 
        /**
         * Do an include of specified page.



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

Reply via email to