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 2018/08/29 22:24:23 UTC

[royale-asjs] branch develop updated: change example data to an VO since in release mode binding doesn't work with normal object and data is showed as "undefined", strange since this works on js-debug mode

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 eb44c2f  change example data to an VO since in release mode binding doesn't work with normal object and data is showed as "undefined", strange since this works on js-debug mode
eb44c2f is described below

commit eb44c2f99e04edd471f72edbafc61471e6015d56
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Thu Aug 30 00:24:19 2018 +0200

    change example data to an VO since in release mode binding doesn't work with normal object and data is showed as "undefined", strange since this works on js-debug mode
---
 .../resources/jewel-example-index-template.html    |  2 +-
 .../src/main/royale/TablePlayGround.mxml           | 11 ++++---
 .../src/main/royale/models/TablesModel.as          | 17 ++++++-----
 .../src/main/royale/vos/GuitarristVO.as            | 35 ++++++++++++++++++++++
 .../royale/org/apache/royale/jewel/ComboBox.as     | 26 ++++++++--------
 .../royale/jewel/beads/views/ComboBoxView.as       | 16 +++++-----
 6 files changed, 71 insertions(+), 36 deletions(-)

diff --git a/examples/royale/JewelExample/src/main/resources/jewel-example-index-template.html b/examples/royale/JewelExample/src/main/resources/jewel-example-index-template.html
index 140ba98..764fe53 100644
--- a/examples/royale/JewelExample/src/main/resources/jewel-example-index-template.html
+++ b/examples/royale/JewelExample/src/main/resources/jewel-example-index-template.html
@@ -19,7 +19,7 @@
 <head>
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <meta name="Custom Template for injecting custom style CSS">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
     <link rel="stylesheet" type="text/css" href="${application}.css">
     <link href="https://fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet">
 ${head}
