Author: buildbot
Date: Wed Nov 1 21:11:48 2023
New Revision: 1084600
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 Wed Nov 1
21:11:48 2023
@@ -160,7 +160,7 @@
<span class="icon aui-icon content-type-page"
title="Page">Page:</span> </div>
<div class="details">
- <a href="ajax-and-zones.html">Ajax and Zones</a>
+ <a href="legacy-javascript.html">Legacy JavaScript</a>
</div>
@@ -169,7 +169,7 @@
<span class="icon aui-icon content-type-page"
title="Page">Page:</span> </div>
<div class="details">
- <a href="legacy-javascript.html">Legacy JavaScript</a>
+ <a href="ajax-and-zones.html">Ajax and Zones</a>
</div>
@@ -346,7 +346,7 @@ void onActionFromRegister()
return result;
}
</code></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><h2
id="AjaxandZones-Invokingserver-sideeventhandlermethodsfromJavaScriptinvoking-server-side-event-handler-methods-from-javascript">Invoking
server-side event handler methods from JavaScript<span
class="confluence-anchor-link"
id="AjaxandZones-invoking-server-side-event-handler-methods-from-javascript"></span></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 <code>@PublishEvent</code> annotation. Then, in JavaScript,
all you need to do is to call the existing <a class="external-link"
href="http://tapestry.apache.org/current/coffeescript/ajax.html">
<code>t5/core/ajax</code> </a> function, but with slightly different
parameters.</p><p>The <code>t5/core/ajax</code> function has two
parameters: <code>url</code> and <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</code> in
your component class,
call <code>componentResources.createEventLink()</code> for each event
handler method, then pass all this information back to the browser through one
of the <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 <code>dat
a-componenent-events</code> attributes. For page classes, the attribute is
added to the <code><body></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 <code><body></code>
element</li></ol><p></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><span class="confluence-anchor-link"
id="AjaxandZones-invoking-server-side-event-handler-methods-from-javascript"></span></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 <code>@PublishEvent</code> annotation. Then, in JavaScript, all
you need to do is to call the existing <a clas
s="external-link"
href="http://tapestry.apache.org/current/coffeescript/ajax.html">
<code>t5/core/ajax</code> </a> function, but with slightly different
parameters.</p><p>The <code>t5/core/ajax</code> function has two
parameters: <code>url</code> and <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</code> in
your component class,
call <code>componentResources.createEventLink()</code> for each event
handler method, then pass all this information back to the browser through one
of the <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 <code>data-componenent-events</code> attributes. For page cl
asses, the attribute is added to the <code><body></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
<code><body></code> element</li></ol><p></p><p>Here's one
example:</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">
<pre><code class="language-java">public class PublishEventDemoComponent
{
@OnEvent("answer")
Modified: websites/production/tapestry/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.