> 1. How could I access the main Application object from objects, I've
> created in its "main" method? Is there the way to access it globally?
I've got around this by some trickery.
The namespaces are just a hierarchy of objects, so you can create anything in
them in addition to the classes.
In my main application class, I have:
----------------------------------------------------------------
var oApplication; // we have a global application class
//===============================================================
/**
* Abling application class
*/
//===============================================================
qx.OO.defineClass("abling.CApplication", qx.component.AbstractApplication,
function()
{
qx.component.AbstractApplication.call(this);
abling.oApplication = this; // remember reference to app class
});
/---------------------------------------------------------------
/**
* getApp - get global app.
*
* @return {abling.CApplication} application class singleton
*/
//---------------------------------------------------------------
abling.getApp = function()
{
return abling.oApplication; // give back global variable
}
----------------------------------------------------------------
Now whenever I want to get my application object, in any class file, I can just
do this:
var myApp = abling.getApp();
I also have, for example, a property on the main app which is a singleton
object that I want to have accessible throughout the app:
/** The main fragment viewer */
qx.OO.addProperty({name : "viewer", type : "object", instance :
"abling.fragment.CViewer", defaultValue : null});
So to get this anywhere I can just use:
var myViewer = abling.getApp().getViewer();
I modelled this on the way that some globals are defined in the qooxdoo
structure, e.g. qx.ui.core.Widget.flushGlobalQueues. That is a function that is
added directly to the namespace object "qx.ui.core.Widget".
Hugh
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel