You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Lenny Primak <lp...@hope.nyc.ny.us> on 2012/03/30 00:33:14 UTC

Mixing prototype and JQuery based components?

I have a T5 bases application that I am trying to enhance using jquery for new pages. I have the got5 module loaded with SUPPRESS_PROTOTYPE=false. 
I also have custom components and mixins based on prototype. From what I understand I can't use jquery form in standard zone in this configuration?  Is this right?
Also how can I use 'old' custom components in jquery?  Is there a perscribed way to modify them to perhaps support both prototype and jquery?

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


Re: Mixing prototype and JQuery based components?

Posted by François Facon <fr...@atos.net>.
Your assumptions are correct.
mixing components should work and you don't need to rewrite your
existing components.

I know some applications that use lib based and prototype and
tapestry5-jquery. SUPPRESS_PROTOTYPE=false provides a kind of backward
compatibility.

2012/4/1 Lenny Primak <lp...@hope.nyc.ny.us>:
> I see, otherwise you are saying that mixing components should work in any case.
> Am i correct in this assumption?
> And I am also assuming that a component library based in prototype does not need to be rewritten in jquery to be able to interoperate assuming SUPPRESS_PROTOTYPR=false
>
> On Mar 31, 2012, at 10:23 AM, François Facon <fr...@atos.net> wrote:
>
>> Hi Lenny,
>>
>> if you have a look at
>> https://github.com/got5/tapestry5-jquery/blob/master/src/main/java/org/got5/tapestry5/jquery/services/javascript/JQueryJavaScriptStack.java
>>
>> you will see that then SUPPRESS_PROTOTYPE is equal to false, we just
>> use the default js modules provided by tapestry. That mean prototype
>> manage the $ and all the default js object provided by Tapestry (zone,
>> formhandler, datefield etc...).
>>
>> Every time we add a new jQuery component to the list,
>> we create a new jQuery plugin to let jQuery manage the $ inside the plugin.
>>
>> plugin is some thing like (function($) { /* some code that uses $ */ })(jQuery)
>>
>> see for example
>> https://github.com/got5/tapestry5-jquery/blob/master/src/main/resources/org/got5/tapestry5/jquery/assets/components/jeditable/jeditable.js
>>
>> by following this simple concept of isolation T5 object should just
>> work even if some a using prototype and others use jQuery.
>>
>> Regards
>> François
>>
>> 2012/3/30 Lenny Primak <lp...@hope.nyc.ny.us>:
>>> Thanks for your info.
>>> Is there a way that my components work with either prototype or jquery or is this a non-starter?
>>> Depending on whether jquery model is installed?
>>>
>>> What should be my strategy if I have a custom component library?
>>>
>>>
>>> On Mar 30, 2012, at 2:54 AM, Emmanuel DEMEY <de...@gmail.com> wrote:
>>>
>>>> With Tapestry5-jQuery, we have overriden just few Component classes, most
>>>> of the time for using JSON format (Autocomplete and Palette).
>>>>
>>>> But all the JavaScript have been translated to jQuery, in order to create a
>>>> full jQuery application.
>>>>
>>>> But, if you have old Prototype-based components/mixins, all your custom and
>>>> Tapestry-core components will use the Prototype JavaScript library. Your
>>>> custom components will not work in a full jQuery-based application.
>>>>
>>>> The SUPPRESS_PROTOTYPE is useful if you have a lot of Prototype-based
>>>> components, so you do not have time to rewrite them. If you start a new
>>>> application, you should set this constant to true.
>>>>
>>>> Manu
>>>>
>>>>
>>>> 2012/3/30 trsvax <tr...@gmail.com>
>>>>
>>>>> I don't really know but I would imagine two things
>>>>>
>>>>> 1. Both want to use $
>>>>> 2. Remove the dependency on prototype.
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://tapestry.1045711.n5.nabble.com/Mixing-prototype-and-JQuery-based-components-tp5605199p5605479.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
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Emmanuel DEMEY
>>>> Ingénieur Etude et Développement
>>>> ATOS Worldline
>>>> +33 (0)6 47 47 42 02
>>>> demey.emmanuel@gmail.com
>>>> http://emmanueldemey.fr
>>>>
>>>> Twitter : @gillespie59
>>>
>>> ---------------------------------------------------------------------
>>> 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
>

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


Re: Mixing prototype and JQuery based components?

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
I see, otherwise you are saying that mixing components should work in any case. 
Am i correct in this assumption?
And I am also assuming that a component library based in prototype does not need to be rewritten in jquery to be able to interoperate assuming SUPPRESS_PROTOTYPR=false

On Mar 31, 2012, at 10:23 AM, François Facon <fr...@atos.net> wrote:

