Repository: flex-asjs Updated Branches: refs/heads/develop c6dc46e91 -> 8dc4524eb
MDL Mega Footer component, still need some tweaks Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/ca2825e9 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/ca2825e9 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/ca2825e9 Branch: refs/heads/develop Commit: ca2825e9371b97042d0d1f2e3f89e158a504e2a0 Parents: cf38a5b Author: Carlos Rovira <[email protected]> Authored: Wed Feb 1 21:24:06 2017 +0100 Committer: Carlos Rovira <[email protected]> Committed: Wed Feb 1 21:24:06 2017 +0100 ---------------------------------------------------------------------- .../MDLExample/src/main/flex/Footers.mxml | 54 ++++++++++ .../src/main/flex/models/MainNavigationModel.as | 2 +- .../apache/flex/mdl/FooterDropDownSection.as | 103 +++++++++++++++++++ .../org/apache/flex/mdl/FooterLeftSection.as | 7 +- .../org/apache/flex/mdl/FooterMiddleSection.as | 103 +++++++++++++++++++ .../org/apache/flex/mdl/FooterRightSection.as | 7 +- .../mdl/itemRenderers/FooterLinkItemRenderer.as | 34 +++++- .../src/main/resources/mdl-manifest.xml | 2 + 8 files changed, 306 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ca2825e9/examples/flexjs/MDLExample/src/main/flex/Footers.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MDLExample/src/main/flex/Footers.mxml b/examples/flexjs/MDLExample/src/main/flex/Footers.mxml index 3a90fb5..7b0dae1 100644 --- a/examples/flexjs/MDLExample/src/main/flex/Footers.mxml +++ b/examples/flexjs/MDLExample/src/main/flex/Footers.mxml @@ -48,6 +48,60 @@ limitations under the License. <mdl:FooterSocialButton>3</mdl:FooterSocialButton> </mdl:FooterRightSection> </mdl:Footer> + + <mdl:Footer width="600"> + + <mdl:FooterTopSection> + + <mdl:FooterLeftSection> + </mdl:FooterLeftSection> + + <mdl:FooterRightSection> + <mdl:FooterSocialButton>1</mdl:FooterSocialButton> + <mdl:FooterSocialButton>2</mdl:FooterSocialButton> + <mdl:FooterSocialButton>3</mdl:FooterSocialButton> + </mdl:FooterRightSection> + </mdl:FooterTopSection> + + <mdl:FooterMiddleSection> + + <mdl:FooterDropDownSection> + <mdl:FooterLinkList> + <mdl:beads> + <js:ConstantBinding + sourceID="model" + sourcePropertyName="links" + destinationPropertyName="dataProvider" /> + </mdl:beads> + </mdl:FooterLinkList> + </mdl:FooterDropDownSection> + + <mdl:FooterDropDownSection> + <mdl:FooterLinkList> + <mdl:beads> + <js:ConstantBinding + sourceID="model" + sourcePropertyName="links" + destinationPropertyName="dataProvider" /> + </mdl:beads> + </mdl:FooterLinkList> + </mdl:FooterDropDownSection> + </mdl:FooterMiddleSection> + + <mdl:FooterBottomSection> + <mdl:FooterLogo text="Mega-Footer Bottom Section Heading"/> + <mdl:FooterLinkList className="footerMiniLinkListItemRenderer"> + <mdl:beads> + <js:ConstantBinding + sourceID="model" + sourcePropertyName="links" + destinationPropertyName="dataProvider" /> + </mdl:beads> + </mdl:FooterLinkList> + </mdl:FooterBottomSection> + + </mdl:Footer> + </mdl:Grid> </mdl:TabBarPanel> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ca2825e9/examples/flexjs/MDLExample/src/main/flex/models/MainNavigationModel.as ---------------------------------------------------------------------- diff --git a/examples/flexjs/MDLExample/src/main/flex/models/MainNavigationModel.as b/examples/flexjs/MDLExample/src/main/flex/models/MainNavigationModel.as index 3039538..0c358e4 100644 --- a/examples/flexjs/MDLExample/src/main/flex/models/MainNavigationModel.as +++ b/examples/flexjs/MDLExample/src/main/flex/models/MainNavigationModel.as @@ -57,6 +57,7 @@ package models new NavigationLinkVO("Chips", "chips_panel"), new NavigationLinkVO("Sliders", "sliders_panel"), new NavigationLinkVO("Grids", "grids_panel"), + new NavigationLinkVO("Footers", "footers_panel"), new NavigationLinkVO("Tabs", "tabs_panel"), new NavigationLinkVO("Buttons", "buttons_panel"), new NavigationLinkVO("TextFields", "textfield_panel"), @@ -68,7 +69,6 @@ package models new NavigationLinkVO("Loading", "loading_panel"), new NavigationLinkVO("Menu", "menus_panel"), new NavigationLinkVO("Badges", "badges_panel"), - new NavigationLinkVO("Footers", "footers_panel"), new NavigationLinkVO("Icons", "icons_panel") ]; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ca2825e9/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterDropDownSection.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterDropDownSection.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterDropDownSection.as new file mode 100644 index 0000000..63f7381 --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterDropDownSection.as @@ -0,0 +1,103 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.core.ContainerBase; + import org.apache.flex.mdl.supportClasses.IFooterSection; + + COMPILE::JS + { + import org.apache.flex.core.WrappedHTMLElement; + } + + /** + * The FooterDropDownSection class is a Container component capable of parenting other + * components + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.8 + */ + public class FooterDropDownSection extends ContainerBase implements IFooterSection + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.8 + */ + public function FooterDropDownSection() + { + 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__drop-down-section"; + + element = document.createElement('div') as WrappedHTMLElement; + + positioner = element; + element.flexjs_wrapper = this; + + return element; + } + + /** + * 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.8 + + COMPILE::JS + override public function addedToParent():void + { + super.addedToParent(); + + if(parent is FooterMiddleSection) + { + element.classList.remove(typeNames); + if(!Footer(parent).mini) + { + typeNames = "mdl-mega-footer__drop-down-section"; + } else + { + typeNames = "mdl-mini-footer__drop-down-section"; + } + element.classList.add(typeNames); + } + else + { + throw new Error("FooterDropDownSection can not be used if parent is not a MDL FooterMiddleSection component."); + } + }*/ + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ca2825e9/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 3387f45..9a61364 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 @@ -69,7 +69,7 @@ package org.apache.flex.mdl } /** - * Configuration depends on parent Footer. + * Configuration depends on parent Footer or IFooterSection. * Check to see if is mega or mini. * * @langversion 3.0 @@ -93,10 +93,13 @@ package org.apache.flex.mdl typeNames = "mdl-mini-footer__left-section"; } element.classList.add(typeNames); + } else if(parent is IFooterSection) + { + } else { - throw new Error("FooterLeftSection can not be used if parent is not a MDL Footer component."); + throw new Error("FooterLeftSection can not be used if parent is not a MDL Footer or IFooterSection component."); } } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ca2825e9/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterMiddleSection.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterMiddleSection.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterMiddleSection.as new file mode 100644 index 0000000..e09f657 --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterMiddleSection.as @@ -0,0 +1,103 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.core.ContainerBase; + import org.apache.flex.mdl.supportClasses.IFooterSection; + + COMPILE::JS + { + import org.apache.flex.core.WrappedHTMLElement; + } + + /** + * The FooterMiddleSection class is a Container component capable of parenting other + * components + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.8 + */ + public class FooterMiddleSection extends ContainerBase implements IFooterSection + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.8 + */ + public function FooterMiddleSection() + { + 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__middle-section"; + + element = document.createElement('div') as WrappedHTMLElement; + + positioner = element; + element.flexjs_wrapper = this; + + return element; + } + + /** + * 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.8 + */ + COMPILE::JS + override public function addedToParent():void + { + super.addedToParent(); + + if(parent is Footer) + { + element.classList.remove(typeNames); + if(!Footer(parent).mini) + { + typeNames = "mdl-mega-footer__middle-section"; + } else + { + typeNames = "mdl-mini-footer__middle-section"; + } + element.classList.add(typeNames); + } + else + { + throw new Error("FooterMiddleSection can not be used if parent is not a MDL Footer component."); + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ca2825e9/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 143d140..9c5c0bc 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 @@ -69,7 +69,7 @@ package org.apache.flex.mdl } /** - * Configuration depends on parent Footer. + * Configuration depends on parent Footer or IFooterSection. * Check to see if is mega or mini. * * @langversion 3.0 @@ -93,10 +93,13 @@ package org.apache.flex.mdl typeNames = "mdl-mini-footer__right-section"; } element.classList.add(typeNames); + } else if(parent is IFooterSection) + { + } else { - throw new Error("FooterRightSection can not be used if parent is not a MDL Footer component."); + throw new Error("FooterRightSection can not be used if parent is not a MDL Footer or IFooterSection component."); } } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ca2825e9/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 index c50fe7e..6f64b21 100644 --- 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 @@ -68,6 +68,29 @@ package org.apache.flex.mdl.itemRenderers _text = value; } + private var _href:String = "#"; + /** + * the link url + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.8 + */ + public function get href():String + { + return _href; + } + public function set href(value:String):void + { + _href = value; + + COMPILE::JS + { + (a as HTMLElement).setAttribute('href', value); + } + } + COMPILE::JS private var textNode:Text; @@ -101,8 +124,12 @@ package org.apache.flex.mdl.itemRenderers } } + COMPILE::JS + private var a:HTMLElement; + /** * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + * @flexjsignorecoercion HTMLElement * @flexjsignorecoercion Text */ COMPILE::JS @@ -110,10 +137,15 @@ package org.apache.flex.mdl.itemRenderers { element = document.createElement('li') as WrappedHTMLElement; + var a:HTMLElement = document.createElement('a') as HTMLElement; + a.setAttribute('href', href); + + element.appendChild(a); + if(MXMLDescriptor == null) { textNode = document.createTextNode('') as Text; - element.appendChild(textNode); + a.appendChild(textNode); } positioner = element; http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ca2825e9/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 007ea7d..9d64a07 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml +++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml @@ -104,6 +104,8 @@ <component id="Tabs" class="org.apache.flex.mdl.Tabs"/> <component id="MaterialIcon" class="org.apache.flex.mdl.materialIcons.MaterialIcon"/> <component id="Footer" class="org.apache.flex.mdl.Footer"/> + <component id="FooterMiddleSection" class="org.apache.flex.mdl.FooterMiddleSection"/> + <component id="FooterDropDownSection" class="org.apache.flex.mdl.FooterDropDownSection"/> <component id="FooterLeftSection" class="org.apache.flex.mdl.FooterLeftSection"/> <component id="FooterRightSection" class="org.apache.flex.mdl.FooterRightSection"/> <component id="FooterTopSection" class="org.apache.flex.mdl.FooterTopSection"/>
