Small contribution (desktop and window manager)

4 views
Skip to first unread message

Lorenzo Vegetti

unread,
Aug 6, 2009, 8:22:58 AM8/6/09
to QxTransformer
This is a first draft for 2 new tags for qx.window.desktop and
qx.window.Manager Qooxdoo classes.
Still not such a big contribution, it's just a little more than an
intelligent cut and paste :-)

With the qxml:
<qx:desktop id="desktop">
<qx:windowManager id="desktopManager">
</qx:windowManager>
</qx:desktop>
it generated the expected code
var desktopManager = new qx.ui.window.Manager();
var desktop = new qx.ui.window.Desktop();
desktop.setWindowManager(desktopManager)

Here's the snippet for tags.json:

/
*-------------------------------------------------------------------------
Desktop and Window Manager

-------------------------------------------------------------------------
*/

"qx:desktop": {
"extends": "qx:widget",
"body": {
"*":"body/qx/desktop.mako"
},
"data": {
"props": {
"class": "qx.ui.window.Desktop"
}
}
},

"qx:windowManager": {
"extends": "qx:widget",
"data": {
"props": {
"class": "qx.ui.window.Manager"
}
}
},

And here's the code for desktop.mako:

<%namespace name="utils" file="../../utils/utils.mako"/>\
<%namespace name="attr" file="../../utils/attribute.mako"/>\
<%namespace name="tag" file="../../utils/tag.mako"/>\
\
${tag.children("*[1]",("new"))}\
var ${utils.rawAttrib("id")} = new ${utils.prop("class")}();
${utils.rawAttrib("id")}.setWindowManager(${utils.xpathRawAttrib("*
[1]","id")})
${utils.varScope()}\
\

${tag.properties()}
${tag.add()}

${tag.children("*[1]",("properties", "children"))}

Lorenzo Vegetti

unread,
Aug 6, 2009, 8:49:07 AM8/6/09
to QxTransformer
Desktop need a non null manager in the constructor., so the "correct"
template is following:

<%namespace name="utils" file="../../utils/utils.mako"/>\
<%namespace name="attr" file="../../utils/attribute.mako"/>\
<%namespace name="tag" file="../../utils/tag.mako"/>\
\
${tag.children("*[1]",("new"))}\
var ${utils.rawAttrib("id")} = new ${utils.prop("class")}($

Lorenzo Vegetti

unread,
Aug 6, 2009, 10:37:41 AM8/6/09
to QxTransformer
Better yet: this way manager may contain other elements.
Now something like this is supported:
<qx:desktop qxt:scope="this" id="desktop" qxt:flex="1">
<qx:windowManager qxt:scope="this" id="desktopManager">
<qx:tabView qxt:edge="0">
<qx:page label="Home" icon="icon/16/apps/utilities-
terminal.png">
<qx:vbox>
<qx:label content="Test label"/>
</qx:vbox>
</qx:page>
</qx:tabView>
</qx:windowManager>
</qx:desktop>


tags.json:

/
*-------------------------------------------------------------------------
Desktop and Window Manager

-------------------------------------------------------------------------
*/

"qx:desktop": {
"extends": "container",
"body": {
"*":"body/qx/desktop.mako"
//"qxt:component" : "body/qx/component_container.mako"
},
"data": {
"props": {
"class": "qx.ui.window.Desktop"
}
}
},

"qx:windowManager": {
"extends": "layout",

Siarhei Barysiuk

unread,
Aug 6, 2009, 11:20:20 AM8/6/09
to qxtran...@googlegroups.com
Well done!

I'll add them to svn repo.

Thanks,
Serge

Siarhei Barysiuk

unread,
Aug 6, 2009, 11:27:41 AM8/6/09
to qxtran...@googlegroups.com
Just for information....

You could use all power of dialect extensions here (these two will be
added to svn repo since they are qooxdoo tags, but may be you find it
useful for your own shortcuts). If you take a look at bin/dialect.json
you can see following structure:

{
//show priority of dialects. Next dialect overrides previous one.
"dialects": ["qxml","qcl"],
"qxml": {
"path": "../dialects/qxml"
},
"qcl" : {
"path" : "../../dialect/qcl"
}
}


So, here you can add an own extension and use separate folder to keep
all templates, tags.json, etc. It's especially useful if you wouldn't
like to mix up own tags with defaults from tags.json of main qxml
dialect. Refer to qcl dialect to get know how dialect is organized
(qxml has the same structure as well). And, yes, you can extend own
tags from base ones from qxml, use default templates from qxml, etc.


Siarhei


On Aug 6, 2009, at 5:37 PM, Lorenzo Vegetti wrote:

>
Reply all
Reply to author
Forward
0 new messages