You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by bu...@apache.org on 2014/01/18 20:20:52 UTC

svn commit: r894649 [1/2] - in /websites/production/tapestry/content: ajax-components-faq.html cache/main.pageCache extending-the-if-component.html link-components-faq.html meta-programming-page-content.html templating-and-markup-faq.html

Author: buildbot
Date: Sat Jan 18 19:20:52 2014
New Revision: 894649

Log:
Production update by buildbot for tapestry

Modified:
    websites/production/tapestry/content/ajax-components-faq.html
    websites/production/tapestry/content/cache/main.pageCache
    websites/production/tapestry/content/extending-the-if-component.html
    websites/production/tapestry/content/link-components-faq.html
    websites/production/tapestry/content/meta-programming-page-content.html
    websites/production/tapestry/content/templating-and-markup-faq.html

Modified: websites/production/tapestry/content/ajax-components-faq.html
==============================================================================
--- websites/production/tapestry/content/ajax-components-faq.html (original)
+++ websites/production/tapestry/content/ajax-components-faq.html Sat Jan 18 19:20:52 2014
@@ -29,6 +29,7 @@
   <link href='http://cxf.apache.org/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet' type='text/css' />
   <script src='http://cxf.apache.org/resources/highlighter/scripts/shCore.js' type='text/javascript'></script>
   <script src='http://cxf.apache.org/resources/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
+  <script src='http://cxf.apache.org/resources/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
   <script type="text/javascript">
   SyntaxHighlighter.defaults['toolbar'] = false;
   SyntaxHighlighter.all();
@@ -77,31 +78,8 @@ table.ScrollbarTable td.ScrollbarParent 
 table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
 table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}
 
-/*]]>*/</style><div class="Scrollbar"><table class="ScrollbarTable"><tr><td colspan="1" rowspan="1" class="ScrollbarPrevIcon"><a shape="rect" href="javascript-faq.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/back_16.gif" width="16" height="16"></a></td><td colspan="1" rowspan="1" class="ScrollbarPrevName" width="33%"><a shape="rect" href="javascript-faq.html">JavaScript FAQ</a>&#160;</td><td colspan="1" rowspan="1" class="ScrollbarParent" width="33%"><sup><a shape="rect" href="frequently-asked-questions.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/up_16.gif" width="8" height="8"></a></sup><a shape="rect" href="frequently-asked-questions.html">Frequently Asked Questions</a></td><td colspan="1" rowspan="1" class="ScrollbarNextName" width="33%">&#160;<a shape="rect" href="injection-faq.html">Injection FAQ</a></td><td colspan="1" rowspan="1" class="ScrollbarNextIcon"><a shape="rect" href="injecti
 on-faq.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/forwd_16.gif" width="16" height="16"></a></td></tr></table></div>
-
-<h2 id="AjaxComponentsFAQ-AjaxComponents">Ajax Components</h2>
-
-<p>Main article: <a shape="rect" href="ajax-and-zones.html">Ajax and Zones</a></p>
-
-<h3 id="AjaxComponentsFAQ-DoIhavetospecifybothidandt:idforZonecomponents?">Do I have to specify both <code>id</code> and <code>t:id</code> for Zone components?</h3>
-
-<p>The examples for the Zone component (in the Component Reference) consistently specify both <code>id</code> and <code>t:id</code> and this is probably a good idea.</p>
-
-<p>Generally speaking, if you don't specify the client-side id (the <code>id</code> attribute), it will be the same as the Tapestry component id (<code>t:id</code>).</p>
-
-<p>However, there are any number of exceptions to this rule. The Zone may be rendering inside a Loop (in which case, each rendering will have a unique client side id). The Zone may be rendering as part of a partial page render, in which case, a random unique id is inserted into the id. There are other examples where Tapestry component ids in nested components may also clash.</p>
-
-<p>The point is, to be sure, specify the exact client id.  This will be the value for the <code>zone</code> parameter of the triggering component (such as a Form, PageLink, ActionLink, etc.).</p>
-
-<h3 id="AjaxComponentsFAQ-HowdoIupdatethecontentofaZonefromaneventhandlermethod?">How do I update the content of a Zone from an event handler method?</h3>
-
-<p>When a client-side link or form triggers an update, the return value from the event handler method is used to construct a partial page response; this partial page response includes markup content that is used to update the Zone's client-side <code>&lt;div&gt;</code> element.</p>
-
-<p>Where does that content come from?  You inject it into your page.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: true" type="syntaxhighlighter"><![CDATA[
-&lt;t:zone id=&quot;search&quot; t:id=&quot;searchZone&quot;&gt;
+/*]]>*/</style><div class="Scrollbar"><table class="ScrollbarTable"><tr><td colspan="1" rowspan="1" class="ScrollbarPrevIcon"><a shape="rect" href="javascript-faq.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/back_16.gif" width="16" height="16"></a></td><td colspan="1" rowspan="1" class="ScrollbarPrevName" width="33%"><a shape="rect" href="javascript-faq.html">JavaScript FAQ</a>&#160;</td><td colspan="1" rowspan="1" class="ScrollbarParent" width="33%"><sup><a shape="rect" href="frequently-asked-questions.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/up_16.gif" width="8" height="8"></a></sup><a shape="rect" href="frequently-asked-questions.html">Frequently Asked Questions</a></td><td colspan="1" rowspan="1" class="ScrollbarNextName" width="33%">&#160;<a shape="rect" href="injection-faq.html">Injection FAQ</a></td><td colspan="1" rowspan="1" class="ScrollbarNextIcon"><a shape="rect" href="injecti
 on-faq.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/forwd_16.gif" width="16" height="16"></a></td></tr></table></div><h2 id="AjaxComponentsFAQ-AjaxComponents">Ajax Components</h2><p>Main article: <a shape="rect" href="ajax-and-zones.html">Ajax and Zones</a></p><h3 id="AjaxComponentsFAQ-DoIhavetospecifybothidandt:idforZonecomponents?">Do I have to specify both <code>id</code> and <code>t:id</code> for Zone components?</h3><p>The examples for the Zone component (in the Component Reference) consistently specify both <code>id</code> and <code>t:id</code> and this is probably a good idea.</p><p>Generally speaking, if you don't specify the client-side id (the <code>id</code> attribute), it will be the same as the Tapestry component id (<code>t:id</code>).</p><p>However, there are any number of exceptions to this rule. The Zone may be rendering inside a Loop (in which case, each rendering will have a unique client side id). The Zone may be rend
 ering as part of a partial page render, in which case, a random unique id is inserted into the id. There are other examples where Tapestry component ids in nested components may also clash.</p><p>The point is, to be sure, specify the exact client id. This will be the value for the <code>zone</code> parameter of the triggering component (such as a Form, PageLink, ActionLink, etc.).</p><h3 id="AjaxComponentsFAQ-HowdoIupdatethecontentofaZonefromaneventhandlermethod?">How do I update the content of a Zone from an event handler method?</h3><p>When a client-side link or form triggers an update, the return value from the event handler method is used to construct a partial page response; this partial page response includes markup content that is used to update the Zone's client-side <code>&lt;div&gt;</code> element.</p><p>Where does that content come from? You inject it into your page.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;t:zone id=&quot;search&quot; t:id=&quot;searchZone&quot;&gt;
   &lt;t:form t:id=&quot;searchForm&quot; zone=&quot;searchZone&quot;&gt;
     &lt;t:textfield t:id=&quot;query&quot; size=&quot;20&quot;/&gt;
     &lt;input type=&quot;submit&quot; value=&quot;Search&quot;/&gt;
