Author: buildbot
Date: Sat Apr  8 14:20:31 2017
New Revision: 1010051

Log:
Production update by buildbot for tapestry

Modified:
    websites/production/tapestry/content/ajax-and-zones.html
    websites/production/tapestry/content/cache/main.pageCache

Modified: websites/production/tapestry/content/ajax-and-zones.html
==============================================================================
--- websites/production/tapestry/content/ajax-and-zones.html (original)
+++ websites/production/tapestry/content/ajax-and-zones.html Sat Apr  8 
14:20:31 2017
@@ -271,7 +271,7 @@ void onActionFromRegister()
     return result;
   }
 </pre>
-</div></div><p>This presumes that <code>findByPartialAccountName()</code> will 
sort the values, otherwise you will probably want to sort them. The 
Autocomplete mixin does <em>not</em> do any sorting.</p><p>You can return an 
object array, a list, even a single object. You may return objects instead of 
strings ... and <code>toString()</code> will be used to convert them into 
client-side strings.</p><p>&#160;</p><h2 
id="AjaxandZones-Invokingserver-sideeventhandlermethodsfromJavaScript">Invoking 
server-side event handler methods from JavaScript</h2><p>Tapestry 5.4.2 
introduced an API which makes it easy for server-side events to be invoked from 
JavaScript. On the server-side, you first need to annotate the event handler 
methods you want to expose with 
the&#160;<code>@PublishEvent</code>&#160;annotation. Then, in JavaScript, all 
you need to do is to call the existing&#160;<code><a  class="external-link" 
href="http://tapestry.apache.org/current/coffeescript/ajax.html";>t5/core/ajax</a></co
 de>&#160;function, but with slightly different 
parameters.</p><p><code>t5/core/ajax</code> has two 
parameters:&#160;<code>url</code> and&#160;<code>options</code>. The first one 
was the difficult part to get when doing AJAX requests to event handler methods 
in Tapestry. You needed to inject <code>ComponentResources</code>, 
call&#160;<code>componentResources.createEventLink()</code> for each event 
handler method then pass all this information to JS through one of 
the&#160;<code>JavaScriptSupport</code> methods. Since 5.4.2, your JavaScript 
code only needs to know the event name (also called <em>event type</em>) and 
optionally indicate a DOM element to be used as a starting point for finding 
the event URL.</p><p>All event data is stored 
in&#160;<code>data-componenent-events</code> attributes. For page classes, it's 
put in the&#160;<code>&lt;body&gt;</code> element. For components, it's put in 
the first element rendered created by rendering the component. Given an HTML 
element, the sea
 rch is done until one in this order until information for the given event is 
first found:</p><ol><li>The element itself</li><li>The element's previous 
siblings, closest first (bottom-up)</li><li>The element's parents.</li><li>The 
page's &lt;<code>body&gt;</code> 
element<code>.</code></li></ol><p>&#160;</p><p>Here's one example:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div><p>This presumes that <code>findByPartialAccountName()</code> will 
sort the values, otherwise you will probably want to sort them. The 
Autocomplete mixin does <em>not</em> do any sorting.</p><p>You can return an 
object array, a list, even a single object. You may return objects instead of 
strings ... and <code>toString()</code> will be used to convert them into 
client-side strings.</p><p>&#160;</p><h2 
id="AjaxandZones-Invokingserver-sideeventhandlermethodsfromJavaScript">Invoking 
server-side event handler methods from JavaScript</h2><p>Tapestry 5.4.2 
introduced an API which makes it easy for server-side events to be invoked from 
JavaScript. On the server-side, you first need to annotate the event handler 
methods you want to expose with 
the&#160;<code>@PublishEvent</code>&#160;annotation. Then, in JavaScript, all 
you need to do is to call the existing&#160;<code><a  class="external-link" 
href="http://tapestry.apache.org/current/coffeescript/ajax.html";>t5/core/ajax</a></co
 de>&#160;function, but with slightly different parameters.</p><p><code>The 
t5/core/ajax</code>&#160;function has two parameters:&#160;<code>url</code> 
and&#160;<code>options</code>. Prior to Tapestry 5.4.2, the first one was 
difficult to get when doing AJAX requests to event handler methods. You needed 
to inject <code>ComponentResources in your component class</code>, 
call&#160;<code>componentResources.createEventLink()</code> for each event 
handler method, then pass all this information back to the browser through one 
of the&#160;<code>JavaScriptSupport</code> methods. For Tapestry 5.4.2 and 
later, your JavaScript code only needs to know the event name (also called 
<em>event type</em>) and optionally indicate a DOM element to be used as a 
starting point for finding the event URL.</p><p>All event data is stored 
in&#160;<code>data-componenent-events</code> attributes. For page classes, the 
attribute is added to the&#160;<code>&lt;body&gt;</code> element. For 
components, it's added to
  the first element rendered by the component. Given an HTML element, the 
search is performed in the following order until information for the given 
event is first found:</p><ol><li>The element itself</li><li>The element's 
previous siblings, closest first (bottom-up)</li><li>The element's 
parents</li><li>The page's &lt;<code>body&gt;</code> 
element</li></ol><p>&#160;</p><p>Here's one 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;">public class PublishEventDemoComponent
 {
     @OnEvent("answer")

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


Reply via email to