var Widget = require ('./widget'); /** * Base class for graphical fields. */ module.exports = new Class ({ Extends: Widget ,Implements: Vn.ParamIface ,Tag: 'htk-field' ,Properties: { value: { type: null ,set: function (x) { this._setValue (x); } ,get: function () { return this._value; } }, type: { type: Type ,set: function (x) { this._setType (x); } ,get: function () { return this._type; } }, param: { type: Vn.ParamIface ,set: function (x) { this._setParam (x); } ,get: function () { return this._param; } }, lot: { type: Vn.LotIface ,set: function (x) { this._setLot (x); } ,get: function () { return this._lot; } }, name: { type: String ,set: function (x) { this._setName (x); } ,get: function () { return this._name; } }, oneWay: { type: Boolean ,set: function (x) { this._oneWay = x; } ,get: function () { return this._oneWay; } }, editable: { type: Boolean ,set: function (x) { if (x != this._editable) { this._editable = x; this.setEditable (x); } } ,get: function () { return this._editable; } }, conditionalFunc: { type: Function ,value: null } } ,_editable: true ,_setValue: function (newValue) { Vn.ParamIface.prototype._setValue.call (this, newValue); this.putValue (newValue); if (this.conditionalFunc) this.conditionalFunc (this, newValue); } /** * Protected method that should be called from class childs when the value * on the associated entry changes. * * @param {*} value The new entry value */ ,valueChanged: function (value) { this._setValue (value); } /** * Virtual method that must be implemented by class childs to set the entry * editable. * * @param {boolean} editable Whether the user is allowed to edit the entry */ ,setEditable: function () {} /** * Virtual method that must be implemented by class childs to put the value * on the associated entry. * * @param {*} value The new value for the entry */ ,putValue: function () {} });