@@ -114,11 +92,8 @@ table.ScrollbarTable td.ScrollbarNextIco
   &lt;/ul&gt;
 &lt;/t:block&gt;
 ]]></script>
-</div></div>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: true" type="syntaxhighlighter"><![CDATA[
-  @Inject
+</div></div><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[  @Inject
   private Block searchResults;
 
   Object onSuccessFromSearchForm()
@@ -128,15 +103,8 @@ table.ScrollbarTable td.ScrollbarNextIco
     return searchResults;
   }
 ]]></script>
-</div></div>
-
-<p>So, when the search form is submitted, the resulting search hits are collected.  In the same request, the searchResults block is rendered, package, and sent to the client.  The form inside the client-side Zone <code>&lt;div&gt;</code> is replaced with the list of hits.</p>
-
-<p>In many cases, you just want to re-render the Zone itself, to display updated content.  In that case, you don't need a separate <code>&lt;t:block&gt;</code>, instead you can use @InjectComponent to inject the Zone object itself, and return the Zone's body:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: true" type="syntaxhighlighter"><![CDATA[
-  @InjectComponent
+</div></div><p>So, when the search form is submitted, the resulting search hits are collected. In the same request, the searchResults block is rendered, package, and sent to the client. The form inside the client-side Zone <code>&lt;div&gt;</code> is replaced with the list of hits.</p><p>In many cases, you just want to re-render the Zone itself, to display updated content. In that case, you don't need a separate <code>&lt;t:block&gt;</code>, instead you can use @InjectComponent to inject the Zone object itself, and return the Zone's body:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[  @InjectComponent
   private Zone statusZone;
 
   Object onActionFromUpdateStatus()
@@ -144,17 +112,8 @@ table.ScrollbarTable td.ScrollbarNextIco
     return statusZone.getBody();
   }
 ]]></script>
-</div></div>
-
-<h3 id="AjaxComponentsFAQ-HowtoIupdatemultiplezonesinasingleeventhandler?">How to I update multiple zones in a single event handler?</h3>
-
-<p>To do this, you must know, on the server, the client ids of each Zone. That's one of the reasons that you will generally set the Zone's client id (via the Zone's id parameter), rather than let Tapestry assign a client id for you.</p>
-
-<p>From the event handler method, instead of returning a Block or a Component, return a multi-zone update:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Multiple Zone Update (5.2)</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: true" type="syntaxhighlighter"><![CDATA[
-  @Inject
+</div></div><h3 id="AjaxComponentsFAQ-HowtoIupdatemultiplezonesinasingleeventhandler?">How to I update multiple zones in a single event handler?</h3><p>To do this, you must know, on the server, the client ids of each Zone. That's one of the reasons that you will generally set the Zone's client id (via the Zone's id parameter), rather than let Tapestry assign a client id for you.</p><p>From the event handler method, instead of returning a Block or a Component, return a multi-zone update:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Multiple Zone Update (5.2)</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[  @Inject
   private Block searchResults;
 
   @Inject
@@ -169,13 +128,8 @@ table.ScrollbarTable td.ScrollbarNextIco
     return new MultiZoneUpdate(&quot;results&quot;, searchResults).add(&quot;status&quot;, statusBlock);
   }
 ]]></script>
-</div></div>
-
-<p>The above will work in Tapestry 5.3, but MultiZoneUpdate is deprecated. For 5.3 and later, use AjaxResponseRenderer instead:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Multiple Zone Update (5.3)</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: true" type="syntaxhighlighter"><![CDATA[
-  @Inject
+</div></div><p>The above will work in Tapestry 5.3, but MultiZoneUpdate is deprecated. For 5.3 and later, use AjaxResponseRenderer instead:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Multiple Zone Update (5.3)</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[  @Inject
   private Block searchResults;
 
   @Inject
@@ -193,64 +147,19 @@ table.ScrollbarTable td.ScrollbarNextIco
     ajaxResponseRenderer.addRender(&quot;results&quot;, searchResults).addRender(&quot;status&quot;, statusBlock);
   }
 ]]></script>
-</div></div>
-
-<p>AjaxResponseRenderer adds other useful commands as well.  It also has the advantage that a simple return value can be returned to render content for the Zone that triggered the request.</p>
-
-<h3 id="AjaxComponentsFAQ-What'sthatweirdnumberinthemiddleoftheclientidsafteraZoneisupdated?">What's that weird number in the middle of the client ids after a Zone is updated?</h3>
-
-<p>You might start with markup in your template for a component such as a TextField:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: true" type="syntaxhighlighter"><![CDATA[
-  &lt;t:textfield t:id=&quot;firstName&quot;/&gt;
+</div></div><p>AjaxResponseRenderer adds other useful commands as well. It also has the advantage that a simple return value can be returned to render content for the Zone that triggered the request.</p><h3 id="AjaxComponentsFAQ-What'sthatweirdnumberinthemiddleoftheclientidsafteraZoneisupdated?">What's that weird number in the middle of the client ids after a Zone is updated?</h3><p>You might start with markup in your template for a component such as a TextField:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[  &lt;t:textfield t:id=&quot;firstName&quot;/&gt;
 ]]></script>
-</div></div>
-
-<p>When the component initially renders as part of a full page render, you get a sensible bit of markup:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: true" type="syntaxhighlighter"><![CDATA[
-  &lt;input id=&quot;firstName&quot; name=&quot;firstName&quot; type=&quot;text&quot;&gt;
+</div></div><p>When the component initially renders as part of a full page render, you get a sensible bit of markup:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[  &lt;input id=&quot;firstName&quot; name=&quot;firstName&quot; type=&quot;text&quot;&gt;
 ]]></script>
-</div></div>
-
-<p>But when the form is inside a Zone and rendered as part of a zone update, the ids get weird:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: true" type="syntaxhighlighter"><![CDATA[
-   &lt;input id=&quot;firstName_12a820cc40e&quot; name=&quot;firstName&quot; type=&quot;text&quot;&gt;
+</div></div><p>But when the form is inside a Zone and rendered as part of a zone update, the ids get weird:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[   &lt;input id=&quot;firstName_12a820cc40e&quot; name=&quot;firstName&quot; type=&quot;text&quot;&gt;
 ]]></script>
