
module.exports = new Class
({
	Extends: Htk.Field
	,Tag: 'htk-label'
	,Properties:
	{
		/**
		 * Format that applies to the value.
		 */
		format:
		{
			type: String
			,set: function (x)
			{
				this._format = _(x);
				this.putValue (this._value);
			}
			,get: function ()
			{
				return this._format;
			}
		}
		/**
		 * 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;
			}
		}
	}
	
	,_format: null
	,_for: null

	,appendChild: function (child)
	{
		this.node.appendChild (child);
	}

	,render: function ()
	{
		this.createRoot ('label');
	}

	,putValue: function (value)
	{
		Vn.Node.setText (this.node,
			Vn.Value.format (value, this._format));
	}
});
