fineui是帆软报表和BI产品线所使用的前端框架。
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.

81 lines
2.2 KiB

8 years ago
/**
* 带有标题栏的pane
* @class BI.Panel
* @extends BI.Widget
*/
7 years ago
BI.Panel = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.Panel.superclass._defaultConfig.apply(this, arguments), {
8 years ago
baseCls: "bi-panel bi-border",
7 years ago
title: "",
titleHeight: 30,
7 years ago
titleButtons: [],
el: {},
logic: {
8 years ago
dynamic: false
}
});
},
7 years ago
_init: function () {
BI.Panel.superclass._init.apply(this, arguments);
8 years ago
var o = this.options;
BI.createWidget(BI.extend({
8 years ago
element: this
8 years ago
}, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection("top", this._createTitle()
7 years ago
, this.options.el)
8 years ago
}))));
},
7 years ago
_createTitle: function () {
8 years ago
var self = this, o = this.options;
this.text = BI.createWidget({
type: "bi.label",
cls: "panel-title-text",
text: o.title,
height: o.titleHeight
8 years ago
});
this.button_group = BI.createWidget({
7 years ago
type: "bi.button_group",
8 years ago
items: o.titleButtons,
layouts: [{
type: "bi.center_adapt",
7 years ago
lgap: 10
8 years ago
}]
});
7 years ago
this.button_group.on(BI.Controller.EVENT_CHANGE, function () {
8 years ago
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
7 years ago
this.button_group.on(BI.ButtonGroup.EVENT_CHANGE, function (value, obj) {
8 years ago
self.fireEvent(BI.Panel.EVENT_CHANGE, value, obj);
});
return {
el: {
type: "bi.left_right_vertical_adapt",
7 years ago
cls: "panel-title bi-header-background bi-border-bottom",
height: BI.toPix(o.titleHeight, 1),
8 years ago
items: {
left: [this.text],
right: [this.button_group]
},
lhgap: 10,
rhgap: 10
},
height: BI.toPix(o.titleHeight, 1)
8 years ago
};
},
7 years ago
setTitle: function (title) {
8 years ago
this.text.setValue(title);
}
});
BI.Panel.EVENT_CHANGE = "EVENT_CHANGE";
8 years ago
7 years ago
BI.shortcut("bi.panel", BI.Panel);