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/03/05 11:11:57 UTC

[royale-asjs] branch develop updated: jewel-combobox: popup height should not be more than dp.length

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 9175a21  jewel-combobox: popup height should not be more than dp.length
9175a21 is described below

commit 9175a21d8c46a27974c2aadb2c32e5515501f7d8
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Thu Mar 5 12:11:45 2020 +0100

    jewel-combobox: popup height should not be more than dp.length
---
 .../royale/jewel/beads/views/ComboBoxPopUpView.as       | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ComboBoxPopUpView.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ComboBoxPopUpView.as
index 6f1a6d0..fe6bb19 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ComboBoxPopUpView.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ComboBoxPopUpView.as
@@ -20,15 +20,15 @@ package org.apache.royale.jewel.beads.views
 {
     import org.apache.royale.core.BeadViewBase;
     import org.apache.royale.core.ClassFactory;
-    import org.apache.royale.core.IBeadModel;
+    import org.apache.royale.core.IDataProviderModel;
     import org.apache.royale.core.IItemRendererClassFactory;
     import org.apache.royale.core.IParent;
     import org.apache.royale.core.IStrand;
     import org.apache.royale.core.ItemRendererClassFactory;
+    import org.apache.royale.events.Event;
     import org.apache.royale.jewel.List;
     import org.apache.royale.jewel.supportClasses.combobox.ComboBoxPopUp;
     import org.apache.royale.jewel.supportClasses.combobox.IComboBoxPresentationModel;
-    import org.apache.royale.events.Event;
     
     /**
 	 * The ComboBoxPopUpView class is a view bead for the ComboBoxPopUp.
@@ -70,7 +70,7 @@ package org.apache.royale.jewel.beads.views
             _strand = value;
 
             // set model
-            var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel;
+            var model:IDataProviderModel = _strand.getBeadByType(IDataProviderModel) as IDataProviderModel;
             list.model = model;
 
             // set rowHeight
@@ -79,6 +79,17 @@ package org.apache.royale.jewel.beads.views
 
             // set height based on rowCount
             var rowCount:int = _presentationModel.rowCount;
+            var len:int;
+
+            // if num records in dp is less than rowCount height should adapt the height
+            if(list.dataProvider)
+            {
+                len = list.dataProvider.length;
+
+                if(len < rowCount)
+                    rowCount = len;
+            }
+            
             list.height = rowCount * list.rowHeight;
 
             IParent(_strand).addElement(list);