2015-01-23 13:09:30 +00:00
|
|
|
Htk.Entry = new Class
|
|
|
|
({
|
|
|
|
Extends: Htk.Field
|
|
|
|
,Tag: 'htk-entry'
|
|
|
|
|
|
|
|
,initialize: function (props)
|
|
|
|
{
|
|
|
|
this.createElement ('input');
|
|
|
|
this.node.type = 'text';
|
2015-03-27 19:10:49 +00:00
|
|
|
this.node.addEventListener ('change', this.onChange.bind (this));
|
2015-11-09 08:14:33 +00:00
|
|
|
|
|
|
|
this.parent (props);
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
2015-03-27 19:10:49 +00:00
|
|
|
,onChange: function (event)
|
2015-01-23 13:09:30 +00:00
|
|
|
{
|
|
|
|
var newValue;
|
|
|
|
|
|
|
|
if (this.node.value == '')
|
|
|
|
newValue = null;
|
|
|
|
else
|
|
|
|
newValue = this.node.value;
|
|
|
|
|
|
|
|
this.valueChanged (newValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
,putValue: function (value)
|
|
|
|
{
|
|
|
|
if (!value)
|
|
|
|
this.node.value = '';
|
|
|
|
else
|
|
|
|
this.node.value = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
,setEditable: function (editable)
|
|
|
|
{
|
|
|
|
this.node.readOnly = !editable;
|
|
|
|
}
|
|
|
|
});
|