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/11/22 12:33:50 UTC

[royale-asjs] branch develop updated: jewel-searchfilterforlist: refactor presentationModel to a getter

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 a89c78c  jewel-searchfilterforlist: refactor presentationModel to a getter
a89c78c is described below

commit a89c78c3b76ca6172d4bcb10f782d23ab98ae177
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sun Nov 22 13:33:41 2020 +0100

    jewel-searchfilterforlist: refactor presentationModel to a getter
---
 .../royale/jewel/beads/controls/textinput/SearchFilterForList.as | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/SearchFilterForList.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/SearchFilterForList.as
index 7276974..66ca0bd 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/SearchFilterForList.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/textinput/SearchFilterForList.as
@@ -144,6 +144,10 @@ package org.apache.royale.jewel.beads.controls.textinput
 				sendEvent(list, 'change');
 			}
 		}
+
+		protected function get presentationModel():IListPresentationModel {
+			return list.presentationModel as IListPresentationModel;
+		}
 		
 		/**
 		 *  Ensures that the data provider item at the given index is visible.
@@ -166,9 +170,8 @@ package org.apache.royale.jewel.beads.controls.textinput
 			var oldScroll:Number = scrollArea.scrollTop;
 
 			var totalHeight:Number = 0;
-			var pm:IListPresentationModel = list.getBeadByType(IListPresentationModel) as IListPresentationModel;
 			
-			if(pm.variableRowHeight)
+			if(presentationModel.variableRowHeight)
 			{
 				//each item render can have its own height
 				var n:int = _visibleIndexes.length;
@@ -182,7 +185,7 @@ package org.apache.royale.jewel.beads.controls.textinput
 			{
 				var rowHeight:Number;
 				// all items renderers with same height
-				rowHeight = isNaN(pm.rowHeight) ? ListPresentationModel.DEFAULT_ROW_HEIGHT : pm.rowHeight;
+				rowHeight = isNaN(presentationModel.rowHeight) ? ListPresentationModel.DEFAULT_ROW_HEIGHT : presentationModel.rowHeight;
 				totalHeight = _visibleIndexes.length * rowHeight - scrollArea.clientHeight;
 				
 				scrollArea.scrollTop = Math.min(index * rowHeight, totalHeight);