-</div></div>
-
-<p>What's happening here is that Tapestry is working to prevent unwanted id clashes as part of the page update.  In an HTML document, each <code>id</code> is expected to be unique; most JavaScript is keyed off of the <code>id</code> field, for instance.</p>
-
-<p>In a full page render, components don't just use their component id (<code>t:id</code>) as their client id; instead they use the <code>JavaScriptSupport</code> environmental to allocate a unique id. When there's no loops or conflicts, the client id matches the component id.</p>
-
-<p>When the component is inside a loop, a suffix is appended:  <code>firstName</code>, <code>firstName_0</code>, <code>firstName_1</code>, etc.</p>
-
-<p>When the component is rendered as part of an Ajax partial page update, the rules are different. Since Tapestry doesn't know what content has been rendered onto the page previously, it can't use its normal tricks to ensure that ids are unique.</p>
-
-<p>Instead, Tapestry creates a random-ish unique id suffix, such as "12a820cc40e" in the example; this suffix is appended to all allocated ids to ensure that they do not conflict with previously rendered ids.</p>
-
-<h3 id="AjaxComponentsFAQ-WhydoIsometimesgettheexception&quot;Therenderedcontentdidnotincludeanyelementsthatallowforthepositioningofthehiddenformfield'selement.&quot;whenrenderinganemptyZone?">Why do I sometimes get the exception "The rendered content did not include any elements that allow for the positioning of the hidden form field's element." when rendering an empty Zone?</h3>
-
-<p>As part of Tapestry's form processing, it must write a hidden input element with information needed when the form is submitted. Since the content of a Zone may be changed or removed, a hidden field is created just for the Zone, separate from the rest of the enclosing form.  </p>
-
-<p>At the same time, Tapestry wants to position the &lt;input&gt; field in a valid location, and HTML defines some constraints for that; an input field must appear inside a &lt;p&gt; or &lt;div&gt; element. In your empty Zone, there's no place to put the hidden element.</p>
-
-<p>The solution is to add the following to the body of your Zone:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-&lt;div class=&quot;t-invisible&quot;/&gt;
+</div></div><p>What's happening here is that Tapestry is working to prevent unwanted id clashes as part of the page update. In an HTML document, each <code>id</code> is expected to be unique; most JavaScript is keyed off of the <code>id</code> field, for instance.</p><p>In a full page render, components don't just use their component id (<code>t:id</code>) as their client id; instead they use the <code>JavaScriptSupport</code> environmental to allocate a unique id. When there's no loops or conflicts, the client id matches the component id.</p><p>When the component is inside a loop, a suffix is appended: <code>firstName</code>, <code>firstName_0</code>, <code>firstName_1</code>, etc.</p><p>When the component is rendered as part of an Ajax partial page update, the rules are different. Since Tapestry doesn't know what content has been rendered onto the page previously, it can't use its normal tricks to ensure that ids are unique.</p><p>Instead, Tapestry creates a random-ish unique id s
 uffix, such as "12a820cc40e" in the example; this suffix is appended to all allocated ids to ensure that they do not conflict with previously rendered ids.</p><h3 id="AjaxComponentsFAQ-WhydoIsometimesgettheexception&quot;Therenderedcontentdidnotincludeanyelementsthatallowforthepositioningofthehiddenformfield'selement.&quot;whenrenderinganemptyZone?">Why do I sometimes get the exception "The rendered content did not include any elements that allow for the positioning of the hidden form field's element." when rendering an empty Zone?</h3><p>As part of Tapestry's form processing, it must write a hidden input element with information needed when the form is submitted. Since the content of a Zone may be changed or removed, a hidden field is created just for the Zone, separate from the rest of the enclosing form.</p><p>At the same time, Tapestry wants to position the &lt;input&gt; field in a valid location, and HTML defines some constraints for that; an input field must appear inside a &l
 t;p&gt; or &lt;div&gt; element. In your empty Zone, there's no place to put the hidden element.</p><p>The solution is to add the following to the body of your Zone:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;div class=&quot;t-invisible&quot;/&gt;
 ]]></script>
-</div></div>
-
-<p>This ensures that there's a place for the hidden input field. The "t-invisible" CSS class ensures that the &lt;div&gt; does not display or otherwise affect layout.</p>
-
-
-<style type="text/css">/*<![CDATA[*/
+</div></div><p>This ensures that there's a place for the hidden input field. The "t-invisible" CSS class ensures that the &lt;div&gt; does not display or otherwise affect layout.</p><style type="text/css">/*<![CDATA[*/
 table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color: #f0f0f0}
 table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
 table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}

Modified: websites/production/tapestry/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/tapestry/content/extending-the-if-component.html
==============================================================================
--- websites/production/tapestry/content/extending-the-if-component.html (original)
+++ websites/production/tapestry/content/extending-the-if-component.html Sat Jan 18 19:20:52 2014
@@ -29,6 +29,7 @@
   <link href='http://cxf.apache.org/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet' type='text/css' />
   <script src='http://cxf.apache.org/resources/highlighter/scripts/shCore.js' type='text/javascript'></script>
   <script src='http://cxf.apache.org/resources/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
+  <script src='http://cxf.apache.org/resources/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
   <script type="text/javascript">
   SyntaxHighlighter.defaults['toolbar'] = false;
   SyntaxHighlighter.all();
@@ -77,18 +78,8 @@ table.ScrollbarTable td.ScrollbarParent 
 table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
 table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}
 
-/*]]>*/</style><div class="Scrollbar"><table class="ScrollbarTable"><tr><td colspan="1" rowspan="1" class="ScrollbarPrevIcon"><a shape="rect" href="error-page-recipe.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/back_16.gif" width="16" height="16"></a></td><td colspan="1" rowspan="1" class="ScrollbarPrevName" width="33%"><a shape="rect" href="error-page-recipe.html">Error Page Recipe</a>&#160;</td><td colspan="1" rowspan="1" class="ScrollbarParent" width="33%"><sup><a shape="rect" href="cookbook.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/up_16.gif" width="8" height="8"></a></sup><a shape="rect" href="cookbook.html">Cookbook</a></td><td colspan="1" rowspan="1" class="ScrollbarNextName" width="33%">&#160;<a shape="rect" href="meta-programming-page-content.html">Meta-Programming Page Content</a></td><td colspan="1" rowspan="1" class="ScrollbarNextIcon"><a shape="rect" href="meta-programming-pag
 e-content.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/forwd_16.gif" width="16" height="16"></a></td></tr></table></div> 
