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/05 10:29:26 UTC
[04/16] git commit: [flex-asjs] [refs/heads/feature/fontawesome] -
Initial version of dataProvider+item renderer API for MDL Tabs and TabBar
components
Initial version of dataProvider+item renderer API for MDL Tabs and TabBar components
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/ae0a67a8
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/ae0a67a8
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/ae0a67a8
Branch: refs/heads/feature/fontawesome
Commit: ae0a67a8df6204f8f443a0226738e1ba423f4937
Parents: 22d7b00
Author: piotrz <pi...@apache.org>
Authored: Wed Jan 4 17:42:23 2017 +0100
Committer: piotrz <pi...@apache.org>
Committed: Wed Jan 4 17:42:23 2017 +0100
----------------------------------------------------------------------
.../src/main/flex/MDLClasses.as | 4 +-
.../src/main/flex/org/apache/flex/mdl/TabBar.as | 72 +++++++-
.../src/main/flex/org/apache/flex/mdl/Tabs.as | 67 +++++++-
.../TabsItemRendererFactoryForArrayData.as | 164 +++++++++++++++++++
.../apache/flex/mdl/beads/models/ITabModel.as | 39 +++++
.../apache/flex/mdl/beads/models/TabModel.as | 42 +++++
.../apache/flex/mdl/beads/views/TabBarView.as | 28 ++++
.../org/apache/flex/mdl/beads/views/TabsView.as | 28 ++++
.../TabBarButtonLayoutItemRenderer.as | 46 ++++++
.../TabBarButtonTabsItemRenderer.as | 46 ++++++
.../itemRenderers/TabBarLayoutItemRenderer.as | 56 +++++++
.../itemRenderers/TabBarPanelItemRenderer.as | 56 +++++++
.../flex/mdl/supportClasses/ITabItemRenderer.as | 31 ++++
.../TabBarButtonItemRendererBase.as | 114 +++++++++++++
.../mdl/supportClasses/TabItemRendererBase.as | 87 ++++++++++
.../src/main/resources/defaults.css | 20 +++
.../src/main/resources/mdl-manifest.xml | 15 +-
17 files changed, 904 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/frameworks/projects/MaterialDesignLite/src/main/flex/MDLClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/MDLClasses.as b/frameworks/projects/MaterialDesignLite/src/main/flex/MDLClasses.as
index 6136bec..14f3d95 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/MDLClasses.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/MDLClasses.as
@@ -26,7 +26,9 @@ package
* from the classes specified in manifest.xml.
*/
internal class MDLClasses
- {
+ {
+ import org.apache.flex.mdl.beads.TabsItemRendererFactoryForArrayData; TabsItemRendererFactoryForArrayData;
+ import org.apache.flex.mdl.beads.models.TabModel; TabModel;
import org.apache.flex.mdl.beads.models.ToastModel; ToastModel;
import org.apache.flex.mdl.beads.models.SnackbarModel; SnackbarModel;
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TabBar.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TabBar.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TabBar.as
index 1865db3..cb487cf 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TabBar.as
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/TabBar.as
@@ -19,7 +19,14 @@
package org.apache.flex.mdl
{
import org.apache.flex.core.ContainerBase;
-
+ import org.apache.flex.core.IChild;
+ import org.apache.flex.core.IItemRenderer;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.ILayoutParent;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.mdl.beads.models.ITabModel;
+
COMPILE::JS
{
import org.apache.flex.core.WrappedHTMLElement;
@@ -34,7 +41,7 @@ package org.apache.flex.mdl
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public class TabBar extends ContainerBase
+ public class TabBar extends ContainerBase implements IItemRendererParent, ILayoutParent, ILayoutHost
{
/**
* constructor.
@@ -51,6 +58,67 @@ package org.apache.flex.mdl
className = ""; //set to empty string avoid 'undefined' output when no class selector is assigned by user;
}
+ public function get dataProvider():Object
+ {
+ return ITabModel(model).dataProvider;
+ }
+ public function set dataProvider(value:Object):void
+ {
+ ITabModel(model).dataProvider = value;
+ }
+
+ public function get labelField():String
+ {
+ return ITabModel(model).labelField;
+ }
+ public function set labelField(value:String):void
+ {
+ ITabModel(model).labelField = value;
+ }
+
+ public function get tabIdField():String
+ {
+ return ITabModel(model).tabIdField;
+ }
+
+ public function set tabIdField(value:String):void
+ {
+ ITabModel(model).tabIdField = value;
+ }
+
+ public function getLayoutHost():ILayoutHost
+ {
+ return this;
+ }
+
+ public function get contentView():IParentIUIBase
+ {
+ return this;
+ }
+
+ public function getItemRendererForIndex(index:int):IItemRenderer
+ {
+ var child:IItemRenderer = getElementAt(index) as IItemRenderer;
+ return child;
+ }
+
+ public function removeAllElements():void
+ {
+ while (numElements > 0) {
+ var child:IChild = getElementAt(0);
+ removeElement(child);
+ }
+ }
+
+ public function updateAllItemRenderers():void
+ {
+ //todo: IItemRenderer does not define update function but DataItemRenderer does
+ //for(var i:int = 0; i < numElements; i++) {
+ // var child:IItemRenderer = getElementAt(i) as IItemRenderer;
+ // child.update();
+ //}
+ }
+
/**
* @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
*/
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/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 4c456d9..9ed138a 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
@@ -19,7 +19,14 @@
package org.apache.flex.mdl
{
import org.apache.flex.core.ContainerBase;
-
+ import org.apache.flex.core.IChild;
+ import org.apache.flex.core.IItemRenderer;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.ILayoutHost;
+ import org.apache.flex.core.ILayoutParent;
+ import org.apache.flex.core.IParentIUIBase;
+ import org.apache.flex.mdl.beads.models.ITabModel;
+
COMPILE::JS
{
import org.apache.flex.core.WrappedHTMLElement;
@@ -34,7 +41,7 @@ package org.apache.flex.mdl
* @playerversion AIR 2.6
* @productversion FlexJS 0.0
*/
- public class Tabs extends ContainerBase
+ public class Tabs extends ContainerBase implements IItemRendererParent, ILayoutParent, ILayoutHost
{
/**
* constructor.
@@ -50,7 +57,59 @@ package org.apache.flex.mdl
className = ""; //set to empty string avoid 'undefined' output when no class selector is assigned by user;
}
-
+
+ public function get dataProvider():Object
+ {
+ return ITabModel(model).dataProvider;
+ }
+ public function set dataProvider(value:Object):void
+ {
+ ITabModel(model).dataProvider = value;
+ }
+
+ public function get tabIdField():String
+ {
+ return ITabModel(model).tabIdField;
+ }
+
+ public function set tabIdField(value:String):void
+ {
+ ITabModel(model).tabIdField = value;
+ }
+
+ public function getLayoutHost():ILayoutHost
+ {
+ return this;
+ }
+
+ public function get contentView():IParentIUIBase
+ {
+ return this;
+ }
+
+ public function getItemRendererForIndex(index:int):IItemRenderer
+ {
+ var child:IItemRenderer = getElementAt(index) as IItemRenderer;
+ return child;
+ }
+
+ public function removeAllElements():void
+ {
+ while (numElements > 0) {
+ var child:IChild = getElementAt(0);
+ removeElement(child);
+ }
+ }
+
+ public function updateAllItemRenderers():void
+ {
+ //todo: IItemRenderer does not define update function but DataItemRenderer does
+ //for(var i:int = 0; i < numElements; i++) {
+ // var child:IItemRenderer = getElementAt(i) as IItemRenderer;
+ // child.update();
+ //}
+ }
+
/**
* @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
*/
@@ -72,7 +131,7 @@ package org.apache.flex.mdl
return element;
}
- protected var _ripple:Boolean = false;
+ private var _ripple:Boolean = false;
/**
* A boolean flag to activate "mdl-js-ripple-effect" effect selector.
* Applies ripple click effect. May be used in combination with any other classes
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TabsItemRendererFactoryForArrayData.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TabsItemRendererFactoryForArrayData.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TabsItemRendererFactoryForArrayData.as
new file mode 100644
index 0000000..b898f17
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TabsItemRendererFactoryForArrayData.as
@@ -0,0 +1,164 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.mdl.beads
+{
+ import org.apache.flex.core.IBead;
+ import org.apache.flex.core.IDataProviderItemRendererMapper;
+ import org.apache.flex.core.IItemRendererClassFactory;
+ import org.apache.flex.core.IItemRendererParent;
+ import org.apache.flex.core.IListPresentationModel;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.core.SimpleCSSStyles;
+ import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.ValuesManager;
+ import org.apache.flex.events.EventDispatcher;
+ import org.apache.flex.events.IEventDispatcher;
+ import org.apache.flex.events.ItemRendererEvent;
+ import org.apache.flex.html.beads.IListView;
+ import org.apache.flex.mdl.beads.models.ITabModel;
+ import org.apache.flex.events.Event;
+ import org.apache.flex.mdl.supportClasses.ITabItemRenderer;
+
+ [Event(name="itemRendererCreated",type="org.apache.flex.events.ItemRendererEvent")]
+
+ public class TabsItemRendererFactoryForArrayData extends EventDispatcher implements IBead, IDataProviderItemRendererMapper
+ {
+ public function TabsItemRendererFactoryForArrayData(target:Object = null)
+ {
+ super(target);
+ }
+
+ protected var dataProviderModel:ITabModel;
+
+ protected var labelField:String;
+ protected var tabsIdField:String;
+
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+ IEventDispatcher(value).addEventListener("beadsAdded",finishSetup);
+ IEventDispatcher(value).addEventListener("initComplete",finishSetup);
+ }
+
+ private function finishSetup(event:Event):void
+ {
+ IEventDispatcher(_strand).removeEventListener("beadsAdded",finishSetup);
+ IEventDispatcher(_strand).removeEventListener("initComplete",finishSetup);
+
+ dataProviderModel = _strand.getBeadByType(ITabModel) as ITabModel;
+ var listView:IListView = _strand.getBeadByType(IListView) as IListView;
+ dataGroup = listView.dataGroup;
+ dataProviderModel.addEventListener("dataProviderChanged", dataProviderChangeHandler);
+
+ tabsIdField = dataProviderModel.tabIdField;
+ labelField = dataProviderModel.labelField;
+
+ if (!itemRendererFactory)
+ {
+ _itemRendererFactory = new (ValuesManager.valuesImpl.getValue(_strand, "iItemRendererClassFactory")) as IItemRendererClassFactory;
+ _strand.addBead(_itemRendererFactory);
+ }
+
+ dataProviderChangeHandler(null);
+ }
+
+ private var _itemRendererFactory:IItemRendererClassFactory;
+
+ /**
+ * The org.apache.flex.core.IItemRendererClassFactory used
+ * to generate instances of item renderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function get itemRendererFactory():IItemRendererClassFactory
+ {
+ return _itemRendererFactory;
+ }
+
+ /**
+ * @private
+ */
+ public function set itemRendererFactory(value:IItemRendererClassFactory):void
+ {
+ _itemRendererFactory = value;
+ }
+
+ /**
+ * The org.apache.flex.core.IItemRendererParent that will
+ * parent the item renderers.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ protected var dataGroup:IItemRendererParent;
+
+ protected function dataProviderChangeHandler(event:Event):void
+ {
+ var dp:Array = dataProviderModel.dataProvider as Array;
+ if (!dp)
+ {
+ return;
+ }
+
+ dataGroup.removeAllElements();
+
+ var presentationModel:IListPresentationModel = _strand.getBeadByType(IListPresentationModel) as IListPresentationModel;
+
+ var n:int = dp.length;
+ for (var i:int = 0; i < n; i++)
+ {
+ var ir:ITabItemRenderer = itemRendererFactory.createItemRenderer(dataGroup) as ITabItemRenderer;
+ dataGroup.addElement(ir);
+ ir.index = i;
+ ir.labelField = labelField;
+ ir.tabIdField = tabsIdField;
+
+ if (presentationModel) {
+ var style:SimpleCSSStyles = new SimpleCSSStyles();
+ style.marginBottom = presentationModel.separatorThickness;
+ UIBase(ir).style = style;
+ UIBase(ir).height = presentationModel.rowHeight;
+ UIBase(ir).percentWidth = 100;
+ }
+ ir.data = dp[i];
+
+ var newEvent:ItemRendererEvent = new ItemRendererEvent(ItemRendererEvent.CREATED);
+ newEvent.itemRenderer = ir;
+ dispatchEvent(newEvent);
+ }
+
+ IEventDispatcher(_strand).dispatchEvent(new Event("itemsCreated"));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/models/ITabModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/models/ITabModel.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/models/ITabModel.as
new file mode 100644
index 0000000..c0110d6
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/models/ITabModel.as
@@ -0,0 +1,39 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.mdl.beads.models
+{
+ import org.apache.flex.core.ISelectionModel;
+
+ public interface ITabModel extends ISelectionModel
+ {
+ /**
+ * The property on the data item that the item renderer
+ * should renderer.
+ *
+ * TabBarButton is binded with TabBarPanel. It requries unique id for each TabBarButton.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ function get tabIdField():String;
+ function set tabIdField(value:String):void;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/models/TabModel.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/models/TabModel.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/models/TabModel.as
new file mode 100644
index 0000000..aeb2711
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/models/TabModel.as
@@ -0,0 +1,42 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.mdl.beads.models
+{
+ import org.apache.flex.html.beads.models.ArraySelectionModel;
+
+ public class TabModel extends ArraySelectionModel implements ITabModel
+ {
+ public function TabModel()
+ {
+ super();
+ }
+
+ private var _tabIdField:String;
+
+ public function get tabIdField():String
+ {
+ return _tabIdField;
+ }
+
+ public function set tabIdField(value:String):void
+ {
+ _tabIdField = value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabBarView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabBarView.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabBarView.as
new file mode 100644
index 0000000..0cde139
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabBarView.as
@@ -0,0 +1,28 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.mdl.beads.views
+{
+ public class TabBarView extends ListView
+ {
+ public function TabBarView()
+ {
+ super();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/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
new file mode 100644
index 0000000..bf882d4
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabsView.as
@@ -0,0 +1,28 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.mdl.beads.views
+{
+ public class TabsView extends ListView
+ {
+ public function TabsView()
+ {
+ super();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TabBarButtonLayoutItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TabBarButtonLayoutItemRenderer.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TabBarButtonLayoutItemRenderer.as
new file mode 100644
index 0000000..bea06e8
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TabBarButtonLayoutItemRenderer.as
@@ -0,0 +1,46 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.mdl.itemRenderers
+{
+ import org.apache.flex.mdl.supportClasses.TabBarButtonItemRendererBase;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ public class TabBarButtonLayoutItemRenderer extends TabBarButtonItemRendererBase
+ {
+ public function TabBarButtonLayoutItemRenderer()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ typeNames = "mdl-layout__tab";
+
+ return super.createElement();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TabBarButtonTabsItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TabBarButtonTabsItemRenderer.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TabBarButtonTabsItemRenderer.as
new file mode 100644
index 0000000..0eedc3a
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TabBarButtonTabsItemRenderer.as
@@ -0,0 +1,46 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.mdl.itemRenderers
+{
+ import org.apache.flex.mdl.supportClasses.TabBarButtonItemRendererBase;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ public class TabBarButtonTabsItemRenderer extends TabBarButtonItemRendererBase
+ {
+ public function TabBarButtonTabsItemRenderer()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ typeNames = "mdl-tabs__tab";
+
+ return super.createElement();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TabBarLayoutItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TabBarLayoutItemRenderer.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TabBarLayoutItemRenderer.as
new file mode 100644
index 0000000..51e7888
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TabBarLayoutItemRenderer.as
@@ -0,0 +1,56 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.mdl.itemRenderers
+{
+ import org.apache.flex.mdl.supportClasses.TabItemRendererBase;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ public class TabBarLayoutItemRenderer extends TabItemRendererBase
+ {
+ public function TabBarLayoutItemRenderer()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ typeNames = "mdl-layout__tab-panel";
+
+ element = document.createElement('section') as WrappedHTMLElement;
+
+ positioner = element;
+
+ // absolute positioned children need a non-null
+ // position value in the parent. It might
+ // get set to 'absolute' if the container is
+ // also absolutely positioned
+ element.flexjs_wrapper = this;
+
+ return element;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TabBarPanelItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TabBarPanelItemRenderer.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TabBarPanelItemRenderer.as
new file mode 100644
index 0000000..55c3ed1
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/TabBarPanelItemRenderer.as
@@ -0,0 +1,56 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.mdl.itemRenderers
+{
+ import org.apache.flex.mdl.supportClasses.TabItemRendererBase;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ public class TabBarPanelItemRenderer extends TabItemRendererBase
+ {
+ public function TabBarPanelItemRenderer()
+ {
+ super();
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ typeNames = "mdl-tabs__panel";
+
+ element = document.createElement('div') as WrappedHTMLElement;
+
+ positioner = element;
+
+ // absolute positioned children need a non-null
+ // position value in the parent. It might
+ // get set to 'absolute' if the container is
+ // also absolutely positioned
+ element.flexjs_wrapper = this;
+
+ return element;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/supportClasses/ITabItemRenderer.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/supportClasses/ITabItemRenderer.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/supportClasses/ITabItemRenderer.as
new file mode 100644
index 0000000..a552908
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/supportClasses/ITabItemRenderer.as
@@ -0,0 +1,31 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.mdl.supportClasses
+{
+ import org.apache.flex.core.ISelectableItemRenderer;
+
+ public interface ITabItemRenderer extends ISelectableItemRenderer
+ {
+ function get tabIdField():String;
+ function set tabIdField(value:String):void;
+
+ function get isActive():Boolean;
+ function set isActive(value:Boolean):void;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/supportClasses/TabBarButtonItemRendererBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/supportClasses/TabBarButtonItemRendererBase.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/supportClasses/TabBarButtonItemRendererBase.as
new file mode 100644
index 0000000..08d3af0
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/supportClasses/TabBarButtonItemRendererBase.as
@@ -0,0 +1,114 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.mdl.supportClasses
+{
+ import org.apache.flex.html.supportClasses.MXMLItemRenderer;
+
+ COMPILE::JS
+ {
+ import org.apache.flex.core.WrappedHTMLElement;
+ }
+
+ public class TabBarButtonItemRendererBase extends MXMLItemRenderer implements ITabItemRenderer
+ {
+ public function TabBarButtonItemRendererBase()
+ {
+ super();
+
+ className = "";
+ }
+
+ COMPILE::JS
+ private var textNode:Text;
+
+ private var _tabIdField:String;
+ private var _isActive:Boolean;
+
+ public function get tabIdField():String
+ {
+ return _tabIdField;
+ }
+
+ public function set tabIdField(value:String):void
+ {
+ _tabIdField = value;
+ }
+
+ public function get isActive():Boolean
+ {
+ return _isActive;
+ }
+
+ public function set isActive(value:Boolean):void
+ {
+ _isActive = value;
+
+ COMPILE::JS
+ {
+ element.classList.toggle("is-active", _isActive);
+ }
+ }
+
+ /**
+ * Sets the data value and uses the String version of the data for display.
+ *
+ * @param Object data The object being displayed by the itemRenderer instance.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set data(value:Object):void
+ {
+ super.data = value;
+
+ COMPILE::JS
+ {
+ if (tabIdField)
+ {
+ (element as HTMLAnchorElement).href = "#" + String(value[tabIdField]);
+ }
+
+ if (labelField)
+ {
+ textNode.nodeValue = String(value[labelField]);
+ }
+ }
+ }
+
+ /**
+ * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement
+ */
+ COMPILE::JS
+ override protected function createElement():WrappedHTMLElement
+ {
+ var a:HTMLAnchorElement = document.createElement('a') as HTMLAnchorElement;
+ element = a as WrappedHTMLElement;
+
+ textNode = document.createTextNode('') as Text;
+ element.appendChild(textNode);
+
+ positioner = element;
+ element.flexjs_wrapper = this;
+
+ return element;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/supportClasses/TabItemRendererBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/supportClasses/TabItemRendererBase.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/supportClasses/TabItemRendererBase.as
new file mode 100644
index 0000000..03eaba4
--- /dev/null
+++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/supportClasses/TabItemRendererBase.as
@@ -0,0 +1,87 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.flex.mdl.supportClasses
+{
+ import org.apache.flex.html.supportClasses.MXMLItemRenderer;
+
+ public class TabItemRendererBase extends MXMLItemRenderer implements ITabItemRenderer
+ {
+ public function TabItemRendererBase()
+ {
+ super();
+
+ className = "";
+ }
+
+ private var _tabIdField:String;
+ private var _isActive:Boolean;
+
+ public function get tabIdField():String
+ {
+ return _tabIdField;
+ }
+
+ public function set tabIdField(value:String):void
+ {
+ _tabIdField = value;
+ }
+
+ public function get isActive():Boolean
+ {
+ return _isActive;
+ }
+
+ public function set isActive(value:Boolean):void
+ {
+ _isActive = value;
+
+ COMPILE::JS
+ {
+ element.classList.toggle("is-active", _isActive);
+ }
+ }
+
+ /**
+ * Sets the data value and uses the String version of the data for display.
+ *
+ * @param Object data The object being displayed by the itemRenderer instance.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ override public function set data(value:Object):void
+ {
+ super.data = value;
+
+ COMPILE::JS
+ {
+ if (tabIdField)
+ {
+ element.id = String(value[tabIdField]);
+ }
+ else
+ {
+ throw new Error("tabIdField cannot be empty.");
+ }
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css b/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
index 1cf6a46..6328c15 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
+++ b/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
@@ -66,6 +66,26 @@ Menu
IItemRenderer: ClassReference("org.apache.flex.mdl.itemRenderers.MenuItemRenderer");
}
+Tabs
+{
+ IBeadView: ClassReference("org.apache.flex.mdl.beads.views.TabsView");
+ IBeadModel: ClassReference("org.apache.flex.mdl.beads.models.TabModel");
+ IBeadLayout: ClassReference(null);
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.mdl.beads.TabsItemRendererFactoryForArrayData");
+ IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
+ IItemRenderer: ClassReference("org.apache.flex.mdl.itemRenderers.TabBarPanelItemRenderer");
+}
+
+TabBar
+{
+ IBeadView: ClassReference("org.apache.flex.mdl.beads.views.TabBarView");
+ IBeadModel: ClassReference("org.apache.flex.mdl.beads.models.TabModel");
+ IBeadLayout: ClassReference(null);
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.mdl.beads.TabsItemRendererFactoryForArrayData");
+ IItemRendererClassFactory: ClassReference("org.apache.flex.core.ItemRendererClassFactory");
+ IItemRenderer: ClassReference("org.apache.flex.mdl.itemRenderers.TabBarButtonTabsItemRenderer");
+}
+
Toast
{
IBeadModel: ClassReference("org.apache.flex.mdl.beads.models.ToastModel");
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ae0a67a8/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
index 5f438fd..b411018 100644
--- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
+++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml
@@ -64,10 +64,6 @@
<component id="Navigation" class="org.apache.flex.mdl.Navigation"/>
<component id="Drawer" class="org.apache.flex.mdl.Drawer"/>
<component id="NavigationLayoutContent" class="org.apache.flex.mdl.NavigationLayoutContent"/>
- <component id="TabBar" class="org.apache.flex.mdl.TabBar"/>
- <component id="TabBarButton" class="org.apache.flex.mdl.TabBarButton"/>
- <component id="TabBarPanel" class="org.apache.flex.mdl.TabBarPanel"/>
- <component id="Tabs" class="org.apache.flex.mdl.Tabs"/>
<component id="Grid" class="org.apache.flex.mdl.Grid"/>
<component id="GridCell" class="org.apache.flex.mdl.GridCell"/>
<component id="Chip" class="org.apache.flex.mdl.Chip"/>
@@ -87,6 +83,17 @@
<component id="FooterLeftSection" class="org.apache.flex.mdl.FooterLeftSection"/>
<component id="FooterRightSection" class="org.apache.flex.mdl.FooterRightSection"/>
+ <component id="TabBarView" class="org.apache.flex.mdl.beads.views.TabBarView"/>
+ <component id="TabBar" class="org.apache.flex.mdl.TabBar"/>
+ <component id="TabBarButtonTabsItemRenderer" class="org.apache.flex.mdl.itemRenderers.TabBarButtonTabsItemRenderer"/>
+ <component id="TabBarButtonLayoutItemRenderer" class="org.apache.flex.mdl.itemRenderers.TabBarButtonLayoutItemRenderer"/>
+ <component id="TabBarButton" class="org.apache.flex.mdl.TabBarButton"/>
+ <component id="TabBarPanelItemRenderer" class="org.apache.flex.mdl.itemRenderers.TabBarPanelItemRenderer"/>
+ <component id="TabBarLayoutItemRenderer" class="org.apache.flex.mdl.itemRenderers.TabBarLayoutItemRenderer"/>
+ <component id="TabBarPanel" class="org.apache.flex.mdl.TabBarPanel"/>
+ <component id="TabsView" class="org.apache.flex.mdl.beads.views.TabsView"/>
+ <component id="Tabs" class="org.apache.flex.mdl.Tabs"/>
+
<component id="MaterialIconCancel" class="org.apache.flex.mdl.materialIcons.MaterialIconCancel"/>
<component id="MaterialIconAdd" class="org.apache.flex.mdl.materialIcons.MaterialIconAdd"/>
<component id="MaterialIconPerson" class="org.apache.flex.mdl.materialIcons.MaterialIconPerson"/>