You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Lance Java <la...@googlemail.com> on 2012/01/05 14:40:18 UTC

Eventlink - Ajax without zone parameter

Correct me if I'm wrong but currently, if you want an eventlink to use
ajax, you must provide a "zone" parameter. This may have been fine in early
versions of tapestry 5 but there are now circumstances where we want an
eventlink to be done via XHR but shouldn't need to specify a zone in the
tml. These include:

1. MultiZoneUpdate where the zone(s) are determined in the event handler

2. AjaxResponseRenderer where zone updates and javascript execs can be
invoked in the event handler

As a suggestion, eventlink could have a new boolean parameter for ajax

eg <t:eventlink event="foo" ajax="true" />

Should I raise a JIRA for this?

Re: Eventlink - Ajax without zone parameter

Posted by Lance Java <la...@googlemail.com>.
I have a minor issue with using "xhr" vs "ajax" as ajax > xhr

It is possible to perform ajax without using an XmlHttpRequest. For
instance, in some browsers it is not currently possible to ajax upload a
file. Instead, you must post to a hidden iframe. I haven't looked at the
code but is possible that tapestry uses this method when posting a form to
a zone.

My 2p ;)

On Thursday, 12 January 2012, Paul Stanton <pa...@mapshed.com.au> wrote:
> Igor,
>
> The zone wildcard idea is a bit flawed in that this 'should' work without
any zones on the page whatsoever. A zone update is not required for
AjaxResponseRenderer to be valid, therefore relying on a zone being present
is illogical.
>
> While a rare case, what would be wrong with executing an eventlink (or
the like) who's event handler just adds a script command to the
AjaxResponseRenderer?
>
> tml:
>
> <a t:type="eventlink" event="click" xhr="true">click</a>
>
> java:
>
> private void onClick()
> {
>    ajaxResponseRenderer.addCallback(new JavaScriptCallback() {
>            @Override
>            public void run(JavaScriptSupport javascriptSupport) {
>                javascriptSupport.addScript("alert('hello');");
>            }
>        });
> }
>
> As I mention in the Jira issue (which you should all vote for) you could
easily ensure backwards compatibility with some simple logic, ie:
> isXhr = xhrParam || zoneParam != null
>
> The problem is that the whole reliance on ZoneManager (tapestry.js) for
ajax response processing is out dated. Its left over from the initial
architecture that an event was tied to a single zone for request/response
handling.
>
> In my opinion Tapestry.ajaxRequest (or alternative) should be able to
handle anything AjaxResponseRenderer can throw back at it.
>
> If this were fixed, it would also resolve my other pet hate - the
inability to initialise an xhr request (who's handler makes use of
AjaxResponseRenderer) from script without linking to a zone/ZoneManager.
>
> I love tapestry but I hate this feature of it.
>
> Regards, Paul.
>
> On 6/01/2012 9:22 AM, Paul Stanton wrote:
>
> +1 vote for this, I previously raised this last January.
>
> https://issues.apache.org/jira/browse/TAP5-1404
>
> On 6/01/2012 7:37 AM, Igor Drobiazko wrote:
>
> This not a good idea, as we consequently would need to provide
> AjaxActionLink, AjaxPageLink, AjaxForm, etc.
>
> On Thu, Jan 5, 2012 at 9:02 PM, Muhammad Gelbana<m.gelbana@gmail.com
>wrote:
>
> Or maybe a whole new component with a whole different name ? Instead of
> EventLink we can have AjaxEventLink or something..just an idea.
> I bet you will find this page very interesting Lance
> http://tawus.wordpress.com/2011/10/01/tapestry-5-3-new-features-part-2/ It
> demonstrates many different flavors of ajax calls in tapestry.
>
> On Thu, Jan 5, 2012 at 8:09 PM, Dragan Sahpaski
> <dr...@gmail.com>wrote:
>
> On Thu, Jan 5, 2012 at 5:35 PM, Igor Drobiazko<igor.drobiazko@gmail.com
>
> wrote:
> Maybe we should reuse zone paramater by passing a special zone id like
> zone="*". There is already a special id ^, which means the first
>
> container
>
> zone.
>
> I like this idea.
> I''m using "^" a lot so at least for me it's a good concept.
>
> Cheers
>
>
> On Thu, Jan 5, 2012 at 2:40 PM, Lance Java<lance.java@googlemail.com
>
> wrote:
> Correct me if I'm wrong but currently, if you want an eventlink to
>
> use
>
> ajax, you must provide a "zone" parameter. This may have been fine in
>
> early
>
> versions of tapestry 5 but there are now circumstances where we want
>
> an
>
> eventlink to be done via XHR but shouldn't need to specify a zone in
>
> the
>
> tml. These include:
>
> 1. MultiZoneUpdate where the zone(s) are determined in the event
>
> handler
>
> 2. AjaxResponseRenderer where zone updates and javascript execs can
>
> be
>
> invoked in the event handler
>
> As a suggestion, eventlink could have a new boolean parameter for
>
> ajax
>
> eg

Re: Eventlink - Ajax without zone parameter