diff --git a/examples/royale/JewelExample/src/main/royale/TablePlayGround.mxml b/examples/royale/JewelExample/src/main/royale/TablePlayGround.mxml
index 0a4a2c8..b176061 100644
--- a/examples/royale/JewelExample/src/main/royale/TablePlayGround.mxml
+++ b/examples/royale/JewelExample/src/main/royale/TablePlayGround.mxml
@@ -223,7 +223,7 @@ limitations under the License.
 	<fx:Script>
 		<![CDATA[
 			import org.apache.royale.collections.ArrayList;
-
+			import vos.GuitarristVO;
 
 			private function onChange(event:Event):void {
                 selected.text = "Selected: " + table.selectedItemProperty;
@@ -232,11 +232,10 @@ limitations under the License.
 			private function changeTableData():void
 			{
 				table.dataProvider = new ArrayList([
-					{icon: MaterialIconType.CLOSE, guitarrist: "Ssi", album: "Paasadasdssion & Warfare", year: "1990"},
-					{icon: MaterialIconType.CLOSE, guitarrist: "Steve Morse", album: "Southern Steel", year: "1991"},
-					{icon: MaterialIconType.CLOSE, guitarrist: "Yngwie Malmsteen", album: "sfsdf Force", year: "2984"},
-					{icon: MaterialIconType.CLOSE, guitarrist: "Joe sf", album: "Surfing With The Alien", year: "1987"},
-					{icon: MaterialIconType.CLOSE, guitarrist: "Mark Knopfler", album: "Local sf", year: "1983"}
+					new GuitarristVO("David Gilmour", "On an Island", 2006),
+					new GuitarristVO("Eric Clapton", "Journeyman", 1989),
+					new GuitarristVO("Frank Zappa", "Hot Rats", 1969),
+					new GuitarristVO("Jimi Hendrix", "Electric Ladyland", 1968)
 				]);
 			}
 
diff --git a/examples/royale/JewelExample/src/main/royale/models/TablesModel.as b/examples/royale/JewelExample/src/main/royale/models/TablesModel.as
index c77144f..b64e7e0 100644
--- a/examples/royale/JewelExample/src/main/royale/models/TablesModel.as
+++ b/examples/royale/JewelExample/src/main/royale/models/TablesModel.as
@@ -19,19 +19,20 @@
 package models
 {
 	import org.apache.royale.collections.ArrayList;
+	import vos.GuitarristVO;
 
 	[Bindable]
 	public class TablesModel 
 	{
 		private var _guitarrists:ArrayList = new ArrayList([
-			{icon: MaterialIconType.CLOSE, guitarrist: "Steve Vai", album: "Passion & Warfare", year: "1990"},
-			{icon: MaterialIconType.CLOSE, guitarrist: "Joe Satriani", album: "Surfing With The Alien", year: "1987"},
-			{icon: MaterialIconType.CLOSE, guitarrist: "Yngwie Malmsteen", album: "Rising Force", year: "1984"},
-			{icon: MaterialIconType.CLOSE, guitarrist: "Steve Morse", album: "Southern Steel", year: "1991"},
-			{icon: MaterialIconType.CLOSE, guitarrist: "Mark Knopfler", album: "Local Hero", year: "1983"},
-			{icon: MaterialIconType.CLOSE, guitarrist: "Eric Sardinas", album: "Treat Me Right", year: "1999"},
-			{icon: MaterialIconType.CLOSE, guitarrist: "Mike Oldfield", album: "Tubular Bells", year: "1973"},
-			{icon: MaterialIconType.CLOSE, guitarrist: "Van Halen", album: "1984", year: "1984"}
+			new GuitarristVO("Steve Vai", "Passion & Warfare", 1990),
+			new GuitarristVO("Joe Satriani", "Surfing With The Alien", 1987),
+			new GuitarristVO("Yngwie Malmsteen", "Rising Force", 1984),
+			new GuitarristVO("Steve Morse", "Southern Steel", 1991),
+			new GuitarristVO("Mark Knopfler", "Local Hero", 1983),
+			new GuitarristVO("Eric Sardinas", "Treat Me Right", 1999),
+			new GuitarristVO("Mike Oldfield", "Tubular Bells", 1973),
+			new GuitarristVO("Van Halen", "1984", 1984)
 		]);
 		
 		public function get guitarrists():ArrayList
diff --git a/examples/royale/JewelExample/src/main/royale/vos/GuitarristVO.as b/examples/royale/JewelExample/src/main/royale/vos/GuitarristVO.as
new file mode 100644
index 0000000..1648385
--- /dev/null
+++ b/examples/royale/JewelExample/src/main/royale/vos/GuitarristVO.as
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 vos
+{
+    [Bindable]
+    public class GuitarristVO
+    {
+        public var guitarrist:String;
+        public var album:String;
+        public var year:int;
+
+        public function GuitarristVO(guitarrist:String, album:String, year:int)
+        {
+            this.guitarrist = guitarrist;
+            this.album = album;
+            this.year = year;
+        }
+    }
+}
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ComboBox.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ComboBox.as
index caf12db..d639b3f 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ComboBox.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/ComboBox.as
@@ -72,9 +72,10 @@ package org.apache.royale.jewel
             
             typeNames = "jewel combobox";
 		}
-		
+
 		/**
-		 *  The data for display by the ComboBox.
+		 *  The name of field within the data used for display. Each item of the
+		 *  data should have a property with this name.
 		 *
 		 *  @langversion 3.0
 		 *  @playerversion Flash 10.2
@@ -82,21 +83,20 @@ package org.apache.royale.jewel
 		 *  @productversion Royale 0.9.4
 		 *  @royaleignorecoercion org.apache.royale.core.IDataProviderModel
 		 */
-		public function get dataProvider():Object
+		public function get labelField():String
 		{
-			return IDataProviderModel(model).dataProvider;
+			return IDataProviderModel(model).labelField;
 		}
 		/**
 		 * @royaleignorecoercion org.apache.royale.core.IDataProviderModel
 		 */
-		public function set dataProvider(value:Object):void
+		public function set labelField(value:String):void
 		{
-			IDataProviderModel(model).dataProvider = value;
+            IDataProviderModel(model).labelField = value;
 		}
-
+		
 		/**
-		 *  The name of field within the data used for display. Each item of the
-		 *  data should have a property with this name.
+		 *  The data for display by the ComboBox.
 		 *
 		 *  @langversion 3.0
 		 *  @playerversion Flash 10.2
@@ -104,16 +104,16 @@ package org.apache.royale.jewel
 		 *  @productversion Royale 0.9.4
 		 *  @royaleignorecoercion org.apache.royale.core.IDataProviderModel
 		 */
-		public function get labelField():String
+		public function get dataProvider():Object
 		{
-			return IDataProviderModel(model).labelField;
+			return IDataProviderModel(model).dataProvider;
 		}
 		/**
 		 * @royaleignorecoercion org.apache.royale.core.IDataProviderModel
 		 */
-		public function set labelField(value:String):void
+		public function set dataProvider(value:Object):void
 		{
-            IDataProviderModel(model).labelField = value;
+			IDataProviderModel(model).dataProvider = value;
 		}
 		
         [Bindable("change")]
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ComboBoxView.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ComboBoxView.as
index ed3eed4..4e3e85b 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ComboBoxView.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/ComboBoxView.as
@@ -130,7 +130,7 @@ package org.apache.royale.jewel.beads.views
 			
 			// set initial value and positions using default sizes
 			itemChangeAction();
-			sizeChangeAction();
+			// sizeChangeAction();
 		}
 		
 		/**
@@ -178,10 +178,10 @@ package org.apache.royale.jewel.beads.views
 		/**
 		 * @private
 		 */
-		protected function handleSizeChange(event:Event):void
-		{
-			sizeChangeAction();
-		}
+		// protected function handleSizeChange(event:Event):void
+		// {
+		// 	sizeChangeAction();
+		// }
 		
 		/**
 		 * @private
@@ -207,8 +207,8 @@ package org.apache.royale.jewel.beads.views
 		 * @private
 		 * @royaleignorecoercion org.apache.royale.core.StyledUIBase
 		 */
-		protected function sizeChangeAction():void
-		{
+		// protected function sizeChangeAction():void
+		// {
 			//var host:StyledUIBase = StyledUIBase(_strand);
 			
 			// input.x = 0;
@@ -235,6 +235,6 @@ package org.apache.royale.jewel.beads.views
 			// if (host.isWidthSizedToContent()) {
 			// 	host.width = input.width + button.width;
 			// }
-		}
+		// }
 	}
 }