http://www.backbase.com
http://www.backbase.com/demos/explorer/ <--- Demo
On 8/19/06, Christian Boulanger <[EMAIL PROTECTED]> wrote:
Siarhei Barysiuk schrieb:
> I think how do we realize this in specification. Will it be mandatory
> rule to give name for widget?
> How will we define scope? See following example:
> <qx:somewidget>
> //sets some props
> </qx:somewidget>
>
> <qx:somewidget2>
> // I want to call any method for previous widget , but I won't variable
> of previuose widget will be global
> </qx:somewidget2>
>
> May be this example looks like unnessesary :)
>
If you choose your global variable names well, I don't think there is
any problem with using global variables. But you can also use some sort
of object lookup, and we could, if this is important for you, include
this in the QxBuilder, even though it would increase the code length. So
instead of just
<qx:button id="myGlobalButton" .../> => var qx_123 = myGlobalButton =
new QxButton();
we could do
QxById = {};
[...]
var qx_123 = new QxButton(); QxById['myGlobalButton'] = qx_123;
then you could access the widget later through the lookup object.
Somebody wrote a object container a while ago, we should be able to find
it on the list. However, this should be optional, since for me at least,
working with global variables is just fine. I call them, for example,
"bg_login_window", and there is little chance that this will conflict
with anything. But this is a matter of taste.
I usually work with global events, and then objects do not need to know
each others' names, they just listen for the event for a certain
behaviour. You might think about this way of doing things. Instead of
having one object manipulate another object, why not embedding all the
manipulation code in the object that is being modified, and having this
object listen for events. I think this makes an application much more
maintainable and also easier to understand, because you can see the
behaviour of an object immediately when looking at the object.
<qx:widget1 ...>
<qx:globalEventListener type="do-alert-hello-world">
alert ("Hello World");
</qx:globalEventListener>
</qx:widget1>
<qx:widget2...>
<qx:eventListener type="click">
window.application.createDispatchEvent ( "do-alert-hello-world");
</qx:eventListener>
</qx:widget2>
Note that the globalEventListener tag is not a native qooxdoo function,
but a shortcut for
window.application.addEventListener ( "event-name", function(){
(event listener code)
},this);
Lastly, Ken Olsson has argued for not putting any code within templates.
Instead, behavioural code should be left outside and put into separate
js-files. The qxml files, then, should only contain ui description. This
probably makes sense, even though I am too lazy for it and like
clobbering the qxml with qx:script tags. But Ken's suggestion means
using the eventlistener tags solely to delegate event handling to an
external function. Instead of
<qx:button label="Click me!">
<qx:eventLister type="execute">
alert ( "Hello world!");
</qx:eventListener>
</qx:button>
you should only have
<qx:button id="mybutton" label="Click me!"
>
or
<qx:button id="mybutton" label="Click me!">
<qx:eventListener type="execute" delegate="mybutton.handleExecute"/>
</qx:button>
and then include a js after widget creating which contains the code
myButton.handleExecute = function()
{
alert ("Hello world!");
};
Does this address your concerns?
Christian
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ qooxdoo-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
