diff --git a/src/core/wrapper/layout.js b/src/core/wrapper/layout.js index 01e50c54f..ca4777f42 100644 --- a/src/core/wrapper/layout.js +++ b/src/core/wrapper/layout.js @@ -550,6 +550,10 @@ BI.Layout = BI.inherit(BI.Widget, { return updated; }, + shouldUpdate: function () { + return true; + }, + update: function (opt) { var o = this.options; var items = opt.items || []; @@ -618,16 +622,23 @@ BI.Layout = BI.inherit(BI.Widget, { populate: function (items) { var self = this, o = this.options; items = items || []; - if (this._isMounted) { + var shouldUpdate = this.shouldUpdate(); + if (this._isMounted && shouldUpdate) { this.update({items: items}); return; } + if (this._isMounted && !shouldUpdate){ + BI.each(this._children, function (i, c) { + c.destroy(); + }); + this._children = {}; + } this.options.items = items; this.stroke(items); }, resize: function () { - + this.stroke(this.options.items); } }); BI.shortcut("bi.layout", BI.Layout); diff --git a/src/core/wrapper/layout/adapt/absolute.center.js b/src/core/wrapper/layout/adapt/absolute.center.js index 60838983e..f5da01bbc 100644 --- a/src/core/wrapper/layout/adapt/absolute.center.js +++ b/src/core/wrapper/layout/adapt/absolute.center.js @@ -35,10 +35,6 @@ BI.AbsoluteCenterLayout = BI.inherit(BI.Layout, { return w; }, - resize: function () { - // console.log("absolute_center_adapt布局不需要resize"); - }, - populate: function (items) { BI.AbsoluteCenterLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/core/wrapper/layout/adapt/absolute.horizontal.js b/src/core/wrapper/layout/adapt/absolute.horizontal.js index 53c8a05cc..bbae5ff4c 100644 --- a/src/core/wrapper/layout/adapt/absolute.horizontal.js +++ b/src/core/wrapper/layout/adapt/absolute.horizontal.js @@ -42,7 +42,11 @@ BI.AbsoluteHorizontalLayout = BI.inherit(BI.Layout, { }, resize: function () { - // console.log("absolute_horizontal_adapt布局不需要resize"); + this.layout.resize(); + }, + + update: function (opt) { + return this.layout.update(opt); }, populate: function (items) { diff --git a/src/core/wrapper/layout/adapt/absolute.leftrightvertical.js b/src/core/wrapper/layout/adapt/absolute.leftrightvertical.js index 1ac9c37b3..dc745b307 100644 --- a/src/core/wrapper/layout/adapt/absolute.leftrightvertical.js +++ b/src/core/wrapper/layout/adapt/absolute.leftrightvertical.js @@ -80,7 +80,7 @@ BI.AbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, { }, resize: function () { - // console.log("absolute_left_right_vertical_adapt布局不需要resize"); + this.layout.stroke(this._formatItems()) }, addItem: function () { @@ -132,7 +132,11 @@ BI.AbsoluteRightVerticalAdaptLayout = BI.inherit(BI.Layout, { }, resize: function () { + this.layout.stroke([{}].concat(this.options.items)) + }, + update: function (opt) { + return this.layout.update(opt); }, addItem: function () { diff --git a/src/core/wrapper/layout/adapt/absolute.vertical.js b/src/core/wrapper/layout/adapt/absolute.vertical.js index f4c9552e2..a2ea783fe 100644 --- a/src/core/wrapper/layout/adapt/absolute.vertical.js +++ b/src/core/wrapper/layout/adapt/absolute.vertical.js @@ -42,7 +42,11 @@ BI.AbsoluteVerticalLayout = BI.inherit(BI.Layout, { }, resize: function () { - // console.log("absolute_vertical_adapt布局不需要resize"); + this.layout.resize(); + }, + + update: function (opt) { + return this.layout.update(opt); }, populate: function (items) { diff --git a/src/core/wrapper/layout/adapt/adapt.center.js b/src/core/wrapper/layout/adapt/adapt.center.js index 4158a3ccc..ba8c82f10 100644 --- a/src/core/wrapper/layout/adapt/adapt.center.js +++ b/src/core/wrapper/layout/adapt/adapt.center.js @@ -43,7 +43,11 @@ BI.CenterAdaptLayout = BI.inherit(BI.Layout, { }, resize: function () { - // console.log("center_adapt布局不需要resize"); + this.layout.resize(); + }, + + update: function (opt) { + return this.layout.update(opt); }, populate: function (items) { diff --git a/src/core/wrapper/layout/adapt/adapt.leftrightvertical.js b/src/core/wrapper/layout/adapt/adapt.leftrightvertical.js index b2dabf32a..4e0dbeb57 100644 --- a/src/core/wrapper/layout/adapt/adapt.leftrightvertical.js +++ b/src/core/wrapper/layout/adapt/adapt.leftrightvertical.js @@ -76,7 +76,18 @@ BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, { }, resize: function () { - // console.log("left_right_vertical_adapt布局不需要resize"); + this.left.stroke(this.options.items.left); + this.right.stroke(this.options.items.right); + }, + + update: function (opt) { + this.left.update({ + items: opt.items.left + }); + this.right.update({ + items: opt.items.right + }); + return true; }, addItem: function () { @@ -129,7 +140,11 @@ BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, { }, resize: function () { - // console.log("left_vertical_adapt布局不需要resize"); + this.layout.resize(); + }, + + update: function (opt) { + return this.layout.update(opt); }, addItem: function () { @@ -181,7 +196,11 @@ BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, { }, resize: function () { + this.layout.resize(); + }, + update: function (opt) { + return this.layout.update(opt); }, addItem: function () { diff --git a/src/core/wrapper/layout/adapt/adapt.table.js b/src/core/wrapper/layout/adapt/adapt.table.js index f1391c29b..8ea7025a8 100644 --- a/src/core/wrapper/layout/adapt/adapt.table.js +++ b/src/core/wrapper/layout/adapt/adapt.table.js @@ -100,10 +100,6 @@ BI.TableAdaptLayout = BI.inherit(BI.Layout, { this.element.append(this.$table); }, - resize: function () { - // console.log("center_adapt布局不需要resize"); - }, - populate: function (items) { BI.TableAdaptLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/core/wrapper/layout/adapt/adapt.vertical.js b/src/core/wrapper/layout/adapt/adapt.vertical.js index 15fc8e7c0..3f5f2a405 100644 --- a/src/core/wrapper/layout/adapt/adapt.vertical.js +++ b/src/core/wrapper/layout/adapt/adapt.vertical.js @@ -43,7 +43,11 @@ BI.VerticalAdaptLayout = BI.inherit(BI.Layout, { }, resize: function () { - // console.log("vertical_adapt布局不需要resize"); + this.layout.resize(); + }, + + update: function (opt) { + return this.layout.update(opt); }, populate: function (items) { diff --git a/src/core/wrapper/layout/adapt/auto.horizontal.js b/src/core/wrapper/layout/adapt/auto.horizontal.js index 27b64bd9c..197b2badc 100644 --- a/src/core/wrapper/layout/adapt/auto.horizontal.js +++ b/src/core/wrapper/layout/adapt/auto.horizontal.js @@ -32,10 +32,6 @@ BI.HorizontalAutoLayout = BI.inherit(BI.Layout, { return w; }, - resize: function () { - // console.log("horizontal_adapt布局不需要resize"); - }, - populate: function (items) { BI.HorizontalAutoLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/core/wrapper/layout/adapt/inline.center.js b/src/core/wrapper/layout/adapt/inline.center.js index 0aea35ef1..d8bc184db 100644 --- a/src/core/wrapper/layout/adapt/inline.center.js +++ b/src/core/wrapper/layout/adapt/inline.center.js @@ -44,6 +44,14 @@ BI.InlineCenterAdaptLayout = BI.inherit(BI.Layout, { }; }, + resize: function () { + this.layout.resize(); + }, + + update: function (opt) { + return this.layout.update(opt); + }, + populate: function (items) { this.layout.populate.apply(this.layout, arguments); } diff --git a/src/core/wrapper/layout/adapt/inline.horizontal.js b/src/core/wrapper/layout/adapt/inline.horizontal.js index 3ad1bc602..734c2bd3d 100644 --- a/src/core/wrapper/layout/adapt/inline.horizontal.js +++ b/src/core/wrapper/layout/adapt/inline.horizontal.js @@ -44,6 +44,14 @@ BI.InlineHorizontalAdaptLayout = BI.inherit(BI.Layout, { }; }, + resize: function () { + this.layout.resize(); + }, + + update: function (opt) { + return this.layout.update(opt); + }, + populate: function (items) { this.layout.populate.apply(this.layout, arguments); } diff --git a/src/core/wrapper/layout/adapt/inline.vertical.js b/src/core/wrapper/layout/adapt/inline.vertical.js index 1e7401e46..ba7bf54f5 100644 --- a/src/core/wrapper/layout/adapt/inline.vertical.js +++ b/src/core/wrapper/layout/adapt/inline.vertical.js @@ -44,6 +44,14 @@ BI.InlineVerticalAdaptLayout = BI.inherit(BI.Layout, { }; }, + resize: function () { + this.layout.resize(); + }, + + update: function (opt) { + return this.layout.update(opt); + }, + populate: function (items) { this.layout.populate.apply(this.layout, arguments); } diff --git a/src/core/wrapper/layout/fill/float.fill.horizontal.js b/src/core/wrapper/layout/fill/float.fill.horizontal.js index b19b31b0a..648c5aace 100644 --- a/src/core/wrapper/layout/fill/float.fill.horizontal.js +++ b/src/core/wrapper/layout/fill/float.fill.horizontal.js @@ -123,6 +123,10 @@ BI.FloatHorizontalFillLayout = BI.inherit(BI.Layout, { }); }, + shouldUpdate: function () { + return false; + }, + populate: function (items) { BI.FloatHorizontalFillLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/core/wrapper/layout/flex/flex.center.js b/src/core/wrapper/layout/flex/flex.center.js index 23c81d318..09c81b792 100644 --- a/src/core/wrapper/layout/flex/flex.center.js +++ b/src/core/wrapper/layout/flex/flex.center.js @@ -42,7 +42,7 @@ BI.FlexCenterLayout = BI.inherit(BI.Layout, { }, resize: function () { - // console.log("flex_center_adapt布局不需要resize"); + this.wrapper.resize(); }, update: function (opt) { diff --git a/src/core/wrapper/layout/flex/flex.horizontal.center.js b/src/core/wrapper/layout/flex/flex.horizontal.center.js index 0c4207484..028ef748f 100644 --- a/src/core/wrapper/layout/flex/flex.horizontal.center.js +++ b/src/core/wrapper/layout/flex/flex.horizontal.center.js @@ -43,7 +43,7 @@ BI.FlexHorizontalCenter = BI.inherit(BI.Layout, { }, resize: function () { - // console.log("flex_vertical_center_adapt布局不需要resize"); + this.wrapper.resize(); }, update: function (opt) { diff --git a/src/core/wrapper/layout/flex/flex.horizontal.js b/src/core/wrapper/layout/flex/flex.horizontal.js index 7c4fbcc0d..59108c851 100644 --- a/src/core/wrapper/layout/flex/flex.horizontal.js +++ b/src/core/wrapper/layout/flex/flex.horizontal.js @@ -78,10 +78,6 @@ BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { return w; }, - resize: function () { - // console.log("flex_horizontal布局不需要resize"); - }, - populate: function (items) { BI.FlexHorizontalLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/core/wrapper/layout/flex/flex.leftrightvertical.center.js b/src/core/wrapper/layout/flex/flex.leftrightvertical.center.js index f2cc78c0c..20e05b2ef 100644 --- a/src/core/wrapper/layout/flex/flex.leftrightvertical.center.js +++ b/src/core/wrapper/layout/flex/flex.leftrightvertical.center.js @@ -72,7 +72,11 @@ BI.FlexLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, { }, resize: function () { - // console.log("left_right_vertical_adapt布局不需要resize"); + this.layout.stroke(this._formatItems()); + }, + + update: function (opt) { + return this.layout.update(opt); }, addItem: function () { diff --git a/src/core/wrapper/layout/flex/flex.vertical.center.js b/src/core/wrapper/layout/flex/flex.vertical.center.js index 24559546d..533ac2fa9 100644 --- a/src/core/wrapper/layout/flex/flex.vertical.center.js +++ b/src/core/wrapper/layout/flex/flex.vertical.center.js @@ -44,7 +44,7 @@ BI.FlexVerticalCenter = BI.inherit(BI.Layout, { }, resize: function () { - // console.log("flex_vertical_center_adapt布局不需要resize"); + this.wrapper.resize(); }, update: function (opt) { diff --git a/src/core/wrapper/layout/flex/flex.vertical.js b/src/core/wrapper/layout/flex/flex.vertical.js index 515541e46..eb38d07a3 100644 --- a/src/core/wrapper/layout/flex/flex.vertical.js +++ b/src/core/wrapper/layout/flex/flex.vertical.js @@ -77,10 +77,6 @@ BI.FlexVerticalLayout = BI.inherit(BI.Layout, { return w; }, - resize: function () { - // console.log("flex_vertical布局不需要resize"); - }, - populate: function (items) { BI.FlexVerticalLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js index ae7612780..740030e76 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.center.js @@ -44,6 +44,10 @@ BI.FlexWrapperCenterLayout = BI.inherit(BI.Layout, { }; }, + resize: function () { + this.wrapper.resize(); + }, + update: function (opt) { return this.wrapper.update(opt); }, diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.center.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.center.js index fc8ef31a8..3d4d28c2c 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.center.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.center.js @@ -44,6 +44,10 @@ BI.FlexWrapperHorizontalCenter = BI.inherit(BI.Layout, { }; }, + resize: function () { + this.wrapper.resize(); + }, + update: function (opt) { return this.wrapper.update(opt); }, diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js index 075ffe8cb..fb4ea738a 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.horizontal.js @@ -84,10 +84,6 @@ BI.FlexWrapperHorizontalLayout = BI.inherit(BI.Layout, { return this.$wrapper; }, - resize: function () { - // console.log("flex_wrapper_horizontal布局不需要resize"); - }, - populate: function (items) { BI.FlexWrapperHorizontalLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js index 0a461c74c..af072c1a6 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.center.js @@ -44,6 +44,10 @@ BI.FlexWrapperVerticalCenter = BI.inherit(BI.Layout, { }; }, + resize: function () { + this.wrapper.resize(); + }, + update: function (opt) { return this.wrapper.update(opt); }, diff --git a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js index 89214e9a8..413bb0fa2 100644 --- a/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js +++ b/src/core/wrapper/layout/flex/wrapper/flex.wrapper.vertical.js @@ -84,10 +84,6 @@ BI.FlexWrapperVerticalLayout = BI.inherit(BI.Layout, { return this.$wrapper; }, - resize: function () { - // console.log("flex_wrapper_vertical布局不需要resize"); - }, - populate: function (items) { BI.FlexWrapperVerticalLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/core/wrapper/layout/float/float.absolute.center.js b/src/core/wrapper/layout/float/float.absolute.center.js index 566b5d738..afe3e77b7 100644 --- a/src/core/wrapper/layout/float/float.absolute.center.js +++ b/src/core/wrapper/layout/float/float.absolute.center.js @@ -24,10 +24,6 @@ BI.FloatAbsoluteCenterLayout = BI.inherit(BI.Layout, { return w; }, - resize: function () { - // console.log("float_absolute_center_adapt布局不需要resize"); - }, - populate: function (items) { BI.FloatAbsoluteCenterLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/core/wrapper/layout/float/float.absolute.horizontal.js b/src/core/wrapper/layout/float/float.absolute.horizontal.js index eb59723eb..d044fbe23 100644 --- a/src/core/wrapper/layout/float/float.absolute.horizontal.js +++ b/src/core/wrapper/layout/float/float.absolute.horizontal.js @@ -57,11 +57,15 @@ BI.FloatAbsoluteHorizontalLayout = BI.inherit(BI.Layout, { }, resize: function () { - // console.log("float_absolute_horizontal_adapt布局不需要resize"); + this.layout.stroke(this._formatItems(this.options.items)); + }, + + update: function (opt) { + return this.layout.update(opt); }, populate: function (items) { - this.layout.populate.apply(this, arguments); + this.layout.populate(this._formatItems(items)); } }); BI.shortcut("bi.absolute_horizontal_float", BI.FloatAbsoluteHorizontalLayout); diff --git a/src/core/wrapper/layout/float/float.absolute.leftrightvertical.js b/src/core/wrapper/layout/float/float.absolute.leftrightvertical.js index c56d101eb..f2b70a53a 100644 --- a/src/core/wrapper/layout/float/float.absolute.leftrightvertical.js +++ b/src/core/wrapper/layout/float/float.absolute.leftrightvertical.js @@ -97,7 +97,11 @@ BI.FloatAbsoluteLeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, { }, resize: function () { - // console.log("absolute_left_right_vertical_adapt布局不需要resize"); + this.layout.stroke(this._formatItems()); + }, + + update: function (opt) { + return this.layout.update(opt); }, addItem: function () { @@ -162,7 +166,11 @@ BI.FloatAbsoluteRightVerticalAdaptLayout = BI.inherit(BI.Layout, { }, resize: function () { + this.layout.stroke([{}].concat(this._formatItems(this.options.items))); + }, + update: function (opt) { + return this.layout.update(opt); }, addItem: function () { diff --git a/src/core/wrapper/layout/float/float.absolute.vertical.js b/src/core/wrapper/layout/float/float.absolute.vertical.js index 2cb1042bf..9b5609030 100644 --- a/src/core/wrapper/layout/float/float.absolute.vertical.js +++ b/src/core/wrapper/layout/float/float.absolute.vertical.js @@ -57,7 +57,11 @@ BI.FloatAbsoluteVerticalLayout = BI.inherit(BI.Layout, { }, resize: function () { - // console.log("float_absolute_vertical_adapt布局不需要resize"); + this.layout.stroke(this._formatItems(this.options.items)); + }, + + update: function (opt) { + return this.layout.update(opt); }, populate: function (items) { diff --git a/src/core/wrapper/layout/layout.absolute.js b/src/core/wrapper/layout/layout.absolute.js index d392ccc56..6a59eb133 100644 --- a/src/core/wrapper/layout/layout.absolute.js +++ b/src/core/wrapper/layout/layout.absolute.js @@ -81,10 +81,6 @@ BI.AbsoluteLayout = BI.inherit(BI.Layout, { return w; }, - resize: function () { - this.stroke(this.options.items); - }, - populate: function (items) { BI.AbsoluteLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/core/wrapper/layout/layout.adaptive.js b/src/core/wrapper/layout/layout.adaptive.js index f82a9e321..7c19e1928 100644 --- a/src/core/wrapper/layout/layout.adaptive.js +++ b/src/core/wrapper/layout/layout.adaptive.js @@ -51,10 +51,6 @@ BI.AdaptiveLayout = BI.inherit(BI.Layout, { return w; }, - resize: function () { - this.stroke(this.options.items); - }, - populate: function (items) { BI.AbsoluteLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/core/wrapper/layout/layout.border.js b/src/core/wrapper/layout/layout.border.js index 47907c572..fb6f6ca94 100644 --- a/src/core/wrapper/layout/layout.border.js +++ b/src/core/wrapper/layout/layout.border.js @@ -16,10 +16,6 @@ BI.BorderLayout = BI.inherit(BI.Layout, { this.populate(this.options.items); }, - resize: function () { - this.stroke(this.options.items); - }, - addItem: function (item) { // do nothing throw new Error("不能添加子组件"); @@ -130,7 +126,8 @@ BI.BorderLayout = BI.inherit(BI.Layout, { } }, - update: function (opt) { + shouldUpdate: function () { + return false; }, populate: function (items) { diff --git a/src/core/wrapper/layout/layout.card.js b/src/core/wrapper/layout/layout.card.js index 65fa9fcf6..ac59fa873 100644 --- a/src/core/wrapper/layout/layout.card.js +++ b/src/core/wrapper/layout/layout.card.js @@ -20,7 +20,7 @@ BI.CardLayout = BI.inherit(BI.Layout, { }, resize: function () { - // console.log("default布局不需要resize"); + // console.log("Card布局不需要resize"); }, stroke: function (items) { @@ -48,7 +48,8 @@ BI.CardLayout = BI.inherit(BI.Layout, { }); }, - update: function () { + shouldUpdate: function () { + return false; }, empty: function () { diff --git a/src/core/wrapper/layout/layout.default.js b/src/core/wrapper/layout/layout.default.js index 516b7e3a1..a35f99a07 100644 --- a/src/core/wrapper/layout/layout.default.js +++ b/src/core/wrapper/layout/layout.default.js @@ -27,10 +27,6 @@ BI.DefaultLayout = BI.inherit(BI.Layout, { return w; }, - resize: function () { - // console.log("default布局不需要resize") - }, - populate: function (items) { BI.DefaultLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/core/wrapper/layout/layout.division.js b/src/core/wrapper/layout/layout.division.js index 1aac78bc8..2c5b8e1d1 100644 --- a/src/core/wrapper/layout/layout.division.js +++ b/src/core/wrapper/layout/layout.division.js @@ -41,10 +41,6 @@ BI.DivisionLayout = BI.inherit(BI.Layout, { this.populate(this.options.items); }, - resize: function () { - this.stroke(this.opitons.items); - }, - addItem: function (item) { // do nothing throw new Error("不能添加子组件"); @@ -151,7 +147,8 @@ BI.DivisionLayout = BI.inherit(BI.Layout, { } }, - update: function () { + shouldUpdate: function () { + return false; }, populate: function (items) { diff --git a/src/core/wrapper/layout/layout.flow.js b/src/core/wrapper/layout/layout.flow.js index be0ff5481..2061b4513 100644 --- a/src/core/wrapper/layout/layout.flow.js +++ b/src/core/wrapper/layout/layout.flow.js @@ -64,10 +64,6 @@ BI.FloatLeftLayout = BI.inherit(BI.Layout, { return w; }, - resize: function () { - this.stroke(this.options.items); - }, - populate: function (items) { BI.FloatLeftLayout.superclass.populate.apply(this, arguments); this._mount(); @@ -141,10 +137,6 @@ BI.FloatRightLayout = BI.inherit(BI.Layout, { return w; }, - resize: function () { - this.stroke(this.options.items); - }, - populate: function (items) { BI.FloatRightLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/core/wrapper/layout/layout.grid.js b/src/core/wrapper/layout/layout.grid.js index a787c449b..665993694 100644 --- a/src/core/wrapper/layout/layout.grid.js +++ b/src/core/wrapper/layout/layout.grid.js @@ -119,7 +119,8 @@ BI.GridLayout = BI.inherit(BI.Layout, { } }, - update: function () { + shouldUpdate: function () { + return false; }, populate: function (items) { diff --git a/src/core/wrapper/layout/layout.inline.js b/src/core/wrapper/layout/layout.inline.js index 053b49562..322d7252d 100644 --- a/src/core/wrapper/layout/layout.inline.js +++ b/src/core/wrapper/layout/layout.inline.js @@ -76,14 +76,6 @@ BI.InlineLayout = BI.inherit(BI.Layout, { return w; }, - resize: function () { - this.stroke(this.options.items); - }, - - addItem: function (item) { - throw new Error("不能添加子组件"); - }, - populate: function (items) { BI.InlineLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/core/wrapper/layout/layout.lattice.js b/src/core/wrapper/layout/layout.lattice.js index b9779db94..9b5731815 100644 --- a/src/core/wrapper/layout/layout.lattice.js +++ b/src/core/wrapper/layout/layout.lattice.js @@ -31,22 +31,6 @@ BI.LatticeLayout = BI.inherit(BI.Layout, { return w; }, - addItem: function (item) { - var w = BI.LatticeLayout.superclass.addItem.apply(this, arguments); - this.resize(); - return w; - }, - - addItemAt: function (item) { - var w = BI.LatticeLayout.superclass.addItemAt.apply(this, arguments); - this.resize(); - return w; - }, - - resize: function () { - this.stroke(this.options.items); - }, - populate: function (items) { BI.LatticeLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/core/wrapper/layout/layout.table.js b/src/core/wrapper/layout/layout.table.js index faec5d7fa..ef2e25bfe 100644 --- a/src/core/wrapper/layout/layout.table.js +++ b/src/core/wrapper/layout/layout.table.js @@ -121,14 +121,8 @@ BI.TableLayout = BI.inherit(BI.Layout, { // console.log("table布局不需要resize"); }, - addItem: function (arr) { - if (!BI.isArray(arr)) { - throw new Error("必须是数组", arr); - } - return BI.TableLayout.superclass.addItem.apply(this, arguments); - }, - - update: function () { + shouldUpdate: function () { + return false; }, populate: function (items) { diff --git a/src/core/wrapper/layout/layout.tape.js b/src/core/wrapper/layout/layout.tape.js index 7c5a85b2f..3889f65d3 100644 --- a/src/core/wrapper/layout/layout.tape.js +++ b/src/core/wrapper/layout/layout.tape.js @@ -23,9 +23,6 @@ BI.HTapeLayout = BI.inherit(BI.Layout, { this.populate(this.options.items); }, - resize: function () { - this.stroke(this.options.items); - }, addItem: function (item) { // do nothing throw new Error("不能添加子组件"); @@ -122,12 +119,8 @@ BI.HTapeLayout = BI.inherit(BI.Layout, { }); }, - update: function () { - var updated; - BI.each(this._children, function (i, child) { - updated = child.update() || updated; - }); - return updated; + shouldUpdate: function () { + return false; }, populate: function (items) { @@ -162,10 +155,6 @@ BI.VTapeLayout = BI.inherit(BI.Layout, { this.populate(this.options.items); }, - resize: function () { - this.stroke(this.options.items); - }, - addItem: function (item) { // do nothing throw new Error("不能添加子组件"); @@ -262,7 +251,8 @@ BI.VTapeLayout = BI.inherit(BI.Layout, { }); }, - update: function () { + shouldUpdate: function () { + return false; }, populate: function (items) { diff --git a/src/core/wrapper/layout/layout.td.js b/src/core/wrapper/layout/layout.td.js index a5aefb300..0ba970792 100644 --- a/src/core/wrapper/layout/layout.td.js +++ b/src/core/wrapper/layout/layout.td.js @@ -172,18 +172,8 @@ BI.TdLayout = BI.inherit(BI.Layout, { this.element.append(this.$table); }, - resize: function () { - // console.log("td布局不需要resize"); - }, - - addItem: function (arr) { - if (!BI.isArray(arr)) { - throw new Error("必须是数组", arr); - } - return BI.TdLayout.superclass.addItem.apply(this, arguments); - }, - - update: function () { + shouldUpdate: function () { + return false; }, populate: function (items) { diff --git a/src/core/wrapper/layout/layout.vertical.js b/src/core/wrapper/layout/layout.vertical.js index d34e14d31..90c78e1b7 100644 --- a/src/core/wrapper/layout/layout.vertical.js +++ b/src/core/wrapper/layout/layout.vertical.js @@ -42,10 +42,6 @@ BI.VerticalLayout = BI.inherit(BI.Layout, { return w; }, - resize: function () { - this.stroke(this.options.items); - }, - populate: function (items) { BI.VerticalLayout.superclass.populate.apply(this, arguments); this._mount(); diff --git a/src/core/wrapper/layout/layout.window.js b/src/core/wrapper/layout/layout.window.js index d7037f923..f09b6b0b1 100644 --- a/src/core/wrapper/layout/layout.window.js +++ b/src/core/wrapper/layout/layout.window.js @@ -25,10 +25,6 @@ BI.WindowLayout = BI.inherit(BI.Layout, { this.populate(this.options.items); }, - resize: function () { - this.stroke(this.options.items); - }, - addItem: function (item) { // do nothing throw new Error("不能添加子组件"); @@ -171,7 +167,8 @@ BI.WindowLayout = BI.inherit(BI.Layout, { } }, - update: function () { + shouldUpdate: function () { + return false; }, populate: function (items) {