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/02/06 17:16:29 UTC

[royale-asjs] branch develop updated: jewel: Add VirtualComboBox for combos that need performance in the popup list recycling renderers

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 7dcc0f8  jewel: Add VirtualComboBox for combos that need performance in the popup list recycling renderers
7dcc0f8 is described below

commit 7dcc0f8e847e266b36977fa877ead5ff9ea42244
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Thu Feb 6 18:16:18 2020 +0100

    jewel: Add VirtualComboBox for combos that need performance in the popup list recycling renderers
---
 .../projects/Jewel/src/main/resources/defaults.css |  8 +++
 .../Jewel/src/main/resources/jewel-manifest.xml    |  2 +
 .../projects/Jewel/src/main/royale/JewelClasses.as |  1 +
 .../org/apache/royale/jewel/VirtualComboBox.as     | 56 +++++++++++++++
 .../jewel/beads/views/VirtualComboBoxPopUpView.as  | 83 ++++++++++++++++++++++
 .../combobox/VirtualComboBoxPopUp.as               | 45 ++++++++++++
 .../Jewel/src/main/sass/components/_combobox.sass  |  8 ++-
 7 files changed, 202 insertions(+), 1 deletion(-)

diff --git a/frameworks/projects/Jewel/src/main/resources/defaults.css b/frameworks/projects/Jewel/src/main/resources/defaults.css
index 6c77471..67af3ed 100644
--- a/frameworks/projects/Jewel/src/main/resources/defaults.css
+++ b/frameworks/projects/Jewel/src/main/resources/defaults.css
@@ -484,6 +484,14 @@ j|ComboBoxPopUp {
   IBeadView: ClassReference("org.apache.royale.jewel.beads.views.ComboBoxPopUpView");
 }
 
+j|VirtualComboBox {
+  IPopUp: ClassReference("org.apache.royale.jewel.supportClasses.combobox.ComboBoxPopUp");
+}
+
+j|VirtualComboBoxPopUp {
+  IBeadView: ClassReference("org.apache.royale.jewel.beads.views.VirtualComboBoxPopUpView");
+}
+
 .jewel.datagrid {
   display: flex;
   position: relative;
diff --git a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
index e57b809..e5e11b7 100644
--- a/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
+++ b/frameworks/projects/Jewel/src/main/resources/jewel-manifest.xml
@@ -75,6 +75,8 @@
     <component id="DropDownList" class="org.apache.royale.jewel.DropDownList"/>
     <component id="ComboBox" class="org.apache.royale.jewel.ComboBox"/>
     <component id="ComboBoxPopUp" class="org.apache.royale.jewel.supportClasses.combobox.ComboBoxPopUp"/>
+    <component id="VirtualComboBox" class="org.apache.royale.jewel.VirtualComboBox"/>
+    <component id="VirtualComboBoxPopUp" class="org.apache.royale.jewel.supportClasses.combobox.VirtualComboBoxPopUp"/>
     <component id="Spacer" class="org.apache.royale.jewel.Spacer"/>
     <component id="DateChooser" class="org.apache.royale.jewel.DateChooser"/>
     <component id="DateField" class="org.apache.royale.jewel.DateField"/>
diff --git a/frameworks/projects/Jewel/src/main/royale/JewelClasses.as b/frameworks/projects/Jewel/src/main/royale/JewelClasses.as
index c1aa33b..59b8eec 100644
--- a/frameworks/projects/Jewel/src/main/royale/JewelClasses.as
+++ b/frameworks/projects/Jewel/src/main/royale/JewelClasses.as
@@ -75,6 +75,7 @@ package
         import org.apache.royale.jewel.beads.views.TableView; TableView;
         import org.apache.royale.jewel.beads.views.ComboBoxView; ComboBoxView;
         import org.apache.royale.jewel.beads.views.ComboBoxPopUpView; ComboBoxPopUpView;
+        import org.apache.royale.jewel.beads.views.VirtualComboBoxPopUpView; VirtualComboBoxPopUpView;
 		import org.apache.royale.jewel.beads.views.SnackbarView; SnackbarView;
         import org.apache.royale.jewel.beads.views.FormItemView; FormItemView;
         import org.apache.royale.jewel.beads.views.FormHeadingView; FormHeadingView;
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/VirtualComboBox.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/VirtualComboBox.as
new file mode 100644
index 0000000..0c309a3
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/VirtualComboBox.as
@@ -0,0 +1,56 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 org.apache.royale.jewel
+{
+	/**
+	 *  The VirtualComboBox class is a component that displays an input field and
+	 *  pop-up VirtualList with selections. Selecting an item from the pop-up List
+	 *  places that item into the input field of the ComboBox.
+	 *  
+	 *  This component should be used when data provider has several items for performance
+	 *  improvements
+	 * 
+	 *  The ComboBox uses the following bead types:
+	 *
+	 *  org.apache.royale.core.IBeadModel: the data model, which includes the dataProvider, selectedItem, and
+	 *  so forth.
+	 *  org.apache.royale.core.IBeadView:  the bead that constructs the visual parts of the component.
+	 *  org.apache.royale.core.IBeadController: the bead that handles input and output.
+	 *
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9.7
+	 */
+	public class VirtualComboBox extends ComboBox
+	{
+		/**
+		 *  constructor.
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.7
+		 */
+		public function VirtualComboBox()
+		{
+			super();
+		}
+   	}
+}
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/VirtualComboBoxPopUpView.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/VirtualComboBoxPopUpView.as
new file mode 100644
index 0000000..fc3a70f
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/VirtualComboBoxPopUpView.as
@@ -0,0 +1,83 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 org.apache.royale.jewel.beads.views
+{
+    import org.apache.royale.core.BeadViewBase;
+    import org.apache.royale.core.IBeadModel;
+    import org.apache.royale.core.IParent;
+    import org.apache.royale.core.IStrand;
+    import org.apache.royale.jewel.VirtualList;
+
+    /**
+	 *  The VirtualComboBoxPopUpView class is a view bead for the VirtualComboBoxPopUp.
+     * 
+     *  This class creates a VirtualList that will be pop up when the combo box needs
+     *  to show the associated list
+     * 
+	 *  @viewbead	 
+	 */
+	public class VirtualComboBoxPopUpView extends BeadViewBase
+	{
+		/**
+		 *  constructor
+		 *
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.7
+		 */
+		public function VirtualComboBoxPopUpView()
+		{
+			super();
+		}
+        
+        /**
+         *  Get the strand for this bead
+         * 
+         *  @copy org.apache.royale.core.IBead#strand
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion Royale 0.9.7
+         */
+        override public function set strand(value:IStrand):void
+		{
+            _strand = value;
+            
+            var model:IBeadModel = _strand.getBeadByType(IBeadModel) as IBeadModel;
+
+            _list = new VirtualList();
+            _list.model = model;
+            
+            IParent(_strand).addElement(_list);
+		}
+
+        private var _list:VirtualList;
+
+        public function get list():VirtualList
+        {
+        	return _list;
+        }
+        public function set list(value:VirtualList):void
+        {
+        	_list = value;
+        }
+    }
+}
\ No newline at end of file
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/combobox/VirtualComboBoxPopUp.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/combobox/VirtualComboBoxPopUp.as
new file mode 100644
index 0000000..d8ef164
--- /dev/null
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/supportClasses/combobox/VirtualComboBoxPopUp.as
@@ -0,0 +1,45 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 org.apache.royale.jewel.supportClasses.combobox
+{
+	/**
+	 *  The VirtualComboBoxPopUp class is the popup that holds the VirtualList used internally
+	 *  by VirtualComboBox as the dropdown/popup.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 10.2
+	 *  @playerversion AIR 2.6
+	 *  @productversion Royale 0.9.7
+	 */
+	public class VirtualComboBoxPopUp extends ComboBoxPopUp
+	{
+		/**
+		 *  Constructor.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.7
+		 */
+		public function VirtualComboBoxPopUp()
+		{
+			super();
+		}
+	}
+}
diff --git a/frameworks/projects/Jewel/src/main/sass/components/_combobox.sass b/frameworks/projects/Jewel/src/main/sass/components/_combobox.sass
index eaa8653..28f735d 100644
--- a/frameworks/projects/Jewel/src/main/sass/components/_combobox.sass
+++ b/frameworks/projects/Jewel/src/main/sass/components/_combobox.sass
@@ -169,4 +169,10 @@ j|ComboBoxPopUp
 // @media -royale-swf
 //     j|ComboBoxPopUp
 //         IBackgroundBead: ClassReference('org.apache.royale.html.beads.SolidBackgroundBead')
-	
\ No newline at end of file
+
+j|VirtualComboBox
+    IPopUp: ClassReference("org.apache.royale.jewel.supportClasses.combobox.ComboBoxPopUp")
+
+// this is a StyledUIBase with a List inside
+j|VirtualComboBoxPopUp
+    IBeadView: ClassReference("org.apache.royale.jewel.beads.views.VirtualComboBoxPopUpView")
\ No newline at end of file