2016-09-26 09:28:47 +00:00
|
|
|
|
|
|
|
var Entry = require ('./entry');
|
|
|
|
var ColumnRadio = require ('../column/radio');
|
|
|
|
|
|
|
|
module.exports = new Class
|
2015-01-23 13:09:30 +00:00
|
|
|
({
|
2016-09-26 09:28:47 +00:00
|
|
|
Extends: Entry
|
2015-01-23 13:09:30 +00:00
|
|
|
,Tag: 'htk-table'
|
|
|
|
|
|
|
|
,initialize: function (props)
|
|
|
|
{
|
|
|
|
var tv = new Htk.TreeView ();
|
|
|
|
this.node.appendChild (tv.getNode ());
|
|
|
|
|
2016-09-26 09:28:47 +00:00
|
|
|
var renderer = new ColumnRadio ();
|
2015-01-23 13:09:30 +00:00
|
|
|
tv.appendColumn (0, renderer, '');
|
|
|
|
|
|
|
|
var rbGroup = renderer.rbGroup;
|
|
|
|
rbGroup.addSignal ('changed', this.changed, this);
|
|
|
|
|
|
|
|
this.treeview = tv;
|
|
|
|
this.rbGroup = rbGroup;
|
2015-11-09 08:14:33 +00:00
|
|
|
this.parent (props);
|
2015-01-23 13:09:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
,setModel: function (model)
|
|
|
|
{
|
|
|
|
this.treeview.setModel (model);
|
|
|
|
model.addSignal ('status-changed', this.modelRefresh, this);
|
|
|
|
this.selectValue ();
|
|
|
|
}
|
|
|
|
|
|
|
|
,changed: function (rbGroup)
|
|
|
|
{
|
|
|
|
this.realValue = this.rbGroup.getValue ();
|
|
|
|
this.signalEmit ('changed');
|
|
|
|
}
|
|
|
|
|
|
|
|
,selectValue: function ()
|
|
|
|
{
|
|
|
|
this.rbGroup.setValue (this.realValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
,setRealValue: function ()
|
|
|
|
{
|
|
|
|
this.selectValue ();
|
|
|
|
}
|
|
|
|
|
|
|
|
,modelRefresh: function (model, status)
|
|
|
|
{
|
2016-09-26 09:28:47 +00:00
|
|
|
if (status == Db.Model.Status.READY)
|
2015-01-23 13:09:30 +00:00
|
|
|
this.selectValue ();
|
|
|
|
}
|
|
|
|
|
|
|
|
,setEditable: function (editable)
|
|
|
|
{
|
|
|
|
this.rbGroup.setEditable (editable);
|
|
|
|
}
|
|
|
|
});
|