royale-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject [royale-asjs] branch feature/revert-refactor updated: Fixed getLabelFromData
Date Fri, 01 Jun 2018 10:03:46 GMT
This is an automated email from the ASF dual-hosted git repository.

harbs pushed a commit to branch feature/revert-refactor
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/feature/revert-refactor by this push:
     new de6b7ee  Fixed getLabelFromData
de6b7ee is described below

commit de6b7ee6ea804589c81d4e04fbd926fe2e4aa0bf
Author: Harbs <harbs@in-tools.com>
AuthorDate: Fri Jun 1 13:03:12 2018 +0300

    Fixed getLabelFromData
---
 .../main/royale/org/apache/royale/html/beads/ComboBoxView.as |  2 +-
 .../royale/html/supportClasses/CascadingMenuItemRenderer.as  |  2 +-
 .../apache/royale/html/supportClasses/MenuBarItemRenderer.as |  2 +-
 .../apache/royale/html/supportClasses/MenuItemRenderer.as    |  2 +-
 .../apache/royale/html/supportClasses/StringItemRenderer.as  |  2 +-
 .../royale/html/supportClasses/TextButtonItemRenderer.as     |  2 +-
 .../apache/royale/html/supportClasses/TreeItemRenderer.as    |  4 ++--
 .../royale/org/apache/royale/html/util/getLabelFromData.as   | 12 ++++--------
 8 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/ComboBoxView.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/ComboBoxView.as
index 97af6fb..4b983fe 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/ComboBoxView.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/beads/ComboBoxView.as
@@ -223,7 +223,7 @@ package org.apache.royale.html.beads
 		protected function itemChangeAction():void
 		{
 			var model:IComboBoxModel = _strand.getBeadByType(IComboBoxModel) as IComboBoxModel;
-			input.text = getLabelFromData(model.selectedItem);
+			input.text = getLabelFromData(model,model.selectedItem);
 		}
 		
 		/**
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/CascadingMenuItemRenderer.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/CascadingMenuItemRenderer.as
index 7cf3b7d..5def7a8 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/CascadingMenuItemRenderer.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/CascadingMenuItemRenderer.as
@@ -101,7 +101,7 @@ package org.apache.royale.html.supportClasses
 					addElement(label);
 				}
 				
-				label.text = getLabelFromData(value);
+				label.text = getLabelFromData(this,value);
 				
 				if (value.hasOwnProperty("menu")) {
 					if (submenuIndicator == null) {
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/MenuBarItemRenderer.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/MenuBarItemRenderer.as
index 67ac760..eddc6a2 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/MenuBarItemRenderer.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/MenuBarItemRenderer.as
@@ -45,7 +45,7 @@ package org.apache.royale.html.supportClasses
 		{
 			super.data = value;
 			
-			label.text = getLabelFromData(value);
+			label.text = getLabelFromData(this,value);
 			
 			adjustSize();
 		}
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/MenuItemRenderer.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/MenuItemRenderer.as
index 466b6dd..1a69f35 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/MenuItemRenderer.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/MenuItemRenderer.as
@@ -75,7 +75,7 @@ package org.apache.royale.html.supportClasses
 		{
 			super.data = value;
 			
-			label.text = getLabelFromData(value);
+			label.text = getLabelFromData(this,value);
 		}
 		
 		/**
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/StringItemRenderer.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/StringItemRenderer.as
index bdb5a23..6bef769 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/StringItemRenderer.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/StringItemRenderer.as
@@ -147,7 +147,7 @@ package org.apache.royale.html.supportClasses
 		{
 			super.data = value;
             var text:String;
-            this.text = getLabelFromData(value);
+            this.text = getLabelFromData(this,value);
 		}
 
         // COMPILE::JS
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TextButtonItemRenderer.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TextButtonItemRenderer.as
index 524d28e..1b599eb 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TextButtonItemRenderer.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TextButtonItemRenderer.as
@@ -85,7 +85,7 @@ package org.apache.royale.html.supportClasses
 			var valueAsString:String;
 
 			if (data == null) return;
-			valueAsString = getLabelFromData(data);
+			valueAsString = getLabelFromData(this,data);
 			if (!valueAsString && data.hasOwnProperty("title")) {
 				valueAsString = "" + data["title"];
 			}
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeItemRenderer.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeItemRenderer.as
index 8065c54..b232655 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeItemRenderer.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/supportClasses/TreeItemRenderer.as
@@ -51,8 +51,8 @@ package org.apache.royale.html.supportClasses
 			var extraSpace:String = " ";
 			
 			COMPILE::JS {
-				indentSpace = "&nbsp;&nbsp;&nbsp;&nbsp;";
-				extraSpace = "&nbsp;";
+				indentSpace = "\u00a0\u00a0\u00a0\u00a0";
+				extraSpace = "\u00a0";
 			}
 				
 			var indent:String = "";
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/util/getLabelFromData.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/util/getLabelFromData.as
index f48b98c..617a483 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/util/getLabelFromData.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/html/util/getLabelFromData.as
@@ -26,21 +26,17 @@ package org.apache.royale.html.util
 	 *  @productversion Royale 0.9.3
      * Utility function to get a label string from a value object
      */
-    public function getLabelFromData(data:Object):String
+    public function getLabelFromData(obj:Object,data:Object):String
     {
         // slightly more code, but we bail early if it's a string which is often
         if (data is String) return "" + data;
         if(!data) return "";
 
-        if (ownsProperty("labelField")) return "" + data[data["labelField"]];
-        if (ownsProperty("dataField")) return "" + data[data["dataField"]];
-        if (ownsProperty("label")) return "" + data["label"];
+        if (obj["labelField"]) return "" + data[obj["labelField"]];
+        if (obj["dataField"]) return "" + data[obj["dataField"]];
+        if (data.hasOwnProperty("label")) return "" + data["label"];
 
         return "" + data;
-        // a little less code with this function
-        function ownsProperty(val:String):Boolean{
-            return data.hasOwnProperty(val);
-        }
 
     }
 }

-- 
To stop receiving notification emails like this one, please contact
harbs@apache.org.

Mime
View raw message