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/01/14 09:27:06 UTC

[royale-asjs] branch develop updated (b12e342 -> ae770b5)

This is an automated email from the ASF dual-hosted git repository.

aharui pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git.


    from b12e342  clean up warnings from Closure
     new 24f953b  add Spark TabBar example
     new 7c500df  Spark DPs are IList so assume IList in list classes
     new 9a3b81e  ViewStack needs to be a dataprovider for tabbar
     new 2e31903  default labelField is 'label'
     new 18a1c6b  in a Spark Container there is an internal Group that should be sized with the top-level container. May need to factor in borders later
     new 6ad2400  Container needs defaultButton
     new 93eba36  TabBar
     new 6028aa9  get TabBar to take a VS and show its labels
     new 4847924  don't cache 0 as measurement value.  When a component is visible=false, then display:none and measurements will end up being 0 which is not right, so don't use 0 as cached value
     new ae770b5  in JS, make child visible before setting size so the layout can get valid sizes.  This and prior commits fix #366

The 10 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 examples/mxroyale/tourdeflexmodules/build.xml      |   2 +
 .../mxroyale/tourdeflexmodules/src/explorer.xml    |   2 +
 .../src/spark/containers/TabNavigator1Example.mxml |   4 +-
 .../MXRoyale/src/main/royale/MXRoyaleClasses.as    |   1 +
 .../src/main/royale/mx/containers/ViewStack.as     |  19 +++-
 .../beads/models/SingleSelectionIListModel.as      |   2 +-
 ...a.as => DataItemRendererFactoryForIListData.as} |  17 ++--
 ... VirtualDataItemRendererFactoryForIListData.as} |  27 ++----
 .../MXRoyale/src/main/royale/mx/core/Container.as  |  39 ++++++++
 .../mx/core/{FlexGlobals.as => ISelectableList.as} |  48 ++++++----
 .../src/main/royale/mx/core/UIComponent.as         |   4 +-
 .../SparkRoyale/src/main/resources/defaults.css    |  39 +++++++-
 .../src/main/resources/spark-royale-manifest.xml   |   4 +
 .../royale/spark/components/NavigatorContent.as    |  20 ++--
 .../NonVirtualHDataGroup.as}                       | 105 ++++++++++-----------
 .../NonVirtualVDataGroup.as}                       | 105 ++++++++++-----------
 .../src/main/royale/spark/components/TabBar.as     |   3 +
 .../spark/components/supportClasses/ListBase.as    |  32 +++++--
 .../layouts/supportClasses/SparkLayoutBead.as      |   8 ++
 19 files changed, 294 insertions(+), 187 deletions(-)
 copy frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/{DataItemRendererFactoryForICollectionViewData.as => DataItemRendererFactoryForIListData.as} (88%)
 copy frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/{VirtualDataItemRendererFactoryForICollectionViewData.as => VirtualDataItemRendererFactoryForIListData.as} (88%)
 copy frameworks/projects/MXRoyale/src/main/royale/mx/core/{FlexGlobals.as => ISelectableList.as} (58%)
 copy frameworks/projects/SparkRoyale/src/main/royale/spark/{layouts/TileOrientation.as => components/NonVirtualHDataGroup.as} (69%)
 copy frameworks/projects/SparkRoyale/src/main/royale/spark/{layouts/TileOrientation.as => components/NonVirtualVDataGroup.as} (69%)


[royale-asjs] 06/10: Container needs defaultButton

Posted by ah...@apache.org.
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

commit 6ad2400180ea752747a68afe230a890e3548b0a6
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sun Jan 13 23:51:51 2019 -0800

    Container needs defaultButton
---
 .../MXRoyale/src/main/royale/mx/core/Container.as  | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)

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 6606c86..69a88df 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as
@@ -392,6 +392,45 @@ public class Container extends UIComponent
 		typeNames = "Container";
     }
     
+    //----------------------------------
+    //  defaultButton
+    //----------------------------------
+    
+    /**
+     *  @private
+     *  Storage for the defaultButton property.
+     */
+    private var _defaultButton:IFlexDisplayObject;
+    
+    [Inspectable(category="General")]
+    
+    /**
+     *  The Button control designated as the default button
+     *  for the container.
+     *  When controls in the container have focus, pressing the
+     *  Enter key is the same as clicking this Button control.
+     *
+     *  @default null
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function get defaultButton():IFlexDisplayObject
+    {
+        return _defaultButton;
+    }
+    
+    /**
+     *  @private
+     */
+    public function set defaultButton(value:IFlexDisplayObject):void
+    {
+        _defaultButton = value;
+        //ContainerGlobals.focusedContainer = null;
+    }
+    
     
     //----------------------------------
     //  textDecoration


[royale-asjs] 02/10: Spark DPs are IList so assume IList in list classes

Posted by ah...@apache.org.
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

commit 7c500df317777620b34a2f1ec9097f22c4906754
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sun Jan 13 23:47:18 2019 -0800

    Spark DPs are IList so assume IList in list classes