Posted by Paul Stanton <pa...@mapshed.com.au>.
Here's a script/component I use to generate callbacks to tapestry xhr 
event handlers direct from script. Feel free to use this if it makes 
sense to you.

You can either include the component on a page via "<t:EventCallback />" 
which will also include the script, or just @Import the script in your 
component/page java class. The tml just makes sure there is a zone to use:

[project-package-dir]/components/EventCallback.tml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<div xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" 
xmlns:p="tapestry:parameter">
<t:zone t:id="dummyZone" style="display:none;" />
</div>

The real feature is the js:

[project-package-dir]/components/EventCallback.js

/**
  * creates an object used to create tapestry supported
  * ajax callbacks to tapestry component events.
  *
  * eg:
  *     new EventCallback(url).call(["argument1"]);
  *
  * where url is generated via
  *     
org.apache.tapestry5.ComponentResources.createEventLink(?).toAbsoluteURI();
  */
EventCallback = Class.create(
{
     initialize: function(url)
     {
         this.url = url;
     },

     call: function(params, zone)
     {
         // if none specified, use any found on page
         if (!zone)
             zone = Element.select(document, ".t-zone").first();
         // if none found, error (tapestry needs one)
         if (!zone)
             throw "no zones on page";
         // convert to tapestry zone object
         zone = Tapestry.findZoneManagerForZone(zone.id);
         if (zone == null)
             throw "zone not found for " + zone.id;

         var url = this.url;

         // strip query string for later appending
         var queryString = "";
         var queryStringIndex = url.indexOf("?");
         if (queryStringIndex != -1)
         {
             queryString = url.substring(queryStringIndex);
             url = url.substring(0, queryStringIndex);
         }

         // strip jsessionid string for later appending (present if 
cookies disabled)
         var sessionId = "";
         var sessionIndex = url.indexOf(";");
         if (sessionIndex != -1)
         {
             sessionId = url.substring(sessionIndex);
             url = url.substring(0, sessionIndex);
         }

         // append context parameters
         if (!params)
             params = [];
         if (!(params instanceof Array))
             params = [params];
         for (var p = 0; p < params.length; p++)
             url += "/" + params[p];

         // initialise request/response/callback with tapestry support
         zone.updateFromURL(url + sessionId + queryString);
     },

     CLASS_NAME: "EventCallback"
});

