82 lines
1.2 KiB
JavaScript
82 lines
1.2 KiB
JavaScript
Htk.Widget = new Class
|
|
({
|
|
Extends: Vn.Object
|
|
,Properties:
|
|
{
|
|
class:
|
|
{
|
|
type: String
|
|
,set: function (x)
|
|
{
|
|
this._cssClass = x;
|
|
this._refreshClass ();
|
|
}
|
|
,get: function ()
|
|
{
|
|
return this.node.className;
|
|
}
|
|
}
|
|
}
|
|
|
|
/** Main HTML node that represents the widget **/
|
|
,node: null
|
|
,builder: null
|
|
|
|
,builderInit: function (path)
|
|
{
|
|
var builder = new Vn.Builder ();
|
|
builder.signalData = this;
|
|
builder.loadXml (path);
|
|
|
|
var res = this.builder = builder.load ();
|
|
this.node = res.$('main');
|
|
res.link ();
|
|
}
|
|
|
|
,createElement: function (tagName)
|
|
{
|
|
this.node = document.createElement (tagName);
|
|
return this.node;
|
|
}
|
|
|
|
,getNode: function ()
|
|
{
|
|
if (!this.node)
|
|
{
|
|
this._createNode ();
|
|
this._refreshClass ();
|
|
}
|
|
|
|
return this.node;
|
|
}
|
|
|
|
,_createNode: function () {}
|
|
|
|
,_refreshClass: function ()
|
|
{
|
|
if (this.node && this._cssClass)
|
|
this.node.className = this._cssClass +' '+ this.node.className;
|
|
}
|
|
|
|
,$: function (id)
|
|
{
|
|
if (this.builder)
|
|
return this.builder.getById (id);
|
|
|
|
return null;
|
|
}
|
|
|
|
,remove: function ()
|
|
{
|
|
Vn.Node.remove (this.node);
|
|
}
|
|
|
|
,_destroy: function ()
|
|
{
|
|
if (this.builder)
|
|
this.builder.unref ();
|
|
|
|
this.parent ();
|
|
}
|
|
});
|