---
 .../MXRoyale/src/main/royale/MXRoyaleClasses.as    |   1 +
 .../DataItemRendererFactoryForIListData.as         | 121 +++++++++++++++++++++
 2 files changed, 122 insertions(+)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
index c6a0194..1c1783c 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
@@ -72,6 +72,7 @@ internal class MXRoyaleClasses
 	import mx.controls.treeClasses.TreeListData; TreeListData;
 	import mx.controls.listClasses.DataItemRendererFactoryForICollectionViewData; DataItemRendererFactoryForICollectionViewData;
     import mx.controls.listClasses.VirtualDataItemRendererFactoryForICollectionViewData; VirtualDataItemRendererFactoryForICollectionViewData;
+    import mx.controls.listClasses.VirtualDataItemRendererFactoryForIListData; VirtualDataItemRendererFactoryForIListData;
 	import mx.controls.treeClasses.DataItemRendererFactoryForICollectionViewHierarchicalData; DataItemRendererFactoryForICollectionViewHierarchicalData;
 	import mx.charts.chartClasses.RenderData; RenderData;
 	import mx.effects.EffectInstance; EffectInstance;
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataItemRendererFactoryForIListData.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataItemRendererFactoryForIListData.as
new file mode 100644
index 0000000..807446a
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/DataItemRendererFactoryForIListData.as
@@ -0,0 +1,121 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package mx.controls.listClasses
+{
+    import mx.collections.ArrayList;
+	import mx.collections.IList;
+	
+	import org.apache.royale.core.IBead;
+	import org.apache.royale.core.IBeadModel;
+	import org.apache.royale.core.IDataProviderItemRendererMapper;
+	import org.apache.royale.core.IDataProviderModel;
+	import org.apache.royale.core.IItemRendererClassFactory;
+	import org.apache.royale.core.IItemRendererParent;
+	import org.apache.royale.core.IListPresentationModel;
+	import org.apache.royale.core.ISelectableItemRenderer;
+	import org.apache.royale.core.IStrand;
+	import org.apache.royale.core.IUIBase;
+	import org.apache.royale.core.SimpleCSSStyles;
+	import org.apache.royale.core.UIBase;
+	import org.apache.royale.core.ValuesManager;
+	import org.apache.royale.events.CollectionEvent;
+	import org.apache.royale.events.Event;
+	import org.apache.royale.events.EventDispatcher;
+	import org.apache.royale.events.IEventDispatcher;
+	import org.apache.royale.events.ItemRendererEvent;
+	import org.apache.royale.html.List;
+	import org.apache.royale.html.beads.DataItemRendererFactoryForCollectionView;
+	import org.apache.royale.html.supportClasses.TreeListData;
+	
+	[Event(name="itemRendererCreated",type="org.apache.royale.events.ItemRendererEvent")]
+
+    /**
+     *  The DataItemRendererFactoryForHierarchicalData class reads a
+     *  HierarchicalData object and creates an item renderer for every
+     *  item in the array.  Other implementations of
+     *  IDataProviderItemRendererMapper map different data
+     *  structures or manage a virtual set of renderers.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion Royale 0.0
+     */
+	public class DataItemRendererFactoryForIListData extends DataItemRendererFactoryForCollectionView
+	{
+        /**
+         *  Constructor.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.0
+         */
+		public function DataItemRendererFactoryForIListData()
+		{
+			super();
+		}
+        
+        /**
+         * @private
+         * @royaleignorecoercion org.apache.royale.core.IListPresentationModel
+         * @royaleignorecoercion org.apache.royale.core.ISelectableItemRenderer
+         * @royaleignorecoercion org.apache.royale.events.IEventDispatcher
+         */
+        override protected function dataProviderChangeHandler(event:Event):void
+        {
+            if (!dataProviderModel)
+                return;
+            var dp:IList = dataProviderModel.dataProvider as IList;
+            if (!dp)
+            {
+                // temporary until descriptor is used in MenuBarModel
+                var obj:Object = dataProviderModel.dataProvider;
+                if (obj is Array)
+                {
+                    dp = new ArrayList(obj as Array);
+                }
+                else
+                    return;
+            }
+            
+            // listen for individual items being added in the future.
+            var dped:IEventDispatcher = dp as IEventDispatcher;
+            dped.addEventListener(CollectionEvent.ITEM_ADDED, itemAddedHandler);
+            dped.addEventListener(CollectionEvent.ITEM_REMOVED, itemRemovedHandler);
+            dped.addEventListener(CollectionEvent.ITEM_UPDATED, itemUpdatedHandler);
+            
+            dataGroup.removeAllItemRenderers();
+            
+            var presentationModel:IListPresentationModel = _strand.getBeadByType(IListPresentationModel) as IListPresentationModel;
+            labelField = dataProviderModel.labelField;
+            
+            var n:int = dp.length;
+            for (var i:int = 0; i < n; i++)
+            {
+                var ir:ISelectableItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as ISelectableItemRenderer;
+                var item:Object = dp.getItemAt(i);
+                fillRenderer(i, item, ir, presentationModel);
+            }
+            
+            IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
+        }
+		
+	}
+}


