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 2017/08/25 08:23:01 UTC

svn commit: r1017261 [16/41] - in /websites/production/tapestry/content: ./ cache/

Modified: websites/production/tapestry/content/environmental-services.html
==============================================================================
--- websites/production/tapestry/content/environmental-services.html (original)
+++ websites/production/tapestry/content/environmental-services.html Fri Aug 25 08:22:59 2017
@@ -27,16 +27,6 @@
       </title>
   <link type="text/css" rel="stylesheet" href="/resources/space.css" />
 
-          <link href='/resources/highlighter/styles/shCoreCXF.css' rel='stylesheet' type='text/css' />
-    <link href='/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet' type='text/css' />
-    <script src='/resources/highlighter/scripts/shCore.js' type='text/javascript'></script>
-          <script src='/resources/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
-          <script src='/resources/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
-          <script src='/resources/highlighter/scripts/shBrushPlain.js' type='text/javascript'></script>
-        <script>
-      SyntaxHighlighter.defaults['toolbar'] = false;
-      SyntaxHighlighter.all();
-    </script>
   
   <link href="/styles/style.css" rel="stylesheet" type="text/css"/>
 
@@ -77,11 +67,11 @@
       </div>
 
       <div id="content">
-                <div id="ConfluenceContent"><div class="navmenu" style="float:right; width:30%; background:#eee; margin:3px; padding:3px">
-<p>Environmental services represent yet another, distinct form of injection.</p>
+                <div id="ConfluenceContent"><p><plain-text-body>{float:right|background=#eee|width=30%}
+Environmental services represent yet another, distinct form of injection.
 
-<p>Unlike service injection (injection via a service implementation's constructor) or normal component injection (directly into component fields, via the @Inject annotation) where the injected value is always the same, with environmental services, the injected value is very late bound and dynamic.</p></div><strong>Environmental services</strong> provide a conduit of communication between two components (usually a component and the components it encloses). The first component pushes an object of a certain type into the <em>environment</em>, and then the second component can access that object merely by defining an annotated property of the same type.<p>An example of how this works is Tapestry's built-in <em>form support</em>. The <a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Form.html">Form</a> component creates an object of type <a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/t
 apestry5/services/FormSupport.html">FormSupport</a> and pushes it into the environment. Then, the enclosed form components can use that FormSupport object to participate in both the rendering of the Form and the Form's eventual submission. This is how control names and client-side ids are determined, how fields register callbacks so that they can process their part of the submission, and how fields hook themselves to client-side validation.</p><h1 id="EnvironmentalServices-Usingthe@Environmentalannotation">Using the @Environmental annotation</h1><p>The @<a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Environmental.html">Environmental</a> annotation, when used in a component class, causes the associated field to be replaced at runtime with a read-only value obtained from an Environment service provided by an enclosing component.</p><p>A very common Environmental is <a  class="external-link" href="http://tapestry.apache.org/c
 urrent/apidocs/org/apache/tapestry5/services/javascript/JavaScriptSupport.html">JavaScriptSupport</a>, used when generating <a  href="legacy-javascript.html">client-side JavaScript</a>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">  @Inject @Path("${tapestry.scriptaculous}/dragdrop.js")
+Unlike service injection (injection via a service implementation's constructor) or normal component injection (directly into component fields, via the @Inject annotation) where the injected value is always the same, with environmental services, the injected value is very late bound and dynamic.
+{float}</plain-text-body><strong>Environmental services</strong> provide a conduit of communication between two components (usually a component and the components it encloses). The first component pushes an object of a certain type into the <em>environment</em>, and then the second component can access that object merely by defining an annotated property of the same type.</p><p>An example of how this works is Tapestry's built-in <em>form support</em>. The <a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/corelib/components/Form.html">Form</a> component creates an object of type <a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/FormSupport.html">FormSupport</a> and pushes it into the environment. Then, the enclosed form components can use that FormSupport object to participate in both the rendering of the Form and the Form's eventual submission. This is how control names and client-si
 de ids are determined, how fields register callbacks so that they can process their part of the submission, and how fields hook themselves to client-side validation.</p><h1 id="EnvironmentalServices-Usingthe@Environmentalannotation">Using the @Environmental annotation</h1><p>The @<a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/annotations/Environmental.html">Environmental</a> annotation, when used in a component class, causes the associated field to be replaced at runtime with a read-only value obtained from an Environment service provided by an enclosing component.</p><p>A very common Environmental is <a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/javascript/JavaScriptSupport.html">JavaScriptSupport</a>, used when generating <a  href="legacy-javascript.html">client-side JavaScript</a>.</p><parameter ac:name="">java</parameter><plain-text-body>  @Inject @Path("${tapestry.scripta
 culous}/dragdrop.js")
   private Asset dragDropLibrary;
 
   @Environmental
@@ -92,9 +82,7 @@
     javaScriptSupport.importJavaScriptLibrary(dragDropLibrary);
   }
 
-</pre>
-</div></div><p>Environmental services are, by their nature, per-thread (and therefore per-request).</p><p>Accessing an environmental field causes a lookup, by type, against the <a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/Environment.html">Environment</a> service.</p><p>Normally, an environmental of the specified type must be available in the Environment, or an exception is thrown when accessing the field. However, if the value of the Environmental annotation's value is false, then the environmental value is optional.</p><h1 id="EnvironmentalServices-Placingavalueintheenvironment">Placing a value in the environment</h1><p>The Environment service has push() and pop() methods to put a value in the Environment, and discard it.</p><p>For example, say you were building a tab-based menu system and you needed to allow an outer TabGroup component to communicate with inner Tab components, to control various aspects of presentation.<
 /p><p>The relevant information could be exposed as an interface, TabModel.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">public class TabGroup
+</plain-text-body><p>Environmental services are, by their nature, per-thread (and therefore per-request).</p><p>Accessing an environmental field causes a lookup, by type, against the <a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/Environment.html">Environment</a> service.</p><p>Normally, an environmental of the specified type must be available in the Environment, or an exception is thrown when accessing the field. However, if the value of the Environmental annotation's value is false, then the environmental value is optional.</p><h1 id="EnvironmentalServices-Placingavalueintheenvironment">Placing a value in the environment</h1><p>The Environment service has push() and pop() methods to put a value in the Environment, and discard it.</p><p>For example, say you were building a tab-based menu system and you needed to allow an outer TabGroup component to communicate with inner Tab components, to control various aspects of presenta
 tion.</p><p>The relevant information could be exposed as an interface, TabModel.</p><parameter ac:name="">java</parameter><plain-text-body>public class TabGroup
 {
   @Inject
   private Environment environment;
@@ -120,14 +108,11 @@ public class Tab
     ...
   }
 }
-</pre>
-</div></div><p>Notice that when pushing a value into the Environment, you identify its type as well as the instance. Environment maintains a number of stacks, one for each type. Thus, pushing a TabModel into the environment won't disturb the RenderSupport or other environmentals already there.</p><p>What's important here is that the code that pushes a environmental onto a stack should also pop it off.</p><p>The enclosed class, Tab, has full access to whatever object was pushed onto the stack by the TabGroup.</p><p>The reason why Environment is a stack is so that a component can, when it makes sense, easily replace or intercept access to an Environmental.</p><h1 id="EnvironmentalServices-FundamentalEnvironmentals">Fundamental Environmentals</h1><p>Not all environmentals are pushed into the Environment by components.</p><p>A number of environmentals are initialized as part of page rendering, even before the first component starts to render. This initialization is accomplished with <a 
  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/MarkupRendererFilter.html">MarkupRendererFilter</a> contributions to the <a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/MarkupRenderer.html">MarkupRenderer</a> service.</p><h1 id="EnvironmentalServices-AccessingEnvironmentalsinServices">Accessing Environmentals in Services</h1><p>The Environmental annotation only works inside components.</p><p>To access an Environmental inside a service implementation, you must inject the Environment service and obtain values from it using the peek() method.</p><p>If this is something that will occur frequently, it is possible to create a service implementation that is "backed" by the Environment. For example, RenderSupport is accessible as a normal injection, because a service is built for it in TapestryModule:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
  panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">  public RenderSupport buildRenderSupport(EnvironmentalShadowBuilder builder)
+</plain-text-body><p>Notice that when pushing a value into the Environment, you identify its type as well as the instance. Environment maintains a number of stacks, one for each type. Thus, pushing a TabModel into the environment won't disturb the RenderSupport or other environmentals already there.</p><p>What's important here is that the code that pushes a environmental onto a stack should also pop it off.</p><p>The enclosed class, Tab, has full access to whatever object was pushed onto the stack by the TabGroup.</p><p>The reason why Environment is a stack is so that a component can, when it makes sense, easily replace or intercept access to an Environmental.</p><h1 id="EnvironmentalServices-FundamentalEnvironmentals">Fundamental Environmentals</h1><p>Not all environmentals are pushed into the Environment by components.</p><p>A number of environmentals are initialized as part of page rendering, even before the first component starts to render. This initialization is accomplished wi
 th <a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/MarkupRendererFilter.html">MarkupRendererFilter</a> contributions to the <a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/MarkupRenderer.html">MarkupRenderer</a> service.</p><h1 id="EnvironmentalServices-AccessingEnvironmentalsinServices">Accessing Environmentals in Services</h1><p>The Environmental annotation only works inside components.</p><p>To access an Environmental inside a service implementation, you must inject the Environment service and obtain values from it using the peek() method.</p><p>If this is something that will occur frequently, it is possible to create a service implementation that is "backed" by the Environment. For example, RenderSupport is accessible as a normal injection, because a service is built for it in TapestryModule:</p><parameter ac:name="">java</parameter><plain-text-body>  public RenderSu
 pport buildRenderSupport(EnvironmentalShadowBuilder builder)
   {
     return builder.build(RenderSupport.class);
   }
-</pre>
-</div></div><p>The EnvironmentShadowBuilder service creates a service implementation that delegates to the proper instance in the environment. The same technique can be used for your own services and environmentals.</p></div>
+</plain-text-body><p>The EnvironmentShadowBuilder service creates a service implementation that delegates to the proper instance in the environment. The same technique can be used for your own services and environmentals.</p></div>
       </div>
 
       <div class="clearer"></div>

Modified: websites/production/tapestry/content/error-page-recipe.html
==============================================================================
--- websites/production/tapestry/content/error-page-recipe.html (original)
+++ websites/production/tapestry/content/error-page-recipe.html Fri Aug 25 08:22:59 2017
@@ -27,16 +27,6 @@
       </title>
   <link type="text/css" rel="stylesheet" href="/resources/space.css" />
 
-          <link href='/resources/highlighter/styles/shCoreCXF.css' rel='stylesheet' type='text/css' />
-    <link href='/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet' type='text/css' />
-    <script src='/resources/highlighter/scripts/shCore.js' type='text/javascript'></script>
-          <script src='/resources/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
-          <script src='/resources/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
-          <script src='/resources/highlighter/scripts/shBrushPlain.js' type='text/javascript'></script>
-        <script>
-      SyntaxHighlighter.defaults['toolbar'] = false;
-      SyntaxHighlighter.all();
-    </script>
   
   <link href="/styles/style.css" rel="stylesheet" type="text/css"/>
 
@@ -77,50 +67,7 @@
       </div>
 
       <div id="content">
-                <div id="ConfluenceContent"><h1 id="ErrorPageRecipe-ServingTapestryPagesasServletErrorPages">Serving Tapestry Pages as Servlet Error Pages</h1><p>Do you want to dress up your site and use a snazzy Tapestry page instead of the default 404 error page? Using modern servlet containers, this is a snap!</p><div class="aui-label" style="float:right" title="Related Articles">
-
-
-
-
-
-
-
-
-<h3>Related Articles</h3>
-
-<ul class="content-by-label"><li>
-        <div>
-                <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span>        </div>
-
-        <div class="details">
-                        <a  href="error-page-recipe.html">Error Page Recipe</a>
-                
-                        
-                    </div>
-    </li><li>
-        <div>
-                <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span>        </div>
-
-        <div class="details">
-                        <a  href="specific-errors-faq.html">Specific Errors FAQ</a>
-                
-                        
-                    </div>
-    </li><li>
-        <div>
-                <span class="icon aui-icon aui-icon-small aui-iconfont-page-default" title="Page">Page:</span>        </div>
-
-        <div class="details">
-                        <a  href="overriding-exception-reporting.html">Overriding Exception Reporting</a>
-                
-                        
-                    </div>
-    </li></ul>
-</div>
-
-
-<p>Simply upgrade your application web.xml to the 2.4 version, and make a couple of changes:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>web.xml</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+                <div id="ConfluenceContent"><p><plain-text-body>{scrollbar}</plain-text-body></p><parameter ac:name="hidden">true</parameter><parameter ac:name="atlassian-macro-output-type">BLOCK</parameter><rich-text-body><p>Serving up a Tapestry page as your site's custom 404 response page</p></rich-text-body><h1 id="ErrorPageRecipe-ServingTapestryPagesasServletErrorPages">Serving Tapestry Pages as Servlet Error Pages</h1><p>Do you want to dress up your site and use a snazzy Tapestry page instead of the default 404 error page? Using modern servlet containers, this is a snap!</p><parameter ac:name="style">float:right</parameter><parameter ac:name="title">Related Articles</parameter><parameter ac:name="class">aui-label</parameter><rich-text-body><parameter ac:name="showLabels">false</parameter><parameter ac:name="showSpace">false</parameter><parameter ac:name="title">Related Articles</parameter><parameter ac:name="cql">label = "errors" and space = currentSpace()</parameter></rich-te
 xt-body><p>Simply upgrade your application web.xml to the 2.4 version, and make a couple of changes:</p><parameter ac:name="language">xml</parameter><parameter ac:name="title">web.xml</parameter><plain-text-body>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
 
 &lt;web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
@@ -149,9 +96,7 @@
   &lt;/error-page&gt;
 
 &lt;/web-app&gt;
-</pre>
-</div></div><p>Tapestry's filter must be marked as a handler for both standard requests and errors. That's accomplished with the <code>&lt;dispatcher&gt;</code> elements inside the <code>&lt;filter-mapping&gt;</code> section.</p><p>You must then map error codes to Tapestry URLs. In this case, the 404 error is send to the <code>/error404</code> resource, which is really the "Error404" Tapestry page.</p><p>We'll create a simple Error404 page, one that displays a message and (in development mode) displays the details about the incoming request.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Error404.tml</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd"&gt;
+</plain-text-body><p>Tapestry's filter must be marked as a handler for both standard requests and errors. That's accomplished with the <code>&lt;dispatcher&gt;</code> elements inside the <code>&lt;filter-mapping&gt;</code> section.</p><p>You must then map error codes to Tapestry URLs. In this case, the 404 error is send to the <code>/error404</code> resource, which is really the "Error404" Tapestry page.</p><p>We'll create a simple Error404 page, one that displays a message and (in development mode) displays the details about the incoming request.</p><parameter ac:name="language">xml</parameter><parameter ac:name="title">Error404.tml</parameter><plain-text-body>&lt;html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd"&gt;
  &lt;head&gt;
 
         &lt;title&gt;Resource not found.&lt;/title&gt;
@@ -168,9 +113,7 @@
         &lt;/div&gt;
 
     &lt;/body&gt;
-&lt;/html&gt;</pre>
-</div></div><p>The page simply makes the request and productionMode properties available:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Error404.java</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">package com.example.newapp.pages;
+&lt;/html&gt;</plain-text-body><p>The page simply makes the request and productionMode properties available:</p><parameter ac:name="language">java</parameter><parameter ac:name="title">Error404.java</parameter><plain-text-body>package com.example.newapp.pages;
 
 import org.apache.tapestry5.SymbolConstants;
 import org.apache.tapestry5.annotations.Property;
@@ -191,8 +134,7 @@ public class Error404
 }
 
 
-</pre>
-</div></div><p>The end-result, in when <em>not</em> in production mode, looks like this:</p><p><span class="confluence-embedded-file-wrapper image-center-wrapper confluence-embedded-manual-size"><img class="confluence-embedded-image confluence-content-image-border image-center" width="500" src="error-page-recipe.data/Resource_not_found_.png"></span></p><div class="confluence-information-macro confluence-information-macro-information"><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>An issue with an application that has a root Index page is that any invalid path, which would normally generate a 404 error, is instead routed to the Index page (because the invalid path looks like page's activation context). See <a  class="external-link" href="https://issues.apache.org/jira/browse/TAP5-2070">Issue TAP5-2070</a>.</p></div></div></div>
+</plain-text-body><p>The end-result, in when <em>not</em> in production mode, looks like this:</p><p><span class="confluence-embedded-file-wrapper image-center-wrapper confluence-embedded-manual-size"><img class="confluence-embedded-image confluence-content-image-border image-center" width="500" src="error-page-recipe.data/Resource_not_found_.png"></span></p><rich-text-body><p>An issue with an application that has a root Index page is that any invalid path, which would normally generate a 404 error, is instead routed to the Index page (because the invalid path looks like page's activation context). See <a  class="external-link" href="https://issues.apache.org/jira/browse/TAP5-2070">Issue TAP5-2070</a>.</p></rich-text-body></div>
       </div>
 
       <div class="clearer"></div>

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 Fri Aug 25 08:22:59 2017
@@ -27,16 +27,6 @@
       </title>
   <link type="text/css" rel="stylesheet" href="/resources/space.css" />
 
-          <link href='/resources/highlighter/styles/shCoreCXF.css' rel='stylesheet' type='text/css' />
-    <link href='/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet' type='text/css' />
-    <script src='/resources/highlighter/scripts/shCore.js' type='text/javascript'></script>
-          <script src='/resources/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
-          <script src='/resources/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
-          <script src='/resources/highlighter/scripts/shBrushPlain.js' type='text/javascript'></script>
-        <script>
-      SyntaxHighlighter.defaults['toolbar'] = false;
-      SyntaxHighlighter.all();
-    </script>
   
   <link href="/styles/style.css" rel="stylesheet" type="text/css"/>
 
@@ -77,8 +67,7 @@
       </div>
 
       <div id="content">
-                <div id="ConfluenceContent"><h1 id="ExtendingtheIfComponent-ExtendingtheIfComponent">Extending the If Component</h1><p>The <a  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  href="type-coercion.html">coerced</a> to boolean.</p><p>For example, you may be working on an application that does a lot of <a  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">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">public class SearchResult&lt;T&gt; {
+                <div id="ConfluenceContent"><plain-text-body>{scrollbar}</plain-text-body><parameter ac:name="hidden">true</parameter><parameter ac:name="atlassian-macro-output-type">BLOCK</parameter><rich-text-body><p>Adding a type coercion to enable the If component to test for anything</p></rich-text-body><h1 id="ExtendingtheIfComponent-ExtendingtheIfComponent">Extending the If Component</h1><p>The <a  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  href="type-coercion.html">coerced</a> to boolean.</p><p>For example, you may be working on an application that does a lot of <a  class="external-link" href="http://lucene.apache.org/java/docs/index.html">Lucene</a> searches, and you represent the results as a SearchResult obje
 ct:</p><parameter ac:name="language">java</parameter><parameter ac:name="title">SearchResult.java</parameter><plain-text-body>public class SearchResult&lt;T&gt; {
   public final Class&lt;T&gt; itemType;
   public final List&lt;T&gt; items;
   public final int size;
@@ -100,16 +89,12 @@
     return size == 0;
   }
 }
-</pre>
-</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">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;t:if test="searchResult"&gt;
+</plain-text-body><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><parameter ac:name="language">xml</parameter><plain-text-body>&lt;t:if test="searchResult"&gt;
   &lt;t:if test="! searchResult.empty"&gt;
     . . .
   &lt;/t:if&gt;
 &lt;/t:if&gt;
-</pre>
-</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">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">public static void contributeTypeCoercer(Configuration&lt;CoercionTuple&gt; configuration) {
+</plain-text-body><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><parameter ac:name="language">java</parameter><parameter ac:name="title">AppModule.java (partial)</parameter><plain-text-body>public static void contributeTypeCoercer(Configuration&lt;CoercionTuple&gt; configuration) {
 
   add(configuration, SearchResult.class, Boolean.class,
       new Coercion&lt;SearchResult, Boolean&gt;() {
@@ -126,13 +111,10 @@ private static &lt;S, T&gt; void add(Con
 
   configuration.add(tuple);
 }
-</pre>
-</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">
-<pre class="brush: xml; gutter: false; theme: Default" style="font-size:12px;">&lt;t:if test="searchResult"&gt;
+</plain-text-body><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><parameter ac:name="language">xml</parameter><plain-text-body>&lt;t:if test="searchResult"&gt;
   . . .
 &lt;/t:if&gt;
-</pre>
-</div></div><p>The single test now implies that <code>searchResult</code> is not null and not empty.</p></div>
+</plain-text-body><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/forms-and-form-components-faq.html
==============================================================================
--- websites/production/tapestry/content/forms-and-form-components-faq.html (original)
+++ websites/production/tapestry/content/forms-and-form-components-faq.html Fri Aug 25 08:22:59 2017
@@ -27,16 +27,6 @@
       </title>
   <link type="text/css" rel="stylesheet" href="/resources/space.css" />
 
-          <link href='/resources/highlighter/styles/shCoreCXF.css' rel='stylesheet' type='text/css' />
-    <link href='/resources/highlighter/styles/shThemeCXF.css' rel='stylesheet' type='text/css' />
-    <script src='/resources/highlighter/scripts/shCore.js' type='text/javascript'></script>
-          <script src='/resources/highlighter/scripts/shBrushJava.js' type='text/javascript'></script>
-          <script src='/resources/highlighter/scripts/shBrushXml.js' type='text/javascript'></script>
-          <script src='/resources/highlighter/scripts/shBrushPlain.js' type='text/javascript'></script>
-        <script>
-      SyntaxHighlighter.defaults['toolbar'] = false;
-      SyntaxHighlighter.all();
-    </script>
   
   <link href="/styles/style.css" rel="stylesheet" type="text/css"/>
 
@@ -77,8 +67,7 @@
       </div>
 
       <div id="content">
-                <div id="ConfluenceContent"><h2 id="FormsandFormComponentsFAQ-FormsandFormComponents">Forms and Form Components</h2><p>Main article: <a  href="forms-and-validation.html">Forms and Validation</a></p><h3 id="FormsandFormComponentsFAQ-Whatisthet:formdatahiddenfieldfor?">What is the <code>t:formdata</code> hidden field for?</h3><p>In Tapestry, rendering a form can be a complicated process; inside the body of the Form component are many of field components: TextField, Select, TextArea, and so forth. Each of these must pull data out of your data model and convert it to the string form used inside the client web browser. In addition, JavaScript to support client-side validation must be generated. This can be further complicated by the use of Loop and If components, or made really complicated by the use of Block (to render portions of other pages: this is what the BeanEditForm component does).</p><p>Along the way, the Form is generating unique form control names for each fie
 ld component, as it renders.</p><p>When the client-side Form is submitted, an event is triggered on the server-side Form component. It now needs to locate each component, in turn, inform the component of its control name, and allow the component to read the corresponding query parameter. The component then converts the client-side string back into a server-side value and performs validations before updating the data model.</p><p>That's where <code>t:formdata</code> comes in. While components are rendering, they are using the FormSupport environmental object to record callbacks:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>FormSupport.java (partial)</b></div><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: true; theme: Default" style="font-size:12px;">public interface FormSupport extends ClientElement
+                <div id="ConfluenceContent"><plain-text-body>{scrollbar}</plain-text-body><h2 id="FormsandFormComponentsFAQ-FormsandFormComponents">Forms and Form Components</h2><p>Main article: <a  href="forms-and-validation.html">Forms and Validation</a></p><h3 id="FormsandFormComponentsFAQ-Whatisthet:formdatahiddenfieldfor?">What is the <code>t:formdata</code> hidden field for?</h3><p>In Tapestry, rendering a form can be a complicated process; inside the body of the Form component are many of field components: TextField, Select, TextArea, and so forth. Each of these must pull data out of your data model and convert it to the string form used inside the client web browser. In addition, JavaScript to support client-side validation must be generated. This can be further complicated by the use of Loop and If components, or made really complicated by the use of Block (to render portions of other pages: this is what the BeanEditForm component does).</p><p>Along the way, the Form is gen
 erating unique form control names for each field component, as it renders.</p><p>When the client-side Form is submitted, an event is triggered on the server-side Form component. It now needs to locate each component, in turn, inform the component of its control name, and allow the component to read the corresponding query parameter. The component then converts the client-side string back into a server-side value and performs validations before updating the data model.</p><p>That's where <code>t:formdata</code> comes in. While components are rendering, they are using the FormSupport environmental object to record callbacks:</p><parameter ac:name="controls">true</parameter><parameter ac:name="title">FormSupport.java (partial)</parameter><parameter ac:name="linenumbers">true</parameter><plain-text-body>public interface FormSupport extends ClientElement
 {
     /**
      * Stores an action for execution during a later request.  If the action contains any mutable state, it should be in
@@ -95,25 +84,16 @@
      * @param action    the action that will be triggered (and passed the component)
      */
     &lt;T&gt; void storeAndExecute(T component, ComponentAction&lt;T&gt; action);
-</pre>
-</div></div><p>The <code>ComponentAction</code> objects are the callbacks. <code>t:formdata</code> is simply an object stream of these callbacks, compressed and encoded in Base64. When using Ajax, you may see multiple <code>t:formdata</code> hidden fields (they are processed one after another).</p><h3 id="FormsandFormComponentsFAQ-HowdoIchangethelabelforafieldonthefly?">How do I change the label for a field on the fly?</h3><p>Tapestry tries to be smart about generating the label string for a field. It has some smart default logic, first checking for the <em>component-id</em><code>-label</code> in the container's message catalog, then ultimately converting the component's id into a user-presentable label.</p><p>You can override the label in two ways:</p><p>First, you can supply a body to the <code>Label</code> component:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: true; theme: Default" style="font-size:12px;">  &lt;t:label for="username"&gt;${usernameLabel}&lt;/t:label&gt;
+</plain-text-body><p>The <code>ComponentAction</code> objects are the callbacks. <code>t:formdata</code> is simply an object stream of these callbacks, compressed and encoded in Base64. When using Ajax, you may see multiple <code>t:formdata</code> hidden fields (they are processed one after another).</p><h3 id="FormsandFormComponentsFAQ-HowdoIchangethelabelforafieldonthefly?">How do I change the label for a field on the fly?</h3><p>Tapestry tries to be smart about generating the label string for a field. It has some smart default logic, first checking for the <em>component-id</em><code>-label</code> in the container's message catalog, then ultimately converting the component's id into a user-presentable label.</p><p>You can override the label in two ways:</p><p>First, you can supply a body to the <code>Label</code> component:</p><parameter ac:name="controls">true</parameter><parameter ac:name="linenumbers">true</parameter><plain-text-body>  &lt;t:label for="username"&gt;${usernameLa
 bel}&lt;/t:label&gt;
   &lt;t:textfield t:id="username"/&gt;
-</pre>
-</div></div><p>Here, the component class must provide a <code>usernameLabel</code> property. That property becomes the text of the label. An implementation of the property might look something like:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: true; theme: Default" style="font-size:12px;">  public String getUsernameLabel()
+</plain-text-body><p>Here, the component class must provide a <code>usernameLabel</code> property. That property becomes the text of the label. An implementation of the property might look something like:</p><parameter ac:name="controls">true</parameter><parameter ac:name="linenumbers">true</parameter><plain-text-body>  public String getUsernameLabel()
   {
     return systemPreferences.useEmailAddressForUserName() ? "Email address" : "User name";
   }
-</pre>
-</div></div><p>However, if there are any validations on the field, the error message will include the default label (as discussed above).</p><p>To uniformly update the label both on the page, and in any validation messages, bind the TextField's <code>label</code> parameter:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: true; theme: Default" style="font-size:12px;">  &lt;t:label for="username"/&gt;
+</plain-text-body><p>However, if there are any validations on the field, the error message will include the default label (as discussed above).</p><p>To uniformly update the label both on the page, and in any validation messages, bind the TextField's <code>label</code> parameter:</p><parameter ac:name="controls">true</parameter><parameter ac:name="linenumbers">true</parameter><plain-text-body>  &lt;t:label for="username"/&gt;
   &lt;t:textfield t:id="username" label="prop:usernameLabel"/&gt;
-</pre>
-</div></div><p>The "prop:" prefix identifies that "usernameLabel" is to be interpreted as a property expression (normally, the binding for the <code>label</code> parameter is interpreted as a string literal). The Label component gets the text it displays from the TextField component, and the TextField component uses the same text when generating server-side and client-side validation messages.</p><h3 id="FormsandFormComponentsFAQ-Tapestryfocusesonthewrongfieldinmyform,howdoIfixthat?">Tapestry focuses on the wrong field in my form, how do I fix that?</h3><p>Tapestry normally figures out the correct field in your form to initially receive focus; this is based on assigning a <a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/FieldFocusPriority.html">FieldFocusPriority</a> to each field as it renders, which works out to the following logic:</p><ul><li>The first field which has an error</li><li>Or, the first field which is required</li><li>Or,
  the first field</li></ul><p>Occasionally, due a wide range of factors beyond Tapestry's control, it's selection will not be quite what you want, and it is necessary to supply an override. The information is tracked inside the <a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/javascript/JavaScriptSupport.html">JavaScriptSupport</a> environmental. It's just a matter of injecting the component so that you can determine its client id, then informing JavaScriptSupport about your override.</p><p>Here's an example</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">  &lt;t:textfield t:id="email" t:mixins="OverrideFieldFocus" .../&gt;
-</pre>
-</div></div><p>The <a  class="external-link" href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/corelib/mixins/OverrideFieldFocus.html">OverrideFieldFocus</a> mixin forces the email field to be the focus field, regardless.</p></div>
+</plain-text-body><p>The "prop:" prefix identifies that "usernameLabel" is to be interpreted as a property expression (normally, the binding for the <code>label</code> parameter is interpreted as a string literal). The Label component gets the text it displays from the TextField component, and the TextField component uses the same text when generating server-side and client-side validation messages.</p><h3 id="FormsandFormComponentsFAQ-Tapestryfocusesonthewrongfieldinmyform,howdoIfixthat?">Tapestry focuses on the wrong field in my form, how do I fix that?</h3><p>Tapestry normally figures out the correct field in your form to initially receive focus; this is based on assigning a <a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/FieldFocusPriority.html">FieldFocusPriority</a> to each field as it renders, which works out to the following logic:</p><ul><li>The first field which has an error</li><li>Or, the first field which is required</li><
 li>Or, the first field</li></ul><p>Occasionally, due a wide range of factors beyond Tapestry's control, it's selection will not be quite what you want, and it is necessary to supply an override. The information is tracked inside the <a  class="external-link" href="http://tapestry.apache.org/current/apidocs/org/apache/tapestry5/services/javascript/JavaScriptSupport.html">JavaScriptSupport</a> environmental. It's just a matter of injecting the component so that you can determine its client id, then informing JavaScriptSupport about your override.</p><p>Here's an example</p><plain-text-body>  &lt;t:textfield t:id="email" t:mixins="OverrideFieldFocus" .../&gt;
+</plain-text-body><p>The <a  class="external-link" href="http://tapestry.apache.org/5.4/apidocs/org/apache/tapestry5/corelib/mixins/OverrideFieldFocus.html">OverrideFieldFocus</a> mixin forces the email field to be the focus field, regardless.</p><plain-text-body>{scrollbar}</plain-text-body></div>
       </div>
 
       <div class="clearer"></div>