0
1
Fork 0
hedera-web-mindshore/js/htk/field.js

148 lines
2.2 KiB
JavaScript
Raw Normal View History

2016-09-26 09:28:47 +00:00
var Widget = require ('./widget');
2017-04-19 06:16:37 +00:00
/**
* Base class for graphical fields.
*/
2016-09-26 09:28:47 +00:00
module.exports = new Class
({
2016-09-26 09:28:47 +00:00
Extends: Widget
2017-04-19 06:16:37 +00:00
,Implements: Vn.ParamIface
,Tag: 'htk-field'
,Properties:
{
value:
{
2017-04-19 06:16:37 +00:00
type: null
,set: function (x)
{
2017-04-19 06:16:37 +00:00
this._setValue (x);
}
2017-04-05 14:06:07 +00:00
,get: function ()
{
return this._value;
}
},
2017-04-19 06:16:37 +00:00
type:
{
2017-04-19 06:16:37 +00:00
type: Type
,set: function (x)
{
2017-04-19 06:16:37 +00:00
this._setType (x);
}
,get: function ()
{
2017-04-19 06:16:37 +00:00
return this._type;
}
},
2017-04-19 06:16:37 +00:00
param:
{
2017-04-19 06:16:37 +00:00
type: Vn.ParamIface
,set: function (x)
{
2017-04-19 06:16:37 +00:00
this._setParam (x);
}
,get: function ()
{
2017-04-19 06:16:37 +00:00
return this._param;
}
},
2017-04-05 14:06:07 +00:00
lot:
{
2017-04-19 06:16:37 +00:00
type: Vn.LotIface
,set: function (x)
{
2017-04-19 06:16:37 +00:00
this._setLot (x);
}
,get: function ()
{
return this._lot;
}
},
2017-04-05 14:06:07 +00:00
name:
{
type: String
,set: function (x)
{
2017-04-21 10:53:15 +00:00
this._setName (x);
2017-04-19 06:16:37 +00:00
}
,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
2017-04-19 06:16:37 +00:00
,_setValue: function (newValue)
{
2017-04-19 06:16:37 +00:00
Vn.ParamIface.prototype._setValue.call (this, newValue);
this.putValue (newValue);
if (this.conditionalFunc)
this.conditionalFunc (this, newValue);
}
2017-04-19 06:16:37 +00:00
/**
* 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)
{
2017-04-19 06:16:37 +00:00
this._setValue (value);
}
/**
* Virtual method that must be implemented by class childs to set the entry
* editable.
*
2017-04-21 10:53:15 +00:00
* @param {boolean} editable Whether the user is allowed to edit the entry
2016-12-20 09:32:17 +00:00
*/
2017-04-07 11:00:33 +00:00
,setEditable: function () {}
/**
* Virtual method that must be implemented by class childs to put the value
* on the associated entry.
*
2017-04-07 11:00:33 +00:00
* @param {*} value The new value for the entry
2016-12-20 09:32:17 +00:00
*/
2017-04-07 11:00:33 +00:00
,putValue: function () {}
});