[royale-asjs] 04/10: default labelField is 'label'

Posted by ah...@apache.org.
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

commit 2e319039caaa8ca16ca0bc48fa62c19e56f9f0a2
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sun Jan 13 23:49:10 2019 -0800

    default labelField is 'label'
---
 .../main/royale/mx/controls/beads/models/SingleSelectionIListModel.as   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/models/SingleSelectionIListModel.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/models/SingleSelectionIListModel.as
index 4bb6e7f..1f6544b 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/models/SingleSelectionIListModel.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/beads/models/SingleSelectionIListModel.as
@@ -98,7 +98,7 @@ package mx.controls.beads.models
 
 		private var _selectedIndex:int = -1;
 		private var _rollOverIndex:int = -1;
-		private var _labelField:String = null;
+		private var _labelField:String = "label";
 
         /**
          *  @copy org.apache.royale.core.ISelectionModel#labelField


[royale-asjs] 03/10: ViewStack needs to be a dataprovider for tabbar

Posted by ah...@apache.org.
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

commit 9a3b81e466acfc1222401fe2eed975fd8ea45043
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sun Jan 13 23:48:17 2019 -0800

    ViewStack needs to be a dataprovider for tabbar
---
 .../src/main/royale/mx/containers/ViewStack.as     |  4 +-
 .../src/main/royale/mx/core/ISelectableList.as     | 72 ++++++++++++++++++++++
 2 files changed, 74 insertions(+), 2 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as
index dbe29ea..74f1364 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as
@@ -32,7 +32,7 @@ import mx.core.ContainerCreationPolicy;
 import mx.core.EdgeMetrics;
 import mx.core.IInvalidating;
 import mx.core.INavigatorContent;
-//import mx.core.ISelectableList;
+import mx.core.ISelectableList;
 import mx.core.IUIComponent;
 import mx.core.ScrollPolicy;
 import mx.core.UIComponent;
@@ -251,7 +251,7 @@ use namespace mx_internal;
  *  @playerversion AIR 1.1
  *  @productversion Flex 3
  */
