royale-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harbs <harbs.li...@gmail.com>
Subject Re: [royale-asjs] branch feature/new_merge updated: this fixes add/remove items from list
Date Wed, 05 Sep 2018 12:20:04 GMT
Ah. I was just working on this.

I guess I’ll leave it to you to finish.

Let me know if you want help.

Harbs

> On Sep 5, 2018, at 3:13 PM, carlosrovira@apache.org wrote:
> 
> This is an automated email from the ASF dual-hosted git repository.
> 
> carlosrovira pushed a commit to branch feature/new_merge
> in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
> 
> 
> The following commit(s) were added to refs/heads/feature/new_merge by this push:
>     new 40a85ea  this fixes add/remove items from list
> 40a85ea is described below
> 
> commit 40a85ea77bc2e9c57d7d2760d9f7a1aa2cff032b
> Author: Carlos Rovira <carlosrovira@apache.org>
> AuthorDate: Wed Sep 5 14:13:06 2018 +0200
> 
>    this fixes add/remove items from list
> ---
> .../itemRenderers/AddListItemRendererForArrayListData.as     | 10 +++++-----
> .../itemRenderers/RemoveListItemRendererForArrayListData.as  | 12 ++++++------
> 2 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/AddListItemRendererForArrayListData.as
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/AddListItemRendererForArrayListData.as
> index 7e7c2ed..188dba2 100644
> --- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/AddListItemRendererForArrayListData.as
> +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/AddListItemRendererForArrayListData.as
> @@ -26,6 +26,7 @@ package org.apache.royale.jewel.beads.itemRenderers
> 	import org.apache.royale.core.ISelectableItemRenderer;
> 	import org.apache.royale.core.ISelectionModel;
> 	import org.apache.royale.core.IStrand;
> +	import org.apache.royale.core.IStrandWithModelView;
> 	import org.apache.royale.core.SimpleCSSStyles;
> 	import org.apache.royale.core.UIBase;
> 	import org.apache.royale.events.CollectionEvent;
> @@ -130,11 +131,10 @@ package org.apache.royale.jewel.beads.itemRenderers
>             fillRenderer(event.index, event.item, ir, presentationModel);
> 			
> 			// update the index values in the itemRenderers to correspond to their shifted positions.
> -			var dataGroup:UIBase = itemRendererParent as UIBase;
> -			var n:int = dataGroup.numElements;
> +			var n:int = itemRendererParent.numItemRenderers;
> 			for (var i:int = event.index; i < n; i++)
> 			{
> -				ir = dataGroup.getElementAt(i) as ISelectableItemRenderer;
> +				ir = itemRendererParent.getItemRendererAt(i) as ISelectableItemRenderer;
> 				ir.index = i;
> 			}
> 
> @@ -174,8 +174,8 @@ package org.apache.royale.jewel.beads.itemRenderers
> 		public function get itemRendererParent():IItemRendererParent
> 		{
> 			if (_itemRendererParent == null) {
> -				var listView:IListView = _strand.getBeadByType(IListView) as IListView;
> -				_itemRendererParent = listView.dataGroup;
> +				var view:IListView = (_strand as IStrandWithModelView).view as IListView;
> +				_itemRendererParent = view.dataGroup;
> 			}
> 			return _itemRendererParent;
> 		}
> diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/RemoveListItemRendererForArrayListData.as
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/RemoveListItemRendererForArrayListData.as
> index 10f8b4e..98aa953 100644
> --- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/RemoveListItemRendererForArrayListData.as
> +++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/RemoveListItemRendererForArrayListData.as
> @@ -24,6 +24,7 @@ package org.apache.royale.jewel.beads.itemRenderers
> 	import org.apache.royale.core.ISelectableItemRenderer;
> 	import org.apache.royale.core.ISelectionModel;
> 	import org.apache.royale.core.IStrand;
> +	import org.apache.royale.core.IStrandWithModelView;
> 	import org.apache.royale.core.UIBase;
> 	import org.apache.royale.events.CollectionEvent;
> 	import org.apache.royale.events.Event;
> @@ -116,15 +117,14 @@ package org.apache.royale.jewel.beads.itemRenderers
> 		 */
> 		protected function handleItemRemoved(event:CollectionEvent):void
> 		{
> -			var parent:UIBase = itemRendererParent as UIBase;
> -			var ir:ISelectableItemRenderer = parent.getElementAt(event.index) as ISelectableItemRenderer;
> +			var ir:ISelectableItemRenderer = itemRendererParent.getItemRendererAt(event.index)
as ISelectableItemRenderer;
> 			itemRendererParent.removeItemRenderer(ir);
> 			
> 			// adjust the itemRenderers' index to adjust for the shift
> -			var n:int = parent.numElements;
> +			var n:int = itemRendererParent.numItemRenderers;
> 			for (var i:int = event.index; i < n; i++)
> 			{
> -				ir = parent.getElementAt(i) as ISelectableItemRenderer;
> +				ir = itemRendererParent.getItemRendererAt(i) as ISelectableItemRenderer;
> 				ir.index = i;
> 			}
> 
> @@ -164,8 +164,8 @@ package org.apache.royale.jewel.beads.itemRenderers
> 		public function get itemRendererParent():IItemRendererParent
> 		{
> 			if (_itemRendererParent == null) {
> -				var listView:IListView = _strand.getBeadByType(IListView) as IListView;
> -				_itemRendererParent = listView.dataGroup;
> +				var view:IListView = (_strand as IStrandWithModelView).view as IListView;
> +				_itemRendererParent = view.dataGroup;
> 			}
> 			return _itemRendererParent;
> 		}
> 


Mime
View raw message