On 13/01/2012 4:58 AM, Jochen Frey wrote:
> +1. Voted.
>
> On Jan 12, 2012, at 9:16 AM, Lenny Primak wrote:
>
>> +1. Voted.
>>
>>
>>
>> On Jan 12, 2012, at 3:28 AM, Paul Stanton<pa...@mapshed.com.au>  wrote:
>>
>>> Igor,
>>>
>>> The zone wildcard idea is a bit flawed in that this 'should' work without any zones on the page whatsoever. A zone update is not required for AjaxResponseRenderer to be valid, therefore relying on a zone being present is illogical.
>>>
>>> While a rare case, what would be wrong with executing an eventlink (or the like) who's event handler just adds a script command to the AjaxResponseRenderer?
>>>
>>> tml:
>>>
>>> <a t:type="eventlink" event="click" xhr="true">click</a>
>>>
>>> java:
>>>
>>> private void onClick()
>>> {
>>>    ajaxResponseRenderer.addCallback(new JavaScriptCallback() {
>>>            @Override
>>>            public void run(JavaScriptSupport javascriptSupport) {
>>>                javascriptSupport.addScript("alert('hello');");
>>>            }
>>>        });
>>> }
>>>
>>> As I mention in the Jira issue (which you should all vote for) you could easily ensure backwards compatibility with some simple logic, ie:
>>> isXhr = xhrParam || zoneParam != null
>>>
>>> The problem is that the whole reliance on ZoneManager (tapestry.js) for ajax response processing is out dated. Its left over from the initial architecture that an event was tied to a single zone for request/response handling.
>>>
>>> In my opinion Tapestry.ajaxRequest (or alternative) should be able to handle anything AjaxResponseRenderer can throw back at it.
>>>
>>> If this were fixed, it would also resolve my other pet hate - the inability to initialise an xhr request (who's handler makes use of AjaxResponseRenderer) from script without linking to a zone/ZoneManager.
>>>
>>> I love tapestry but I hate this feature of it.
>>>
>>> Regards, Paul.
>>>
>>> On 6/01/2012 9:22 AM, Paul Stanton wrote:
>>>> +1 vote for this, I previously raised this last January.
>>>>
>>>> https://issues.apache.org/jira/browse/TAP5-1404
>>>>
>>>> On 6/01/2012 7:37 AM, Igor Drobiazko wrote:
>>>>> This not a good idea, as we consequently would need to provide
>>>>> AjaxActionLink, AjaxPageLink, AjaxForm, etc.
>>>>>
>>>>> On Thu, Jan 5, 2012 at 9:02 PM, Muhammad Gelbana<m....@gmail.com>wrote:
>>>>>
>>>>>> Or maybe a whole new component with a whole different name ? Instead of
>>>>>> EventLink we can have AjaxEventLink or something..just an idea.
>>>>>> I bet you will find this page very interesting Lance
>>>>>> http://tawus.wordpress.com/2011/10/01/tapestry-5-3-new-features-part-2/ It
>>>>>> demonstrates many different flavors of ajax calls in tapestry.
>>>>>>
>>>>>> On Thu, Jan 5, 2012 at 8:09 PM, Dragan Sahpaski
>>>>>> <dr...@gmail.com>wrote:
>>>>>>
>>>>>>> On Thu, Jan 5, 2012 at 5:35 PM, Igor Drobiazko<igor.drobiazko@gmail.com
>>>>>>>> wrote:
>>>>>>>> Maybe we should reuse zone paramater by passing a special zone id like
>>>>>>>> zone="*". There is already a special id ^, which means the first
>>>>>>> container
>>>>>>>> zone.
>>>>>>>>
>>>>>>> I like this idea.
>>>>>>> I''m using "^" a lot so at least for me it's a good concept.
>>>>>>>
>>>>>>> Cheers
>>>>>>>
>>>>>>>
>>>>>>>> On Thu, Jan 5, 2012 at 2:40 PM, Lance Java<lance.java@googlemail.com
>>>>>>>>> wrote:
>>>>>>>>> Correct me if I'm wrong but currently, if you want an eventlink to
>>>>>> use
>>>>>>>>> ajax, you must provide a "zone" parameter. This may have been fine in
>>>>>>>> early
>>>>>>>>> versions of tapestry 5 but there are now circumstances where we want
>>>>>> an
>>>>>>>>> eventlink to be done via XHR but shouldn't need to specify a zone in
>>>>>>> the
>>>>>>>>> tml. These include:
>>>>>>>>>
>>>>>>>>> 1. MultiZoneUpdate where the zone(s) are determined in the event
>>>>>>> handler
>>>>>>>>> 2. AjaxResponseRenderer where zone updates and javascript execs can
>>>>>> be
>>>>>>>>> invoked in the event handler
>>>>>>>>>
>>>>>>>>> As a suggestion, eventlink could have a new boolean parameter for
>>>>>> ajax
>>>>>>>>> eg<t:eventlink event="foo" ajax="true" />
>>>>>>>>>
>>>>>>>>> Should I raise a JIRA for this?
>>>>>>>>>
>>>>>>>>
>>>>>>>> -- 
>>>>>>>> Best regards,
>>>>>>>>
>>>>>>>> Igor Drobiazko
>>>>>>>> http://tapestry5.de
>>>>>>>> http://twitter.com/drobiazko
>>>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> *Regards,*
>>>>>> *Muhammad Gelbana
>>>>>> Java Developer*
>>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
> ---
>    jochen@jochenfrey.com
>    +1.415.366.0450
>    @jochen_frey
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Eventlink - Ajax without zone parameter

Posted by Jochen Frey <jo...@jochenfrey.com>.
+1. Voted.

On Jan 12, 2012, at 9:16 AM, Lenny Primak wrote:

> +1. Voted. 
> 
> 
> 
> On Jan 12, 2012, at 3:28 AM, Paul Stanton <pa...@mapshed.com.au> wrote:
> 
>> Igor,
>> 
>> The zone wildcard idea is a bit flawed in that this 'should' work without any zones on the page whatsoever. A zone update is not required for AjaxResponseRenderer to be valid, therefore relying on a zone being present is illogical.
>> 
>> While a rare case, what would be wrong with executing an eventlink (or the like) who's event handler just adds a script command to the AjaxResponseRenderer?
>> 
>> tml:
>> 
>> <a t:type="eventlink" event="click" xhr="true">click</a>
>> 
>> java:
>> 
>> private void onClick()
>> {
>>   ajaxResponseRenderer.addCallback(new JavaScriptCallback() {
>>           @Override
>>           public void run(JavaScriptSupport javascriptSupport) {
>>               javascriptSupport.addScript("alert('hello');");
>>           }
>>       });
>> }
>> 
>> As I mention in the Jira issue (which you should all vote for) you could easily ensure backwards compatibility with some simple logic, ie:
>> isXhr = xhrParam || zoneParam != null
>> 
>> The problem is that the whole reliance on ZoneManager (tapestry.js) for ajax response processing is out dated. Its left over from the initial architecture that an event was tied to a single zone for request/response handling.
>> 
>> In my opinion Tapestry.ajaxRequest (or alternative) should be able to handle anything AjaxResponseRenderer can throw back at it.
>> 
>> If this were fixed, it would also resolve my other pet hate - the inability to initialise an xhr request (who's handler makes use of AjaxResponseRenderer) from script without linking to a zone/ZoneManager.
>> 
>> I love tapestry but I hate this feature of it.
>> 
>> Regards, Paul.
>> 
>> On 6/01/2012 9:22 AM, Paul Stanton wrote:
>>> +1 vote for this, I previously raised this last January.
>>> 
>>> https://issues.apache.org/jira/browse/TAP5-1404
>>> 
>>> On 6/01/2012 7:37 AM, Igor Drobiazko wrote:
>>>> This not a good idea, as we consequently would need to provide
>>>> AjaxActionLink, AjaxPageLink, AjaxForm, etc.
>>>> 
>>>> On Thu, Jan 5, 2012 at 9:02 PM, Muhammad Gelbana<m....@gmail.com>wrote:
>>>> 
>>>>> Or maybe a whole new component with a whole different name ? Instead of
>>>>> EventLink we can have AjaxEventLink or something..just an idea.
>>>>> I bet you will find this page very interesting Lance
>>>>> http://tawus.wordpress.com/2011/10/01/tapestry-5-3-new-features-part-2/ It
>>>>> demonstrates many different flavors of ajax calls in tapestry.
>>>>> 
>>>>> On Thu, Jan 5, 2012 at 8:09 PM, Dragan Sahpaski
>>>>> <dr...@gmail.com>wrote:
>>>>> 
>>>>>> On Thu, Jan 5, 2012 at 5:35 PM, Igor Drobiazko<igor.drobiazko@gmail.com
>>>>>>> wrote:
>>>>>>> Maybe we should reuse zone paramater by passing a special zone id like
>>>>>>> zone="*". There is already a special id ^, which means the first
>>>>>> container
>>>>>>> zone.
>>>>>>> 
>>>>>> I like this idea.
>>>>>> I''m using "^" a lot so at least for me it's a good concept.
>>>>>> 
>>>>>> Cheers
>>>>>> 
>>>>>> 
>>>>>>> On Thu, Jan 5, 2012 at 2:40 PM, Lance Java<lance.java@googlemail.com
>>>>>>>> wrote:
>>>>>>>> Correct me if I'm wrong but currently, if you want an eventlink to
>>>>> use
>>>>>>>> ajax, you must provide a "zone" parameter. This may have been fine in
>>>>>>> early
>>>>>>>> versions of tapestry 5 but there are now circumstances where we want
>>>>> an
>>>>>>>> eventlink to be done via XHR but shouldn't need to specify a zone in
>>>>>> the
>>>>>>>> tml. These include:
>>>>>>>> 
>>>>>>>> 1. MultiZoneUpdate where the zone(s) are determined in the event
>>>>>> handler
>>>>>>>> 2. AjaxResponseRenderer where zone updates and javascript execs can
>>>>> be
>>>>>>>> invoked in the event handler
>>>>>>>> 
>>>>>>>> As a suggestion, eventlink could have a new boolean parameter for
>>>>> ajax
>>>>>>>> eg<t:eventlink event="foo" ajax="true" />
>>>>>>>> 
>>>>>>>> Should I raise a JIRA for this?
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> -- 
>>>>>>> Best regards,
>>>>>>> 
>>>>>>> Igor Drobiazko
>>>>>>> http://tapestry5.de
>>>>>>> http://twitter.com/drobiazko
>>>>>>> 
>>>>> 
>>>>> 
>>>>> -- 
>>>>> *Regards,*
>>>>> *Muhammad Gelbana
>>>>> Java Developer*
>>>>> 
>>>> 
>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>> 
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 


---
  jochen@jochenfrey.com
  +1.415.366.0450
  @jochen_frey


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Eventlink - Ajax without zone parameter

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
+1. Voted. 



On Jan 12, 2012, at 3:28 AM, Paul Stanton <pa...@mapshed.com.au> wrote:

> Igor,
> 
> The zone wildcard idea is a bit flawed in that this 'should' work without any zones on the page whatsoever. A zone update is not required for AjaxResponseRenderer to be valid, therefore relying on a zone being present is illogical.
> 
> While a rare case, what would be wrong with executing an eventlink (or the like) who's event handler just adds a script command to the AjaxResponseRenderer?
> 
> tml:
> 
> <a t:type="eventlink" event="click" xhr="true">click</a>
> 
> java:
> 
> private void onClick()
> {
>    ajaxResponseRenderer.addCallback(new JavaScriptCallback() {
>            @Override
>            public void run(JavaScriptSupport javascriptSupport) {
>                javascriptSupport.addScript("alert('hello');");
>            }
>        });
> }
> 
> As I mention in the Jira issue (which you should all vote for) you could easily ensure backwards compatibility with some simple logic, ie:
> isXhr = xhrParam || zoneParam != null
> 
> The problem is that the whole reliance on ZoneManager (tapestry.js) for ajax response processing is out dated. Its left over from the initial architecture that an event was tied to a single zone for request/response handling.
> 
> In my opinion Tapestry.ajaxRequest (or alternative) should be able to handle anything AjaxResponseRenderer can throw back at it.
> 
> If this were fixed, it would also resolve my other pet hate - the inability to initialise an xhr request (who's handler makes use of AjaxResponseRenderer) from script without linking to a zone/ZoneManager.
> 
> I love tapestry but I hate this feature of it.
> 
> Regards, Paul.
> 
> On 6/01/2012 9:22 AM, Paul Stanton wrote:
>> +1 vote for this, I previously raised this last January.
>> 
>> https://issues.apache.org/jira/browse/TAP5-1404
>> 
>> On 6/01/2012 7:37 AM, Igor Drobiazko wrote:
>>> This not a good idea, as we consequently would need to provide
>>> AjaxActionLink, AjaxPageLink, AjaxForm, etc.
>>> 
>>> On Thu, Jan 5, 2012 at 9:02 PM, Muhammad Gelbana<m....@gmail.com>wrote:
>>> 
>>>> Or maybe a whole new component with a whole different name ? Instead of
>>>> EventLink we can have AjaxEventLink or something..just an idea.
>>>> I bet you will find this page very interesting Lance
>>>> http://tawus.wordpress.com/2011/10/01/tapestry-5-3-new-features-part-2/ It
>>>> demonstrates many different flavors of ajax calls in tapestry.
>>>> 
>>>> On Thu, Jan 5, 2012 at 8:09 PM, Dragan Sahpaski
>>>> <dr...@gmail.com>wrote:
>>>> 
>>>>> On Thu, Jan 5, 2012 at 5:35 PM, Igor Drobiazko<igor.drobiazko@gmail.com
>>>>>> wrote:
>>>>>> Maybe we should reuse zone paramater by passing a special zone id like
>>>>>> zone="*". There is already a special id ^, which means the first
>>>>> container
>>>>>> zone.
>>>>>> 
>>>>> I like this idea.
>>>>> I''m using "^" a lot so at least for me it's a good concept.
>>>>> 
>>>>> Cheers
>>>>> 
>>>>> 
>>>>>> On Thu, Jan 5, 2012 at 2:40 PM, Lance Java<lance.java@googlemail.com
>>>>>>> wrote:
>>>>>>> Correct me if I'm wrong but currently, if you want an eventlink to
>>>> use
>>>>>>> ajax, you must provide a "zone" parameter. This may have been fine in
>>>>>> early
>>>>>>> versions of tapestry 5 but there are now circumstances where we want
>>>> an
>>>>>>> eventlink to be done via XHR but shouldn't need to specify a zone in
>>>>> the
>>>>>>> tml. These include:
>>>>>>> 
>>>>>>> 1. MultiZoneUpdate where the zone(s) are determined in the event
>>>>> handler
>>>>>>> 2. AjaxResponseRenderer where zone updates and javascript execs can
>>>> be
>>>>>>> invoked in the event handler
>>>>>>> 
>>>>>>> As a suggestion, eventlink could have a new boolean parameter for
>>>> ajax
>>>>>>> eg<t:eventlink event="foo" ajax="true" />
>>>>>>> 
>>>>>>> Should I raise a JIRA for this?
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> -- 
>>>>>> Best regards,
>>>>>> 
>>>>>> Igor Drobiazko
>>>>>> http://tapestry5.de
>>>>>> http://twitter.com/drobiazko
>>>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> *Regards,*
>>>> *Muhammad Gelbana
>>>> Java Developer*
>>>> 
>>> 
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Eventlink - Ajax without zone parameter

Posted by Paul Stanton <pa...@mapshed.com.au>.
Igor,

The zone wildcard idea is a bit flawed in that this 'should' work 
without any zones on the page whatsoever. A zone update is not required 
for AjaxResponseRenderer to be valid, therefore relying on a zone being 
present is illogical.

While a rare case, what would be wrong with executing an eventlink (or 
the like) who's event handler just adds a script command to the 
AjaxResponseRenderer?

tml:

<a t:type="eventlink" event="click" xhr="true">click</a>

java:

private void onClick()
{
     ajaxResponseRenderer.addCallback(new JavaScriptCallback() {
             @Override
             public void run(JavaScriptSupport javascriptSupport) {
                 javascriptSupport.addScript("alert('hello');");
             }
         });
}

As I mention in the Jira issue (which you should all vote for) you could 
easily ensure backwards compatibility with some simple logic, ie:
isXhr = xhrParam || zoneParam != null

The problem is that the whole reliance on ZoneManager (tapestry.js) for 
ajax response processing is out dated. Its left over from the initial 
architecture that an event was tied to a single zone for 
request/response handling.

In my opinion Tapestry.ajaxRequest (or alternative) should be able to 
handle anything AjaxResponseRenderer can throw back at it.

If this were fixed, it would also resolve my other pet hate - the 
inability to initialise an xhr request (who's handler makes use of 
AjaxResponseRenderer) from script without linking to a zone/ZoneManager.

I love tapestry but I hate this feature of it.

Regards, Paul.

On 6/01/2012 9:22 AM, Paul Stanton wrote:
> +1 vote for this, I previously raised this last January.
>
> https://issues.apache.org/jira/browse/TAP5-1404
>
> On 6/01/2012 7:37 AM, Igor Drobiazko wrote:
>> This not a good idea, as we consequently would need to provide
>> AjaxActionLink, AjaxPageLink, AjaxForm, etc.
>>
>> On Thu, Jan 5, 2012 at 9:02 PM, Muhammad 
>> Gelbana<m....@gmail.com>wrote:
>>
>>> Or maybe a whole new component with a whole different name ? Instead of
>>> EventLink we can have AjaxEventLink or something..just an idea.
>>> I bet you will find this page very interesting Lance
>>> http://tawus.wordpress.com/2011/10/01/tapestry-5-3-new-features-part-2/ 
>>> It
>>> demonstrates many different flavors of ajax calls in tapestry.
>>>
>>> On Thu, Jan 5, 2012 at 8:09 PM, Dragan Sahpaski
>>> <dr...@gmail.com>wrote:
>>>
>>>> On Thu, Jan 5, 2012 at 5:35 PM, Igor 
>>>> Drobiazko<igor.drobiazko@gmail.com
>>>>> wrote:
>>>>> Maybe we should reuse zone paramater by passing a special zone id 
>>>>> like
>>>>> zone="*". There is already a special id ^, which means the first
>>>> container
>>>>> zone.
>>>>>
>>>> I like this idea.
>>>> I''m using "^" a lot so at least for me it's a good concept.
>>>>
>>>> Cheers
>>>>
>>>>
>>>>> On Thu, Jan 5, 2012 at 2:40 PM, Lance Java<lance.java@googlemail.com
>>>>>> wrote:
>>>>>> Correct me if I'm wrong but currently, if you want an eventlink to
>>> use
>>>>>> ajax, you must provide a "zone" parameter. This may have been 
>>>>>> fine in
>>>>> early
>>>>>> versions of tapestry 5 but there are now circumstances where we want
>>> an
>>>>>> eventlink to be done via XHR but shouldn't need to specify a zone in
>>>> the
>>>>>> tml. These include:
>>>>>>
>>>>>> 1. MultiZoneUpdate where the zone(s) are determined in the event
>>>> handler
>>>>>> 2. AjaxResponseRenderer where zone updates and javascript execs can
>>> be
>>>>>> invoked in the event handler
>>>>>>
>>>>>> As a suggestion, eventlink could have a new boolean parameter for
>>> ajax
>>>>>> eg<t:eventlink event="foo" ajax="true" />
>>>>>>
>>>>>> Should I raise a JIRA for this?
>>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> Best regards,
>>>>>
>>>>> Igor Drobiazko
>>>>> http://tapestry5.de
>>>>> http://twitter.com/drobiazko
>>>>>
>>>
>>>
>>> -- 
>>> *Regards,*
>>> *Muhammad Gelbana
>>> Java Developer*
>>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Eventlink - Ajax without zone parameter

Posted by Paul Stanton <pa...@mapshed.com.au>.
+1 vote for this, I previously raised this last January.

https://issues.apache.org/jira/browse/TAP5-1404

On 6/01/2012 7:37 AM, Igor Drobiazko wrote:
> This not a good idea, as we consequently would need to provide
> AjaxActionLink, AjaxPageLink, AjaxForm, etc.
>
> On Thu, Jan 5, 2012 at 9:02 PM, Muhammad Gelbana<m....@gmail.com>wrote:
>
>> Or maybe a whole new component with a whole different name ? Instead of
>> EventLink we can have AjaxEventLink or something..just an idea.
>> I bet you will find this page very interesting Lance
>> http://tawus.wordpress.com/2011/10/01/tapestry-5-3-new-features-part-2/ It
>> demonstrates many different flavors of ajax calls in tapestry.
>>
>> On Thu, Jan 5, 2012 at 8:09 PM, Dragan Sahpaski
>> <dr...@gmail.com>wrote:
>>
>>> On Thu, Jan 5, 2012 at 5:35 PM, Igor Drobiazko<igor.drobiazko@gmail.com
>>>> wrote:
>>>> Maybe we should reuse zone paramater by passing a special zone id like
>>>> zone="*". There is already a special id ^, which means the first
>>> container
>>>> zone.
>>>>
>>> I like this idea.
>>> I''m using "^" a lot so at least for me it's a good concept.
>>>
>>> Cheers
>>>
>>>
>>>> On Thu, Jan 5, 2012 at 2:40 PM, Lance Java<lance.java@googlemail.com
>>>>> wrote:
>>>>> Correct me if I'm wrong but currently, if you want an eventlink to
>> use
>>>>> ajax, you must provide a "zone" parameter. This may have been fine in
>>>> early
>>>>> versions of tapestry 5 but there are now circumstances where we want
>> an
>>>>> eventlink to be done via XHR but shouldn't need to specify a zone in
>>> the
>>>>> tml. These include:
>>>>>
>>>>> 1. MultiZoneUpdate where the zone(s) are determined in the event
>>> handler
>>>>> 2. AjaxResponseRenderer where zone updates and javascript execs can
>> be
>>>>> invoked in the event handler
>>>>>
>>>>> As a suggestion, eventlink could have a new boolean parameter for
>> ajax
>>>>> eg<t:eventlink event="foo" ajax="true" />
>>>>>
>>>>> Should I raise a JIRA for this?
>>>>>
>>>>
>>>>
>>>> --
>>>> Best regards,
>>>>
>>>> Igor Drobiazko
>>>> http://tapestry5.de
>>>> http://twitter.com/drobiazko
>>>>
>>
>>
>> --
>> *Regards,*
>> *Muhammad Gelbana
>> Java Developer*
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Eventlink - Ajax without zone parameter

Posted by Igor Drobiazko <ig...@gmail.com>.
This not a good idea, as we consequently would need to provide
AjaxActionLink, AjaxPageLink, AjaxForm, etc.

On Thu, Jan 5, 2012 at 9:02 PM, Muhammad Gelbana <m....@gmail.com>wrote:

> Or maybe a whole new component with a whole different name ? Instead of
> EventLink we can have AjaxEventLink or something..just an idea.
> I bet you will find this page very interesting Lance
> http://tawus.wordpress.com/2011/10/01/tapestry-5-3-new-features-part-2/ It
> demonstrates many different flavors of ajax calls in tapestry.
>
> On Thu, Jan 5, 2012 at 8:09 PM, Dragan Sahpaski
> <dr...@gmail.com>wrote:
>
> > On Thu, Jan 5, 2012 at 5:35 PM, Igor Drobiazko <igor.drobiazko@gmail.com
> > >wrote:
> >
> > > Maybe we should reuse zone paramater by passing a special zone id like
> > > zone="*". There is already a special id ^, which means the first
> > container
> > > zone.
> > >
> >
> > I like this idea.
> > I''m using "^" a lot so at least for me it's a good concept.
> >
> > Cheers
> >
> >
> > >
> > > On Thu, Jan 5, 2012 at 2:40 PM, Lance Java <lance.java@googlemail.com
> > > >wrote:
> > >
> > > > Correct me if I'm wrong but currently, if you want an eventlink to
> use
> > > > ajax, you must provide a "zone" parameter. This may have been fine in
> > > early
> > > > versions of tapestry 5 but there are now circumstances where we want
> an
> > > > eventlink to be done via XHR but shouldn't need to specify a zone in
> > the
> > > > tml. These include:
> > > >
> > > > 1. MultiZoneUpdate where the zone(s) are determined in the event
> > handler
> > > >
> > > > 2. AjaxResponseRenderer where zone updates and javascript execs can
> be
> > > > invoked in the event handler
> > > >
> > > > As a suggestion, eventlink could have a new boolean parameter for
> ajax
> > > >
> > > > eg <t:eventlink event="foo" ajax="true" />
> > > >
> > > > Should I raise a JIRA for this?
> > > >
> > >
> > >
> > >
> > > --
> > > Best regards,
> > >
> > > Igor Drobiazko
> > > http://tapestry5.de
> > > http://twitter.com/drobiazko
> > >
> >
>
>
>
> --
> *Regards,*
> *Muhammad Gelbana
> Java Developer*
>



-- 
Best regards,

Igor Drobiazko
http://tapestry5.de
http://twitter.com/drobiazko

Re: Eventlink - Ajax without zone parameter

Posted by Muhammad Gelbana <m....@gmail.com>.
Or maybe a whole new component with a whole different name ? Instead of
EventLink we can have AjaxEventLink or something..just an idea.
I bet you will find this page very interesting Lance
http://tawus.wordpress.com/2011/10/01/tapestry-5-3-new-features-part-2/ It
demonstrates many different flavors of ajax calls in tapestry.

On Thu, Jan 5, 2012 at 8:09 PM, Dragan Sahpaski
<dr...@gmail.com>wrote:

> On Thu, Jan 5, 2012 at 5:35 PM, Igor Drobiazko <igor.drobiazko@gmail.com
> >wrote:
>
> > Maybe we should reuse zone paramater by passing a special zone id like
> > zone="*". There is already a special id ^, which means the first
> container
> > zone.
> >
>
> I like this idea.
> I''m using "^" a lot so at least for me it's a good concept.
>
> Cheers
>
>
> >
> > On Thu, Jan 5, 2012 at 2:40 PM, Lance Java <lance.java@googlemail.com
> > >wrote:
> >
> > > Correct me if I'm wrong but currently, if you want an eventlink to use
> > > ajax, you must provide a "zone" parameter. This may have been fine in
> > early
> > > versions of tapestry 5 but there are now circumstances where we want an
> > > eventlink to be done via XHR but shouldn't need to specify a zone in
> the
> > > tml. These include:
> > >
> > > 1. MultiZoneUpdate where the zone(s) are determined in the event
> handler
> > >
> > > 2. AjaxResponseRenderer where zone updates and javascript execs can be
> > > invoked in the event handler
> > >
> > > As a suggestion, eventlink could have a new boolean parameter for ajax
> > >
> > > eg <t:eventlink event="foo" ajax="true" />
> > >
> > > Should I raise a JIRA for this?
> > >
> >
> >
> >
> > --
> > Best regards,
> >
> > Igor Drobiazko
> > http://tapestry5.de
> > http://twitter.com/drobiazko
> >
>



-- 
*Regards,*
*Muhammad Gelbana
Java Developer*

Re: Eventlink - Ajax without zone parameter

Posted by Dragan Sahpaski <dr...@gmail.com>.
On Thu, Jan 5, 2012 at 5:35 PM, Igor Drobiazko <ig...@gmail.com>wrote:

> Maybe we should reuse zone paramater by passing a special zone id like
> zone="*". There is already a special id ^, which means the first container
> zone.
>

I like this idea.
I''m using "^" a lot so at least for me it's a good concept.

Cheers


>
> On Thu, Jan 5, 2012 at 2:40 PM, Lance Java <lance.java@googlemail.com
> >wrote:
>
> > Correct me if I'm wrong but currently, if you want an eventlink to use
> > ajax, you must provide a "zone" parameter. This may have been fine in
> early
> > versions of tapestry 5 but there are now circumstances where we want an
> > eventlink to be done via XHR but shouldn't need to specify a zone in the
> > tml. These include:
> >
> > 1. MultiZoneUpdate where the zone(s) are determined in the event handler
> >
> > 2. AjaxResponseRenderer where zone updates and javascript execs can be
> > invoked in the event handler
> >
> > As a suggestion, eventlink could have a new boolean parameter for ajax
> >
> > eg <t:eventlink event="foo" ajax="true" />
> >
> > Should I raise a JIRA for this?
> >
>
>
>
> --
> Best regards,
>
> Igor Drobiazko
> http://tapestry5.de
> http://twitter.com/drobiazko
>

Re: Eventlink - Ajax without zone parameter

Posted by Jochen Frey <jo...@jochenfrey.com>.
+1 on the need to address this!

-- j

On Jan 5, 2012, at 8:35 AM, Igor Drobiazko <ig...@gmail.com> wrote:

> Maybe we should reuse zone paramater by passing a special zone id like
> zone="*". There is already a special id ^, which means the first container
> zone.
> 
> On Thu, Jan 5, 2012 at 2:40 PM, Lance Java <la...@googlemail.com>wrote:
> 
>> Correct me if I'm wrong but currently, if you want an eventlink to use
>> ajax, you must provide a "zone" parameter. This may have been fine in early
>> versions of tapestry 5 but there are now circumstances where we want an
>> eventlink to be done via XHR but shouldn't need to specify a zone in the
>> tml. These include:
>> 
>> 1. MultiZoneUpdate where the zone(s) are determined in the event handler
>> 
>> 2. AjaxResponseRenderer where zone updates and javascript execs can be
>> invoked in the event handler
>> 
>> As a suggestion, eventlink could have a new boolean parameter for ajax
>> 
>> eg <t:eventlink event="foo" ajax="true" />
>> 
>> Should I raise a JIRA for this?
>> 
> 
> 
> 
> -- 
> Best regards,
> 
> Igor Drobiazko
> http://tapestry5.de
> http://twitter.com/drobiazko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Eventlink - Ajax without zone parameter

Posted by Igor Drobiazko <ig...@gmail.com>.
Maybe we should reuse zone paramater by passing a special zone id like
zone="*". There is already a special id ^, which means the first container
zone.

On Thu, Jan 5, 2012 at 2:40 PM, Lance Java <la...@googlemail.com>wrote:

> Correct me if I'm wrong but currently, if you want an eventlink to use
> ajax, you must provide a "zone" parameter. This may have been fine in early
> versions of tapestry 5 but there are now circumstances where we want an
> eventlink to be done via XHR but shouldn't need to specify a zone in the
> tml. These include:
>
> 1. MultiZoneUpdate where the zone(s) are determined in the event handler
>
> 2. AjaxResponseRenderer where zone updates and javascript execs can be
> invoked in the event handler
>
> As a suggestion, eventlink could have a new boolean parameter for ajax
>
> eg <t:eventlink event="foo" ajax="true" />
>
> Should I raise a JIRA for this?
>



-- 
Best regards,

Igor Drobiazko
http://tapestry5.de
http://twitter.com/drobiazko

Re: Eventlink - Ajax without zone parameter

Posted by Dragan Sahpaski <dr...@gmail.com>.
Hi,
I agree with your point. I usually use a dummy zone for wiring the zone
parameter of such links.
IDK if a boolean is appropriate but It would be nice if we could avoid
workarounds with dummy zones.

Cheers,
Dragan Sahpaski



On Thu, Jan 5, 2012 at 2:40 PM, Lance Java <la...@googlemail.com>wrote:

> Correct me if I'm wrong but currently, if you want an eventlink to use
> ajax, you must provide a "zone" parameter. This may have been fine in early
> versions of tapestry 5 but there are now circumstances where we want an
> eventlink to be done via XHR but shouldn't need to specify a zone in the
> tml. These include:
>
> 1. MultiZoneUpdate where the zone(s) are determined in the event handler
>
> 2. AjaxResponseRenderer where zone updates and javascript execs can be
> invoked in the event handler
>
> As a suggestion, eventlink could have a new boolean parameter for ajax
>
> eg <t:eventlink event="foo" ajax="true" />
>
> Should I raise a JIRA for this?
>