You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2019/12/01 06:52:45 UTC
[royale-asjs] branch develop updated: mxmlDocument wasn't being set
correctly in popups because it calls numChildren/numElement which
instantiates the view and contentarea too soon. Added a test that won't
instantiate the view. Should fix #596
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 39526e3 mxmlDocument wasn't being set correctly in popups because it calls numChildren/numElement which instantiates the view and contentarea too soon. Added a test that won't instantiate the view. Should fix #596
39526e3 is described below
commit 39526e399560a8e50bc8070ad1286647a46c792a
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sat Nov 30 22:52:25 2019 -0800
mxmlDocument wasn't being set correctly in popups because it calls numChildren/numElement which instantiates the view and contentarea too soon. Added a test that won't instantiate the view. Should fix #596
---
.../projects/MXRoyale/src/main/royale/mx/containers/FormItem.as | 7 +++++++
.../projects/MXRoyale/src/main/royale/mx/containers/Panel.as | 7 +++++++
.../MXRoyale/src/main/royale/mx/containers/TabNavigator.as | 7 +++++++
.../MXRoyale/src/main/royale/mx/controls/listClasses/ListBase.as | 7 +++++++
frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as | 7 +++++++
.../projects/SparkRoyale/src/main/royale/spark/components/Panel.as | 7 +++++++
.../src/main/royale/spark/components/SkinnableContainer.as | 7 +++++++
7 files changed, 49 insertions(+)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/FormItem.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/FormItem.as
index c4b63ae..dd6933c 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/FormItem.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/FormItem.as
@@ -38,6 +38,7 @@ import mx.core.UIComponent;
import mx.core.mx_internal;
import mx.styles.CSSStyleDeclaration;
+import org.apache.royale.core.IBeadView;
import org.apache.royale.core.IChild;
import org.apache.royale.events.Event;
@@ -1554,6 +1555,12 @@ public class FormItem extends Container
*/
override public function get numElements():int
{
+ // the view getter below will instantiate the view which can happen
+ // earlier than we would like (when setting mxmlDocument) so we
+ // see if the view bead exists on the strand. If not, nobody
+ // has added any children so numElements must be 0
+ if (!getBeadByType(IBeadView))
+ return 0;
var containerView:FormItemView = view as FormItemView;
return containerView.contentArea.numElements;
}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as
index ec6afff..ff057ae 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/Panel.as
@@ -65,6 +65,7 @@ import mx.containers.beads.models.PanelModel;
import mx.core.Container;
import mx.core.UIComponent;
+import org.apache.royale.core.IBeadView;
import org.apache.royale.core.IChild;
import org.apache.royale.events.Event;
import org.apache.royale.events.ValueEvent;
@@ -768,6 +769,12 @@ public class Panel extends Container
*/
override public function get numElements():int
{
+ // the view getter below will instantiate the view which can happen
+ // earlier than we would like (when setting mxmlDocument) so we
+ // see if the view bead exists on the strand. If not, nobody
+ // has added any children so numElements must be 0
+ if (!getBeadByType(IBeadView))
+ return 0;
var panelView:PanelView = view as PanelView;
if (panelView.contentArea == this)
return super.numElements;
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/TabNavigator.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/TabNavigator.as
index 181f59a..76a0d02 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/TabNavigator.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/TabNavigator.as
@@ -26,6 +26,7 @@ import mx.core.Container;
import mx.core.EdgeMetrics;
import mx.managers.IFocusManagerComponent;
+import org.apache.royale.core.IBeadView;
import org.apache.royale.core.IChild;
import org.apache.royale.events.Event;
@@ -476,6 +477,12 @@ public class TabNavigator extends ViewStack implements IFocusManagerComponent
*/
override public function get numElements():int
{
+ // the view getter below will instantiate the view which can happen
+ // earlier than we would like (when setting mxmlDocument) so we
+ // see if the view bead exists on the strand. If not, nobody
+ // has added any children so numElements must be 0
+ if (!getBeadByType(IBeadView))
+ return 0;
var tnView:TabNavigatorView = view as TabNavigatorView;
return tnView.contentArea.numElements;
}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/ListBase.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/ListBase.as
index ae60a3a..77c59d6 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/ListBase.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/ListBase.as
@@ -35,6 +35,7 @@ import mx.core.ScrollControlBase;
import org.apache.royale.core.ContainerBaseStrandChildren;
import org.apache.royale.core.IBeadLayout;
+import org.apache.royale.core.IBeadView;
import org.apache.royale.core.IChild;
import org.apache.royale.core.IContainer;
import org.apache.royale.core.IContainerBaseStrandChildrenHost;
@@ -849,6 +850,12 @@ use namespace mx_internal;
COMPILE::SWF
override public function get numElements():int
{
+ // the view getter below will instantiate the view which can happen
+ // earlier than we would like (when setting mxmlDocument) so we
+ // see if the view bead exists on the strand. If not, nobody
+ // has added any children so numElements must be 0
+ if (!getBeadByType(IBeadView))
+ return 0;
var layoutHost:ILayoutHost = view as ILayoutHost;
var contentView:IParent = layoutHost.contentView as IParent;
if (contentView == this)
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
index c4965fa..645cff6 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
@@ -23,6 +23,7 @@ package mx.core
import org.apache.royale.binding.DataBindingBase;
import org.apache.royale.core.ContainerBaseStrandChildren;
import org.apache.royale.core.IBeadLayout;
+ import org.apache.royale.core.IBeadView;
import org.apache.royale.core.IBorderPaddingMarginValuesImpl;
import org.apache.royale.core.IChild;
import org.apache.royale.core.IContainer;
@@ -1111,6 +1112,12 @@ public class Container extends UIComponent
COMPILE::SWF
override public function get numElements():int
{
+ // the view getter below will instantiate the view which can happen
+ // earlier than we would like (when setting mxmlDocument) so we
+ // see if the view bead exists on the strand. If not, nobody
+ // has added any children so numElements must be 0
+ if (!getBeadByType(IBeadView))
+ return 0;
var layoutHost:ILayoutHost = view as ILayoutHost;
var contentView:IParent = layoutHost.contentView as IParent;
return contentView.numElements;
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Panel.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Panel.as
index f99a0f5..4b2eff3 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Panel.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/Panel.as
@@ -26,6 +26,7 @@ import mx.core.IVisualElement;
import mx.core.UIComponent;
import mx.core.mx_internal;
+import org.apache.royale.core.IBeadView;
import org.apache.royale.core.IChild;
import org.apache.royale.events.Event;
import org.apache.royale.events.ValueEvent;
@@ -697,6 +698,12 @@ public class Panel extends SkinnableContainer
*/
override public function get numElements():int
{
+ // the view getter below will instantiate the view which can happen
+ // earlier than we would like (when setting mxmlDocument) so we
+ // see if the view bead exists on the strand. If not, nobody
+ // has added any children so numElements must be 0
+ if (!getBeadByType(IBeadView))
+ return 0;
var panelView:PanelView = view as PanelView;
return panelView.contentArea.numElements;
}
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/SkinnableContainer.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/SkinnableContainer.as
index 590a135..64b6b44 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/SkinnableContainer.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/SkinnableContainer.as
@@ -44,6 +44,7 @@ import org.apache.royale.binding.ContainerDataBinding;
import org.apache.royale.binding.DataBindingBase;
import org.apache.royale.core.ContainerBaseStrandChildren;
import org.apache.royale.core.IBeadLayout;
+import org.apache.royale.core.IBeadView;
import org.apache.royale.core.IChild;
import org.apache.royale.core.IContainer;
import org.apache.royale.core.IContainerBaseStrandChildrenHost;
@@ -1307,6 +1308,12 @@ public class SkinnableContainer extends SkinnableComponent implements IContainer
*/
override public function get numElements():int
{
+ // the view getter below will instantiate the view which can happen
+ // earlier than we would like (when setting mxmlDocument) so we
+ // see if the view bead exists on the strand. If not, nobody
+ // has added any children so numElements must be 0
+ if (!getBeadByType(IBeadView))
+ return 0;
var layoutHost:ILayoutHost = view as ILayoutHost;
if (!layoutHost) return 0; // view is null when called in addingChild from MXMLDataInterpreter before children are added
var contentView:IParent = layoutHost.contentView as IParent;