|
|
|
/**
|
|
|
|
* Created by GUY on 2016/1/26.
|
|
|
|
*
|
|
|
|
* @class BI.MultiLayerSingleTreePopup
|
|
|
|
* @extends BI.Pane
|
|
|
|
*/
|
|
|
|
|
|
|
|
BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, {
|
|
|
|
|
|
|
|
_defaultConfig: function () {
|
|
|
|
return BI.extend(BI.MultiLayerSingleTreePopup.superclass._defaultConfig.apply(this, arguments), {
|
|
|
|
baseCls: "bi-multilayer-singletree-popup",
|
|
|
|
tipText: BI.i18nText("BI-No_Selected_Item"),
|
|
|
|
isDefaultInit: false,
|
|
|
|
itemsCreator: BI.emptyFn,
|
|
|
|
items: []
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
_init: function () {
|
|
|
|
BI.MultiLayerSingleTreePopup.superclass._init.apply(this, arguments);
|
|
|
|
|
|
|
|
var self = this, o = this.options;
|
|
|
|
|
|
|
|
this.tree = BI.createWidget({
|
|
|
|
type: "bi.multilayer_single_level_tree",
|
|
|
|
isDefaultInit: o.isDefaultInit,
|
|
|
|
items: o.items,
|
|
|
|
itemsCreator: o.itemsCreator,
|
|
|
|
value: o.value
|
|
|
|
});
|
|
|
|
|
|
|
|
BI.createWidget({
|
|
|
|
type: "bi.vertical",
|
|
|
|
scrolly: false,
|
|
|
|
scrollable: true,
|
|
|
|
element: this,
|
|
|
|
vgap: 5,
|
|
|
|
items: [this.tree]
|
|
|
|
});
|
|
|
|
|
|
|
|
this.tree.on(BI.Controller.EVENT_CHANGE, function () {
|
|
|
|
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
|
|
|
|
});
|
|
|
|
|
|
|
|
this.tree.on(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, function () {
|
|
|
|
self.fireEvent(BI.MultiLayerSingleTreePopup.EVENT_CHANGE);
|
|
|
|
});
|
|
|
|
|
|
|
|
this.check();
|
|
|
|
},
|
|
|
|
|
|
|
|
getValue: function () {
|
|
|
|
return this.tree.getValue();
|
|
|
|
},
|
|
|
|
|
|
|
|
setValue: function (v) {
|
|
|
|
v = BI.isArray(v) ? v : [v];
|
|
|
|
this.tree.setValue(v);
|
|
|
|
},
|
|
|
|
|
|
|
|
populate: function (items) {
|
|
|
|
BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments);
|
|
|
|
this.tree.populate(items);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
BI.MultiLayerSingleTreePopup.EVENT_CHANGE = "EVENT_CHANGE";
|
|
|
|
BI.shortcut("bi.multilayer_single_tree_popup", BI.MultiLayerSingleTreePopup);
|