-<p></p>
-
-<h1 id="ExtendingtheIfComponent-ExtendingtheIfComponent">Extending the If Component</h1>
-
-<p>The <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/If.html">If</a> component can be made very flexible; its main parameter, <code>test</code>, does not <em>have</em> to be bound to a boolean value, it merely has to be bound to a value that can be <a shape="rect" href="typecoercer-service.html">coerced</a> to boolean.</p>
-
-<p>For example, you may be working on an application that does a lot of <a shape="rect" class="external-link" href="http://lucene.apache.org/java/docs/index.html">Lucene</a> searches, and you represent the results as a SearchResult object:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>SearchResult.java</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-public class SearchResult&lt;T&gt; {
+/*]]>*/</style><div class="Scrollbar"><table class="ScrollbarTable"><tr><td colspan="1" rowspan="1" class="ScrollbarPrevIcon"><a shape="rect" href="error-page-recipe.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/back_16.gif" width="16" height="16"></a></td><td colspan="1" rowspan="1" class="ScrollbarPrevName" width="33%"><a shape="rect" href="error-page-recipe.html">Error Page Recipe</a>&#160;</td><td colspan="1" rowspan="1" class="ScrollbarParent" width="33%"><sup><a shape="rect" href="cookbook.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/up_16.gif" width="8" height="8"></a></sup><a shape="rect" href="cookbook.html">Cookbook</a></td><td colspan="1" rowspan="1" class="ScrollbarNextName" width="33%">&#160;<a shape="rect" href="meta-programming-page-content.html">Meta-Programming Page Content</a></td><td colspan="1" rowspan="1" class="ScrollbarNextIcon"><a shape="rect" href="meta-programming-pag
 e-content.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/forwd_16.gif" width="16" height="16"></a></td></tr></table></div><h1 id="ExtendingtheIfComponent-ExtendingtheIfComponent">Extending the If Component</h1><p>The <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/If.html">If</a> component can be made very flexible; its main parameter, <code>test</code>, does not <em>have</em> to be bound to a boolean value, it merely has to be bound to a value that can be <a shape="rect" href="typecoercer-service.html">coerced</a> to boolean.</p><p>For example, you may be working on an application that does a lot of <a shape="rect" class="external-link" href="http://lucene.apache.org/java/docs/index.html">Lucene</a> searches, and you represent the results as a SearchResult object:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" 
 style="border-bottom-width: 1px;"><b>SearchResult.java</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[public class SearchResult&lt;T&gt; {
   public final Class&lt;T&gt; itemType;
   public final List&lt;T&gt; items;
   public final int size;
@@ -111,31 +102,15 @@ public class SearchResult&lt;T&gt; {
   }
 }
 ]]></script>
-</div></div>
-
-<p>In a SearchResult, the <code>size</code> property is the overall number of results from the search. The <code>items</code> list is a single "page" of those results to present to the user, consisting of items from <code>firstIndex</code> to <code>lastIndex</code> within the overall set.</p>
-
-<p>In your templates, you have to check to see if the SearchResult exists, then see if it is empty, before you can get to the part that displays the content:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
-&lt;t:if test=&quot;searchResult&quot;&gt;
+</div></div><p>In a SearchResult, the <code>size</code> property is the overall number of results from the search. The <code>items</code> list is a single "page" of those results to present to the user, consisting of items from <code>firstIndex</code> to <code>lastIndex</code> within the overall set.</p><p>In your templates, you have to check to see if the SearchResult exists, then see if it is empty, before you can get to the part that displays the content:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;t:if test=&quot;searchResult&quot;&gt;
   &lt;t:if test=&quot;! searchResult.empty&quot;&gt;
     . . .
   &lt;/t:if&gt;
 &lt;/t:if&gt;
 ]]></script>
-</div></div>
-
-<p>The first test checks to see if <code>searchResult</code> is not null (null is treated as false).  The second checks to see if the search result is empty.</p>
-
-<p>What we'd like is for the test to look at the <code>searchResult</code> directly and treat an empty search result as false, and a non-empty search result as true. This is similar to what Tapestry already does for Collections.</p>
-
-<p>This is just a matter of extending the TypeCoercer service:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>AppModule.java (partial)</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-public static void contributeTypeCoercer(Configuration&lt;CoercionTuple&gt; configuration) {
+</div></div><p>The first test checks to see if <code>searchResult</code> is not null (null is treated as false). The second checks to see if the search result is empty.</p><p>What we'd like is for the test to look at the <code>searchResult</code> directly and treat an empty search result as false, and a non-empty search result as true. This is similar to what Tapestry already does for Collections.</p><p>This is just a matter of extending the TypeCoercer service:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>AppModule.java (partial)</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[public static void contributeTypeCoercer(Configuration&lt;CoercionTuple&gt; configuration) {
 
   add(configuration, SearchResult.class, Boolean.class,
       new Coercion&lt;SearchResult, Boolean&gt;() {
@@ -153,21 +128,12 @@ private static &lt;S, T&gt; void add(Con
   configuration.add(tuple);
 }
 ]]></script>
-</div></div>
-
-<p>Inside this thicket of generics and brackets is the code that treats a SearchResult as a boolean:  <code>return !input.isEmpty();</code>.</p>
-
-<p>With this in place, the previous template can be simplified:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[
-&lt;t:if test=&quot;searchResult&quot;&gt;
+</div></div><p>Inside this thicket of generics and brackets is the code that treats a SearchResult as a boolean: <code>return !input.isEmpty();</code>.</p><p>With this in place, the previous template can be simplified:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;t:if test=&quot;searchResult&quot;&gt;
   . . .
 &lt;/t:if&gt;
 ]]></script>
-</div></div>
-
-<p>The single test now implies that <code>searchResult</code> is not null and not empty.</p></div>
+</div></div><p>The single test now implies that <code>searchResult</code> is not null and not empty.</p></div>
 </div>
 
 <div class="clearer"></div>

Modified: websites/production/tapestry/content/link-components-faq.html
==============================================================================
--- websites/production/tapestry/content/link-components-faq.html (original)
+++ websites/production/tapestry/content/link-components-faq.html Sat Jan 18 19:20:52 2014
@@ -29,6 +29,7 @@
   <link href='http://cxf.apache.org/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet' type='text/css' />
   <script src='http://cxf.apache.org/resources/highlighter/scripts/shCore.js' type='text/javascript'></script>
   <script src='http://cxf.apache.org/resources/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
+  <script src='http://cxf.apache.org/resources/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
   <script type="text/javascript">
   SyntaxHighlighter.defaults['toolbar'] = false;
   SyntaxHighlighter.all();
@@ -77,45 +78,22 @@ table.ScrollbarTable td.ScrollbarParent 
 table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
 table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}
 
-/*]]>*/</style><div class="Scrollbar"><table class="ScrollbarTable"><tr><td colspan="1" rowspan="1" class="ScrollbarPrevIcon"><a shape="rect" href="beaneditform-faq.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/back_16.gif" width="16" height="16"></a></td><td colspan="1" rowspan="1" class="ScrollbarPrevName" width="33%"><a shape="rect" href="beaneditform-faq.html">BeanEditForm FAQ</a>&#160;</td><td colspan="1" rowspan="1" class="ScrollbarParent" width="33%"><sup><a shape="rect" href="frequently-asked-questions.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/up_16.gif" width="8" height="8"></a></sup><a shape="rect" href="frequently-asked-questions.html">Frequently Asked Questions</a></td><td colspan="1" rowspan="1" class="ScrollbarNextName" width="33%">&#160;<a shape="rect" href="component-events-faq.html">Component Events FAQ</a></td><td colspan="1" rowspan="1" class="ScrollbarNextIcon"><a shape=
 "rect" href="component-events-faq.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/forwd_16.gif" width="16" height="16"></a></td></tr></table></div>
-
-<h2 id="LinkComponentsFAQ-LinkComponents">Link Components</h2>
-
-<h3 id="LinkComponentsFAQ-HowdoIaddqueryparameterstoaPageLinkorActionLink?">How do I add query parameters to a PageLink or ActionLink?</h3>
-
-<p>These components do not have parameters to allow you to specify query parameters for the link; they both allow you to specify a <em>context</em> (one or more values to encode into the request path).</p>
-
-<p>However, you can accomplish the same thing with a little code and markup.  For example, to create a link to another page and pass a query parameter, you can replace your PageLink component with a standard <code>&lt;a&gt;</code> tag:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: true" type="syntaxhighlighter"><![CDATA[
-&lt;a href=&quot;${profilePageLink}&quot;&gt;Display Profile (w/ full details)&lt;/a&gt;
+/*]]>*/</style><div class="Scrollbar"><table class="ScrollbarTable"><tr><td colspan="1" rowspan="1" class="ScrollbarPrevIcon"><a shape="rect" href="beaneditform-faq.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/back_16.gif" width="16" height="16"></a></td><td colspan="1" rowspan="1" class="ScrollbarPrevName" width="33%"><a shape="rect" href="beaneditform-faq.html">BeanEditForm FAQ</a>&#160;</td><td colspan="1" rowspan="1" class="ScrollbarParent" width="33%"><sup><a shape="rect" href="frequently-asked-questions.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/up_16.gif" width="8" height="8"></a></sup><a shape="rect" href="frequently-asked-questions.html">Frequently Asked Questions</a></td><td colspan="1" rowspan="1" class="ScrollbarNextName" width="33%">&#160;<a shape="rect" href="component-events-faq.html">Component Events FAQ</a></td><td colspan="1" rowspan="1" class="ScrollbarNextIcon"><a shape=
 "rect" href="component-events-faq.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/forwd_16.gif" width="16" height="16"></a></td></tr></table></div><h2 id="LinkComponentsFAQ-LinkComponents">Link Components</h2><h3 id="LinkComponentsFAQ-HowdoIaddqueryparameterstoaPageLinkorActionLink?">How do I add query parameters to a PageLink or ActionLink?</h3><p>These components do not have parameters to allow you to specify query parameters for the link; they both allow you to specify a <em>context</em> (one or more values to encode into the request path).</p><p>However, you can accomplish the same thing with a little code and markup. For example, to create a link to another page and pass a query parameter, you can replace your PageLink component with a standard <code>&lt;a&gt;</code> tag:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;a href=&quot;${profilePageLink}&quot;&gt;Display Profile (w/ full details)&lt;/a&gt;
 ]]></script>
-</div></div>
-
-<p>In the matching Java class, you can create the Link programmatically:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: true" type="syntaxhighlighter"><![CDATA[
-  @Inject
+</div></div><p>In the matching Java class, you can create the Link programmatically:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[  @Inject
   private PageRenderLinkSource linkSource;
 
   public Link getProfilePageLink()
   {
     Link link = linkSource.createPageRenderLinkWithContext(DisplayProfile.class, user);
-
     link.addParameterValue(&quot;detail&quot;, true);
-
     return link;
   }
 ]]></script>
-</div></div>
-
-<p>... and in the DisplayProfile page:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: true" type="syntaxhighlighter"><![CDATA[
-public class DisplayProfile
+</div></div><p>... and in the DisplayProfile page:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[public class DisplayProfile
 {
   void onActivate(@RequestParameter(&quot;detail&quot;) boolean detail)
   {
@@ -123,14 +101,7 @@ public class DisplayProfile
   }
 }
 ]]></script>
-</div></div>
-
-<p>The @RequestParameter annotation directs Tapestry to extract the query parameter from the request and coerce it to type boolean.  You can use any reasonable type for such a parameter (int, long and Date are common).</p>
-
-<p>A similar technique can be used to add query parmeters to component event URLs (the type generated by the ActionLink or EventLink components), by injecting the ComponentResources, and invoking method <code>createEventLink()</code>.</p>
-
-
-
+</div></div><p>The @RequestParameter annotation directs Tapestry to extract the query parameter from the request and coerce it to type boolean. You can use any reasonable type for such a parameter (int, long and Date are common).</p><p>A similar technique can be used to add query parmeters to component event URLs (the type generated by the ActionLink or EventLink components), by injecting the ComponentResources, and invoking method <code>createEventLink()</code>.</p>
 
     <div class="aui-message hint shadowed information-macro">
                     <p class="title">Added in 5.3</p>
@@ -142,26 +113,12 @@ public class DisplayProfile
     </div>
 
 <div style="border-right: 20px solid #D8E4F1;border-left: 20px solid #D8E4F1;">
-
 <p>You may also bind a link component's <code>parameters</code> parameter; this is a Map of additional query parameters to add to the URL.  The Map keys should be strings, and the Map values will be encoded to strings.  Tapestry 5.3 also adds a literal map syntax to the <a shape="rect" href="property-expressions.html" title="Property Expressions">property expression language</a>.</p>
 
-</div>
-
-<h3 id="LinkComponentsFAQ-HowdoIcreateaLinkbacktothecurrentpagefromacomponent?">How do I create a Link back to the current page from a component?</h3>
-
-<p>Sometimes it is useful to create a link back to the current page, but you don't always know the name of the page (the link may appear inside a deeply nested subcomponent).  Fortunately, this is easy. </p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-&lt;t:pagelink page=&quot;prop:componentResources.pageName&quot;&gt;refresh page&lt;/t:pagelink&gt;
+</div><h3 id="LinkComponentsFAQ-HowdoIcreateaLinkbacktothecurrentpagefromacomponent?">How do I create a Link back to the current page from a component?</h3><p>Sometimes it is useful to create a link back to the current page, but you don't always know the name of the page (the link may appear inside a deeply nested subcomponent). Fortunately, this is easy.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[&lt;t:pagelink page=&quot;prop:componentResources.pageName&quot;&gt;refresh page&lt;/t:pagelink&gt;
 ]]></script>
