cedric 01/09/10 05:57:26 Modified: contrib/tiles/src/share/org/apache/struts/tiles/xmlDefinition XmlAttribute.java Log: Create UntyppedAttribute if an attribute has no type but a role set. Revision Changes Path 1.2 +15 -4 jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/xmlDefinition/XmlAttribute.java Index: XmlAttribute.java =================================================================== RCS file: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/xmlDefinition/XmlAttribute.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- XmlAttribute.java 2001/08/01 14:36:42 1.1 +++ XmlAttribute.java 2001/09/10 12:57:26 1.2 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/xmlDefinition/XmlAttribute.java,v 1.1 2001/08/01 14:36:42 cedric Exp $ - * $Revision: 1.1 $ - * $Date: 2001/08/01 14:36:42 $ + * $Header: /home/cvs/jakarta-struts/contrib/tiles/src/share/org/apache/struts/tiles/xmlDefinition/XmlAttribute.java,v 1.2 2001/09/10 12:57:26 cedric Exp $ + * $Revision: 1.2 $ + * $Date: 2001/09/10 12:57:26 $ * $Author: cedric $ * */ @@ -14,6 +14,7 @@ import org.apache.struts.tiles.PathAttribute; import org.apache.struts.tiles.DefinitionAttribute; import org.apache.struts.tiles.DefinitionNameAttribute; +import org.apache.struts.tiles.UntyppedAttribute; /** * A property key-value pair. @@ -200,7 +201,7 @@ else valueType = "path"; } // end if - if( value != null && valueType!=null && !(value instanceof AttributeDefinition) ) + if( value != null && valueType!=null /* && !(value instanceof AttributeDefinition) */ ) { String strValue = value.toString(); if( valueType.equalsIgnoreCase( "string" ) ) @@ -219,7 +220,17 @@ { realValue = new DefinitionNameAttribute( strValue ); } // end if + // Set realValue's role value if needed + if( role !=null ) + ((UntyppedAttribute)realValue).setRole( role ); } // end if + + // Create attribute wrapper to hold role if role is set and no type specified + if( role!=null && value != null && valueType==null ) + { + realValue = new UntyppedAttribute( value.toString(), role ); + } // end if + return realValue; } }