On Tue, Jul 16, 2013 at 5:36 PM, Akhil Anil <akhil.ka...@gmail.com> wrote:
> I researched about writing jQuery plugins. We could generate one plugin > file to handle the tuscany calls, they could easly make calls to the > backed. I've updated the proposal page with some ideas I have. Please have > a look and if I'm in the right direction. > > > https://cwiki.apache.org/confluence/display/COMDEV/Proposal+For+Tuscany+-+Akhil+Anil > > > Here are some comments 1. Add the jquery option to implementation.widget to handle jquery codes <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0" targetNamespace="http://store" name="store"> <component name="store"> <t:implementation.widget location="contents/store.html"/> <service name="Widget"> <t:binding.http/> </service> <reference name="catalog" target="Catalog"> <t:binding.jquery/> </reference> ... </component> ..... </composite> <lresende> We are not building a new binding for jquery. The idea is to modify implementation widget, which currently generates javascript code based on Dojo, to also be able to generate code based on jQuery. If you look at implementation-widget-runtime-dojo, we will need something like implementation-widget-runtime-jquery. Here are some of the places we genrate js code [2] And here are some extensions we build for dojo [3] [1] https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/modules/implementation-widget-runtime-dojo/ [2] https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/modules/implementation-widget-runtime-dojo/src/main/java/org/apache/tuscany/sca/implementation/widget/dojo/DojoJavaScriptComponentGeneratorImpl.java [3] https://svn.apache.org/repos/asf/tuscany/sca-java-2.x/trunk/modules/web-javascript-dojo/src/main/resources/tuscany/ </lresende> 2. Include a generated jQuery plugin <!-- one js include per sca component --> <script type="text/javascript" src="jQuery.tuscany.js"></script>jQuery plugins extends the core jQuery nature [1] . This file would be generated by a generator function in the server side. [1] Book Reference : jQuery in Action, Chapter 8 <lresende> I'm not sure if we need a jQuery plugin, we might be able to use the jQuery existing stuff such as $.ajax </lresende> 3. Defining html In Resources The user can write everything in under jQuery syntax and we will have code to handle it in the generated plugin file. For Eg: var ref2 = $.tuscanyReferenceCall.("catalog"); var ref2 = $.tuscanyReferenceCall.("shoppingCart"); <lresende> We should not have to change the application in order to use jQuery, we should be able to swap the jars in the classpath, or have some kind of switch on the composite file, but the application stays the same. The idea is basically enable applications that are already using dojo, to use dojo, but the ones that use jquery, use jquery, and not have two js frameworks just because of Tuscany. </lresende> As next step, try to use js debugger and see what goes on on the client side of store sample application, particularly on the generated store.js file. -- Luciano Resende http://people.apache.org/~lresende http://twitter.com/lresende1975 http://lresende.blogspot.com/