> Hi Lenny,
> 
> if you have a look at
> https://github.com/got5/tapestry5-jquery/blob/master/src/main/java/org/got5/tapestry5/jquery/services/javascript/JQueryJavaScriptStack.java
> 
> you will see that then SUPPRESS_PROTOTYPE is equal to false, we just
> use the default js modules provided by tapestry. That mean prototype
> manage the $ and all the default js object provided by Tapestry (zone,
> formhandler, datefield etc...).
> 
> Every time we add a new jQuery component to the list,
> we create a new jQuery plugin to let jQuery manage the $ inside the plugin.
> 
> plugin is some thing like (function($) { /* some code that uses $ */ })(jQuery)
> 
> see for example
> https://github.com/got5/tapestry5-jquery/blob/master/src/main/resources/org/got5/tapestry5/jquery/assets/components/jeditable/jeditable.js
> 
> by following this simple concept of isolation T5 object should just
> work even if some a using prototype and others use jQuery.
> 
> Regards
> François
> 
> 2012/3/30 Lenny Primak <lp...@hope.nyc.ny.us>:
>> Thanks for your info.
>> Is there a way that my components work with either prototype or jquery or is this a non-starter?
>> Depending on whether jquery model is installed?
>> 
>> What should be my strategy if I have a custom component library?
>> 
>> 
>> On Mar 30, 2012, at 2:54 AM, Emmanuel DEMEY <de...@gmail.com> wrote:
>> 
>>> With Tapestry5-jQuery, we have overriden just few Component classes, most
>>> of the time for using JSON format (Autocomplete and Palette).
>>> 
>>> But all the JavaScript have been translated to jQuery, in order to create a
>>> full jQuery application.
>>> 
>>> But, if you have old Prototype-based components/mixins, all your custom and
>>> Tapestry-core components will use the Prototype JavaScript library. Your
>>> custom components will not work in a full jQuery-based application.
>>> 
>>> The SUPPRESS_PROTOTYPE is useful if you have a lot of Prototype-based
>>> components, so you do not have time to rewrite them. If you start a new
>>> application, you should set this constant to true.
>>> 
>>> Manu
>>> 
>>> 
>>> 2012/3/30 trsvax <tr...@gmail.com>
>>> 
>>>> I don't really know but I would imagine two things
>>>> 
>>>> 1. Both want to use $
>>>> 2. Remove the dependency on prototype.
>>>> 
>>>> --
>>>> View this message in context:
>>>> http://tapestry.1045711.n5.nabble.com/Mixing-prototype-and-JQuery-based-components-tp5605199p5605479.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
>>>> 
>>>> 
>>> 
>>> 
>>> --
>>> Emmanuel DEMEY
>>> Ingénieur Etude et Développement
>>> ATOS Worldline
>>> +33 (0)6 47 47 42 02
>>> demey.emmanuel@gmail.com
>>> http://emmanueldemey.fr
>>> 
>>> Twitter : @gillespie59
>> 
>> ---------------------------------------------------------------------
>> 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: Mixing prototype and JQuery based components?

Posted by François Facon <fr...@atos.net>.
Hi Lenny,

if you have a look at
https://github.com/got5/tapestry5-jquery/blob/master/src/main/java/org/got5/tapestry5/jquery/services/javascript/JQueryJavaScriptStack.java

you will see that then SUPPRESS_PROTOTYPE is equal to false, we just
use the default js modules provided by tapestry. That mean prototype
manage the $ and all the default js object provided by Tapestry (zone,
formhandler, datefield etc...).

Every time we add a new jQuery component to the list,
we create a new jQuery plugin to let jQuery manage the $ inside the plugin.

plugin is some thing like (function($) { /* some code that uses $ */ })(jQuery)

see for example
https://github.com/got5/tapestry5-jquery/blob/master/src/main/resources/org/got5/tapestry5/jquery/assets/components/jeditable/jeditable.js

by following this simple concept of isolation T5 object should just
work even if some a using prototype and others use jQuery.

Regards
François

