You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by pi...@apache.org on 2017/01/08 12:56:29 UTC
git commit: [flex-asjs] [refs/heads/develop] - - Expose from model
selectedIndex in Tabs - in order to gives ability to select specified
TabBarPanel at start up - Update MDL example with selectedIndex
Repository: flex-asjs
Updated Branches:
refs/heads/develop a006bbe89 -> be86f911b
- Expose from model selectedIndex in Tabs - in order to gives ability to select specified TabBarPanel at start up
- Update MDL example with selectedIndex
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/be86f911
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/be86f911
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/be86f911
Branch: refs/heads/develop
Commit: be86f911bc72b30430263e4958e833128fe1fb12
Parents: a006bbe
Author: piotrz <pi...@apache.org>
Authored: Sun Jan 8 13:56:24 2017 +0100
Committer: piotrz <pi...@apache.org>
Committed: Sun Jan 8 13:56:24 2017 +0100
----------------------------------------------------------------------
.../flexjs/MDLExample/src/main/flex/Tabs.mxml | 6 ++--
.../src/main/flex/org/apache/flex/mdl/Tabs.as | 31 +++++++++++++++++++-
.../org/apache/flex/mdl/beads/views/TabsView.as | 24 +++++++++++++--
3 files changed, 55 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/be86f911/examples/flexjs/MDLExample/src/main/flex/Tabs.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MDLExample/src/main/flex/Tabs.mxml b/examples/flexjs/MDLExample/src/main/flex/Tabs.mxml
index 29e17fc..54058ce 100644
--- a/examples/flexjs/MDLExample/src/main/flex/Tabs.mxml
+++ b/examples/flexjs/MDLExample/src/main/flex/Tabs.mxml
@@ -29,7 +29,7 @@ limitations under the License.
<mdl:Grid>
<mdl:GridCell column="1" percentWidth="100">
- <mdl:Tabs width="400" tabIdField="tabId" labelField="label" className="customTabBarPanelItemRenderer">
+ <mdl:Tabs width="400" selectedIndex="0" tabIdField="tabId" labelField="label" className="customTabBarPanelItemRenderer">
<mdl:beads>
<js:ConstantBinding
sourceID="tabsModel"
@@ -38,7 +38,7 @@ limitations under the License.
</mdl:beads>
</mdl:Tabs>
</mdl:GridCell>
- <mdl:GridCell column="1" percentWidth="100">
+ <mdl:GridCell column="1" percentWidth="100">
<mdl:NavigationLayout width="600">
<mdl:Header>
<mdl:TabBar selectedIndex="0" tabIdField="tabId" labelField="label" className="customTabBarSetup">
@@ -64,7 +64,7 @@ limitations under the License.
</js:Ul>
</mdl:TabBarPanel>
- <mdl:TabBarPanel id="lannisters_panel" isActive="true">
+ <mdl:TabBarPanel id="lannisters_panel">
<js:Ul>
<js:Li><js:Label text="Tywin"/></js:Li>
<js:Li><js:Label text="Cersei"/></js:Li>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/be86f911/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Tabs.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Tabs.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Tabs.as
index a5d0a75..4f64e8d 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Tabs.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Tabs.as
@@ -58,6 +58,14 @@ package org.apache.flex.mdl
className = ""; //set to empty string avoid 'undefined' output when no class selector is assigned by user;
}
+ /**
+ * @copy org.apache.flex.core.IDataProviderModel#dataProvider
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
public function get dataProvider():Object
{
return ITabModel(model).dataProvider;
@@ -66,7 +74,15 @@ package org.apache.flex.mdl
{
ITabModel(model).dataProvider = value;
}
-
+
+ /**
+ * @copy org.apache.flex.mdl.beads.models.ITabModel#tabIdField
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
public function get tabIdField():String
{
return ITabModel(model).tabIdField;
@@ -77,6 +93,14 @@ package org.apache.flex.mdl
ITabModel(model).tabIdField = value;
}
+ /**
+ * @copy org.apache.flex.core.IDataProviderModel#labelField
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
public function get labelField():String
{
return ITabModel(model).labelField;
@@ -86,6 +110,11 @@ package org.apache.flex.mdl
ITabModel(model).labelField = value;
}
+ public function set selectedIndex(value:int):void
+ {
+ ITabModel(model).selectedIndex = value;
+ }
+
public function getLayoutHost():ILayoutHost
{
return this;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/be86f911/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabsView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabsView.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabsView.as
index 5619f28..4126569 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabsView.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabsView.as
@@ -23,6 +23,8 @@ package org.apache.flex.mdl.beads.views
import org.apache.flex.events.Event;
import org.apache.flex.core.IStrand;
import org.apache.flex.mdl.TabBar;
+ import org.apache.flex.mdl.TabBarPanel;
+ import org.apache.flex.mdl.supportClasses.ITabItemRenderer;
/**
* The TabsView class creates the visual elements of the org.apache.flex.mdl.Tabs
@@ -76,12 +78,30 @@ package org.apache.flex.mdl.beads.views
host.addEventListener("initComplete", initCompleteHandler);
}
-
private function initCompleteHandler(event:Event):void
{
host.removeEventListener("initComplete", initCompleteHandler);
-
+
+ completeSetup();
+ }
+
+ protected function completeSetup():void
+ {
(host as IContentViewHost).strandChildren.addElementAt(tabBar, 0);
+
+ selectTabBarPanel();
+ }
+
+ private function selectTabBarPanel():void
+ {
+ if (listModel.selectedIndex < 0 ) return;
+
+ var indexElementAfterTabBar:int = listModel.selectedIndex + 1;
+ var tabBarPanel:Object = (host as IContentViewHost).strandChildren.getElementAt(indexElementAfterTabBar);
+ if (tabBarPanel is ITabItemRenderer || tabBarPanel is TabBarPanel)
+ {
+ tabBarPanel.isActive = true;
+ }
}
}
}