On 02/03/2011 01:06 PM, josefkoller wrote:
>
> Hi,
>
> If I use a own class in my Application.js I use till now this method:
>
> qx.Class.define("imkerei.Application",
> {
> extend : qx.application.Standalone,
>
> members :
> {
> main : function()
> {
> qx.Class.define("custom.MovableLabel",
> {
> extend : qx.ui.basic.Label,
> include: [qx.ui.core.MMovable],
> construct : function(content)
> {
> this.base(arguments, content);
> this._activateMoveHandle(this);
> }
> });
> // and I use it with
> test = new custom.MovableLabel("Texttest");
> ....
> }
> }
> });
>
> Is it possible to outsource such own classes for example to ownClasses.js
> and import such classes from ownClasses.js into my Application.js?
This is exactly the strongly recommended way, but the file name has to
match the class name (see [1]). You should generally not nest class
definitions (like you did in your example with
'qx.Class.define("imkerei.Application", { ...
qx.Class.define("custom.MovableLabel",{..});...});'). Although possible,
this makes the work of the tool chain much harder, and might deprive you
from some of its features.
The base line is:
- *one* qx.Class.define per file
- the file name *has* to be the same as the last part of the class name
(e.g. "Application.js", "MoveableLabel.js")
- the name space *has* to match the directory structure, so a class in
the file imkerei/MoveableLabel.js has to be named
"imkerei.MoveableLabel" (and not "custom.MoveableLabel")
- this applies recursively to sub-directories (so a class in a file
imkerei/foo/Bar.js has to be named "imkerei.foo.Bar")
T.
[1] http://manual.qooxdoo.org/1.3/pages/getting_started/code_structure.html
>
> Background:
> If I have more such "own classes" my Application.js will be very long and
> unclear.
>
> Or which syntax I have to use to get a structered code (not all in
> Application.js)?
>
> Thanks
>
> Josef
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel