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

pent 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 a16476d  Improved ListExample.
a16476d is described below

commit a16476d120965ab3f9c3a5b3ebefbbbb0dd44b3b
Author: Peter Ent <[email protected]>
AuthorDate: Sun Jan 21 09:01:03 2018 -0500

    Improved ListExample.
---
 .../ListExample/src/main/royale/MyInitialView.mxml | 74 +++++++++++++---------
 .../src/main/royale/models/ProductsModel.as        |  2 +
 2 files changed, 47 insertions(+), 29 deletions(-)

diff --git a/examples/royale/ListExample/src/main/royale/MyInitialView.mxml 
b/examples/royale/ListExample/src/main/royale/MyInitialView.mxml
index 872b0af..2a97d31 100644
--- a/examples/royale/ListExample/src/main/royale/MyInitialView.mxml
+++ b/examples/royale/ListExample/src/main/royale/MyInitialView.mxml
@@ -18,28 +18,30 @@ limitations under the License.
 
 -->
 <js:View xmlns:fx="http://ns.adobe.com/mxml/2009";
-                               xmlns:js="library://ns.apache.org/royale/basic"
-                               xmlns:gen="simple.*">
-       <fx:Style>
+                xmlns:js="library://ns.apache.org/royale/basic"
+                xmlns:gen="simple.*">
+               <fx:Style>
                @namespace gen "simple.*";
                @namespace js "library://ns.apache.org/royale/basic";
                
+               js|StringItemRenderer {
+                       height: 30px;
+               }
+               
                .GenericList {
                        IBeadView: ClassReference("simple.GenericListView");
-                       IBeadModel: 
ClassReference("org.apache.royale.html.beads.models.ArraySelectionModel");
+                       IBeadModel: 
ClassReference("org.apache.royale.html.beads.models.SingleSelectionCollectionViewModel");
                        IBeadLayout: 
ClassReference("org.apache.royale.html.beads.layouts.VerticalLayout");
                        IDataProviderItemRendererMapper: 
ClassReference("simple.IRFactoryForArrayData");
                        IItemRendererClassFactory: 
ClassReference("org.apache.royale.core.ItemRendererClassFactory");
                        IItemRenderer: 
ClassReference("org.apache.royale.html.supportClasses.StringItemRenderer");     
         
-                       IBeadController: 
ClassReference("org.apache.royale.html.beads.controllers.ListSingleSelectionMouseController");
                 
+                       IBeadController: 
ClassReference("org.apache.royale.html.beads.controllers.ListSingleSelectionMouseController");
 
+                       IViewport: 
ClassReference("org.apache.royale.html.supportClasses.ScrollingViewport");
+                       IViewportModel: 
ClassReference("org.apache.royale.html.beads.models.ViewportModel");            
                        
                        overflow: auto;
                        border: 1px solid #CCCCCC;
                }
-               
-               js|StringItemRenderer {
-                       height: 30px;
-               }
        </fx:Style>
        
        <fx:Script>
@@ -56,48 +58,62 @@ limitations under the License.
                                (applicationModel as 
ProductsModel).states.removeItemAt(2);
                        }
                        
-                       private function addFuzzies():void
+                       private function addProduct():void
                        {
-                               (applicationModel as 
ProductsModel).productNames.addItemAt("Fuzzies", 2);
+                               (applicationModel as 
ProductsModel).productNames.addItemAt("Wing Bats", 2);
                        }
                ]]>
        </fx:Script>
-
-       <js:Label x="20" y="20" text="A Royale List" />
        
-       <js:List id="list" x="20" y="40" width="400" height="300">
+       <!-- Static list using an Array -->
+       
+       <js:Label x="20" y="20" text="A static List" />
+       
+       <js:List id="list" x="20" y="40" width="200" height="300">
+               <js:beads>
+                       <js:ConstantBinding
+                               sourceID="applicationModel"
+                               sourcePropertyName="simple"
+                               destinationPropertyName="dataProvider" />
+               </js:beads>
+       </js:List>
+       
+       <!-- Dynamic list using an ArrayList and responding to additions and
+       deletions. The DynamicList CSS style class is defined in the
+       Royale SDK.
+       -->
+       
+       <js:Label x="300" y="20" text="A dynamic List" />
+       
+       <js:List x="300" y="40" width="200" height="300" 
className="DynamicList">
                <js:beads>
                        <js:ConstantBinding
                                sourceID="applicationModel"
                                sourcePropertyName="states"
                                destinationPropertyName="dataProvider" />
-                       <!-- Use this dynamic itemRenderer factory when the 
data is an ArrayList and
-                            you want to insert items programmatically. -->
-                       <js:DynamicItemsRendererFactoryForArrayListData />
-                       <!-- If you need to dynamically remove items from the 
ArrayList, include this
-                            bead which removes the corresponding itemRenderer. 
-->
-                       <js:DynamicRemoveItemRendererForArrayListData />
                </js:beads>
        </js:List>
        
-       <js:TextButton text="Add New Jersey" x="20" y="350" click="addState()" 
/>
-       <js:TextButton text="Remove Item 0" x="200" y="350" 
click="removeState()" />
-
+       <js:TextButton text="Add New Jersey" x="300" y="350" click="addState()" 
/>
+       <js:TextButton text="Remove New Jersey" x="300" y="380" 
click="removeState()" />
        
-       <js:Label x="500" y="20" text="A local list using DataContainer" />
-               
-       <gen:GenericList x="500" y="40" width="400" height="300" 
className="GenericList">
+       <!-- A custom list built from DataContainer.
+       -->
+       
+       <js:Label x="580" y="20" text="A custom List" />
+       
+       <gen:GenericList x="580" y="40" width="200" height="300" 
className="GenericList">
                <gen:beads>
                        <js:ConstantBinding
                                sourceID="applicationModel"
                                sourcePropertyName="productNames"
                                destinationPropertyName="dataProvider" />
                        <!-- you also add this itemRendererFactory if your 
DataContainer list
-                            is using an ArrayList as its dataProvider -->
+                       is using an ArrayList as its dataProvider -->
                        <js:DynamicItemsRendererFactoryForArrayListData />
                </gen:beads>
        </gen:GenericList>
        
-       <js:TextButton text="Add Fuzzies" x="500" y="350" click="addFuzzies()" 
/>
-
+       <js:TextButton text="Add Wing Bats" x="580" y="350" 
click="addProduct()" />
+       
 </js:View>
diff --git 
a/examples/royale/ListExample/src/main/royale/models/ProductsModel.as 
b/examples/royale/ListExample/src/main/royale/models/ProductsModel.as
index 7fb4606..7ae33ca 100644
--- a/examples/royale/ListExample/src/main/royale/models/ProductsModel.as
+++ b/examples/royale/ListExample/src/main/royale/models/ProductsModel.as
@@ -31,6 +31,8 @@ package models
                        return _productNames;
                }
                
+               public var simple:Array = ["Blueberries", "Bananas", "Lemons", 
"Oranges", "Watermelons"];
+               
                private var _states:ArrayList = new ArrayList([
                                "Massachusetts", "Vermont", "New Hampshire", 
"Maine", "Rhode Island", "Conneticutt"]);
                

-- 
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].

Reply via email to