Browse Source

Pull request #1573: 无JIRA任务 父子组件名的命名优化下

Merge in VISUAL/fineui from ~GUY/fineui:master to master

* commit '9d4f7cf464f97d919fdb3df743b1191bb4091e7a':
  父子组件名的命名优化下
es6
guy 4 years ago
parent
commit
4bb9c3392f
  1. 11
      src/core/wrapper/layout.js
  2. 30
      src/core/wrapper/layout/layout.border.js
  3. 27
      src/core/wrapper/layout/layout.card.js
  4. 12
      src/core/wrapper/layout/layout.division.js
  5. 2
      src/core/wrapper/layout/layout.grid.js
  6. 4
      src/core/wrapper/layout/layout.table.js
  7. 20
      src/core/wrapper/layout/layout.tape.js
  8. 2
      src/core/wrapper/layout/layout.td.js
  9. 13
      src/core/wrapper/layout/layout.window.js

11
src/core/wrapper/layout.js

@ -83,7 +83,7 @@ BI.Layout = BI.inherit(BI.Widget, {
}, },
_getChildName: function (index) { _getChildName: function (index) {
return index + ""; return this.getName() + "_" + index;
}, },
_addElement: function (i, item, context) { _addElement: function (i, item, context) {
@ -94,7 +94,7 @@ BI.Layout = BI.inherit(BI.Widget, {
BI.each(self._children, function (name, child) { BI.each(self._children, function (name, child) {
if (child === w) { if (child === w) {
BI.remove(self._children, child); BI.remove(self._children, child);
self.removeItemAt(name | 0); self.removeItemAt(name.replace(self.getName() + "_", "") | 0);
} }
}); });
}); });
@ -316,14 +316,13 @@ BI.Layout = BI.inherit(BI.Widget, {
}, },
prependItems: function (items, context) { prependItems: function (items, context) {
var self = this;
items = items || []; items = items || [];
var fragment = BI.Widget._renderEngine.createFragment(); var fragment = BI.Widget._renderEngine.createFragment();
var added = []; var added = [];
for (var i = items.length - 1; i >= 0; i--) { for (var i = items.length - 1; i >= 0; i--) {
this._addItemAt(0, items[i]); this._addItemAt(0, items[i]);
var w = this._addElement(0, items[i], context); var w = this._addElement(0, items[i], context);
self._children[self._getChildName(0)] = w; this._children[this._getChildName(0)] = w;
this.options.items.unshift(items[i]); this.options.items.unshift(items[i]);
added.push(w); added.push(w);
fragment.appendChild(w.element[0]); fragment.appendChild(w.element[0]);
@ -565,11 +564,11 @@ BI.Layout = BI.inherit(BI.Widget, {
}, },
removeWidget: function (nameOrWidget) { removeWidget: function (nameOrWidget) {
var removeIndex; var removeIndex, self = this;
if (BI.isWidget(nameOrWidget)) { if (BI.isWidget(nameOrWidget)) {
BI.each(this._children, function (name, child) { BI.each(this._children, function (name, child) {
if (child === nameOrWidget) { if (child === nameOrWidget) {
removeIndex = name; removeIndex = name.replace(self.getName() + "_", "");
} }
}); });
} else { } else {

30
src/core/wrapper/layout/layout.border.js

@ -35,11 +35,11 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
item = regions["north"]; item = regions["north"];
if (item != null) { if (item != null) {
if (item.el) { if (item.el) {
if (!this.hasWidget(this.getName() + "north")) { if (!this.hasWidget(this._getChildName("north"))) {
var w = BI._lazyCreateWidget(item); var w = BI._lazyCreateWidget(item);
this.addWidget(this.getName() + "north", w); this.addWidget(this._getChildName("north"), w);
} }
this.getWidgetByName(this.getName() + "north").element.height(item.height) this.getWidgetByName(this._getChildName("north")).element.height(item.height)
.css({ .css({
position: "absolute", position: "absolute",
top: (item.top || 0), top: (item.top || 0),
@ -55,11 +55,11 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
item = regions["south"]; item = regions["south"];
if (item != null) { if (item != null) {
if (item.el) { if (item.el) {
if (!this.hasWidget(this.getName() + "south")) { if (!this.hasWidget(this._getChildName("south"))) {
var w = BI._lazyCreateWidget(item); var w = BI._lazyCreateWidget(item);
this.addWidget(this.getName() + "south", w); this.addWidget(this._getChildName("south"), w);
} }
this.getWidgetByName(this.getName() + "south").element.height(item.height) this.getWidgetByName(this._getChildName("south")).element.height(item.height)
.css({ .css({
position: "absolute", position: "absolute",
bottom: (item.bottom || 0), bottom: (item.bottom || 0),
@ -75,11 +75,11 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
item = regions["west"]; item = regions["west"];
if (item != null) { if (item != null) {
if (item.el) { if (item.el) {
if (!this.hasWidget(this.getName() + "west")) { if (!this.hasWidget(this._getChildName("west"))) {
var w = BI._lazyCreateWidget(item); var w = BI._lazyCreateWidget(item);
this.addWidget(this.getName() + "west", w); this.addWidget(this._getChildName("west"), w);
} }
this.getWidgetByName(this.getName() + "west").element.width(item.width) this.getWidgetByName(this._getChildName("west")).element.width(item.width)
.css({ .css({
position: "absolute", position: "absolute",
left: (item.left || 0), left: (item.left || 0),
@ -95,11 +95,11 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
item = regions["east"]; item = regions["east"];
if (item != null) { if (item != null) {
if (item.el) { if (item.el) {
if (!this.hasWidget(this.getName() + "east")) { if (!this.hasWidget(this._getChildName("east"))) {
var w = BI._lazyCreateWidget(item); var w = BI._lazyCreateWidget(item);
this.addWidget(this.getName() + "east", w); this.addWidget(this._getChildName("east"), w);
} }
this.getWidgetByName(this.getName() + "east").element.width(item.width) this.getWidgetByName(this._getChildName("east")).element.width(item.width)
.css({ .css({
position: "absolute", position: "absolute",
right: (item.right || 0), right: (item.right || 0),
@ -114,11 +114,11 @@ BI.BorderLayout = BI.inherit(BI.Layout, {
if ("center" in regions) { if ("center" in regions) {
item = regions["center"]; item = regions["center"];
if (item != null) { if (item != null) {
if (!this.hasWidget(this.getName() + "center")) { if (!this.hasWidget(this._getChildName("center"))) {
var w = BI._lazyCreateWidget(item); var w = BI._lazyCreateWidget(item);
this.addWidget(this.getName() + "center", w); this.addWidget(this._getChildName("center"), w);
} }
this.getWidgetByName(this.getName() + "center").element this.getWidgetByName(this._getChildName("center")).element
.css({position: "absolute", top: top, bottom: bottom, left: left, right: right}); .css({position: "absolute", top: top, bottom: bottom, left: left, right: right});
} }
} }

27
src/core/wrapper/layout/layout.card.js

@ -13,6 +13,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
items: [] items: []
}); });
}, },
render: function () { render: function () {
BI.CardLayout.superclass.render.apply(this, arguments); BI.CardLayout.superclass.render.apply(this, arguments);
this.populate(this.options.items); this.populate(this.options.items);
@ -37,9 +38,9 @@ BI.CardLayout = BI.inherit(BI.Layout, {
o.items.splice(index, 1); o.items.splice(index, 1);
} }
}); });
self.addWidget(item.cardName, w); self.addWidget(self._getChildName(item.cardName), w);
} else { } else {
var w = self.getWidgetByName(item.cardName); var w = self.getWidgetByName(self._getChildName(item.cardName));
} }
w.element.css({position: "absolute", top: "0", right: "0", bottom: "0", left: "0"}); w.element.css({position: "absolute", top: "0", right: "0", bottom: "0", left: "0"});
w.setVisible(false); w.setVisible(false);
@ -71,11 +72,11 @@ BI.CardLayout = BI.inherit(BI.Layout, {
if (!this.isCardExisted(cardName)) { if (!this.isCardExisted(cardName)) {
throw new Error("cardName is not exist"); throw new Error("cardName is not exist");
} }
return this._children[cardName]; return this._children[this._getChildName(cardName)];
}, },
_deleteCardByName: function (cardName) { _deleteCardByName: function (cardName) {
delete this._children[cardName]; delete this._children[this.getName() + "_" + cardName];
var index = BI.findIndex(this.options.items, function (i, item) { var index = BI.findIndex(this.options.items, function (i, item) {
return item.cardName == cardName; return item.cardName == cardName;
}); });
@ -89,7 +90,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
throw new Error("cardName is not exist"); throw new Error("cardName is not exist");
} }
var child = this._children[cardName]; var child = this._children[this._getChildName(cardName)];
this._deleteCardByName(cardName); this._deleteCardByName(cardName);
child && child._destroy(); child && child._destroy();
}, },
@ -107,7 +108,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
height: "100%" height: "100%"
}).appendTo(this.element); }).appendTo(this.element);
widget.invisible(); widget.invisible();
this.addWidget(cardName, widget); this.addWidget(this._getChildName(cardName), widget);
this.options.items.push({el: cardItem, cardName: cardName}); this.options.items.push({el: cardItem, cardName: cardName});
return widget; return widget;
}, },
@ -122,7 +123,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
this.showIndex = name; this.showIndex = name;
var flag = false; var flag = false;
BI.each(this.options.items, function (i, item) { BI.each(this.options.items, function (i, item) {
var el = self._children[item.cardName]; var el = self._children[self._getChildName(item.cardName)];
if (el) { if (el) {
if (name != item.cardName) { if (name != item.cardName) {
// 动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了 // 动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了
@ -138,7 +139,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
var self = this; var self = this;
this.showIndex = this.lastShowIndex; this.showIndex = this.lastShowIndex;
BI.each(this.options.items, function (i, item) { BI.each(this.options.items, function (i, item) {
self._children[item.cardName].setVisible(self.showIndex == i); self._children[self._getChildName(item.cardName)].setVisible(self.showIndex == i);
}); });
}, },
@ -161,7 +162,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
if (!BI.isKey(this.showIndex)) { if (!BI.isKey(this.showIndex)) {
return void 0; return void 0;
} }
return this.getWidgetByName(this.showIndex); return this.getWidgetByName(this._getChildName(this.showIndex));
}, },
deleteAllCard: function () { deleteAllCard: function () {
@ -174,7 +175,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
hideAllCard: function () { hideAllCard: function () {
var self = this; var self = this;
BI.each(this.options.items, function (i, item) { BI.each(this.options.items, function (i, item) {
self._children[item.cardName].invisible(); self._children[self._getChildName(item.cardName)].invisible();
}); });
}, },
@ -182,7 +183,7 @@ BI.CardLayout = BI.inherit(BI.Layout, {
var self = this; var self = this;
var flag = true; var flag = true;
BI.some(this.options.items, function (i, item) { BI.some(this.options.items, function (i, item) {
if (self._children[item.cardName].isVisible()) { if (self._children[self._getChildName(item.cardName)].isVisible()) {
flag = false; flag = false;
return false; return false;
} }
@ -191,11 +192,11 @@ BI.CardLayout = BI.inherit(BI.Layout, {
}, },
removeWidget: function (nameOrWidget) { removeWidget: function (nameOrWidget) {
var removeName; var removeName, self = this;
if (BI.isWidget(nameOrWidget)) { if (BI.isWidget(nameOrWidget)) {
BI.each(this._children, function (name, child) { BI.each(this._children, function (name, child) {
if (child === nameOrWidget) { if (child === nameOrWidget) {
removeName = name; removeName = name.replace(self.getName() + "_", "");
} }
}); });
} else { } else {

12
src/core/wrapper/layout/layout.division.js

@ -114,16 +114,16 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
if (!map[i][j]) { if (!map[i][j]) {
throw new Error("item be required"); throw new Error("item be required");
} }
if (!this.hasWidget(this.getName() + i + "_" + j)) { if (!this.hasWidget(this._getChildName(i + "_" + j))) {
var w = BI._lazyCreateWidget(map[i][j]); var w = BI._lazyCreateWidget(map[i][j]);
this.addWidget(this.getName() + i + "_" + j, w); this.addWidget(this._getChildName(i + "_" + j), w);
} else { } else {
w = this.getWidgetByName(this.getName() + i + "_" + j); w = this.getWidgetByName(this._getChildName(i + "_" + j));
} }
var left = totalW * 100 / widths[i]; var left = totalW * 100 / widths[i];
w.element.css({position: "absolute", left: left + "%"}); w.element.css({position: "absolute", left: left + "%"});
if (j > 0) { if (j > 0) {
var lastW = this.getWidgetByName(this.getName() + i + "_" + (j - 1)); var lastW = this.getWidgetByName(this._getChildName(i + "_" + (j - 1)));
lastW.element.css({right: (100 - left) + "%"}); lastW.element.css({right: (100 - left) + "%"});
} }
if (j == o.columns - 1) { if (j == o.columns - 1) {
@ -136,11 +136,11 @@ BI.DivisionLayout = BI.inherit(BI.Layout, {
for (var j = 0; j < o.columns; j++) { for (var j = 0; j < o.columns; j++) {
var totalH = 0; var totalH = 0;
for (var i = 0; i < o.rows; i++) { for (var i = 0; i < o.rows; i++) {
var w = this.getWidgetByName(this.getName() + i + "_" + j); var w = this.getWidgetByName(this._getChildName(i + "_" + j));
var top = totalH * 100 / heights[j]; var top = totalH * 100 / heights[j];
w.element.css({top: top + "%"}); w.element.css({top: top + "%"});
if (i > 0) { if (i > 0) {
var lastW = this.getWidgetByName(this.getName() + (i - 1) + "_" + j); var lastW = this.getWidgetByName(this._getChildName((i - 1) + "_" + j));
lastW.element.css({bottom: (100 - top) + "%"}); lastW.element.css({bottom: (100 - top) + "%"});
} }
if (i == o.rows - 1) { if (i == o.rows - 1) {

2
src/core/wrapper/layout/layout.grid.js

@ -114,7 +114,7 @@ BI.GridLayout = BI.inherit(BI.Layout, {
right: (100 - (width * (j + 1))) + "%", right: (100 - (width * (j + 1))) + "%",
bottom: (100 - (height * (i + 1))) + "%" bottom: (100 - (height * (i + 1))) + "%"
}); });
this.addWidget(els[i][j]); this.addWidget(this._getChildName(i + "_" + j), els[i][j]);
} }
} }
}, },

4
src/core/wrapper/layout/layout.table.js

@ -116,14 +116,14 @@ BI.TableLayout = BI.inherit(BI.Layout, {
items: abs items: abs
}); });
if (this.rows > 0) { if (this.rows > 0) {
this.getWidgetByName(this.getName() + (this.rows - 1)).element.css({ this.getWidgetByName(this._getChildName(this.rows - 1)).element.css({
"margin-bottom": o.vgap "margin-bottom": o.vgap
}); });
} }
w.element.css({ w.element.css({
position: "relative" position: "relative"
}); });
this.addWidget(this.getName() + (this.rows++), w); this.addWidget(this._getChildName(this.rows++), w);
return w; return w;
}, },

20
src/core/wrapper/layout/layout.tape.js

@ -46,11 +46,11 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
var self = this, o = this.options; var self = this, o = this.options;
items = BI.compact(items); items = BI.compact(items);
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!self.hasWidget(self.getName() + i + "")) { if (!self.hasWidget(self.getName() + "_" + i)) {
var w = BI._lazyCreateWidget(item); var w = BI._lazyCreateWidget(item);
self.addWidget(self.getName() + i + "", w); self.addWidget(self._getChildName(i), w);
} else { } else {
w = self.getWidgetByName(self.getName() + i + ""); w = self.getWidgetByName(self._getChildName(i));
} }
w.element.css({position: "absolute", top: (item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap + "px", bottom: (item.bgap || 0) + (item.vgap || 0) + o.vgap + o.bgap + "px"}); w.element.css({position: "absolute", top: (item.vgap || 0) + (item.tgap || 0) + o.vgap + o.tgap + "px", bottom: (item.bgap || 0) + (item.vgap || 0) + o.vgap + o.bgap + "px"});
}); });
@ -60,7 +60,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
right[items.length - 1] = 0; right[items.length - 1] = 0;
BI.any(items, function (i, item) { BI.any(items, function (i, item) {
var w = self.getWidgetByName(self.getName() + i + ""); var w = self.getWidgetByName(self._getChildName(i));
if (BI.isNull(left[i])) { if (BI.isNull(left[i])) {
left[i] = left[i - 1] + items[i - 1].width + (items[i - 1].lgap || 0) + 2 * (items[i - 1].hgap || 0) + o.hgap + o.lgap + o.rgap; left[i] = left[i - 1] + items[i - 1].width + (items[i - 1].lgap || 0) + 2 * (items[i - 1].hgap || 0) + o.hgap + o.lgap + o.rgap;
} }
@ -77,7 +77,7 @@ BI.HTapeLayout = BI.inherit(BI.Layout, {
} }
}); });
BI.backAny(items, function (i, item) { BI.backAny(items, function (i, item) {
var w = self.getWidgetByName(self.getName() + i + ""); var w = self.getWidgetByName(self._getChildName(i));
if (BI.isNull(right[i])) { if (BI.isNull(right[i])) {
right[i] = right[i + 1] + items[i + 1].width + (items[i + 1].rgap || 0) + 2 * (items[i + 1].hgap || 0) + o.hgap + o.lgap + o.rgap; right[i] = right[i + 1] + items[i + 1].width + (items[i + 1].rgap || 0) + 2 * (items[i + 1].hgap || 0) + o.hgap + o.lgap + o.rgap;
} }
@ -159,11 +159,11 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
var self = this, o = this.options; var self = this, o = this.options;
items = BI.compact(items); items = BI.compact(items);
BI.each(items, function (i, item) { BI.each(items, function (i, item) {
if (!self.hasWidget(self.getName() + i + "")) { if (!self.hasWidget(self._getChildName(i))) {
var w = BI._lazyCreateWidget(item); var w = BI._lazyCreateWidget(item);
self.addWidget(self.getName() + i + "", w); self.addWidget(self._getChildName(i), w);
} else { } else {
w = self.getWidgetByName(self.getName() + i + ""); w = self.getWidgetByName(self._getChildName(i));
} }
w.element.css({position: "absolute", left: (item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap + "px", right: + (item.hgap || 0) + (item.rgap || 0) + o.hgap + o.rgap + "px"}); w.element.css({position: "absolute", left: (item.lgap || 0) + (item.hgap || 0) + o.hgap + o.lgap + "px", right: + (item.hgap || 0) + (item.rgap || 0) + o.hgap + o.rgap + "px"});
}); });
@ -173,7 +173,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
bottom[items.length - 1] = 0; bottom[items.length - 1] = 0;
BI.any(items, function (i, item) { BI.any(items, function (i, item) {
var w = self.getWidgetByName(self.getName() + i + ""); var w = self.getWidgetByName(self._getChildName(i));
if (BI.isNull(top[i])) { if (BI.isNull(top[i])) {
top[i] = top[i - 1] + items[i - 1].height + (items[i - 1].tgap || 0) + 2 * (items[i - 1].vgap || 0) + o.vgap + o.tgap + o.bgap; top[i] = top[i - 1] + items[i - 1].height + (items[i - 1].tgap || 0) + 2 * (items[i - 1].vgap || 0) + o.vgap + o.tgap + o.bgap;
} }
@ -190,7 +190,7 @@ BI.VTapeLayout = BI.inherit(BI.Layout, {
} }
}); });
BI.backAny(items, function (i, item) { BI.backAny(items, function (i, item) {
var w = self.getWidgetByName(self.getName() + i + ""); var w = self.getWidgetByName(self._getChildName(i));
if (BI.isNull(bottom[i])) { if (BI.isNull(bottom[i])) {
bottom[i] = bottom[i + 1] + items[i + 1].height + (items[i + 1].bgap || 0) + 2 * (items[i + 1].vgap || 0) + o.vgap + o.tgap + o.bgap; bottom[i] = bottom[i + 1] + items[i + 1].height + (items[i + 1].bgap || 0) + 2 * (items[i + 1].vgap || 0) + o.vgap + o.tgap + o.bgap;
} }

2
src/core/wrapper/layout/layout.td.js

@ -115,7 +115,7 @@ BI.TdLayout = BI.inherit(BI.Layout, {
}); });
tr.addItem(td); tr.addItem(td);
} }
this.addWidget(this.getName() + idx, tr); this.addWidget(this._getChildName(idx), tr);
return tr; return tr;
}, },

13
src/core/wrapper/layout/layout.window.js

@ -52,6 +52,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
if (BI.isNumber(o.columnSize)) { if (BI.isNumber(o.columnSize)) {
o.columnSize = BI.makeArray(o.items[0].length, 1 / o.items[0].length); o.columnSize = BI.makeArray(o.items[0].length, 1 / o.items[0].length);
} }
function firstElement (item, row, col) { function firstElement (item, row, col) {
if (row === 0) { if (row === 0) {
item.addClass("first-row"); item.addClass("first-row");
@ -94,10 +95,10 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
if (!o.items[i][j]) { if (!o.items[i][j]) {
throw new Error("item be required"); throw new Error("item be required");
} }
if (!this.hasWidget(this.getName() + i + "_" + j)) { if (!this.hasWidget(this._getChildName(i + "_" + j))) {
var w = BI._lazyCreateWidget(o.items[i][j]); var w = BI._lazyCreateWidget(o.items[i][j]);
w.element.css({position: "absolute"}); w.element.css({position: "absolute"});
this.addWidget(this.getName() + i + "_" + j, w); this.addWidget(this._getChildName(i + "_" + j), w);
} }
} }
} }
@ -109,7 +110,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
// 从上到下 // 从上到下
for (var i = 0; i < o.rows; i++) { for (var i = 0; i < o.rows; i++) {
for (var j = 0; j < o.columns; j++) { for (var j = 0; j < o.columns; j++) {
var wi = this.getWidgetByName(this.getName() + i + "_" + j); var wi = this.getWidgetByName(this._getChildName(i + "_" + j));
if (BI.isNull(top[i])) { if (BI.isNull(top[i])) {
top[i] = top[i - 1] + (o.rowSize[i - 1] < 1 ? o.rowSize[i - 1] : o.rowSize[i - 1] + o.vgap + o.bgap); top[i] = top[i - 1] + (o.rowSize[i - 1] < 1 ? o.rowSize[i - 1] : o.rowSize[i - 1] + o.vgap + o.bgap);
} }
@ -127,7 +128,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
// 从下到上 // 从下到上
for (var i = o.rows - 1; i >= 0; i--) { for (var i = o.rows - 1; i >= 0; i--) {
for (var j = 0; j < o.columns; j++) { for (var j = 0; j < o.columns; j++) {
var wi = this.getWidgetByName(this.getName() + i + "_" + j); var wi = this.getWidgetByName(this._getChildName(i + "_" + j));
if (BI.isNull(bottom[i])) { if (BI.isNull(bottom[i])) {
bottom[i] = bottom[i + 1] + (o.rowSize[i + 1] < 1 ? o.rowSize[i + 1] : o.rowSize[i + 1] + o.vgap + o.tgap); bottom[i] = bottom[i + 1] + (o.rowSize[i + 1] < 1 ? o.rowSize[i + 1] : o.rowSize[i + 1] + o.vgap + o.tgap);
} }
@ -145,7 +146,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
// 从左到右 // 从左到右
for (var j = 0; j < o.columns; j++) { for (var j = 0; j < o.columns; j++) {
for (var i = 0; i < o.rows; i++) { for (var i = 0; i < o.rows; i++) {
var wi = this.getWidgetByName(this.getName() + i + "_" + j); var wi = this.getWidgetByName(this._getChildName(i + "_" + j));
if (BI.isNull(left[j])) { if (BI.isNull(left[j])) {
left[j] = left[j - 1] + (o.columnSize[j - 1] < 1 ? o.columnSize[j - 1] : o.columnSize[j - 1] + o.hgap + o.rgap); left[j] = left[j - 1] + (o.columnSize[j - 1] < 1 ? o.columnSize[j - 1] : o.columnSize[j - 1] + o.hgap + o.rgap);
} }
@ -163,7 +164,7 @@ BI.WindowLayout = BI.inherit(BI.Layout, {
// 从右到左 // 从右到左
for (var j = o.columns - 1; j >= 0; j--) { for (var j = o.columns - 1; j >= 0; j--) {
for (var i = 0; i < o.rows; i++) { for (var i = 0; i < o.rows; i++) {
var wi = this.getWidgetByName(this.getName() + i + "_" + j); var wi = this.getWidgetByName(this._getChildName(i + "_" + j));
if (BI.isNull(right[j])) { if (BI.isNull(right[j])) {
right[j] = right[j + 1] + (o.columnSize[j + 1] < 1 ? o.columnSize[j + 1] : o.columnSize[j + 1] + o.hgap + o.lgap); right[j] = right[j + 1] + (o.columnSize[j + 1] < 1 ? o.columnSize[j + 1] : o.columnSize[j + 1] + o.hgap + o.lgap);
} }

Loading…
Cancel
Save