2016-09-26 09:28:47 +00:00
|
|
|
|
2022-06-06 08:53:59 +00:00
|
|
|
var Entry = require('../entry');
|
2022-06-06 12:49:18 +00:00
|
|
|
var ColumnRadio = require('../columns/radio');
|
2016-09-26 09:28:47 +00:00
|
|
|
|
2022-05-30 01:30:33 +00:00
|
|
|
module.exports = new Class({
|
2016-09-26 09:28:47 +00:00
|
|
|
Extends: Entry
|
2015-01-23 13:09:30 +00:00
|
|
|
,Tag: 'htk-table'
|
|
|
|
|
2022-05-30 01:30:33 +00:00
|
|
|
,render: function() {
|
|
|
|
var tv = new Htk.TreeView();
|
|
|
|
this.node.appendChild(tv.node);
|
2015-01-23 13:09:30 +00:00
|
|
|
|
2022-05-30 01:30:33 +00:00
|
|
|
var renderer = new ColumnRadio();
|
|
|
|
tv.appendColumn(0, renderer, '');
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
var rbGroup = renderer.rbGroup;
|
2022-05-30 01:30:33 +00:00
|
|
|
rbGroup.addSignal('changed', this.changed, this);
|
2015-01-23 13:09:30 +00:00
|
|
|
|
|
|
|
this.treeview = tv;
|
|
|
|
this.rbGroup = rbGroup;
|
|
|
|
}
|
|
|
|
|
2022-05-30 01:30:33 +00:00
|
|
|
,setModel: function(model) {
|
|
|
|
this.treeview.setModel(model);
|
|
|
|
model.addSignal('status-changed', this.modelRefresh, this);
|
|
|
|
this.selectValue();
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
2022-05-30 01:30:33 +00:00
|
|
|
,changed: function() {
|
|
|
|
this.realValue = this.rbGroup.getValue();
|
|
|
|
this.emit('changed');
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
2022-05-30 01:30:33 +00:00
|
|
|
,selectValue: function() {
|
|
|
|
this.rbGroup.setValue(this.realValue);
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
2022-05-30 01:30:33 +00:00
|
|
|
,setRealValue: function() {
|
|
|
|
this.selectValue();
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
2022-05-30 01:30:33 +00:00
|
|
|
,modelRefresh: function(model, status) {
|
2016-09-26 09:28:47 +00:00
|
|
|
if (status == Db.Model.Status.READY)
|
2022-05-30 01:30:33 +00:00
|
|
|
this.selectValue();
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
2022-05-30 01:30:33 +00:00
|
|
|
,setEditable: function(editable) {
|
|
|
|
this.rbGroup.setEditable(editable);
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
});
|