You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by gbrits <gb...@gmail.com> on 2010/10/21 20:58:15 UTC

T5: porting to Got5-JQuery > how to use former Tapestry.ElementEffect ?

I'm porting my tapestry application to jquery using  Got5-JQuery and it looks
great!
One thing I can't figure out though: 

tapestry allows registering callbacks on zoneupdates, etc. using: 

Tapestry.ElementEffect. 

e.g for illustration purposes I had: 

Tapestry.ElementEffect.updateavailtrigger = function(element){
   alert('yeah');
}

However Tapestry.ElementEffect isn't recognized anymore by the new jquery
client-code. 

I had a quick look at the tapestry.js (the jquery one)  but couldn't figure
it out. 

Anyone knows how to define such a callback? 

Thanks, 
Geert-Jan

-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-porting-to-Got5-JQuery-how-to-use-former-Tapestry-ElementEffect-tp3231132p3231132.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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


Re: T5: porting to Got5-JQuery > how to use former Tapestry.ElementEffect ?

Posted by gbrits <gb...@gmail.com>.
thanks, i'll have a look

2010/10/22 Andreas Andreou-4 [via Tapestry] <
ml-node+3231498-238900553-91353@n5.nabble.com<ml...@n5.nabble.com>
>

> I took a look and it shouldnt be hard to add this ...
> The important file is tapestry-jquery.js and around line 150
> there's a definition for a ui.tapestryZone widget
>
> So, you need to modify the update function of the widget
> to lookup functions in the Tapestry.ElementEffect namespace
> and have them run.
>
> On Thu, Oct 21, 2010 at 21:58, gbrits <[hidden email]<http://user/SendEmail.jtp?type=node&node=3231498&i=0>>
> wrote:
>
> >
> > I'm porting my tapestry application to jquery using  Got5-JQuery and it
> looks
> > great!
> > One thing I can't figure out though:
> >
> > tapestry allows registering callbacks on zoneupdates, etc. using:
> >
> > Tapestry.ElementEffect.
> >
> > e.g for illustration purposes I had:
> >
> > Tapestry.ElementEffect.updateavailtrigger = function(element){
> >   alert('yeah');
> > }
> >
> > However Tapestry.ElementEffect isn't recognized anymore by the new jquery
>
> > client-code.
> >
> > I had a quick look at the tapestry.js (the jquery one)  but couldn't
> figure
> > it out.
> >
> > Anyone knows how to define such a callback?
> >
> > Thanks,
> > Geert-Jan
> >
> > --
> > View this message in context:
> http://tapestry.1045711.n5.nabble.com/T5-porting-to-Got5-JQuery-how-to-use-former-Tapestry-ElementEffect-tp3231132p3231132.html<http://tapestry.1045711.n5.nabble.com/T5-porting-to-Got5-JQuery-how-to-use-former-Tapestry-ElementEffect-tp3231132p3231132.html?by-user=t>
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=3231498&i=1>
> > For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=3231498&i=2>
> >
> >
>
>
>
> --
> Andreas Andreou - [hidden email]<http://user/SendEmail.jtp?type=node&node=3231498&i=3>-
> http://blog.andyhot.gr <http://blog.andyhot.gr?by-user=t>
> Tapestry PMC / Tacos developer
> Open Source / JEE Consulting
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=3231498&i=4>
> For additional commands, e-mail: [hidden email]<http://user/SendEmail.jtp?type=node&node=3231498&i=5>
>
>
>
> ------------------------------
>  View message @
> http://tapestry.1045711.n5.nabble.com/T5-porting-to-Got5-JQuery-how-to-use-former-Tapestry-ElementEffect-tp3231132p3231498.html
> To unsubscribe from T5: porting to Got5-JQuery > how to use former
> Tapestry.ElementEffect ?, click here<http://tapestry.1045711.n5.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=3231132&code=Z2JyaXRzQGdtYWlsLmNvbXwzMjMxMTMyfDExNjk3MTIyNTA=>.
>
>
>

-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-porting-to-Got5-JQuery-how-to-use-former-Tapestry-ElementEffect-tp3231132p3231882.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

Re: T5: porting to Got5-JQuery > how to use former Tapestry.ElementEffect ?

Posted by Andreas Andreou <an...@di.uoa.gr>.
I took a look and it shouldnt be hard to add this ...
The important file is tapestry-jquery.js and around line 150
there's a definition for a ui.tapestryZone widget

So, you need to modify the update function of the widget
to lookup functions in the Tapestry.ElementEffect namespace
and have them run.

On Thu, Oct 21, 2010 at 21:58, gbrits <gb...@gmail.com> wrote:
>
> I'm porting my tapestry application to jquery using  Got5-JQuery and it looks
> great!
> One thing I can't figure out though:
>
> tapestry allows registering callbacks on zoneupdates, etc. using:
>
> Tapestry.ElementEffect.
>
> e.g for illustration purposes I had:
>
> Tapestry.ElementEffect.updateavailtrigger = function(element){
>   alert('yeah');
> }
>
> However Tapestry.ElementEffect isn't recognized anymore by the new jquery
> client-code.
>
> I had a quick look at the tapestry.js (the jquery one)  but couldn't figure
> it out.
>
> Anyone knows how to define such a callback?
>
> Thanks,
> Geert-Jan
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/T5-porting-to-Got5-JQuery-how-to-use-former-Tapestry-ElementEffect-tp3231132p3231132.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry PMC / Tacos developer
Open Source / JEE Consulting

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


