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/04/20 18:11:11 UTC

[royale-asjs] branch develop updated: jewel-assigtabcontent bead: tabbar must always have one selected content

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 ffcb4f1  jewel-assigtabcontent bead: tabbar must always have one selected content
ffcb4f1 is described below

commit ffcb4f13ea46eb88e2e64b364c16a9ba7cb3bd19
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Sat Apr 20 20:11:04 2019 +0200

    jewel-assigtabcontent bead: tabbar must always have one selected content
---
 .../Jewel/src/main/royale/org/apache/royale/jewel/TabBar.as       | 1 +
 .../apache/royale/jewel/beads/controls/tabbar/AssignTabContent.as | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/TabBar.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/TabBar.as
index 902cfe6..b8c4047 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/TabBar.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/TabBar.as
@@ -53,6 +53,7 @@ package org.apache.royale.jewel
 
             typeNames = "jewel tabbar";
 
+			//TabBar is always selected, so selectedIndex can't be -1, at least it will default to 0
 			ISelectionModel(model).selectedIndex = 0;
 
 			addEventListener(MouseEvent.CLICK, internalMouseHandler);
diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/tabbar/AssignTabContent.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/tabbar/AssignTabContent.as
index d4f134b..0b65227 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/tabbar/AssignTabContent.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/tabbar/AssignTabContent.as
@@ -25,6 +25,8 @@ package org.apache.royale.jewel.beads.controls.tabbar
 	import org.apache.royale.jewel.TabBarContent;
 	import org.apache.royale.core.IDataProviderModel;
 	
+	[DefaultProperty("content")]
+
 	/**
 	 *  The Disabled bead class is a specialty bead that can be used to disable a Jewel control.
 	 *  
@@ -72,12 +74,14 @@ package org.apache.royale.jewel.beads.controls.tabbar
 			if(tabbar)
 			{
 				tabbar.parent.addElement(content);
+				if(tabbar.dataProvider)
+					content.selectedContent = tabbar.selectedItem[selectedContentProperty];
 			}
 		}
 		
 		protected function selectionChangedChangeHandler(event:Event):void
 		{
-			if(content && tabbar.selectedIndex != -1)
+			if(content)
 			{
 				content.selectedContent = tabbar.selectedItem[selectedContentProperty];
 			}
@@ -110,7 +114,7 @@ package org.apache.royale.jewel.beads.controls.tabbar
 		
 		private var _selectedContentProperty:String;
         /**
-		 *  the property in the object that will be used to
+		 *  the property in the object in the TabBar dataProvider that will be used to
 		 *  select the content
 		 *
 		 *  @langversion 3.0