2016-09-26 09:28:47 +00:00
|
|
|
|
|
|
|
module.exports = new Class
|
2015-01-23 13:09:30 +00:00
|
|
|
({
|
|
|
|
Extends: Htk.Field
|
|
|
|
,Tag: 'htk-label'
|
|
|
|
,Properties:
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Format that applies to the value.
|
2016-12-20 09:32:17 +00:00
|
|
|
*/
|
2015-01-23 13:09:30 +00:00
|
|
|
format:
|
|
|
|
{
|
|
|
|
type: String
|
|
|
|
,set: function (x)
|
|
|
|
{
|
|
|
|
this._format = _(x);
|
2015-03-09 08:36:54 +00:00
|
|
|
this.putValue (this._value);
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
,get: function ()
|
|
|
|
{
|
|
|
|
return this._format;
|
|
|
|
}
|
|
|
|
}
|
2017-10-18 16:01:21 +00:00
|
|
|
/**
|
|
|
|
* Input entry associated to the label.
|
|
|
|
*/
|
|
|
|
,for:
|
|
|
|
{
|
|
|
|
type: Vn.Component
|
|
|
|
,set: function (x)
|
|
|
|
{
|
|
|
|
this._for = x;
|
|
|
|
this.node.htmlFor = x.htmlId;
|
|
|
|
}
|
|
|
|
,get: function ()
|
|
|
|
{
|
|
|
|
return this._for;
|
|
|
|
}
|
|
|
|
}
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
,_format: null
|
2017-10-18 16:01:21 +00:00
|
|
|
,_for: null
|
|
|
|
|
|
|
|
,appendChild: function (child)
|
|
|
|
{
|
|
|
|
this.node.appendChild (child);
|
|
|
|
}
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2016-10-16 14:16:08 +00:00
|
|
|
,render: function ()
|
2015-01-23 13:09:30 +00:00
|
|
|
{
|
2016-10-16 14:16:08 +00:00
|
|
|
this.createRoot ('label');
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
,putValue: function (value)
|
|
|
|
{
|
|
|
|
Vn.Node.setText (this.node,
|
|
|
|
Vn.Value.format (value, this._format));
|
|
|
|
}
|
|
|
|
});
|