-</div></div>
-
-<p>Every component has an extra property, componentResources, added to it: it's the instance of <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ComponentResources.html">ComponentResources</a> that represents the link between your code and all of Tapestry's structure around your class. One of the properties of ComponentResources is pageName, the name of the page. By binding the PageLink's page parameter with the "prop:" binding prefix, we ensure that we bind to a computed property; this is necessary because the PageLink.page parameter defaults to the "literal:" binding prefix.</p>
-
-<p>As an added benefit, if the page class is ever renamed or moved to a different package, the pageName property will automatically adjust to the new name.</p>
-
-<style type="text/css">/*<![CDATA[*/
+</div></div><p>Every component has an extra property, componentResources, added to it: it's the instance of <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ComponentResources.html">ComponentResources</a> that represents the link between your code and all of Tapestry's structure around your class. One of the properties of ComponentResources is pageName, the name of the page. By binding the PageLink's page parameter with the "prop:" binding prefix, we ensure that we bind to a computed property; this is necessary because the PageLink.page parameter defaults to the "literal:" binding prefix.</p><p>As an added benefit, if the page class is ever renamed or moved to a different package, the pageName property will automatically adjust to the new name.</p><style type="text/css">/*<![CDATA[*/
 table.ScrollbarTable  {border: none;padding: 3px;width: 100%;padding: 3px;margin: 0px;background-color: #f0f0f0}
 table.ScrollbarTable td.ScrollbarPrevIcon {text-align: center;width: 16px;border: none;}
 table.ScrollbarTable td.ScrollbarPrevName {text-align: left;border: none;}

Modified: websites/production/tapestry/content/meta-programming-page-content.html
==============================================================================
--- websites/production/tapestry/content/meta-programming-page-content.html (original)
+++ websites/production/tapestry/content/meta-programming-page-content.html Sat Jan 18 19:20:52 2014
@@ -29,6 +29,7 @@
   <link href='http://cxf.apache.org/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet' type='text/css' />
   <script src='http://cxf.apache.org/resources/highlighter/scripts/shCore.js' type='text/javascript'></script>
   <script src='http://cxf.apache.org/resources/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
+  <script src='http://cxf.apache.org/resources/highlighter/scripts/shBrushJScript.js' type='text/javascript'></script>
   <script type="text/javascript">
   SyntaxHighlighter.defaults['toolbar'] = false;
   SyntaxHighlighter.all();
@@ -77,33 +78,8 @@ table.ScrollbarTable td.ScrollbarParent 
 table.ScrollbarTable td.ScrollbarNextName {text-align: right;border: none;}
 table.ScrollbarTable td.ScrollbarNextIcon {text-align: center;width: 16px;border: none;}
 
-/*]]>*/</style><div class="Scrollbar"><table class="ScrollbarTable"><tr><td colspan="1" rowspan="1" class="ScrollbarPrevIcon"><a shape="rect" href="extending-the-if-component.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/back_16.gif" width="16" height="16"></a></td><td colspan="1" rowspan="1" class="ScrollbarPrevName" width="33%"><a shape="rect" href="extending-the-if-component.html">Extending the If Component</a>&#160;</td><td colspan="1" rowspan="1" class="ScrollbarParent" width="33%"><sup><a shape="rect" href="cookbook.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/up_16.gif" width="8" height="8"></a></sup><a shape="rect" href="cookbook.html">Cookbook</a></td><td colspan="1" rowspan="1" class="ScrollbarNextName" width="33%">&#160;<a shape="rect" href="using-select-with-a-list.html">Using Select With a List</a></td><td colspan="1" rowspan="1" class="ScrollbarNextIcon"><a shape="rect" href="usi
 ng-select-with-a-list.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/forwd_16.gif" width="16" height="16"></a></td></tr></table></div> 
-<p></p>
-
-<h1 id="Meta-ProgrammingPageContent-Meta-ProgrammingPageContent">Meta-Programming Page Content</h1>
-
-<p>It is likely that you have some cross-cutting concerns across your pages, specific features you would like to "mix in" to your pages without getting tied into knots by inheritance.  This is one of those areas where Tapestry shines.</p>
-
-<p>This specific example is adapted from a real client requirement: the client was concerned about other sites wrapping his content in a frameset and making the site content appear to be theirs. Not all pages (in some cases, that would be an advantage) but specific pages in the application. For those pages, the following behaviors were required:</p>
-
-<ul><li>Set the X-Frame-Options response header to "DENY"</li><li>Include JavaScript to "pop" the page out of a frame, if in one</li></ul>
-
-
-<p>Again, this <em>could</em> be done by having a specific base-class that included a <code>beginRender()</code> method, but I think you'll see that the meta-programming approach is nearly as easy and much more flexible.</p>
-
-<h2 id="Meta-ProgrammingPageContent-ComponentMeta-Data">Component Meta-Data</h2>
-
-<p>In Tapestry, every component (and remember, pages are components) has <em>meta data</em>: an extra set of key/value pairs stored in the component's <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ComponentResources.html">ComponentResources</a>.</p>
-
-<p>By hooking into the component class transformation pipeline, we can change an annotation into meta-data that can be accessed by a filter.</p>
-
-
-
-<h2 id="Meta-ProgrammingPageContent-DefiningtheAnnotation">Defining the Annotation</h2>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ForbidFraming.java</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-package com.fnord.annotations;
+/*]]>*/</style><div class="Scrollbar"><table class="ScrollbarTable"><tr><td colspan="1" rowspan="1" class="ScrollbarPrevIcon"><a shape="rect" href="extending-the-if-component.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/back_16.gif" width="16" height="16"></a></td><td colspan="1" rowspan="1" class="ScrollbarPrevName" width="33%"><a shape="rect" href="extending-the-if-component.html">Extending the If Component</a>&#160;</td><td colspan="1" rowspan="1" class="ScrollbarParent" width="33%"><sup><a shape="rect" href="cookbook.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/up_16.gif" width="8" height="8"></a></sup><a shape="rect" href="cookbook.html">Cookbook</a></td><td colspan="1" rowspan="1" class="ScrollbarNextName" width="33%">&#160;<a shape="rect" href="using-select-with-a-list.html">Using Select With a List</a></td><td colspan="1" rowspan="1" class="ScrollbarNextIcon"><a shape="rect" href="usi
 ng-select-with-a-list.html"><img align="middle" border="0" src="https://cwiki.apache.org/confluence/images/icons/forwd_16.gif" width="16" height="16"></a></td></tr></table></div><h1 id="Meta-ProgrammingPageContent-Meta-ProgrammingPageContent">Meta-Programming Page Content</h1><p>It is likely that you have some cross-cutting concerns across your pages, specific features you would like to "mix in" to your pages without getting tied into knots by inheritance. This is one of those areas where Tapestry shines.</p><p>This specific example is adapted from a real client requirement: the client was concerned about other sites wrapping his content in a frameset and making the site content appear to be theirs. Not all pages (in some cases, that would be an advantage) but specific pages in the application. For those pages, the following behaviors were required:</p><ul><li>Set the X-Frame-Options response header to "DENY"</li><li>Include JavaScript to "pop" the page out of a frame, if in one</li
 ></ul><p>Again, this <em>could</em> be done by having a specific base-class that included a <code>beginRender()</code> method, but I think you'll see that the meta-programming approach is nearly as easy and much more flexible.</p><h2 id="Meta-ProgrammingPageContent-ComponentMeta-Data">Component Meta-Data</h2><p>In Tapestry, every component (and remember, pages are components) has <em>meta data</em>: an extra set of key/value pairs stored in the component's <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/ComponentResources.html">ComponentResources</a>.</p><p>By hooking into the component class transformation pipeline, we can change an annotation into meta-data that can be accessed by a filter.</p><h2 id="Meta-ProgrammingPageContent-DefiningtheAnnotation">Defining the Annotation</h2><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ForbidFraming
 .java</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[package com.fnord.annotations;
 
 import java.lang.annotation.Documented;
 import java.lang.annotation.ElementType;
@@ -123,24 +99,8 @@ public @interface ForbidFraming {
 
 }
 ]]></script>
