You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by ap...@apache.org on 2008/09/29 15:32:33 UTC

svn commit: r700127 - in /tiles/framework/trunk/src/site/apt/tutorial/advanced: nesting-extending.apt runtime.apt

Author: apetrelli
Date: Mon Sep 29 06:32:33 2008
New Revision: 700127

URL: http://svn.apache.org/viewvc?rev=700127&view=rev
Log:
TILES-298
Added documentation for cascaded attributes.

Modified:
    tiles/framework/trunk/src/site/apt/tutorial/advanced/nesting-extending.apt
    tiles/framework/trunk/src/site/apt/tutorial/advanced/runtime.apt

Modified: tiles/framework/trunk/src/site/apt/tutorial/advanced/nesting-extending.apt
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/src/site/apt/tutorial/advanced/nesting-extending.apt?rev=700127&r1=700126&r2=700127&view=diff
==============================================================================
--- tiles/framework/trunk/src/site/apt/tutorial/advanced/nesting-extending.apt (original)
+++ tiles/framework/trunk/src/site/apt/tutorial/advanced/nesting-extending.apt Mon Sep 29 06:32:33 2008
@@ -29,7 +29,7 @@
   (the one for the body) inside another definition (the main layout) can be
   useful.
 
-* Named subdefinitions
+* {Named subdefinitions}
 
   Tiles supports nesting definitions natively. One way of usng nested definitions
   is creating a named "subdefinition" and using it as an attribute. For example:
@@ -54,7 +54,7 @@
   <<<myapp.homepage>>>, by putting it inside its <<<body>>> attribute. You will
   be seeing the definition one inside the other.
 
-* Anonymous nested definitions
+* {Anonymous nested definitions}
 
   What you can do with named subdefinitions can be done with nested anonymous
   definitions. The above example can be rewritten in:
@@ -85,6 +85,33 @@
   the surrounding definition. Moreover, you can nest a definition into a nested
   definition, with the desired level of depth.
 
+* {Cascaded attributes}
+
+  Attributes defined into a definition can be cascaded to be available to all
+  nested definitions and templates. For example the
+  {{{#Named_subdefinitions}sample definition}} detailed above can be rewritten
+  this way:
+
+------------------------------------
+<definition name="myapp.homepage" template="/layouts/classic.jsp">
+  <put-attribute name="title" value="Tiles tutorial homepage" />
+  <put-attribute name="header" value="/tiles/banner.jsp" />
+  <put-attribute name="menu" value="/tiles/common_menu.jsp" />
+  <put-attribute name="body" value="/layouts/three_rows.jsp" />
+  <put-attribute name="footer" value="/tiles/credits.jsp" />
+
+  <put-attribute name="one" value="/tiles/headlines.jsp" cascade="true" />
+  <put-attribute name="two" value="/tiles/topics.jsp" cascade="true" />
+  <put-attribute name="one" value="/tiles/comments.jsp" cascade="true" />
+</definition>
+------------------------------------
+
+  The template of <<<myapp.homepage.body>>> definitionhas been used as the
+  <<<body>>> attribute in the <<<myapp.homepage>>> definition. All of the
+  attributes of <<<myapp.homepage.body>>> has been then moved as attributes
+  of <<<myapp.homepage>>> definition, but with the addition of the "cascade"
+  flag.
+
 Extending Definitions
 
   You can extend definitions like a Java class. The concepts of <abstract

Modified: tiles/framework/trunk/src/site/apt/tutorial/advanced/runtime.apt
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/src/site/apt/tutorial/advanced/runtime.apt?rev=700127&r1=700126&r2=700127&view=diff
==============================================================================
--- tiles/framework/trunk/src/site/apt/tutorial/advanced/runtime.apt (original)
+++ tiles/framework/trunk/src/site/apt/tutorial/advanced/runtime.apt Mon Sep 29 06:32:33 2008
@@ -38,6 +38,10 @@
   at runtime. To do it, you can use the <<<\<tiles:insertTemplate\>>>> tag. The
   attributes can be put using <<<\<tiles:putAttribute\>>>> and related tags.
 
+  Notice that you have all the features present in XML definition files, such as
+  {{{nesting-extending.html#Anonymous_nested_definitions}anonymous nested definitions}}
+  and {{{nesting-extending.html#Cascaded_attributes}cascade attributes}}.
+
 -----------------------------------
 <tiles:insertTemplate template="/layouts/classic.jsp">
   <tiles:putAttribute name="title" value="Tiles tutorial homepage" />