Footer Link List
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/654f7c53 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/654f7c53 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/654f7c53 Branch: refs/heads/feature/fontawesome Commit: 654f7c53304667d4075aa5db17c836c9b021db7d Parents: dee04ad Author: Carlos Rovira <[email protected]> Authored: Thu Jan 5 00:58:24 2017 +0100 Committer: Carlos Rovira <[email protected]> Committed: Thu Jan 5 00:58:24 2017 +0100 ---------------------------------------------------------------------- .../flexjs/MDLExample/src/main/flex/Lists.mxml | 2 +- .../MDLExample/src/main/flex/MainFooter.mxml | 14 ++- .../FooterMiniLinkListItemRenderer.mxml | 32 +++++ .../src/main/flex/models/FooterModel.as | 40 ++++++ .../src/main/resources/mdl-styles.css | 5 + .../org/apache/flex/mdl/FooterBottomSection.as | 3 +- .../org/apache/flex/mdl/FooterLeftSection.as | 3 +- .../flex/org/apache/flex/mdl/FooterLinkList.as | 108 ++++++++++++++++ .../org/apache/flex/mdl/FooterRightSection.as | 3 +- .../org/apache/flex/mdl/FooterTopSection.as | 3 +- .../mdl/itemRenderers/FooterLinkItemRenderer.as | 124 +++++++++++++++++++ .../flex/mdl/supportClasses/IFooterSection.as | 28 +++++ .../src/main/resources/defaults.css | 5 + .../src/main/resources/mdl-manifest.xml | 2 + 14 files changed, 361 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/654f7c53/examples/flexjs/MDLExample/src/main/flex/Lists.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MDLExample/src/main/flex/Lists.mxml b/examples/flexjs/MDLExample/src/main/flex/Lists.mxml index 86573e3..c4b44a5 100644 --- a/examples/flexjs/MDLExample/src/main/flex/Lists.mxml +++ b/examples/flexjs/MDLExample/src/main/flex/Lists.mxml @@ -37,7 +37,7 @@ limitations under the License. </mdl:beads> </mdl:List> - <mdl:List labelField="actorName" className="actorListItemRenderer"> + <mdl:List labelField="actorName" className="actorNameListItemRenderer"> <mdl:beads> <js:ConstantBinding sourceID="model" http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/654f7c53/examples/flexjs/MDLExample/src/main/flex/MainFooter.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MDLExample/src/main/flex/MainFooter.mxml b/examples/flexjs/MDLExample/src/main/flex/MainFooter.mxml index ec950c6..43b6c90 100644 --- a/examples/flexjs/MDLExample/src/main/flex/MainFooter.mxml +++ b/examples/flexjs/MDLExample/src/main/flex/MainFooter.mxml @@ -19,22 +19,24 @@ limitations under the License. --> <mdl:Footer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:js="library://ns.apache.org/flexjs/basic" - xmlns:local="*" xmlns:mdl="library://ns.apache.org/flexjs/mdl" - xmlns="http://www.w3.org/1999/xhtml" xmlns:models="models.*" mini="true"> - + + <mdl:model> + <models:FooterModel/> + </mdl:model> + <mdl:FooterLeftSection> <mdl:FooterLogo text="Title"/> - <!--<mdl:List className="mdl-mini-footer__link-list"> + <mdl:FooterLinkList className="footerMiniLinkListItemRenderer"> <mdl:beads> <js:ConstantBinding sourceID="model" - sourcePropertyName="things" + sourcePropertyName="links" destinationPropertyName="dataProvider" /> </mdl:beads> - </mdl:List>--> + </mdl:FooterLinkList> </mdl:FooterLeftSection> <mdl:FooterRightSection> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/654f7c53/examples/flexjs/MDLExample/src/main/flex/itemRenderers/FooterMiniLinkListItemRenderer.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MDLExample/src/main/flex/itemRenderers/FooterMiniLinkListItemRenderer.mxml b/examples/flexjs/MDLExample/src/main/flex/itemRenderers/FooterMiniLinkListItemRenderer.mxml new file mode 100644 index 0000000..71667ca --- /dev/null +++ b/examples/flexjs/MDLExample/src/main/flex/itemRenderers/FooterMiniLinkListItemRenderer.mxml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + +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. + +--> +<mdl:FooterLinkItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" + xmlns:js="library://ns.apache.org/flexjs/basic" + xmlns:mdl="library://ns.apache.org/flexjs/mdl" + xmlns="http://www.w3.org/1999/xhtml"> + + <mdl:beads> + <js:ItemRendererDataBinding /> + </mdl:beads> + + <js:A text="{data.toString()}"/> + +</mdl:FooterLinkItemRenderer> + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/654f7c53/examples/flexjs/MDLExample/src/main/flex/models/FooterModel.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MDLExample/src/main/flex/models/FooterModel.as b/examples/flexjs/MDLExample/src/main/flex/models/FooterModel.as new file mode 100644 index 0000000..9d4e9a3 --- /dev/null +++ b/examples/flexjs/MDLExample/src/main/flex/models/FooterModel.as @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 models +{ + import org.apache.flex.events.EventDispatcher; + //import vos.*; + + public class FooterModel extends EventDispatcher + { + /** + * Used in the Footer example. + */ + private var _links:Array = [ + "Help", + "Privacy and Terms", + "User Agreement" + ]; + + public function get links():Array + { + return _links; + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/654f7c53/examples/flexjs/MDLExample/src/main/resources/mdl-styles.css ---------------------------------------------------------------------- diff --git a/examples/flexjs/MDLExample/src/main/resources/mdl-styles.css b/examples/flexjs/MDLExample/src/main/resources/mdl-styles.css index 6dd7267..d4dda32 100644 --- a/examples/flexjs/MDLExample/src/main/resources/mdl-styles.css +++ b/examples/flexjs/MDLExample/src/main/resources/mdl-styles.css @@ -83,6 +83,11 @@ js|Image IItemRenderer: ClassReference("itemRenderers.CustomListItemRenderer"); } +.footerMiniLinkListItemRenderer +{ + IItemRenderer: ClassReference("itemRenderers.FooterMiniLinkListItemRenderer"); +} + .layoutTransparent { background: url('assets/transparent.jpg') center / cover; color: white; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/654f7c53/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterBottomSection.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterBottomSection.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterBottomSection.as index 4bfd810..c5e6bb2 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterBottomSection.as +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterBottomSection.as @@ -19,6 +19,7 @@ package org.apache.flex.mdl { import org.apache.flex.core.ContainerBase; + import org.apache.flex.mdl.supportClasses.IFooterSection; COMPILE::JS { @@ -34,7 +35,7 @@ package org.apache.flex.mdl * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public class FooterBottomSection extends ContainerBase + public class FooterBottomSection extends ContainerBase implements IFooterSection { /** * constructor. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/654f7c53/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterLeftSection.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterLeftSection.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterLeftSection.as index 0131020..f3a10ad 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterLeftSection.as +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterLeftSection.as @@ -19,6 +19,7 @@ package org.apache.flex.mdl { import org.apache.flex.core.ContainerBase; + import org.apache.flex.mdl.supportClasses.IFooterSection; COMPILE::JS { @@ -34,7 +35,7 @@ package org.apache.flex.mdl * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public class FooterLeftSection extends ContainerBase + public class FooterLeftSection extends ContainerBase implements IFooterSection { /** * constructor. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/654f7c53/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterLinkList.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterLinkList.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterLinkList.as new file mode 100644 index 0000000..0d3f1d4 --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterLinkList.as @@ -0,0 +1,108 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +{ + import org.apache.flex.mdl.supportClasses.IFooterSection; + import org.apache.flex.core.UIBase; + + COMPILE::JS + { + import org.apache.flex.core.WrappedHTMLElement; + } + + /** + * FooterLinkList relies on an itemRenderer factory to produce its children components + * and on a layout to arrange them. + * This is the only UI element aside from the itemRenderers. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class FooterLinkList extends List + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function FooterLinkList() + { + super(); + + className = ""; //set to empty string avoid 'undefined' output when no class selector is assigned by user; + } + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + */ + COMPILE::JS + override protected function createElement():WrappedHTMLElement + { + typeNames = "mdl-mega-footer__link-list"; + + element = document.createElement('ul') as WrappedHTMLElement; + + positioner = element; + element.flexjs_wrapper = this; + + return positioner; + } + + /** + * Configuration depends on parent Footer. + * Check to see if is mega or mini. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + COMPILE::JS + override public function addedToParent():void + { + super.addedToParent(); + + if(parent is IFooterSection) + { + var parentSection:IFooterSection = parent as IFooterSection; + if(UIBase(parentSection).parent is Footer) + { + element.classList.remove(typeNames); + if(!Footer(UIBase(parentSection).parent).mini) + { + typeNames = "mdl-mega-footer__link-list"; + } else + { + typeNames = "mdl-mini-footer__link-list"; + } + element.classList.add(typeNames); + } + } + else + { + throw new Error("FooterLinkList can not be used if parent is not a MDL Footer Section component."); + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/654f7c53/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterRightSection.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterRightSection.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterRightSection.as index 9902e9e..b7f2950 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterRightSection.as +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterRightSection.as @@ -19,6 +19,7 @@ package org.apache.flex.mdl { import org.apache.flex.core.ContainerBase; + import org.apache.flex.mdl.supportClasses.IFooterSection; COMPILE::JS { @@ -34,7 +35,7 @@ package org.apache.flex.mdl * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public class FooterRightSection extends ContainerBase + public class FooterRightSection extends ContainerBase implements IFooterSection { /** * constructor. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/654f7c53/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterTopSection.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterTopSection.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterTopSection.as index 5f26e7f..eb483c0 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterTopSection.as +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterTopSection.as @@ -19,6 +19,7 @@ package org.apache.flex.mdl { import org.apache.flex.core.ContainerBase; + import org.apache.flex.mdl.supportClasses.IFooterSection; COMPILE::JS { @@ -34,7 +35,7 @@ package org.apache.flex.mdl * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public class FooterTopSection extends ContainerBase + public class FooterTopSection extends ContainerBase implements IFooterSection { /** * constructor. http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/654f7c53/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/FooterLinkItemRenderer.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/FooterLinkItemRenderer.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/FooterLinkItemRenderer.as new file mode 100644 index 0000000..8e2e199 --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/itemRenderers/FooterLinkItemRenderer.as @@ -0,0 +1,124 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +{ + COMPILE::JS + { + import org.apache.flex.core.WrappedHTMLElement; + } + + import org.apache.flex.html.supportClasses.MXMLItemRenderer; + + /** + * The FooterLinkItemRenderer defines the basic Item Renderer for a MDL Footer Link List Component. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class FooterLinkItemRenderer extends MXMLItemRenderer + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function FooterLinkItemRenderer() + { + super(); + } + + private var _text:String = ""; + + /** + * The text of the heading + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get text():String + { + return _text; + } + + public function set text(value:String):void + { + _text = value; + } + + COMPILE::JS + private var textNode:Text; + + /** + * 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; + + var text:String; + if (labelField || dataField) { + text = String(value[labelField]); + } else { + text = String(value); + } + + COMPILE::JS + { + if(textNode != null) + { + textNode.nodeValue = text; + } + } + } + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + */ + COMPILE::JS + override protected function createElement():WrappedHTMLElement + { + element = document.createElement('li') as WrappedHTMLElement; + + if(MXMLDescriptor == null) + { + 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/654f7c53/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/supportClasses/IFooterSection.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/supportClasses/IFooterSection.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/supportClasses/IFooterSection.as new file mode 100644 index 0000000..6298545 --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/supportClasses/IFooterSection.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.supportClasses +{ + /** + * marker interface + */ + public interface IFooterSection + { + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/654f7c53/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 6328c15..4530a39 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css +++ b/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css @@ -96,6 +96,11 @@ Snackbar IBeadModel: ClassReference("org.apache.flex.mdl.beads.models.SnackbarModel"); } +FooterLinkList +{ + IItemRenderer: ClassReference("org.apache.flex.mdl.itemRenderers.FooterLinkItemRenderer"); +} + @media -flex-flash { Slider http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/654f7c53/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 6cff420..adfc1e7 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml +++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml @@ -85,6 +85,8 @@ <component id="FooterTopSection" class="org.apache.flex.mdl.FooterTopSection"/> <component id="FooterBottomSection" class="org.apache.flex.mdl.FooterBottomSection"/> <component id="FooterLogo" class="org.apache.flex.mdl.FooterLogo"/> + <component id="FooterLinkList" class="org.apache.flex.mdl.FooterLinkList"/> + <component id="FooterLinkItemRenderer" class="org.apache.flex.mdl.itemRenderers.FooterLinkItemRenderer"/> <component id="TabBarView" class="org.apache.flex.mdl.beads.views.TabBarView"/>