-</div></div>
-
-<p>This annotation presence is all that's needed; there aren't any additional attributes to configure it.</p>
-
-<h2 id="Meta-ProgrammingPageContent-ConvertingtheAnnotationintoMeta-Data">Converting the Annotation into Meta-Data</h2>
-
-<p>This is in three parts:</p>
-
-<ul><li>Define the meta-data key, and define a constant for that key</li><li>Set a default meta-data value for the key</li><li>Set a different value for the key when the annotation is present</li></ul>
-
-
-<p>Our key is just "forbid-framing", with values "true" and "false". The default is "false".</p>
-
-<h3 id="Meta-ProgrammingPageContent-DefiningtheConstant">Defining the Constant</h3>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>FnordSymbols.java</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-package com.fnord;
+</div></div><p>This annotation presence is all that's needed; there aren't any additional attributes to configure it.</p><h2 id="Meta-ProgrammingPageContent-ConvertingtheAnnotationintoMeta-Data">Converting the Annotation into Meta-Data</h2><p>This is in three parts:</p><ul><li>Define the meta-data key, and define a constant for that key</li><li>Set a default meta-data value for the key</li><li>Set a different value for the key when the annotation is present</li></ul><p>Our key is just "forbid-framing", with values "true" and "false". The default is "false".</p><h3 id="Meta-ProgrammingPageContent-DefiningtheConstant">Defining the Constant</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>FnordSymbols.java</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[package com.fnord;
 
 import org.apache.tapestry5.services.BaseURLSource;
 
@@ -159,15 +119,8 @@ public class FnordSymbols {
 
 }
 ]]></script>
-</div></div>
-
-<h3 id="Meta-ProgrammingPageContent-SettingtheMeta-DataDefault">Setting the Meta-Data Default</h3>
-
-<p>Next, we'll create a module just for the logic directly related to framing. In the module, we'll define the default value for the meta-data.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ForbidFramingModule.class</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-package com.fnord.services.forbidframing;
+</div></div><h3 id="Meta-ProgrammingPageContent-SettingtheMeta-DataDefault">Setting the Meta-Data Default</h3><p>Next, we'll create a module just for the logic directly related to framing. In the module, we'll define the default value for the meta-data.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ForbidFramingModule.class</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[package com.fnord.services.forbidframing;
 
 import org.apache.tapestry5.ioc.MappedConfiguration;
 import org.apache.tapestry5.ioc.annotations.Contribute;
@@ -186,15 +139,8 @@ public class ForbidFramingModule {
   }
 }
 ]]></script>
-</div></div>
-
-<h3 id="Meta-ProgrammingPageContent-MappingtheAnnotation">Mapping the Annotation</h3>
-
-<p>Most of the work has already been done for us: we just have to make a contribution to the <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/meta/MetaWorker.html">MetaWorker</a> service, which is already plugged into the component class transformation pipeline. MetaWorker spots the annotations we define and uses a second object, a <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/meta/MetaDataExtractor.html">MetaDataExtractor</a> we provide, to convert the annotation into a meta-data value.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ForbidFramingModule.java (partial)</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-  @Contribute(MetaWorker.class)
+</div></div><h3 id="Meta-ProgrammingPageContent-MappingtheAnnotation">Mapping the Annotation</h3><p>Most of the work has already been done for us: we just have to make a contribution to the <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/meta/MetaWorker.html">MetaWorker</a> service, which is already plugged into the component class transformation pipeline. MetaWorker spots the annotations we define and uses a second object, a <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/meta/MetaDataExtractor.html">MetaDataExtractor</a> we provide, to convert the annotation into a meta-data value.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ForbidFramingModule.java (partial)</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[  @Contribute(MetaWorker.class)
   public static void mapAnnotationsToMetaDataValue(
       MappedConfiguration&lt;Class, MetaDataExtractor&gt; configuration) {
     configuration
@@ -202,38 +148,16 @@ public class ForbidFramingModule {
             FnordSymbols.FORBID_FRAMING));
   }
 ]]></script>
-</div></div>
-
-<p>If the ForbidFraming annotation has attributes, we would provided an implementation of MetaDataExtractor that examined those attributes to set the meta-data value. Since it has no annotations, the <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/meta/FixedExtractor.html">FixedExtractor</a> class. The argument is the meta-data key, and the default value is "true".</p>
-
-<h2 id="Meta-ProgrammingPageContent-PluggingIntoPageRendering">Plugging Into Page Rendering</h2>
-
-<p>The work we ultimately want to do occurs when rendering a page. Tapestry defines a <a shape="rect" href="pipelinebuilder-service.html">pipeline</a> for that overall process. The point of a pipeline is that we can add filters to it.  We'll add a filter that checks for the meta-data key and adds the response header and JavaScript.</p>
-
-<p>The service is <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/MarkupRenderer.html">MarkupRenderer</a>, which (being a pipeline service), takes a configuration of filters (in this case, <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/MarkupRendererFilter.html">MarkupRendererFilter</a>.</p>
-
-<p>We contribute into the pipeline; the order is important: since the filter will need to write JavaScript, it must be added <em>after</em> the built-in filter that provides the <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/javascript/JavaScriptSupport.html">JavaScriptSupport</a> environmental object.</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ForbidFramingModule.java (partial)</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-  @Contribute(MarkupRenderer.class)
+</div></div><p>If the ForbidFraming annotation has attributes, we would provided an implementation of MetaDataExtractor that examined those attributes to set the meta-data value. Since it has no annotations, the <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/meta/FixedExtractor.html">FixedExtractor</a> class. The argument is the meta-data key, and the default value is "true".</p><h2 id="Meta-ProgrammingPageContent-PluggingIntoPageRendering">Plugging Into Page Rendering</h2><p>The work we ultimately want to do occurs when rendering a page. Tapestry defines a <a shape="rect" href="pipelinebuilder-service.html">pipeline</a> for that overall process. The point of a pipeline is that we can add filters to it. We'll add a filter that checks for the meta-data key and adds the response header and JavaScript.</p><p>The service is <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apac
 he/tapestry5/services/MarkupRenderer.html">MarkupRenderer</a>, which (being a pipeline service), takes a configuration of filters (in this case, <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/MarkupRendererFilter.html">MarkupRendererFilter</a>.</p><p>We contribute into the pipeline; the order is important: since the filter will need to write JavaScript, it must be added <em>after</em> the built-in filter that provides the <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/javascript/JavaScriptSupport.html">JavaScriptSupport</a> environmental object.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ForbidFramingModule.java (partial)</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[  @Contribute(MarkupRenderer.class)
   public static void addFilter(
       OrderedConfiguration&lt;MarkupRendererFilter&gt; configuration) {
     configuration.addInstance(&quot;ForbidFraming&quot;, ForbidFramingFilter.class,
         &quot;after:JavascriptSupport&quot;);
   }
 ]]></script>
