Author: greddin Date: Fri Mar 10 21:26:23 2006 New Revision: 385011 URL: http://svn.apache.org/viewcvs?rev=385011&view=rev Log: Ticket #38252. Refactoring taglib. Fixed handling of roles in DefinitionTag and PutListTag.
Modified: struts/sandbox/trunk/tiles/src/java/org/apache/tiles/taglib/DefinitionTag.java struts/sandbox/trunk/tiles/src/java/org/apache/tiles/taglib/PutListTag.java Modified: struts/sandbox/trunk/tiles/src/java/org/apache/tiles/taglib/DefinitionTag.java URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/tiles/src/java/org/apache/tiles/taglib/DefinitionTag.java?rev=385011&r1=385010&r2=385011&view=diff ============================================================================== --- struts/sandbox/trunk/tiles/src/java/org/apache/tiles/taglib/DefinitionTag.java (original) +++ struts/sandbox/trunk/tiles/src/java/org/apache/tiles/taglib/DefinitionTag.java Fri Mar 10 21:26:23 2006 @@ -98,18 +98,22 @@ // If role is set, add it in attribute definition if any. // If no attribute definition, create untyped one and set role. Object attributeValue = nestedTag.getRealValue(); -// AttributeDefinition def; + ComponentAttribute def = null; if (nestedTag.getRole() != null) { - /* FIXME try { - def = ((AttributeDefinition) attributeValue); + def = ((ComponentAttribute) attributeValue); } catch (ClassCastException ex) { - def = new UntypedAttribute(attributeValue); + def = new ComponentAttribute(attributeValue); } - def.setRole(nestedTag.getRole()); + + if (def != null) { + def.setRole(nestedTag.getRole()); + } else { + // now what? Is this an exception? + } + attributeValue = def; - */ } // now add attribute to enclosing parent (i.e. : this object) @@ -130,11 +134,9 @@ Object attributeValue = nestedTag.getList(); if (nestedTag.getRole() != null) { - /* FIXME - AttributeDefinition def = new UntypedAttribute(attributeValue); + ComponentAttribute def = new ComponentAttribute(attributeValue); def.setRole(nestedTag.getRole()); attributeValue = def; - */ } // Check if a name is defined Modified: struts/sandbox/trunk/tiles/src/java/org/apache/tiles/taglib/PutListTag.java URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/tiles/src/java/org/apache/tiles/taglib/PutListTag.java?rev=385011&r1=385010&r2=385011&view=diff ============================================================================== --- struts/sandbox/trunk/tiles/src/java/org/apache/tiles/taglib/PutListTag.java (original) +++ struts/sandbox/trunk/tiles/src/java/org/apache/tiles/taglib/PutListTag.java Fri Mar 10 21:26:23 2006 @@ -23,6 +23,7 @@ import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.TagSupport; +import org.apache.tiles.ComponentAttribute; /** * PutList tag implementation. @@ -130,12 +131,9 @@ Object attributeValue = nestedTag.getList(); if (nestedTag.getRole() != null) { - // FIXME - What to do here? - /* - AttributeDefinition def = new UntypedAttribute(attributeValue); + ComponentAttribute def = new ComponentAttribute(attributeValue); def.setRole(nestedTag.getRole()); attributeValue = def; - */ } // now add attribute to enclosing parent (i.e. : this object) @@ -154,19 +152,22 @@ // If role is set, add it in attribute definition if any. // If no attribute definition, create untyped one, and set role. Object attributeValue = nestedTag.getRealValue(); -// AttributeDefinition def; + ComponentAttribute def; if (nestedTag.getRole() != null) { - /* - FIXME - What to do here? try { - def = ((AttributeDefinition) attributeValue); + def = ((ComponentAttribute) attributeValue); } catch (ClassCastException ex) { - def = new UntypedAttribute(attributeValue); + def = new ComponentAttribute(attributeValue); } - def.setRole(nestedTag.getRole()); + + if (def != null) { + def.setRole(nestedTag.getRole()); + } else { + // what now? Is this an exception? + } + attributeValue = def; - */ } // now add attribute to enclosing parent (i.e. : this object) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]