Hi Leo,
unfortunately, there's no documentation in the manual on how to create
custom qx.Website widgets. That said, it's still possible if you're
willing to jump through a few hoops and dig into the framework's widgets
to see how they're implemented. The main steps are:
* Use q.define to create your widget class
* Inherit from qx.ui.website.Widget or one of its subclasses - there's
no global qx symbol in qx.Website so you have to use q.$$qx
* Create a factory method for your widget and attach it to the q collection
* Override the render method as a starting point for your widget's
implementation logic. Try to stick to the q API if possible. If you need
to use framework classes that aren't included in your qx.Website build,
you'll have to customize your build config (in a qx.Website skeleton
application).
Here's a simple but functional example:
q.ready(function() {
var qx = q.$$qx;
q.define ("Custom", {
extend: qx.ui.website.Widget,
construct : function(selector, context) {
this.base(arguments, selector, context);
},
statics: {
// default configuration
_config : {
label : "Custom qx.Website widget"
},
// factory method
custom: function(label) {
var custom = new Custom(this);
if (label) {
custom.setConfig("label", label);
}
custom.init(); // initialize the widget
custom.render();
return custom;
}
},
members: {
// apply custom config, templates, etc.
render: function() {
this.setHtml(this.getConfig("label"));
}
},
defer: function(statics) {
// attach factory method to q()
q.$attach({custom : statics.custom});
}
});
q.create("<div>").custom("My awesome widget").appendTo(document.body);
});
Hope this helps.
Regards,
Daniel
On 12.02.2015 08:54, Leo von Klenze wrote:
> Hi John,
>
> Thank you for the hint but I'm talking about Website widgets not Desktop.
>
> Therefore I've no application class where to reference my new widget.
>
> Thank you!
> Leo
>
> John Spackman <[email protected]> schrieb:
>> Creating a new widget is as simple as just writing a new class and
>> using it; you have to re-run the generator each time you reference a
>> new class, but it will find it automatically and include it into your
>> application. Contribs are not automatically added but it’s a simple
>> process - see this page
>> http://manual.qooxdoo.org/current/pages/development/contrib.html for
>> how to. If you want help on how to write a widget from scratch, here’s
>> a useful starting point:
>> http://manual.qooxdoo.org/current/pages/desktop/ui_develop.html John >
>> On 11 Feb 2015, at 21:51, Leo von Klenze wrote: > > Hello, > > I've
>> created a Website using create-application.pb -t Website and want > to
>> add own widgets. > > I assumed to modify config.json but unfortunately
>> I haven't found any > information on how to do this. Is such
>> information missing in the manual? > > Do you have any suggestions? > >
>> Thank you! > Best regards, > Leo > >
>> ------------------------------------------------------------------------------
>>> Dive into the World of Parallel Programming. The Go Parallel Website,
>>> sponsored by Intel and developed in partnership with Slashdot Media,
>> is your > hub for all things parallel software development, from weekly
>> thought > leadership blogs to news, videos, case studies, tutorials and
>> more. Take a > look and join the conversation now.
>> http://goparallel.sourceforge.net/ >
>> _______________________________________________ > qooxdoo-devel mailing
>> list > [email protected] >
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming. The Go Parallel Website,
>> sponsored by Intel and developed in partnership with Slashdot Media, is
>> your hub for all things parallel software development, from weekly
>> thought leadership blogs to news, videos, case studies, tutorials and
>> more. Take a look and join the conversation now.
>> http://goparallel.sourceforge.net/
>> _______________________________________________ qooxdoo-devel mailing
>> list [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel