QxTransformer - Namespaces - Global Events

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

QxTransformer - Namespaces - Global Events

Fru Ndenge
Hi all,

I am using QxTransformer and migrating some legacy code from QooxDoo 0.7.

Might be you can hint me on how certain things are implemented in QxTransformer?

1) Using the QxTransformer component model, I am trying to reference Utiltily functions defined in one component from another component but just cannot get that resolved?

in Application.xml the "encode" function cannot be resolved (it is defined in the component "GlobalServicesUI")

alert(encode(Array("Hello", "World")));

2) The event listener for the "appear" event  in the component is not also resolving the defined "encode" function; this however is being resolved well within the "execute" listener!

How does QxTransformer store and handle these entities which could be referenced globally; Do I have to specify that using e.g. "qxt:scope="global"" or something else? Are there any pointers as to  any documentation concerning these issues?

Thanks,
Fru.

custom.zip
Reply | Threaded
Open this post in threaded view
|

Re: QxTransformer - Namespaces - Global Events

Siarhei Barysiuk
Hi Fru,

1) If you defined the function in component then you should use it  
from the component like this.

<ns:yourcomponent id="cmp".... />

cmp.encode(...);

Please post your code snippet and I'll be able to help you with  
another issue, not sure I understand what you're trying to do.

Cheers,
Serge



On Jul 2, 2010, at 3:51 PM, Fru Ndenge wrote:

>
> Hi all,
>
> I am using QxTransformer and migrating some legacy code from QooxDoo  
> 0.7.
>
> Might be you can hint me on how certain things are implemented in
> QxTransformer?
>
> 1) Using the QxTransformer component model, I am trying to reference
> Utiltily functions defined in one component from another component  
> but just
> cannot get that resolved?
>
> in Application.xml the "encode" function cannot be resolved (it is  
> defined
> in the component "GlobalServicesUI")
>
> alert(encode(Array("Hello", "World")));
>
> 2) The event listener for the "appear" event  in the component is  
> not also
> resolving the defined "encode" function; this however is being  
> resolved well
> within the "execute" listener!
>
> How does QxTransformer store and handle these entities which could be
> referenced globally; Do I have to specify that using e.g.
> "qxt:scope="global"" or something else? Are there any pointers as  
> to  any
> documentation concerning these issues?
>
> Thanks,
> Fru.
>
> http://qooxdoo.678.n2.nabble.com/file/n5247608/custom.zip custom.zip
> --
> View this message in context: http://qooxdoo.678.n2.nabble.com/QxTransformer-Namespaces-Global-Events-tp5247608p5247608.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: QxTransformer - Namespaces - Global Events

Fru Ndenge
Thanks for the quick response; I have been dabbling with this for quite some while now and will certainly need your help.

In my original message there is a simple demo-project attached "custom.zip" -check that message again and download the zip file -  make the necessary changes in the "config.json" file and generate the "source". Then clicking on index.html will indicate to you what I am talking about.

With the event handling, I am also currently experiencing a problem with an "ajax"-server call within the component - My request is successfully sent, but my registered "completed" listener never gets called back! This must be an issue with me moving the code into a component - before I had it in custom.Application and everything worked out well!

What I found out too was that <qxt:subscriber filter="xxx" > is not picking up the events anymore. Has this been depreceated in the current Transformer?

Thanks  
Reply | Threaded
Open this post in threaded view
|

Re: QxTransformer - Namespaces - Global Events

Siarhei Barysiuk
Hi Fru,

At the first, I would suggest using trunk version of the  
QxTransformer, it's stable and we added some more features there and  
changed a few things (you will have to move your XML file to class  
folder).

Regarding scope problem. The code you're using

<qxt:script qxt:scope="global">
        <![CDATA[
        function encode(vars) {
                ...
        }
]]>
</qxt:script>

will add 'encode' function which will be available only in your  
component not in all application, so you cannot use qxt:scope in this  
case. If you would like to use a function in any place in your  
application, I would suggest creating a utility class with static  
methods and move your code there. You will be able to access your  
function as package.YourClass.yourFunction(...).

To use subscriber, please follow this pattern:

<qxt:listener type="execute" dispatchMessage="MESSAGE_NAME"/>

<qxt:subscriber name="MESSAGE_NAME">
                             <![CDATA[
                                  ...
                             ]]>
</qxt:subscriber>

Please check out a sample address book app to get more info (https://qooxdoo-contrib.svn.sourceforge.net/svnroot/qooxdoo-contrib/trunk/qooxdoo-contrib/QxTransformer/trunk/demo/addressbook/ 
).

Hope it helps.

Serge

On Jul 2, 2010, at 4:15 PM, Fru Ndenge wrote:

>
> Thanks for the quick response; I have been dabbling with this for  
> quite some
> while now and will certainly need your help.
>
> In my original message there is a simple demo-project attached  
> "custom.zip"
> -check that message again and download the zip file -  make the  
> necessary
> changes in the "config.json" file and generate the "source". Then  
> clicking
> on index.html will indicate to you what I am talking about.
>
> With the event handling, I am also currently experiencing a problem  
> with an
> "ajax"-server call within the component - My request is successfully  
> sent,
> but my registered "completed" listener never gets called back! This  
> must be
> an issue with me moving the code into a component - before I had it in
> custom.Application and everything worked out well!
>
> What I found out too was that <qxt:subscriber filter="xxx" > is not  
> picking
> up the events anymore. Has this been depreceated in the current  
> Transformer?
>
> Thanks
> --
> View this message in context: http://qooxdoo.678.n2.nabble.com/QxTransformer-Namespaces-Global-Events-tp5247608p5247683.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel