Footer initial components. Support mega and mini Footers in the same component
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/a115c718 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/a115c718 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/a115c718 Branch: refs/heads/feature/fontawesome Commit: a115c718121e013d3a9a7d4be82a953fdd0659f2 Parents: 87d4a9d Author: Carlos Rovira <[email protected]> Authored: Wed Jan 4 01:22:13 2017 +0100 Committer: Carlos Rovira <[email protected]> Committed: Wed Jan 4 01:22:13 2017 +0100 ---------------------------------------------------------------------- .../src/main/flex/MainNavigation.mxml | 8 ++ .../src/main/flex/org/apache/flex/mdl/Footer.as | 106 ++++++++++++++++++ .../org/apache/flex/mdl/FooterLeftSection.as | 107 +++++++++++++++++++ .../org/apache/flex/mdl/FooterRightSection.as | 107 +++++++++++++++++++ .../src/main/resources/mdl-manifest.xml | 3 + 5 files changed, 331 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a115c718/examples/flexjs/MDLExample/src/main/flex/MainNavigation.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MDLExample/src/main/flex/MainNavigation.mxml b/examples/flexjs/MDLExample/src/main/flex/MainNavigation.mxml index ee1a583..d32f555 100644 --- a/examples/flexjs/MDLExample/src/main/flex/MainNavigation.mxml +++ b/examples/flexjs/MDLExample/src/main/flex/MainNavigation.mxml @@ -119,4 +119,12 @@ limitations under the License. </mdl:TabBarPanel> </mdl:NavigationLayoutContent> + + <mdl:Footer mini="true"> + <mdl:FooterLeftSection> + </mdl:FooterLeftSection> + + <mdl:FooterRightSection> + </mdl:FooterRightSection> + </mdl:Footer> </mdl:NavigationLayout> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a115c718/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Footer.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Footer.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Footer.as new file mode 100644 index 0000000..43ec122 --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Footer.as @@ -0,0 +1,106 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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; + + COMPILE::JS + { + import org.apache.flex.core.WrappedHTMLElement; + } + + /** + * The Footer class is a Container component capable of parenting other + * components + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class Footer extends ContainerBase + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function Footer() + { + 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"; + + element = document.createElement('footer') 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; + } + + protected var _mini:Boolean = false; + /** + * A boolean flag to activate "mdl-mega-footer" or "mdl-mini-footer" effect selector. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get mini():Boolean + { + return _mini; + } + public function set mini(value:Boolean):void + { + _mini = value; + + COMPILE::JS + { + element.classList.remove(typeNames); + if(!_mini) + { + typeNames = "mdl-mega-footer"; + } else + { + typeNames = "mdl-mini-footer"; + } + element.classList.add(typeNames); + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a115c718/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 new file mode 100644 index 0000000..0131020 --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterLeftSection.as @@ -0,0 +1,107 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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; + + COMPILE::JS + { + import org.apache.flex.core.WrappedHTMLElement; + } + + /** + * The FooterLeftSection class is a Container component capable of parenting other + * components + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class FooterLeftSection extends ContainerBase + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function FooterLeftSection() + { + 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__left-section"; + + 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; + } + + /** + * 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 Footer) + { + element.classList.remove(typeNames); + if(!Footer(parent).mini) + { + typeNames = "mdl-mega-footer__left-section"; + } else + { + typeNames = "mdl-mini-footer__left-section"; + } + element.classList.add(typeNames); + } + else + { + throw new Error("FooterLeftSection can not be used if parent is not a MDL Footer component."); + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a115c718/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 new file mode 100644 index 0000000..9902e9e --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/FooterRightSection.as @@ -0,0 +1,107 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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; + + COMPILE::JS + { + import org.apache.flex.core.WrappedHTMLElement; + } + + /** + * The FooterRightSection class is a Container component capable of parenting other + * components + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class FooterRightSection extends ContainerBase + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function FooterRightSection() + { + 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__right-section"; + + 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; + } + + /** + * 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 Footer) + { + element.classList.remove(typeNames); + if(!Footer(parent).mini) + { + typeNames = "mdl-mega-footer__right-section"; + } else + { + typeNames = "mdl-mini-footer__right-section"; + } + element.classList.add(typeNames); + } + else + { + throw new Error("FooterRightSection can not be used if parent is not a MDL Footer component."); + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/a115c718/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 7bbbc32..a060fa1 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml +++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml @@ -85,6 +85,9 @@ <component id="Toast" class="org.apache.flex.mdl.Toast"/> <component id="SnackbarModel" class="org.apache.flex.mdl.beads.models.SnackbarModel"/> <component id="Snackbar" class="org.apache.flex.mdl.Snackbar"/> + <component id="Footer" class="org.apache.flex.mdl.Footer"/> + <component id="FooterLeftSection" class="org.apache.flex.mdl.FooterLeftSection"/> + <component id="FooterRightSection" class="org.apache.flex.mdl.FooterRightSection"/> <component id="MaterialIconCancel" class="org.apache.flex.mdl.materialIcons.MaterialIconCancel"/> <component id="MaterialIconAdd" class="org.apache.flex.mdl.materialIcons.MaterialIconAdd"/>
