You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
115 lines
2.9 KiB
115 lines
2.9 KiB
8 years ago
|
/**
|
||
|
*
|
||
|
* @class BI.MultiTreeCheckPane
|
||
|
* @extends BI.Pane
|
||
|
*/
|
||
|
BI.MultiTreeCheckPane = BI.inherit(BI.Pane, {
|
||
|
|
||
|
constants: {
|
||
|
height: 25,
|
||
|
lgap: 10,
|
||
|
tgap: 5
|
||
|
},
|
||
|
|
||
|
_defaultConfig: function () {
|
||
|
return BI.extend(BI.MultiTreeCheckPane.superclass._defaultConfig.apply(this, arguments), {
|
||
|
baseCls: "bi-multi-tree-check-pane",
|
||
|
onClickContinueSelect: BI.emptyFn
|
||
|
});
|
||
|
},
|
||
|
|
||
|
_init: function () {
|
||
|
BI.MultiTreeCheckPane.superclass._init.apply(this, arguments);
|
||
|
|
||
|
var self = this, opts = this.options;
|
||
|
|
||
|
this.selected_values = {};
|
||
|
|
||
|
var continueSelect = BI.createWidget({
|
||
|
type: 'bi.text_button',
|
||
|
text: BI.i18nText('BI-Continue_Select'),
|
||
|
cls: 'multi-tree-check-selected'
|
||
|
});
|
||
|
continueSelect.on(BI.TextButton.EVENT_CHANGE, function () {
|
||
|
opts.onClickContinueSelect();
|
||
|
BI.nextTick(function () {
|
||
|
self.empty();
|
||
|
});
|
||
|
});
|
||
|
|
||
|
var backToPopup = BI.createWidget({
|
||
|
type: 'bi.left',
|
||
|
cls: 'multi-tree-continue-select',
|
||
|
items: [
|
||
|
{
|
||
|
el: {
|
||
|
type: "bi.label",
|
||
|
text: BI.i18nText('BI-Selected_Data')
|
||
|
},
|
||
|
lgap: this.constants.lgap,
|
||
|
tgap: this.constants.tgap
|
||
|
},
|
||
|
{
|
||
|
el: continueSelect,
|
||
|
lgap: this.constants.lgap,
|
||
|
tgap: this.constants.tgap
|
||
|
}]
|
||
|
});
|
||
|
|
||
|
this.display = BI.createWidget({
|
||
|
type: "bi.display_tree",
|
||
|
cls: "bi-multi-tree-display",
|
||
|
itemsCreator: function (op, callback) {
|
||
|
op.type = BI.TreeView.REQ_TYPE_SELECTED_DATA;
|
||
|
opts.itemsCreator(op, callback);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
this.display.on(BI.Events.AFTERINIT, function () {
|
||
|
self.fireEvent(BI.Events.AFTERINIT);
|
||
|
});
|
||
|
|
||
|
this.display.on(BI.TreeView.EVENT_INIT, function () {
|
||
|
backToPopup.setVisible(false);
|
||
|
});
|
||
|
|
||
|
this.display.on(BI.TreeView.EVENT_AFTERINIT, function () {
|
||
|
backToPopup.setVisible(true);
|
||
|
});
|
||
|
|
||
|
BI.createWidget({
|
||
|
type: 'bi.vtape',
|
||
|
element: this,
|
||
|
items: [{
|
||
|
height: this.constants.height,
|
||
|
el: backToPopup
|
||
|
}, {
|
||
|
height: 'fill',
|
||
|
el: this.display
|
||
|
}]
|
||
|
});
|
||
|
|
||
|
},
|
||
|
|
||
|
empty: function () {
|
||
|
this.display.empty();
|
||
|
},
|
||
|
|
||
|
populate: function (configs) {
|
||
|
this.display.stroke(configs);
|
||
|
},
|
||
|
|
||
|
setValue: function (v) {
|
||
|
v || (v = {});
|
||
|
this.display.setValue(v.value);
|
||
|
},
|
||
|
|
||
|
getValue: function () {
|
||
|
|
||
|
}
|
||
|
});
|
||
|
|
||
|
BI.MultiTreeCheckPane.EVENT_CONTINUE_CLICK = "EVENT_CONTINUE_CLICK";
|
||
|
|
||
|
|
||
|
$.shortcut("bi.multi_tree_check_pane", BI.MultiTreeCheckPane);
|