Only layout if visible LayoutOnShow bead must be used to trigger layout when visible is set to true. LayoutOnShow added to Express Container
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a9e7458c Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a9e7458c Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a9e7458c Branch: refs/heads/feature/strand-work Commit: a9e7458c505fdd1731068b3888a649035934c171 Parents: bc50901 Author: Harbs <ha...@in-tools.com> Authored: Mon Aug 7 00:12:12 2017 +0300 Committer: Harbs <ha...@in-tools.com> Committed: Mon Aug 7 00:12:12 2017 +0300 ---------------------------------------------------------------------- .../src/main/flex/org/apache/flex/core/LayoutBase.as | 2 ++ .../flex/org/apache/flex/html/beads/ScrollBarView.as | 3 ++- .../apache/flex/html/beads/layouts/DataGridLayout.as | 10 +++++++++- .../flex/html/beads/layouts/DataGridPercentageLayout.as | 12 ++++++++++-- .../src/main/flex/org/apache/flex/express/Container.as | 9 +++++---- 5 files changed, 28 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a9e7458c/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.as index 7bc5ab0..6c4f2f2 100644 --- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.as +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/core/LayoutBase.as @@ -316,6 +316,8 @@ package org.apache.flex.core */ public function performLayout():void { + if(!host.visible) + return; // avoid running this layout instance recursively. if (isLayoutRunning) return; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a9e7458c/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ScrollBarView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ScrollBarView.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ScrollBarView.as index 41ef624..e290ba7 100644 --- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ScrollBarView.as +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/ScrollBarView.as @@ -116,7 +116,8 @@ package org.apache.flex.html.beads sbModel.addEventListener("stepSizeChange", changeHandler); sbModel.addEventListener("pageSizeChange", changeHandler); sbModel.addEventListener("valueChange", changeHandler); - + (value as IEventDispatcher).addEventListener("show", changeHandler); + if( _strand.getBeadByType(IBeadLayout) == null ) { layout = new (ValuesManager.valuesImpl.getValue(_strand, "iBeadLayout")) as IBeadLayout; _strand.addBead(layout); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a9e7458c/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridLayout.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridLayout.as index fe4ccab..e3c4624 100644 --- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridLayout.as +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridLayout.as @@ -67,6 +67,7 @@ package org.apache.flex.html.beads.layouts * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 + * @flexjsignorecoercion org.apache.flex.core.UIBase */ public function set strand(value:IStrand):void { @@ -105,9 +106,12 @@ package org.apache.flex.html.beads.layouts { return _header; } + /** + * @flexjsignorecoercion org.apache.flex.core.UIBase + */ public function set header(value:IUIBase):void { - _header = UIBase(value); + _header = (value as UIBase); } private var _columns:Array; @@ -142,6 +146,7 @@ package org.apache.flex.html.beads.layouts /** * @copy org.apache.flex.core.IBeadLayout#layout + * @flexjsignorecoercion org.apache.flex.core.UIBase */ public function layout():Boolean { @@ -202,9 +207,12 @@ package org.apache.flex.html.beads.layouts /** * @private + * @flexjsignorecoercion org.apache.flex.core.UIBase */ private function handleSizeChanges(event:Event):void { + if(!(_strand as UIBase).visible) + return; var view:DataGridView = UIBase(_strand).view as DataGridView; if (view == null) return; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a9e7458c/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridPercentageLayout.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridPercentageLayout.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridPercentageLayout.as index 7459a24..a8195d5 100644 --- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridPercentageLayout.as +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/beads/layouts/DataGridPercentageLayout.as @@ -66,6 +66,7 @@ package org.apache.flex.html.beads.layouts * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion FlexJS 0.0 + * @flexjsignorecoercion org.apache.flex.core.UIBase */ public function set strand(value:IStrand):void { @@ -104,9 +105,12 @@ package org.apache.flex.html.beads.layouts { return _header; } + /** + * @flexjsignorecoercion org.apache.flex.core.UIBase + */ public function set header(value:IUIBase):void { - _header = UIBase(value); + _header = value as UIBase; } private var _columns:Array; @@ -141,6 +145,7 @@ package org.apache.flex.html.beads.layouts /** * @copy org.apache.flex.core.IBeadLayout#layout + * @flexjsignorecoercion org.apache.flex.core.UIBase */ public function layout():Boolean { @@ -210,10 +215,13 @@ package org.apache.flex.html.beads.layouts /** * @private + * @flexjsignorecoercion org.apache.flex.core.UIBase */ private function handleSizeChanges(event:Event):void { - var view:DataGridView = UIBase(_strand).view as DataGridView; + if(!(_strand as UIBase).visible) + return; + var view:DataGridView = (_strand as UIBase).view as DataGridView; if (view == null) return; columns = view.columnLists; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a9e7458c/frameworks/projects/Express/src/main/flex/org/apache/flex/express/Container.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Express/src/main/flex/org/apache/flex/express/Container.as b/frameworks/projects/Express/src/main/flex/org/apache/flex/express/Container.as index 27e2b08..5316c8c 100644 --- a/frameworks/projects/Express/src/main/flex/org/apache/flex/express/Container.as +++ b/frameworks/projects/Express/src/main/flex/org/apache/flex/express/Container.as @@ -19,15 +19,15 @@ package org.apache.flex.express { import org.apache.flex.binding.ContainerDataBinding; - import org.apache.flex.html.Container; - import org.apache.flex.html.supportClasses.ScrollingViewport; - import org.apache.flex.core.BindableCSSStyles; import org.apache.flex.core.StyleChangeNotifier; + import org.apache.flex.html.Container; + import org.apache.flex.html.beads.layouts.LayoutOnShow; + import org.apache.flex.html.supportClasses.ScrollingViewport; COMPILE::SWF { - import org.apache.flex.html.beads.SolidBackgroundWithChangeListenerBead; import org.apache.flex.html.beads.SingleLineBorderWithChangeListenerBead; + import org.apache.flex.html.beads.SolidBackgroundWithChangeListenerBead; } /** @@ -48,6 +48,7 @@ package org.apache.flex.express addBead(new ContainerDataBinding()); addBead(new ScrollingViewport()); addBead(new StyleChangeNotifier()); + addBead(new LayoutOnShow()); COMPILE::SWF { addBead(new SolidBackgroundWithChangeListenerBead());