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 e5f98d4 jewel-tabbar: improves AssignTabContent selecting the
tabbarbutton when dataprovider changes (if content was already selected and
button exists)
e5f98d4 is described below
commit e5f98d42fadcc445b971c9fe14f830aee90964a4
Author: Carlos Rovira <[email protected]>
AuthorDate: Mon Feb 24 20:58:10 2020 +0100
jewel-tabbar: improves AssignTabContent selecting the tabbarbutton when
dataprovider changes (if content was already selected and button exists)
---
.../beads/controls/tabbar/AssignTabContent.as | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
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 7fc8b84..bcb8781 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
@@ -18,6 +18,7 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.jewel.beads.controls.tabbar
{
+ import org.apache.royale.collections.ArrayList;
import org.apache.royale.core.IBead;
import org.apache.royale.core.IStrand;
import org.apache.royale.events.Event;
@@ -82,12 +83,33 @@ package org.apache.royale.jewel.beads.controls.tabbar
}
}
+ /**
+ * Select the right content for the selected tabbar button.
+ * Or if the dataprovider changes and a content was already
selected, tries
+ * to select the tabbar button (if exits).
+ *
+ * @param event
+ */
protected function selectionChangedHandler(event:Event):void
{
if(content && tabbar.selectedIndex != -1)
{
content.selectedContent =
tabbar.selectedItem[selectedContentProperty];
}
+ else if(tabbar.selectedIndex == -1 &&
content.selectedContent)
+ {
+ var len:int = tabbar.dataProvider.length;
+ var item:Object;
+ for(var index:int = 0; index < len; index++)
+ {
+ item = (tabbar.dataProvider as
ArrayList).getItemAt(index);
+ if(item[selectedContentProperty] ==
content.selectedContent)
+ {
+ tabbar.selectedItem = item;
+ return;
+ }
+ }
+ }
}
private var _content:TabBarContent;