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 2019/12/27 18:34:19 UTC

[royale-asjs] branch develop updated: jewel-itemrenders: make itemrenderers accept emphasis from the strand and show in TDJ example

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 69788ba  jewel-itemrenders: make itemrenderers accept emphasis from the strand and show in TDJ example
69788ba is described below

commit 69788ba5464e64798e2ae0266dbb55528c8fd825
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Fri Dec 27 19:34:09 2019 +0100

    jewel-itemrenders: make itemrenderers accept emphasis from the strand and show in TDJ example
---
 .../src/main/royale/ListPlayGround.mxml            |  2 +-
 .../apache/royale/core/StyledMXMLItemRenderer.as   | 23 ++++++++++++++++++++++
 .../royale/jewel/itemRenderers/ListItemRenderer.as |  1 -
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/examples/royale/TourDeJewel/src/main/royale/ListPlayGround.mxml b/examples/royale/TourDeJewel/src/main/royale/ListPlayGround.mxml
index 501fc02..d10633f 100644
--- a/examples/royale/TourDeJewel/src/main/royale/ListPlayGround.mxml
+++ b/examples/royale/TourDeJewel/src/main/royale/ListPlayGround.mxml
@@ -164,7 +164,7 @@ limitations under the License.
 				<html:H3 text="Jewel List With ItemRenderer"/>
 				<j:HGroup gap="3">
 					<j:VGroup gap="3">
-						<j:List id="iconList" width="200" height="300" className="iconListItemRenderer" labelField="label">
+						<j:List localId="iconList" emphasis="secondary" width="200" height="300" className="iconListItemRenderer" labelField="label">
 							<j:beads>
 								<js:ConstantBinding sourceID="listModel" sourcePropertyName="iconListData" destinationPropertyName="dataProvider" />
 								<j:AddListItemRendererForArrayListData/>
diff --git a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/StyledMXMLItemRenderer.as b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/StyledMXMLItemRenderer.as
index 3a954b1..9959ad0 100644
--- a/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/StyledMXMLItemRenderer.as
+++ b/frameworks/projects/Basic/src/main/royale/org/apache/royale/core/StyledMXMLItemRenderer.as
@@ -217,5 +217,28 @@ package org.apache.royale.core
                 toggleClass(_emphasis, value);
             }
         }
+
+        /**
+		 *  The method called when added to a parent. The StyledItemRenderer class uses
+		 *  this opportunity to assign emphasis from the strand if possible, otherwise defaults
+		 *  to PRIMARY.
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 10.2
+		 *  @playerversion AIR 2.6
+		 *  @productversion Royale 0.9.7
+		 */
+		override public function addedToParent():void
+		{
+			super.addedToParent();
+			
+			if (itemRendererParent.host is IEmphasis && (itemRendererParent.host as IEmphasis).emphasis)
+			{
+				emphasis = (itemRendererParent.host as IEmphasis).emphasis;
+			} else
+			{
+				emphasis = "primary";
+			}
+		}
 	}
 }
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/ListItemRenderer.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/ListItemRenderer.as
index b6fd37f..23b2d7e 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/ListItemRenderer.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/itemRenderers/ListItemRenderer.as
@@ -53,7 +53,6 @@ package org.apache.royale.jewel.itemRenderers
 			super();
 
 			typeNames = "jewel item";
-			emphasis = "primary";
 			addClass("selectable");
 
 			if(MXMLDescriptor != null)