tiles-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Petrelli (JIRA)" <j...@apache.org>
Subject [jira] Commented: (TILES-494) Add support for a default value to attribute's cascade
Date Wed, 10 Mar 2010 11:25:27 GMT

    [ https://issues.apache.org/jira/browse/TILES-494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12843529#action_12843529
] 

Antonio Petrelli commented on TILES-494:
----------------------------------------

Sorry for the delay, but we had a problem during the migration about the issues mailing list.

I disagree here, the "cascade" mechanism should be used rarely, only when you cannot put the
attribute where it belongs, using anonymous nested definitions for example.

> Add support for a default value to attribute's cascade
> ------------------------------------------------------
>
>                 Key: TILES-494
>                 URL: https://issues.apache.org/jira/browse/TILES-494
>             Project: Tiles
>          Issue Type: Improvement
>          Components: tiles-core
>    Affects Versions: 2.2.2
>            Reporter: Mck SembWever
>
> Make it possible to specify a default value for attribute@cascade.
> I'm writing definitions for a legacy project and we don't have the luxury of a flat template
that directly inserts each defined attribute.
> To have to specify cascade="true" on every put-attribute seems excessive  verbosity.
> One solution would be to add a boolean attribute cascadeAttributes to Definition.
> For example:
> <definition name="myapp.homepage" template="/layouts/classic.jsp" cascade-attributes="true">
>   <put-attribute name="header" value="/tiles/banner.jsp" />
>   <put-attribute name="menu" value="/tiles/common_menu.jsp" />
>   <put-attribute name="body" value="/tiles/home_body.jsp" />
>   <put-attribute name="footer" value="/tiles/credits.jsp" />
> </definition>
> instead of today's
> <definition name="myapp.homepage" template="/layouts/classic.jsp">
>   <put-attribute name="header" value="/tiles/banner.jsp" cascade="true" />
>   <put-attribute name="menu" value="/tiles/common_menu.jsp" cascade="true" />
>   <put-attribute name="body" value="/tiles/home_body.jsp" cascade="true" />
>   <put-attribute name="footer" value="/tiles/credits.jsp" cascade="true" />
> </definition>
> Implementation:
>  + add to FillDefinitionRule.begin()
>           definition.setCascadeAttributes("true".equals(attributes.getValue("cascade-attributes")));
>  + change in PutAttributeRule.begin()
>            definition.putAttribute(attributes.getValue("name"), attribute,
>                     "true".equals(attributes.getValue("cascade")) || definition.getCascadeAttributes());
>  + add to Definition the getter and setter methods: getCascadeAttributes and setCascadeAttributes

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message