2012/3/30 Lenny Primak <lp...@hope.nyc.ny.us>:
> Thanks for your info.
> Is there a way that my components work with either prototype or jquery or is this a non-starter?
> Depending on whether jquery model is installed?
>
> What should be my strategy if I have a custom component library?
>
>
> On Mar 30, 2012, at 2:54 AM, Emmanuel DEMEY <de...@gmail.com> wrote:
>
>> With Tapestry5-jQuery, we have overriden just few Component classes, most
>> of the time for using JSON format (Autocomplete and Palette).
>>
>> But all the JavaScript have been translated to jQuery, in order to create a
>> full jQuery application.
>>
>> But, if you have old Prototype-based components/mixins, all your custom and
>> Tapestry-core components will use the Prototype JavaScript library. Your
>> custom components will not work in a full jQuery-based application.
>>
>> The SUPPRESS_PROTOTYPE is useful if you have a lot of Prototype-based
>> components, so you do not have time to rewrite them. If you start a new
>> application, you should set this constant to true.
>>
>> Manu
>>
>>
>> 2012/3/30 trsvax <tr...@gmail.com>
>>
>>> I don't really know but I would imagine two things
>>>
>>> 1. Both want to use $
>>> 2. Remove the dependency on prototype.
>>>
>>> --
>>> View this message in context:
>>> http://tapestry.1045711.n5.nabble.com/Mixing-prototype-and-JQuery-based-components-tp5605199p5605479.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
>>>
>>>
>>
>>
>> --
>> Emmanuel DEMEY
>> Ingénieur Etude et Développement
>> ATOS Worldline
>> +33 (0)6 47 47 42 02
>> demey.emmanuel@gmail.com
>> http://emmanueldemey.fr
>>
>> Twitter : @gillespie59
>
> ---------------------------------------------------------------------
> 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: Mixing prototype and JQuery based components?

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
Thanks for your info. 
Is there a way that my components work with either prototype or jquery or is this a non-starter?
Depending on whether jquery model is installed?

What should be my strategy if I have a custom component library?


On Mar 30, 2012, at 2:54 AM, Emmanuel DEMEY <de...@gmail.com> wrote:

> With Tapestry5-jQuery, we have overriden just few Component classes, most
> of the time for using JSON format (Autocomplete and Palette).
> 
> But all the JavaScript have been translated to jQuery, in order to create a
> full jQuery application.
> 
> But, if you have old Prototype-based components/mixins, all your custom and
> Tapestry-core components will use the Prototype JavaScript library. Your
> custom components will not work in a full jQuery-based application.
> 
> The SUPPRESS_PROTOTYPE is useful if you have a lot of Prototype-based
> components, so you do not have time to rewrite them. If you start a new
> application, you should set this constant to true.
> 
> Manu
> 
> 
> 2012/3/30 trsvax <tr...@gmail.com>
> 
>> I don't really know but I would imagine two things
>> 
>> 1. Both want to use $
>> 2. Remove the dependency on prototype.
>> 
>> --
>> View this message in context:
>> http://tapestry.1045711.n5.nabble.com/Mixing-prototype-and-JQuery-based-components-tp5605199p5605479.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
>> 
>> 
> 
> 
> -- 
> Emmanuel DEMEY
> Ingénieur Etude et Développement
> ATOS Worldline
> +33 (0)6 47 47 42 02
> demey.emmanuel@gmail.com
> http://emmanueldemey.fr
> 
> Twitter : @gillespie59

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


Re: Mixing prototype and JQuery based components?

Posted by Emmanuel DEMEY <de...@gmail.com>.
With Tapestry5-jQuery, we have overriden just few Component classes, most
of the time for using JSON format (Autocomplete and Palette).

But all the JavaScript have been translated to jQuery, in order to create a
full jQuery application.

But, if you have old Prototype-based components/mixins, all your custom and
Tapestry-core components will use the Prototype JavaScript library. Your
custom components will not work in a full jQuery-based application.

The SUPPRESS_PROTOTYPE is useful if you have a lot of Prototype-based
components, so you do not have time to rewrite them. If you start a new
application, you should set this constant to true.

Manu


2012/3/30 trsvax <tr...@gmail.com>

> I don't really know but I would imagine two things
>
> 1. Both want to use $
> 2. Remove the dependency on prototype.
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Mixing-prototype-and-JQuery-based-components-tp5605199p5605479.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
>
>


-- 
Emmanuel DEMEY
Ingénieur Etude et Développement
ATOS Worldline
+33 (0)6 47 47 42 02
demey.emmanuel@gmail.com
http://emmanueldemey.fr

Twitter : @gillespie59

Re: Mixing prototype and JQuery based components?

Posted by trsvax <tr...@gmail.com>.
I don't really know but I would imagine two things

1. Both want to use $
2. Remove the dependency on prototype.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Mixing-prototype-and-JQuery-based-components-tp5605199p5605479.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: Mixing prototype and JQuery based components?

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
I now see there is no 'JQuery Zone', so the mystery deepens.
Are there any downsides to having SUPPRESS_PROTOTYPE=false thus not overriding default Tapestry components?
What was the original decisions that drove to override the JS engine behind the core Tapestry components?

On Mar 29, 2012, at 6:33 PM, Lenny Primak wrote:

> I have a T5 bases application that I am trying to enhance using jquery for new pages. I have the got5 module loaded with SUPPRESS_PROTOTYPE=false. 
> I also have custom components and mixins based on prototype. From what I understand I can't use jquery form in standard zone in this configuration?  Is this right?
> Also how can I use 'old' custom components in jquery?  Is there a perscribed way to modify them to perhaps support both prototype and jquery?
> 
> Thanks for your suggestions.


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