Re: T5: porting to Got5-JQuery > how to use former Tapestry.ElementEffect ?

Posted by Andreas Andreou <an...@di.uoa.gr>.
i think you have quite an elegant solution here - i'll make sure to apply
this to the 5.2 branch and i guess it'll also appear in master soon

On Sat, Oct 23, 2010 at 00:22, gbrits <gb...@gmail.com> wrote:
>
> for people that might run into this:
>
> I didn't know that ElementEffect was the prototype way of handling things,
> jquery handles effects differently.
> Moreover, it's best practise to observe Tapestry.ZONE_UPDATED_EVENT instead
> of misusing an effect which is only meant for visual purposes.
>
> The problem is, at the moment the GOT jquery implementation of a zone
> doesn't trigger the Tapestry.ZONE_UPDATED_EVENT.
>
> I raised a ticket at http://github.com/got5/tapestry5-jquery/
> in the mean time you can plug this in your own js to be able to listen to
> the ZONE_UPDATED_EVENT
>
> hth,
> Geert-Jan
>
>
>
> /* extending "ui.tapestryZone":
>  * - ability to update update-feedback functions
>  * - firing Tapestry.ZONE_UPDATED_EVENT on zone-update
>  * - fixing show vs update effecs (they were reversed)  quick hack.
>  * */
> $.extend($.ui.tapestryZone.prototype, {
>        setoptions: function(opt) {
>                this.options=opt;
>        },
>        /**
>         * Refresh a zone
>         * @zoneId
>         * @url to request
>         * @params optional, can contain data. Request will switch from GET to POST
>         */
>        update: function(specs) {
>            var el = this.element;
>
>            ajaxRequest = {
>                url: specs.url,
>                success: function(data) {
>                    el.html(data.content);
>                    el.effect(effect);
>                    $.tapestry.utils.loadScriptsInReply(data);
>                    el.trigger(Tapestry.ZONE_UPDATED_EVENT);
>                }
>            };
>
>            if (specs.params != undefined) {
>                ajaxRequest = $.extend(ajaxRequest, {
>                    type: 'post',
>                    data: specs.params
>                })
>            }
>
>            effect = el.is(":visible") ? this.options.show : this.options.update;
>
>            $.ajax(ajaxRequest);
>        }
>
> });
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/T5-porting-to-Got5-JQuery-how-to-use-former-Tapestry-ElementEffect-tp3231132p3232973.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry PMC / Tacos developer
Open Source / JEE Consulting

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


Re: T5: porting to Got5-JQuery > how to use former Tapestry.ElementEffect ?

Posted by gbrits <gb...@gmail.com>.
for people that might run into this: 

I didn't know that ElementEffect was the prototype way of handling things,
jquery handles effects differently.
Moreover, it's best practise to observe Tapestry.ZONE_UPDATED_EVENT instead
of misusing an effect which is only meant for visual purposes. 

The problem is, at the moment the GOT jquery implementation of a zone
doesn't trigger the Tapestry.ZONE_UPDATED_EVENT. 

I raised a ticket at http://github.com/got5/tapestry5-jquery/
in the mean time you can plug this in your own js to be able to listen to
the ZONE_UPDATED_EVENT

hth, 
Geert-Jan



/* extending "ui.tapestryZone":
 * - ability to update update-feedback functions 
 * - firing Tapestry.ZONE_UPDATED_EVENT on zone-update 
 * - fixing show vs update effecs (they were reversed)  quick hack.
 * */
$.extend($.ui.tapestryZone.prototype, { 
	setoptions: function(opt) {
		this.options=opt;
	},
	/**
	 * Refresh a zone
	 * @zoneId
	 * @url to request
	 * @params optional, can contain data. Request will switch from GET to POST
	 */
	update: function(specs) {
	    var el = this.element;
	    
	    ajaxRequest = {
	        url: specs.url,
	        success: function(data) {
	            el.html(data.content);
	            el.effect(effect);
	            $.tapestry.utils.loadScriptsInReply(data);
	            el.trigger(Tapestry.ZONE_UPDATED_EVENT);
	        }
	    };
	    
	    if (specs.params != undefined) {
	        ajaxRequest = $.extend(ajaxRequest, {
	            type: 'post',
	            data: specs.params
	        })
	    }
	    
	    effect = el.is(":visible") ? this.options.show : this.options.update;
	    
	    $.ajax(ajaxRequest);
	}

});


-- 
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-porting-to-Got5-JQuery-how-to-use-former-Tapestry-ElementEffect-tp3231132p3232973.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

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