-</div></div>
-
-<p>How do you know what filters are built-in and where to add your own?  The right starting point is the JavaDoc for the method of TapestryModule that contributes the base set: <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/TapestryModule.html#contributeMarkupRenderer(org.apache.tapestry5.ioc.OrderedConfiguration, boolean, java.lang.String, boolean, org.apache.tapestry5.ioc.services.SymbolSource, org.apache.tapestry5.services.AssetSource, org.apache.tapestry5.services.javascript.JavaScriptStackSource, org.apache.tapestry5.internal.services.javascript.JavaScriptStackPathConstructor, org.apache.tapestry5.services.ValidationDecoratorFactory, org.apache.tapestry5.Asset))">contributeMarkupRenderer()</a></p>
-
-<h2 id="Meta-ProgrammingPageContent-ImplementingtheFilter">Implementing the Filter</h2>
-
-<p>Everything comes together in the filter:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>ForbidFramingFilter.java</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-package com.fnord.services.forbidframing;
+</div></div><p>How do you know what filters are built-in and where to add your own? The right starting point is the JavaDoc for the method of TapestryModule that contributes the base set: <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/TapestryModule.html#contributeMarkupRenderer(org.apache.tapestry5.ioc.OrderedConfiguration, boolean, java.lang.String, boolean, org.apache.tapestry5.ioc.services.SymbolSource, org.apache.tapestry5.services.AssetSource, org.apache.tapestry5.services.javascript.JavaScriptStackSource, org.apache.tapestry5.internal.services.javascript.JavaScriptStackPathConstructor, org.apache.tapestry5.services.ValidationDecoratorFactory, org.apache.tapestry5.Asset))">contributeMarkupRenderer()</a></p><h2 id="Meta-ProgrammingPageContent-ImplementingtheFilter">Implementing the Filter</h2><p>Everything comes together in the filter:</p><div class="code panel pdl" style="border-width: 1px;"><div class="code
 Header panelHeader pdl" style="border-bottom-width: 1px;"><b>ForbidFramingFilter.java</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[package com.fnord.services.forbidframing;
 
 import org.apache.tapestry5.MarkupWriter;
 import org.apache.tapestry5.ioc.annotations.Inject;
@@ -282,38 +206,18 @@ public class ForbidFramingFilter impleme
 
 }
 ]]></script>
-</div></div>
-
-<p>There's a bit going on in this short piece of code.  The heart of the code is the <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/MetaDataLocator.html">MetaDataLocator</a> service; given a meta-data key and a page name, it can not only extract the value, but then <a shape="rect" href="ioc-coerce.html">coerce</a> it to a desired type, all in one go.</p>
-
-<p>How do we know which page is being rendered? Before Tapestry 5.2 that was a small challenge, but 5.2 adds a method to <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/RequestGlobals.html#getActivePageName()">RequestGlobals</a> for this exact purpose.</p>
-
-<p>Both Request and JavaScriptSupport are per-thread/per-request services. You don't see that here, because that's part of the service definition, and invisible to the consumer code, as here.</p>
-
-<p>Of course, it is vitally important that the filter re-invoke <code>markup()</code> on the next renderer in the pipeline (you can see that as the last line of the method).</p>
-
-<p>This code makes one assumption: that the fnord application's Layout component added fnord.js to every page. That's necessary for the JavaScript that's added:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>fnord.js (partial)</b></div><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: javascript; gutter: false" type="syntaxhighlighter"><![CDATA[
-Fnord = {
+</div></div><p>There's a bit going on in this short piece of code. The heart of the code is the <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/MetaDataLocator.html">MetaDataLocator</a> service; given a meta-data key and a page name, it can not only extract the value, but then <a shape="rect" href="ioc-coerce.html">coerce</a> it to a desired type, all in one go.</p><p>How do we know which page is being rendered? Before Tapestry 5.2 that was a small challenge, but 5.2 adds a method to <a shape="rect" class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/RequestGlobals.html#getActivePageName()">RequestGlobals</a> for this exact purpose.</p><p>Both Request and JavaScriptSupport are per-thread/per-request services. You don't see that here, because that's part of the service definition, and invisible to the consumer code, as here.</p><p>Of course, it is vitally important th
 at the filter re-invoke <code>markup()</code> on the next renderer in the pipeline (you can see that as the last line of the method).</p><p>This code makes one assumption: that the fnord application's Layout component added fnord.js to every page. That's necessary for the JavaScript that's added:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>fnord.js (partial)</b></div><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: js; gutter: false" type="syntaxhighlighter"><![CDATA[Fnord = {
   popOutOfFrame : function() {
     if (top != self)
       top.location.replace(location);
   }
 }
 ]]></script>
-</div></div>
-
-<h2 id="Meta-ProgrammingPageContent-Conclusion">Conclusion</h2>
-
-<p>That's it: with the above code, simply adding the @ForbidFraming annotation to a page will add the response header and associated JavaScript; no inheritance hassles.  This basic pattern can be applied to a wide range of cross-cutting concerns, such as security, transaction management, logging, or virtually any other kind of situation that would normally be solved with inheritance or ugly boilerplate code.</p>
-
-    <div class="aui-message warning shadowed information-macro">
+</div></div><h2 id="Meta-ProgrammingPageContent-Conclusion">Conclusion</h2><p>That's it: with the above code, simply adding the @ForbidFraming annotation to a page will add the response header and associated JavaScript; no inheritance hassles. This basic pattern can be applied to a wide range of cross-cutting concerns, such as security, transaction management, logging, or virtually any other kind of situation that would normally be solved with inheritance or ugly boilerplate code.</p>    <div class="aui-message warning shadowed information-macro">
                             <span class="aui-icon icon-warning">Icon</span>
                 <div class="message-content">
-                            
-<p>The code in this example was designed for Tapestry 5.2.  Some names were changed to maintain the anonymity of the client (whose project is still secret at the time of writing).</p>
+                            <p>The code in this example was designed for Tapestry 5.2. Some names were changed to maintain the anonymity of the client (whose project is still secret at the time of writing).</p>
                     </div>
     </div></div>
 </div>