-public class ViewStack extends Container // implements IHistoryManagerClient, ISelectableList
+public class ViewStack extends Container implements /*IHistoryManagerClient,*/ ISelectableList
 {
 //    include "../core/Version.as";
 
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/ISelectableList.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/ISelectableList.as
new file mode 100644
index 0000000..fb7338b
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/ISelectableList.as
@@ -0,0 +1,72 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.core
+{
+import mx.collections.IList;
+
+/**
+ *  Dispatched when the <code>selectedIndex</code> property changes.
+ *
+ *  @eventType mx.events.IndexChangedEvent.CHANGE
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ */
+[Event(name="change")]
+
+/**
+ *  Dispatched when the <code>selectedIndex</code> property changes.
+ *
+ *  @eventType mx.events.FlexEvent.VALUE_COMMIT
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ */
+[Event(name="valueCommit")]
+
+/**
+ *  The ISelectableList interface indicates that the
+ *  implementor is an IList element that supports a <code>selectedIndex</code>
+ *  property.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ */
+public interface ISelectableList extends IList
+{
+    /**
+     *  The index of the selected IList item.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    function set selectedIndex(value:int):void;
+    function get selectedIndex():int;
+}
+
+}


[royale-asjs] 05/10: in a Spark Container there is an internal Group that should be sized with the top-level container. May need to factor in borders later

Posted by ah...@apache.org.
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

commit 18a1c6b85d973af991714bcfaa1866ab831fa748
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sun Jan 13 23:50:54 2019 -0800

    in a Spark Container there is an internal Group that should be sized with the top-level container. May need to factor in borders later
---
 .../main/royale/spark/layouts/supportClasses/SparkLayoutBead.as   | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/layouts/supportClasses/SparkLayoutBead.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/layouts/supportClasses/SparkLayoutBead.as
index 4f05fff..84e8c0a 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/layouts/supportClasses/SparkLayoutBead.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/layouts/supportClasses/SparkLayoutBead.as
@@ -76,6 +76,14 @@ public class SparkLayoutBead extends org.apache.royale.core.LayoutBase
         if (n == 0)
             return false;
         
+        if (target != host)
+        {
+            var tlc:UIComponent = host as UIComponent;
+            if (!tlc.isWidthSizedToContent() &&
+                !tlc.isHeightSizedToContent())
+                target.setActualSize(tlc.width, tlc.height);
+        }
+        
         var w:Number = target.width;
         var h:Number = target.height;
         if (target.isHeightSizedToContent())


[royale-asjs] 07/10: TabBar

Posted by ah...@apache.org.
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

commit 93eba364068a13f76163d94f74086b7013bfc3d1
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sun Jan 13 23:53:20 2019 -0800

    TabBar
---
 .../projects/SparkRoyale/src/main/royale/spark/components/TabBar.as    | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/TabBar.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/TabBar.as
index 6b4f889..8baaab3 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/TabBar.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/TabBar.as
@@ -164,6 +164,9 @@ public class TabBar extends ListBase implements IFocusManagerComponent
     public function TabBar()
     {
         super();
+        
+        typeNames += " TabBar";
+        
        // requireSelection = true;
        // mouseFocusEnabled = false;        
     }


[royale-asjs] 01/10: add Spark TabBar example

Posted by ah...@apache.org.
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

commit 24f953ba91a9573eca24bbc5c82d1a6c4416c6fe
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sun Jan 13 23:45:22 2019 -0800

    add Spark TabBar example
---
 examples/mxroyale/tourdeflexmodules/build.xml                         | 2 ++
 examples/mxroyale/tourdeflexmodules/src/explorer.xml                  | 2 ++
 .../tourdeflexmodules/src/spark/containers/TabNavigator1Example.mxml  | 4 +++-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/examples/mxroyale/tourdeflexmodules/build.xml b/examples/mxroyale/tourdeflexmodules/build.xml
index 58d99fe..b3eb54c 100644
--- a/examples/mxroyale/tourdeflexmodules/build.xml
+++ b/examples/mxroyale/tourdeflexmodules/build.xml
@@ -544,7 +544,9 @@
 		<compile-mxml folder="/spark/containers/" relmap="../../" example="BorderExample"/>
 		<compile-mxml folder="/spark/containers/" relmap="../../" example="GroupExample"/>
 		<compile-mxml folder="/spark/containers/" relmap="../../" example="PanelExample"/>
+         -->
 		<compile-mxml folder="/spark/containers/" relmap="../../" example="TabNavigator1Example"/>
+        <!--
 		<compile-mxml folder="/spark/containers/" relmap="../../" example="TabNavigator2Example"/>
 		<compile-mxml folder="/spark/skinning/" relmap="../../" example="ButtonWithIconExample"/>
 		<compile-mxml folder="/spark/skinning/" relmap="../../" example="SkinningApplication1Example"/>
diff --git a/examples/mxroyale/tourdeflexmodules/src/explorer.xml b/examples/mxroyale/tourdeflexmodules/src/explorer.xml
index d9e3eb8..d63272c 100755
--- a/examples/mxroyale/tourdeflexmodules/src/explorer.xml
+++ b/examples/mxroyale/tourdeflexmodules/src/explorer.xml
@@ -374,7 +374,9 @@
 					<node label="Panel" module="spark/containers/PanelExample"/>
                     <!--
 					<node label="SkinnableDataContainer" module="spark/containers/SkinnableDataContainerExample" />
+                     -->
 					<node label="TabNavigator" module="spark/containers/TabNavigator1Example" />
+                     <!--
 					<node label="TabNavigator" module="spark/containers/TabNavigator2Example" />
                      -->
 					<node label="TileGroup" module="spark/containers/TileGroupExample" />
diff --git a/examples/mxroyale/tourdeflexmodules/src/spark/containers/TabNavigator1Example.mxml b/examples/mxroyale/tourdeflexmodules/src/spark/containers/TabNavigator1Example.mxml
index 22824b1..e3ab963 100644
--- a/examples/mxroyale/tourdeflexmodules/src/spark/containers/TabNavigator1Example.mxml
+++ b/examples/mxroyale/tourdeflexmodules/src/spark/containers/TabNavigator1Example.mxml
@@ -45,7 +45,7 @@
 			
 			protected function dg_itemClickHandler(event:ListEvent):void
 			{
-				contact = dg.selectedItem as Contact;
+				//contact = dg.selectedItem as Contact;
 			}
 			
 		]]>
@@ -84,6 +84,7 @@
 			</s:NavigatorContent>
 			<s:NavigatorContent label="Contact List" width="100%" height="100%" >
 				<s:BorderContainer width="100%" height="100%" dropShadowVisible="false">
+                    <!--
 					<mx:DataGrid id="dg" dataProvider="{contacts}" x="5" y="5"  doubleClickEnabled="true" 
 								 doubleClick="{tabs.selectedIndex=0}" itemClick="dg_itemClickHandler(event)">
 						<mx:columns>
@@ -94,6 +95,7 @@
 							<mx:DataGridColumn headerText="Zip" dataField="zip"/>
 						</mx:columns>
 					</mx:DataGrid>
+                    -->
 				</s:BorderContainer>
 				
 			</s:NavigatorContent>


[royale-asjs] 08/10: get TabBar to take a VS and show its labels

Posted by ah...@apache.org.
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

commit 6028aa9c0b89de82cac23db12378066b4b734731
Author: Alex Harui <ah...@apache.org>
AuthorDate: Sun Jan 13 23:53:46 2019 -0800

    get TabBar to take a VS and show its labels
---
 .../VirtualDataItemRendererFactoryForIListData.as  | 177 +++++++++++++++++++++
 .../SparkRoyale/src/main/resources/defaults.css    |  39 ++++-
 .../src/main/resources/spark-royale-manifest.xml   |   4 +
 .../royale/spark/components/NavigatorContent.as    |  20 +--
 .../spark/components/NonVirtualHDataGroup.as       |  49 ++++++
 .../spark/components/NonVirtualVDataGroup.as       |  49 ++++++
 .../spark/components/supportClasses/ListBase.as    |  32 +++-
 7 files changed, 350 insertions(+), 20 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/VirtualDataItemRendererFactoryForIListData.as b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/VirtualDataItemRendererFactoryForIListData.as
new file mode 100644
index 0000000..b2c095d
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/controls/listClasses/VirtualDataItemRendererFactoryForIListData.as
@@ -0,0 +1,177 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package mx.controls.listClasses
+{
+	import mx.collections.IList;
+	
+	import org.apache.royale.core.IBead;
+	import org.apache.royale.core.IBeadModel;
+	import org.apache.royale.core.IDataProviderItemRendererMapper;
+    import org.apache.royale.core.IDataProviderVirtualItemRendererMapper;
+	import org.apache.royale.core.IDataProviderModel;
+	import org.apache.royale.core.IItemRendererClassFactory;
+	import org.apache.royale.core.IItemRendererParent;
+	import org.apache.royale.core.IListPresentationModel;
+	import org.apache.royale.core.ISelectableItemRenderer;
+	import org.apache.royale.core.IStrand;
+    import org.apache.royale.core.IStrandWithModelView;
+	import org.apache.royale.core.IUIBase;
+	import org.apache.royale.core.SimpleCSSStyles;
+	import org.apache.royale.core.UIBase;
+	import org.apache.royale.core.ValuesManager;
+	import org.apache.royale.events.CollectionEvent;
+	import org.apache.royale.events.Event;
+	import org.apache.royale.events.EventDispatcher;
+	import org.apache.royale.events.IEventDispatcher;
+	import org.apache.royale.events.ItemRendererEvent;
+	import org.apache.royale.html.List;
+    import org.apache.royale.html.beads.IListView;
+	import org.apache.royale.html.beads.DataItemRendererFactoryForCollectionView;
+    import org.apache.royale.html.supportClasses.DataItemRenderer;
+	
+	[Event(name="itemRendererCreated",type="org.apache.royale.events.ItemRendererEvent")]
+
+    /**
+     *  The DataItemRendererFactoryForHierarchicalData class reads a
+     *  HierarchicalData object and creates an item renderer for every
+     *  item in the array.  Other implementations of
+     *  IDataProviderItemRendererMapper map different data
+     *  structures or manage a virtual set of renderers.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion Royale 0.0
+     */
+	public class VirtualDataItemRendererFactoryForIListData extends DataItemRendererFactoryForIListData 
+        implements IDataProviderVirtualItemRendererMapper
+	{
+        /**
+         *  Constructor.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.0
+         */
+		public function VirtualDataItemRendererFactoryForIListData()
+		{
+			super();
+		}
+
+        protected var dataProviderModel:IDataProviderModel;
+        
+        protected var dataField:String;
+                
+        /**
+         *  Free an item renderer for a given index.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.9.0
+         *  @royaleignorecoercion org.apache.royale.core.IStrandWithModelView
+         *  @royaleignorecoercion org.apache.royale.html.beads.IListView
+         */
+        public function freeItemRendererForIndex(index:int):void
+        {
+            var ir:ISelectableItemRenderer = rendererMap[index];
+            var view:IListView = (_strand as IStrandWithModelView).view as IListView;
+            var dataGroup:IItemRendererParent = view.dataGroup;
+            dataGroup.removeItemRenderer(ir);
+            delete rendererMap[index];
+        }
+        
+        private var rendererMap:Object = {};
+                
+        /**
+         *  The org.apache.royale.core.IItemRendererParent that will
+         *  parent the item renderers.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.0
+         *  @royaleignorecoercion org.apache.royale.core.IStrandWithModelView
+         *  @royaleignorecoercion org.apache.royale.html.beads.IListView
+         */		
+        override protected function dataProviderChangeHandler(event:Event):void
+        {
+            // do not call super as it will be non-virtual and renderer every item in the dp
+            
+            var dp:IList = dataProviderModel.dataProvider as IList;
+            if (!dp)
+                return;
+            
+            var view:IListView = (_strand as IStrandWithModelView).view as IListView;
+            var dataGroup:IItemRendererParent = view.dataGroup;
+            
+            dataGroup.removeAllItemRenderers();
+        }
+        
+
+        /**
+         *  Get an item renderer for a given index.
+         *
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.9.0
+         *  @royaleignorecoercion org.apache.royale.core.IStrandWithModelView
+         *  @royaleignorecoercion org.apache.royale.html.beads.IListView
+         */
+        public function getItemRendererForIndex(index:int, elementIndex:int):ISelectableItemRenderer
+        {
+            var ir:ISelectableItemRenderer = rendererMap[index];
+            if (ir) return ir;
+            
+            var dp:IList = dataProviderModel.dataProvider as IList;
+            
+            var view:IListView = (_strand as IStrandWithModelView).view as IListView;
+            var dataGroup:IItemRendererParent = view.dataGroup;
+            ir = itemRendererFactory.createItemRenderer(dataGroup) as ISelectableItemRenderer;
+            var dataItemRenderer:DataItemRenderer = ir as DataItemRenderer;
+            
+            dataGroup.addItemRendererAt(ir, elementIndex);
+            ir.index = index;
+            ir.labelField = labelField;
+            if (dataItemRenderer)
+            {
+                dataItemRenderer.dataField = dataField;
+            }
+            rendererMap[index] = ir;
+            
+            var presentationModel:IListPresentationModel = _strand.getBeadByType(IListPresentationModel) as IListPresentationModel;
+            if (presentationModel) {
+                var style:SimpleCSSStyles = new SimpleCSSStyles();
+                style.marginBottom = presentationModel.separatorThickness;
+                UIBase(ir).style = style;
+                UIBase(ir).height = presentationModel.rowHeight;
+                UIBase(ir).percentWidth = 100;
+            }
+            ir.data = dp.getItemAt(index);
+            
+            var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED);
+            newEvent.itemRenderer = ir;
+            dispatchEvent(newEvent);
+            return ir;
+        }
+		
+	}
+}
diff --git a/frameworks/projects/SparkRoyale/src/main/resources/defaults.css b/frameworks/projects/SparkRoyale/src/main/resources/defaults.css
index 04db8a9..7bc7c3b 100644
--- a/frameworks/projects/SparkRoyale/src/main/resources/defaults.css
+++ b/frameworks/projects/SparkRoyale/src/main/resources/defaults.css
@@ -67,8 +67,8 @@ Image
 
 DataGroup
 {
-	IDataProviderItemRendererMapper: ClassReference("mx.controls.listClasses.VirtualDataItemRendererFactoryForICollectionViewData");
-	IBeadModel: ClassReference("mx.controls.beads.models.SingleSelectionICollectionViewModel");
+	IDataProviderItemRendererMapper: ClassReference("mx.controls.listClasses.VirtualDataItemRendererFactoryForIListData");
+	IBeadModel: ClassReference("mx.controls.beads.models.SingleSelectionIListModel");
 	IBeadView:  ClassReference("org.apache.royale.html.beads.VirtualDataContainerView");			
 	IBeadController: ClassReference("org.apache.royale.html.beads.controllers.ListSingleSelectionMouseController");
 	IBeadLayout: ClassReference("org.apache.royale.html.beads.layouts.VirtualListVerticalLayout");
@@ -78,6 +78,32 @@ DataGroup
 	IViewportModel: ClassReference("org.apache.royale.html.beads.models.ViewportModel");
 }
 
+NonVirtualHDataGroup
+{
+	IDataProviderItemRendererMapper: ClassReference("mx.controls.listClasses.DataItemRendererFactoryForIListData");
+	IBeadModel: ClassReference("mx.controls.beads.models.SingleSelectionIListModel");
+	IBeadView:  ClassReference("org.apache.royale.html.beads.DataContainerView");			
+	IBeadController: ClassReference("org.apache.royale.html.beads.controllers.ListSingleSelectionMouseController");
+	IBeadLayout: ClassReference("org.apache.royale.html.beads.layouts.HorizontalLayout");
+	IItemRendererClassFactory: ClassReference("org.apache.royale.core.ItemRendererClassFactory");
+	IItemRenderer: ClassReference("mx.controls.listClasses.ListItemRenderer");
+	IViewport: ClassReference("org.apache.royale.html.supportClasses.ScrollingViewport");
+	IViewportModel: ClassReference("org.apache.royale.html.beads.models.ViewportModel");
+}
+
+NonVirtualVDataGroup
+{
+	IDataProviderItemRendererMapper: ClassReference("mx.controls.listClasses.DataItemRendererFactoryForIListData");
+	IBeadModel: ClassReference("mx.controls.beads.models.SingleSelectionIListModel");
+	IBeadView:  ClassReference("org.apache.royale.html.beads.DataContainerView");			
+	IBeadController: ClassReference("org.apache.royale.html.beads.controllers.ListSingleSelectionMouseController");
+	IBeadLayout: ClassReference("org.apache.royale.html.beads.layouts.VerticalLayout");
+	IItemRendererClassFactory: ClassReference("org.apache.royale.core.ItemRendererClassFactory");
+	IItemRenderer: ClassReference("mx.controls.listClasses.ListItemRenderer");
+	IViewport: ClassReference("org.apache.royale.html.supportClasses.ScrollingViewport");
+	IViewportModel: ClassReference("org.apache.royale.html.beads.models.ViewportModel");
+}
+
 DropDownList
 {
 	IBeadModel: ClassReference("mx.controls.beads.models.SingleSelectionICollectionViewModel");
@@ -133,6 +159,15 @@ SkinnableContainer
 	IContentView: ClassReference("spark.components.Group");
 }
 
+TabBar
+{
+	IBeadView: ClassReference("spark.components.beads.SkinnableContainerView");
+	IBeadLayout: ClassReference("spark.layouts.supportClasses.SparkLayoutBead");
+	IViewport: ClassReference("org.apache.royale.html.supportClasses.ScrollingViewport");
+	IViewportModel: ClassReference("org.apache.royale.html.beads.models.ViewportModel");
+	IContentView: ClassReference("spark.components.NonVirtualHDataGroup");
+}
+
 TextArea
 {
 	border-style: solid;
diff --git a/frameworks/projects/SparkRoyale/src/main/resources/spark-royale-manifest.xml b/frameworks/projects/SparkRoyale/src/main/resources/spark-royale-manifest.xml
index 58dbf87..bb0a87e 100644
--- a/frameworks/projects/SparkRoyale/src/main/resources/spark-royale-manifest.xml
+++ b/frameworks/projects/SparkRoyale/src/main/resources/spark-royale-manifest.xml
@@ -109,5 +109,9 @@
 	<component id="TabBar" class="spark.components.TabBar"/>
 	<component id="ButtonBar" class="spark.components.ButtonBar"/>
 	<component id="SkinnablePopUpContainer" class="spark.components.SkinnablePopUpContainer"/>
+    
+    <component id="NonVirtualHDataGroup" class="spark.components.NonVirtualHDataGroup"/>
+    <component id="NonVirtualVDataGroup" class="spark.components.NonVirtualVDataGroup"/>
+
 	
 </componentPackage>
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/NavigatorContent.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/NavigatorContent.as
index 8ab2303..240cf44 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/NavigatorContent.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/NavigatorContent.as
@@ -22,8 +22,8 @@ package spark.components
 //import flash.events.Event;
 import org.apache.royale.events.Event;
 /* import mx.core.ContainerCreationPolicy;
-import mx.core.IDeferredContentOwner;
-import mx.core.INavigatorContent */
+import mx.core.IDeferredContentOwner; */
+import mx.core.INavigatorContent;
 
 /**
  *  The NavigatorContent class defines a Spark container that can be used 
@@ -74,9 +74,9 @@ import mx.core.INavigatorContent */
  *  @playerversion AIR 1.5
  *  @productversion Royale 0.9.4
  */
-public class NavigatorContent extends SkinnableContainer 
+public class NavigatorContent extends SkinnableContainer implements INavigatorContent
 {
- //implements INavigatorContent
+
    // include "../core/Version.as";
     
 
@@ -114,10 +114,10 @@ public class NavigatorContent extends SkinnableContainer
      *  @private
      *  Storage for the icon property.
      */
-    /* private var _icon:Class = null;
+    private var _icon:Class = null;
 
     [Bindable("iconChanged")]
-    [Inspectable(category="General", defaultValue="", format="EmbeddedFile")] */
+    [Inspectable(category="General", defaultValue="", format="EmbeddedFile")]
 
     /**
      *  The Class of the icon displayed by some navigator
@@ -144,20 +144,20 @@ public class NavigatorContent extends SkinnableContainer
      *  @playerversion AIR 1.5
      *  @productversion Royale 0.9.4
      */
-    /* public function get icon():Class
+    public function get icon():Class
     {
         return _icon;
-    } */
+    }
 
     /**
      *  @private
      */
-    /* public function set icon(value:Class):void
+    public function set icon(value:Class):void
     {
         _icon = value;
 
         dispatchEvent(new Event("iconChanged"));
-    } */
+    }
 
     //----------------------------------
     //  label
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/NonVirtualHDataGroup.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/NonVirtualHDataGroup.as
new file mode 100644
index 0000000..cf5a0bf
--- /dev/null
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/NonVirtualHDataGroup.as
@@ -0,0 +1,49 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package spark.components
+{
+
+/**
+ *  The NonVirtualHDataGroup class is a DataGroup that defaults to
+ *  non-virtual vertical layout
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ */
+public class NonVirtualHDataGroup extends DataGroup
+{
+    /**
+     *  Constructor.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function NonVirtualHDataGroup()
+    {
+        super();
+        typeNames = "NonVirtualHDataGroup";
+        
+    }
+}
+}
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/NonVirtualVDataGroup.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/NonVirtualVDataGroup.as
new file mode 100644
index 0000000..a58f158
--- /dev/null
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/NonVirtualVDataGroup.as
@@ -0,0 +1,49 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package spark.components
+{
+
+/**
+ *  The NonVirtualVDataGroup class is a DataGroup that defaults to
+ *  non-virtual vertical layout
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4
+ */
+public class NonVirtualVDataGroup extends DataGroup
+{
+    /**
+     *  Constructor.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4
+     */
+    public function NonVirtualVDataGroup()
+    {
+        super();
+        typeNames = "NonVirtualVDataGroup";
+        
+    }
+}
+}
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/ListBase.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/ListBase.as
index 60706c5..7f4b8a2 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/ListBase.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/ListBase.as
@@ -50,7 +50,10 @@ import spark.components.SkinnableContainer;
 import spark.components.beads.SkinnableContainerView;
 
 import org.apache.royale.core.IBeadLayout;
+import org.apache.royale.core.ISelectionModel;
 import org.apache.royale.core.ItemRendererClassFactory;
+import org.apache.royale.events.Event;
+import org.apache.royale.events.IEventDispatcher;
 
 use namespace mx_internal;   //ListBase and List share selection properties that are mx_internal
 
@@ -489,9 +492,27 @@ public class ListBase  extends SkinnableContainer
      */
     public function set dataProvider(value:IList):void
     {
+        if (isWidthSizedToContent() || isHeightSizedToContent())
+            ((view as SkinnableContainerView).contentView as DataGroup).addEventListener("itemsCreated", itemsCreatedHandler);
         ((view as SkinnableContainerView).contentView as DataGroup).dataProvider = value;
     }
     
+    private function itemsCreatedHandler(event:Event):void
+    {
+        if (parent)
+        {
+            COMPILE::JS
+            {
+                // clear last width/height so elements size to content
+                element.style.width = "";
+                element.style.height = "";
+                ((view as SkinnableContainerView).contentView as DataGroup).element.style.width = "";
+                ((view as SkinnableContainerView).contentView as DataGroup).element.style.height = "";
+            }
+            (parent as IEventDispatcher).dispatchEvent(new Event("layoutNeeded"));
+        }
+    }
+    
     //----------------------------------
     //  itemRenderer copied from SkinnableDataContainer
     //----------------------------------
@@ -619,7 +640,7 @@ public class ListBase  extends SkinnableContainer
     /**
      *  @private
      */
-    private var _labelField:String = "label";
+    //private var _labelField:String = "label";
     
     /**
      *  @private
@@ -646,7 +667,7 @@ public class ListBase  extends SkinnableContainer
      */
      public function get labelField():String
     {
-        return _labelField;
+         return (((view as SkinnableContainerView).contentView as DataGroup).model as ISelectionModel).labelField;
     } 
     
     /**
@@ -654,12 +675,7 @@ public class ListBase  extends SkinnableContainer
      */
     public function set labelField(value:String):void
     {
-        if (value == _labelField)
-            return;
-            
-        _labelField = value;
-        //labelFieldOrFunctionChanged = true;
-        //invalidateProperties();
+        (((view as SkinnableContainerView).contentView as DataGroup).model as ISelectionModel).labelField = value;
     } 
     
     //----------------------------------


[royale-asjs] 10/10: in JS, make child visible before setting size so the layout can get valid sizes. This and prior commits fix #366

Posted by ah...@apache.org.
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

commit ae770b55427e3b62d49ae7112f5175bdefbcda80
Author: Alex Harui <ah...@apache.org>
AuthorDate: Mon Jan 14 01:24:56 2019 -0800

    in JS, make child visible before setting size so the layout can get valid sizes.  This and prior commits fix #366
---
 .../MXRoyale/src/main/royale/mx/containers/ViewStack.as   | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as
index 74f1364..99cef43 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/ViewStack.as
@@ -986,15 +986,24 @@ public class ViewStack extends Container implements /*IHistoryManagerClient,*/ I
                     newHeight = child.explicitHeight;
             }
 
+            COMPILE::JS
+            {
+                // must set visible=true otherwise child has display:none
+                // and measurements of its children will not be correct
+                child.visible = true;
+            }
             // Don't send events for the size/move. The set visible below
             if (child.width != newWidth || child.height != newHeight)
                 child.setActualSize(newWidth, newHeight);
             if (child.x != left || child.y != top)
                 child.move(left, top);
 
-            // Now that the child is properly sized and positioned it
-            // can be shown.
-            child.visible = true;
+            COMPILE::SWF
+            {
+                // Now that the child is properly sized and positioned it
+                // can be shown.
+                child.visible = true;
+            }
         }
     }
 


[royale-asjs] 09/10: don't cache 0 as measurement value. When a component is visible=false, then display:none and measurements will end up being 0 which is not right, so don't use 0 as cached value

Posted by ah...@apache.org.
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

commit 4847924a5a115c640aa68d87763db7dfb050af3b
Author: Alex Harui <ah...@apache.org>
AuthorDate: Mon Jan 14 01:23:29 2019 -0800

    don't cache 0 as measurement value.  When a component is visible=false, then display:none and measurements will end up being 0 which is not right, so don't use 0 as cached value
---
 frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
index 246e843..8acc298 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
@@ -1967,7 +1967,7 @@ COMPILE::JS
             }
 		}
 		COMPILE::JS {
-			if (isNaN(_measuredWidth)) 
+			if (isNaN(_measuredWidth) || _measuredWidth <= 0) 
             {
                 var oldWidth:Object;
                 var oldLeft:String;
@@ -2040,7 +2040,7 @@ COMPILE::JS
             }
 		}
 		COMPILE::JS {
-            if (isNaN(_measuredHeight))
+            if (isNaN(_measuredHeight) || _measuredHeight <= 0)
             {
                 var oldHeight:Object;
                 var oldTop:String;