You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by pi...@apache.org on 2020/12/15 07:55:33 UTC

[royale-asjs] branch develop updated: SparkRoyale: Improve handle itemRendererFunction in DataGroup - Implement some sort of working label property in ItemRenderer

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

piotrz 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 3cfd8aa  SparkRoyale: Improve handle itemRendererFunction in DataGroup - Implement some sort of working label property in ItemRenderer
3cfd8aa is described below

commit 3cfd8aa4db48b0ded5527cb0ebf8d3125a87b895
Author: pzarzycki <pi...@wipro.com>
AuthorDate: Tue Dec 15 07:55:16 2020 +0000

    SparkRoyale: Improve handle itemRendererFunction in DataGroup
    - Implement some sort of working label property in ItemRenderer
---
 .../src/main/royale/spark/components/DataGroup.as  | 23 ++++++++++--------
 .../components/supportClasses/ItemRenderer.as      | 27 +++++++++++-----------
 2 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/DataGroup.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/DataGroup.as
index b5ffa41..b920669 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/DataGroup.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/DataGroup.as
@@ -556,8 +556,13 @@ public class DataGroup extends GroupBase implements IItemRendererProvider, IStra
      */
     public function get itemRendererFunction():Function // not implemeneted
     {
-        //return _itemRendererFunction;
-	return null;
+        var itemRendererFunctionBead:ItemRendererFunctionBead = getBeadByType(ItemRendererFunctionBead) as ItemRendererFunctionBead;
+	    if (itemRendererFunctionBead)
+        {
+            return itemRendererFunctionBead.itemRendererFunction;
+        }
+
+        return null;
     }
     
     /**
@@ -565,13 +570,13 @@ public class DataGroup extends GroupBase implements IItemRendererProvider, IStra
      */
     public function set itemRendererFunction(value:Function):void
     {
-	var itemRendererFunctionBead:ItemRendererFunctionBead = getBeadByType(ItemRendererFunctionBead) as ItemRendererFunctionBead;
-	if (!itemRendererFunctionBead)
-	{
-		itemRendererFunctionBead = new ItemRendererFunctionBead();
-		addBead(itemRendererFunctionBead);
-	}
-	itemRendererFunctionBead.itemRendererFunction = value;
+        var itemRendererFunctionBead:ItemRendererFunctionBead = getBeadByType(ItemRendererFunctionBead) as ItemRendererFunctionBead;
+        if (!itemRendererFunctionBead)
+        {
+            itemRendererFunctionBead = new ItemRendererFunctionBead();
+            addBead(itemRendererFunctionBead);
+        }
+        itemRendererFunctionBead.itemRendererFunction = value;
     }
 
     //----------------------------------
diff --git a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/ItemRenderer.as b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/ItemRenderer.as
index f599776..eb34517 100644
--- a/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/ItemRenderer.as
+++ b/frameworks/projects/SparkRoyale/src/main/royale/spark/components/supportClasses/ItemRenderer.as
@@ -610,12 +610,6 @@ public class ItemRenderer extends DataRenderer implements IItemRenderer
             //invalidateRendererState();
         }
     }
-    
-    // not implemented
-    public function get label():String {return "label"} 
-
-    // not implemented
-    public function set label(value:String):void {}
 
     //----------------------------------
     //  label
@@ -625,9 +619,9 @@ public class ItemRenderer extends DataRenderer implements IItemRenderer
      *  @private 
      *  Storage var for label
      */ 
-   /*  private var _label:String = "";
+     private var _label:String = "";
     
-    [Bindable("labelChanged")] */
+    [Bindable("labelChanged")]
     
     /**
      *  @inheritDoc 
@@ -639,15 +633,15 @@ public class ItemRenderer extends DataRenderer implements IItemRenderer
      *  @playerversion AIR 1.5
      *  @productversion Royale 0.9.4
      */
-    /* public function get label():String
+    public function get label():String
     {
         return _label;
-    } */
+    }
     
     /**
      *  @private
      */ 
-    /* public function set label(value:String):void
+     public function set label(value:String):void
     {
         if (value == _label)
             return;
@@ -656,11 +650,16 @@ public class ItemRenderer extends DataRenderer implements IItemRenderer
             
         // Push the label down into the labelDisplay,
         // if it exists
-        if (labelDisplay)
-            labelDisplay.text = _label;
+        COMPILE::JS
+        {
+            if (this.element) {
+                //labelDisplay.text = _label;
+                this.element.textContent = value;
+            }
+        }
         
         dispatchEvent(new Event("labelChanged"));
-    } */
+    }
     
     //--------------------------------------------------------------------------
     //