You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2020/08/16 10:40:46 UTC

[royale-asjs] branch develop updated: jewel-list: extend from DataContainer instead of DataContainerBase. Also remove IStrandWithPresentationModel since is duplicated interface and use IListWithPresentationModel always in all cases

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

carlosrovira 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 a08212c  jewel-list: extend from DataContainer instead of DataContainerBase. Also remove IStrandWithPresentationModel since is duplicated interface and use IListWithPresentationModel always in all cases
a08212c is described below

commit a08212c00a7865d51f06fe84a071f837059764b3
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sun Aug 16 12:40:34 2020 +0200

    jewel-list: extend from DataContainer instead of DataContainerBase. Also remove IStrandWithPresentationModel since is duplicated interface and use IListWithPresentationModel always in all cases
---
 .../projects/Jewel/src/main/resources/defaults.css |  1 -
 .../org/apache/royale/jewel/DataContainer.as       |  2 +
 .../main/royale/org/apache/royale/jewel/List.as    | 73 +---------------------
 .../itemRenderers/ListItemRendererInitializer.as   |  6 +-
 .../beads/layouts/VirtualListVerticalLayout.as     |  8 +--
 .../Jewel/src/main/sass/components/_list.sass      |  2 +-
 6 files changed, 12 insertions(+), 80 deletions(-)

diff --git a/frameworks/projects/Jewel/src/main/resources/defaults.css b/frameworks/projects/Jewel/src/main/resources/defaults.css
index 2dd6554..866e8d6 100644
--- a/frameworks/projects/Jewel/src/main/resources/defaults.css
+++ b/frameworks/projects/Jewel/src/main/resources/defaults.css
@@ -3250,7 +3250,6 @@ j|List {
   IBeadView: ClassReference("org.apache.royale.jewel.beads.views.ListView");
   IBeadController: ClassReference("org.apache.royale.jewel.beads.controllers.ListSingleSelectionMouseController");
   IBeadKeyController: ClassReference("org.apache.royale.jewel.beads.controllers.ListKeyDownController");
-  IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.VerticalLayout");
   IItemRendererClassFactory: ClassReference("org.apache.royale.core.SelectableItemRendererClassFactory");
   IItemRenderer: ClassReference("org.apache.royale.jewel.itemRenderers.ListItemRenderer");
   IItemRendererInitializer: ClassReference("org.apache.royale.jewel.beads.itemRenderers.ListItemRendererInitializer");
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DataContainer.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DataContainer.as
index 819428a..fe1d8c2 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DataContainer.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/DataContainer.as
@@ -77,6 +77,7 @@ package org.apache.royale.jewel
             typeNames = "jewel datacontainer";
 		}
 
+		[Bindable("labelFieldChanged")]
 		/**
 		 *  The name of field within the data used for display. Each item of the
 		 *  data should have a property with this name.
@@ -99,6 +100,7 @@ package org.apache.royale.jewel
             IDataProviderModel(model).labelField = value;
 		}
 
+		[Bindable("dataProviderChanged")]
 		/**
 		 *  The data being display by the List.
 		 *
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/List.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/List.as
index 367fea7..07c6c0e 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/List.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/List.as
@@ -18,16 +18,11 @@
 ////////////////////////////////////////////////////////////////////////////////
 package org.apache.royale.jewel
 {
-	import org.apache.royale.core.IBead;
 	import org.apache.royale.core.IBeadKeyController;
-	import org.apache.royale.core.IDataProviderModel;
 	import org.apache.royale.core.IRollOverModel;
 	import org.apache.royale.core.ISelectionModel;
-	import org.apache.royale.core.IStrandWithPresentationModel;
 	import org.apache.royale.jewel.beads.layouts.IVariableRowHeight;
-	import org.apache.royale.jewel.beads.models.ListPresentationModel;
 	import org.apache.royale.jewel.beads.views.IScrollToIndexView;
-	import org.apache.royale.jewel.supportClasses.container.DataContainerBase;
 	import org.apache.royale.jewel.supportClasses.list.IListPresentationModel;
 	import org.apache.royale.utils.loadBeadFromValuesManager;
 
@@ -70,7 +65,7 @@ package org.apache.royale.jewel
 	 *  @playerversion AIR 2.6
 	 *  @productversion Royale 0.9.4
 	 */
-	public class List extends DataContainerBase implements IStrandWithPresentationModel, IVariableRowHeight
+	public class List extends DataContainer implements IVariableRowHeight
 	{
 		/**
 		 *  constructor.
@@ -90,52 +85,7 @@ package org.apache.royale.jewel
 			tabIndex = 0;
 		}
 
-        [Bindable("labelFieldChanged")]
-		/**
-		 *  The name of field within the data used for display. Each item of the
-		 *  data should have a property with this name.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.4
-		 *  @royaleignorecoercion org.apache.royale.core.IDataProviderModel
-		 */
-		public function get labelField():String
-		{
-			return IDataProviderModel(model).labelField;
-		}
-		/**
-		 * @royaleignorecoercion org.apache.royale.core.IDataProviderModel
-		 */
-		public function set labelField(value:String):void
-		{
-            IDataProviderModel(model).labelField = value;
-		}
-
-        [Bindable("dataProviderChanged")]
-		/**
-		 *  The data being display by the List.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.4
-		 *  @royaleignorecoercion org.apache.royale.core.IDataProviderModel
-		 */
-        public function get dataProvider():Object
-        {
-            return IDataProviderModel(model).dataProvider;
-        }
-		/**
-		 * @royaleignorecoercion org.apache.royale.core.IDataProviderModel
-		 */
-        public function set dataProvider(value:Object):void
-        {
-            IDataProviderModel(model).dataProvider = value;
-        }
-
-		/**
+        /**
 		 *  The index of the currently selected item. Changing this value
 		 *  also changes the selectedItem property.
 		 *
@@ -247,25 +197,6 @@ package org.apache.royale.jewel
         }
 
 		/**
-		 *  The presentation model for the list.
-		 *
-		 *  @langversion 3.0
-		 *  @playerversion Flash 10.2
-		 *  @playerversion AIR 2.6
-		 *  @productversion Royale 0.9.4
-		 *  @royaleignorecoercion org.apache.royale.core.IListPresentationModel
-		 */
-		public function get presentationModel():IBead
-		{
-			var presModel:IListPresentationModel = getBeadByType(IListPresentationModel) as IListPresentationModel;
-			if (presModel == null) {
-				presModel = new ListPresentationModel();
-				addBead(presModel);
-			}
-			return presModel;
-		}
-
-		/**
 		 *  Ensures that the data provider item at the given index is visible.
 		 *  
 		 *  @param index The index of the item in the data provider.
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/ListItemRendererInitializer.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/ListItemRendererInitializer.as
index ab1caae..62ddd0d 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/ListItemRendererInitializer.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/ListItemRendererInitializer.as
@@ -22,10 +22,10 @@ package org.apache.royale.jewel.beads.itemRenderers
 	import org.apache.royale.core.IItemRendererOwnerView;
 	import org.apache.royale.core.IStrand;
 	import org.apache.royale.core.IStrandWithModelView;
-	import org.apache.royale.core.IStrandWithPresentationModel;
 	import org.apache.royale.core.StyledMXMLItemRenderer;
 	import org.apache.royale.core.StyledUIBase;
 	import org.apache.royale.jewel.supportClasses.list.IListPresentationModel;
+	import org.apache.royale.core.IListWithPresentationModel;
 
 	/**
 	 *  The ListItemRendererInitializer class initializes item renderers
@@ -67,8 +67,8 @@ package org.apache.royale.jewel.beads.itemRenderers
 		{	
 			super.strand = value;
             ownerView = (value as IStrandWithModelView).view as IItemRendererOwnerView;
-			if(_strand as IStrandWithPresentationModel)
-            	presentationModel = (_strand as IStrandWithPresentationModel).presentationModel as IListPresentationModel;            
+			if(_strand as IListWithPresentationModel)
+            	presentationModel = (_strand as IListWithPresentationModel).presentationModel as IListPresentationModel;            
 		}
         
         override protected function setupVisualsForItemRenderer(ir:IIndexedItemRenderer):void
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/VirtualListVerticalLayout.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/VirtualListVerticalLayout.as
index b910b77..bd3fca3 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/VirtualListVerticalLayout.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/layouts/VirtualListVerticalLayout.as
@@ -35,8 +35,8 @@ package org.apache.royale.jewel.beads.layouts
 	import org.apache.royale.core.IDataProviderVirtualItemRendererMapper;
 	import org.apache.royale.core.IIndexedItemRenderer;
 	import org.apache.royale.core.ILayoutView;
+	import org.apache.royale.core.IListWithPresentationModel;
 	import org.apache.royale.core.IStrand;
-	import org.apache.royale.core.IStrandWithPresentationModel;
 	import org.apache.royale.events.Event;
 	import org.apache.royale.jewel.supportClasses.list.IListPresentationModel;
         
@@ -132,7 +132,7 @@ package org.apache.royale.jewel.beads.layouts
 		 *  @royaleignorecoercion org.apache.royale.core.ILayoutHost
 		 *  @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement
 		 *  @royaleignorecoercion org.apache.royale.jewel.supportClasses.list.IListPresentationModel
-		 *  @royaleignorecoercion org.apache.royale.core.IStrandWithPresentationModel
+		 *  @royaleignorecoercion org.apache.royale.core.IListWithPresentationModel
 		 */
 		override public function layout():Boolean
 		{
@@ -156,7 +156,7 @@ package org.apache.royale.jewel.beads.layouts
                     inLayout = false;
                     return true;
                 }
-                var presentationModel:IListPresentationModel = (host as IStrandWithPresentationModel).presentationModel as IListPresentationModel;
+                var presentationModel:IListPresentationModel = (host as IListWithPresentationModel).presentationModel as IListPresentationModel;
 				var hostWidthSizedToContent:Boolean = host.isWidthSizedToContent();
 				var hostHeightSizedToContent:Boolean = host.isHeightSizedToContent();
 				var hostWidth:Number = host.width;
@@ -283,7 +283,7 @@ package org.apache.royale.jewel.beads.layouts
                     inLayout = false;
                     return true;
                 }
-                var presentationModel:IListPresentationModel = (host as IStrandWithPresentationModel).presentationModel as IListPresentationModel;
+                var presentationModel:IListPresentationModel = (host as IListWithPresentationModel).presentationModel as IListPresentationModel;
                 var totalHeight:Number = presentationModel.rowHeight * dp.length;
                 var viewportTop:Number = Math.max(contentView.element.scrollTop, 0);
                 var viewportHeight:Number = contentView.height;
diff --git a/frameworks/projects/Jewel/src/main/sass/components/_list.sass b/frameworks/projects/Jewel/src/main/sass/components/_list.sass
index 4e64097..40791eb 100644
--- a/frameworks/projects/Jewel/src/main/sass/components/_list.sass
+++ b/frameworks/projects/Jewel/src/main/sass/components/_list.sass
@@ -42,7 +42,7 @@ j|List
     IBeadView:  ClassReference("org.apache.royale.jewel.beads.views.ListView")
     IBeadController: ClassReference("org.apache.royale.jewel.beads.controllers.ListSingleSelectionMouseController")
     IBeadKeyController: ClassReference("org.apache.royale.jewel.beads.controllers.ListKeyDownController")
-    IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.VerticalLayout")
+    // IBeadLayout: ClassReference("org.apache.royale.jewel.beads.layouts.VerticalLayout")
     IItemRendererClassFactory: ClassReference("org.apache.royale.core.SelectableItemRendererClassFactory")
     IItemRenderer: ClassReference("org.apache.royale.jewel.itemRenderers.ListItemRenderer")
     IItemRendererInitializer: ClassReference("org.apache.royale.jewel.beads.itemRenderers.ListItemRendererInitializer")