Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 318E8200BD7 for ; Sun, 6 Nov 2016 02:30:24 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 3068D160B14; Sun, 6 Nov 2016 01:30:24 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D4A6A160B09 for ; Sun, 6 Nov 2016 02:30:22 +0100 (CET) Received: (qmail 13581 invoked by uid 500); 6 Nov 2016 01:30:18 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 13227 invoked by uid 99); 6 Nov 2016 01:30:18 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 06 Nov 2016 01:30:18 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id EDE8BF159D; Sun, 6 Nov 2016 01:30:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: carlosrovira@apache.org To: commits@flex.apache.org Date: Sun, 06 Nov 2016 01:30:54 -0000 Message-Id: <15faf12088f34eb8a9a87a3fa11e0b45@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [38/41] git commit: [flex-asjs] [refs/heads/feature/mdl] - Refactor Badge archived-at: Sun, 06 Nov 2016 01:30:24 -0000 Refactor Badge Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/fe775c6c Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/fe775c6c Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/fe775c6c Branch: refs/heads/feature/mdl Commit: fe775c6cbf1f36b4a663fff97eaf284384a42da8 Parents: d815c24 Author: Carlos Rovira Authored: Fri Nov 4 12:14:52 2016 +0100 Committer: Carlos Rovira Committed: Sun Nov 6 02:28:52 2016 +0100 ---------------------------------------------------------------------- .../flexjs/MDLExample/src/main/flex/App.mxml | 16 +- .../src/main/flex/org/apache/flex/mdl/Badge.as | 233 ------------------- .../src/main/flex/org/apache/flex/mdl/Link.as | 137 +++++++++++ .../flex/org/apache/flex/mdl/beads/Badge.as | 157 +++++++++++++ .../org/apache/flex/mdl/beads/BadgeEffect.as | 121 ---------- .../flex/org/apache/flex/mdl/beads/Disabled.as | 2 +- .../src/main/resources/mdl-manifest.xml | 4 +- 7 files changed, 307 insertions(+), 363 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fe775c6c/examples/flexjs/MDLExample/src/main/flex/App.mxml ---------------------------------------------------------------------- diff --git a/examples/flexjs/MDLExample/src/main/flex/App.mxml b/examples/flexjs/MDLExample/src/main/flex/App.mxml index 111deed..abece5f 100644 --- a/examples/flexjs/MDLExample/src/main/flex/App.mxml +++ b/examples/flexjs/MDLExample/src/main/flex/App.mxml @@ -109,13 +109,17 @@ limitations under the License. - + - + - + - + + + + + @@ -129,7 +133,7 @@ limitations under the License. - + @@ -137,7 +141,7 @@ limitations under the License. - + http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fe775c6c/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Badge.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Badge.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Badge.as deleted file mode 100644 index fa4ffd1..0000000 --- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Badge.as +++ /dev/null @@ -1,233 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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.UIBase; - - COMPILE::JS - { - import org.apache.flex.core.WrappedHTMLElement; - } - - /** - * The Badge class provides a MDL UI-like appearance for a badge. - * A Badge is an onscreen notification element consists of a small circle, - * typically containing a number or other characters, that appears in - * proximity to another object - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class Badge extends UIBase - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function Badge() - { - super(); - } - - private var _type:Number = 0; - public static const LINK_TYPE:Number = 0; - public static const TEXT_TYPE:Number = 1; - public static const CONTAINER_TYPE:Number = 2; - - /** - * the type of badge - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get type():Number - { - return _type; - } - - public function set type(value:Number):void - { - _type = value; - - COMPILE::JS - { - if(value == LINK_TYPE) - { - var link:HTMLElement = document.createElement('a') as HTMLElement; - link.setAttribute('href', linkUrl); - link.setAttribute('data-badge', dataBadge); - link.appendChild(textNode); - link.className = 'mdl-badge'; - - element.parentNode.replaceChild(link, element); - - - element = link as WrappedHTMLElement; - } - else if(value == TEXT_TYPE) - { - var span:HTMLSpanElement = document.createElement('span') as HTMLSpanElement; - span.setAttribute('data-badge', dataBadge); - span.appendChild(textNode); - span.className = 'mdl-badge'; - - element.parentNode.replaceChild(span, element); - - element = span as WrappedHTMLElement; - } - else if(value == CONTAINER_TYPE) - { - var div:HTMLDivElement = document.createElement('div') as HTMLDivElement; - div.setAttribute('data-badge', dataBadge); - div.appendChild(textNode); - div.className = 'mdl-badge material-icons'; - - element.parentNode.replaceChild(div, element); - - element = div as WrappedHTMLElement; - } - - positioner = element; - positioner.style.position = 'relative'; - element.flexjs_wrapper = this; - - } - } - - private var _text:String = ""; - - /** - * The text of the link - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get text():String - { - COMPILE::SWF - { - return _text; - } - COMPILE::JS - { - return textNode.nodeValue; - } - } - - public function set text(value:String):void - { - COMPILE::SWF - { - _text = value; - } - COMPILE::JS - { - textNode.nodeValue = value; - } - } - - private var _linkUrl:String = "#"; - - /** - * the link url - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get linkUrl():String - { - return _linkUrl; - } - - public function set linkUrl(value:String):void - { - _linkUrl = value; - - COMPILE::JS - { - (element as HTMLElement).setAttribute('href', value); - } - } - - - private var _dataBadge:Number = 0; - - /** - * The current value of the Badge that appers inside the circle. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get dataBadge():Number - { - return _dataBadge; - } - public function set dataBadge(value:Number):void - { - _dataBadge = value; - - COMPILE::JS - { - (element as HTMLElement).setAttribute('data-badge', _dataBadge.toString()); - } - } - - COMPILE::JS - private var textNode:Text; - - /** - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - * @flexjsignorecoercion HTMLElement - */ - COMPILE::JS - override protected function createElement():WrappedHTMLElement - { - var a:HTMLElement = document.createElement('a') as HTMLElement; - a.setAttribute('href', linkUrl); - a.setAttribute('data-badge', dataBadge); - - textNode = document.createTextNode('') as Text; - a.appendChild(textNode); - - element = a as WrappedHTMLElement; - - positioner = element; - positioner.style.position = 'relative'; - element.flexjs_wrapper = this; - - className = typeNames = 'mdl-badge'; - - return element; - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fe775c6c/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Link.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Link.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Link.as new file mode 100644 index 0000000..b74f7cc --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/Link.as @@ -0,0 +1,137 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.UIBase; + + COMPILE::JS + { + import org.apache.flex.core.WrappedHTMLElement; + } + + /** + * The Link class + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class Link extends UIBase + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function Link() + { + super(); + } + + private var _text:String = ""; + + /** + * The text of the link + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get text():String + { + COMPILE::SWF + { + return _text; + } + COMPILE::JS + { + return textNode.nodeValue; + } + } + + public function set text(value:String):void + { + COMPILE::SWF + { + _text = value; + } + COMPILE::JS + { + textNode.nodeValue = value; + } + } + + private var _linkUrl:String = "#"; + + /** + * the link url + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get linkUrl():String + { + return _linkUrl; + } + + public function set linkUrl(value:String):void + { + _linkUrl = value; + + COMPILE::JS + { + (element as HTMLElement).setAttribute('href', value); + } + } + + COMPILE::JS + private var textNode:Text; + + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + * @flexjsignorecoercion HTMLElement + */ + COMPILE::JS + override protected function createElement():WrappedHTMLElement + { + var a:HTMLElement = document.createElement('a') as HTMLElement; + a.setAttribute('href', linkUrl); + + textNode = document.createTextNode('') as Text; + a.appendChild(textNode); + + element = a as WrappedHTMLElement; + + positioner = element; + positioner.style.position = 'relative'; + element.flexjs_wrapper = this; + + //className = typeNames = 'Link'; + + return element; + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fe775c6c/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Badge.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Badge.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Badge.as new file mode 100644 index 0000000..02fdfe6 --- /dev/null +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Badge.as @@ -0,0 +1,157 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.IStrand; + import org.apache.flex.core.IBead; + import org.apache.flex.core.UIBase; + + + /** + * The Badge class provides a MDL UI-like appearance for a badge. + * A Badge is an onscreen notification element consists of a small circle, + * typically containing a number or other characters, that appears in + * proximity to another object + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class Badge implements IBead + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function Badge() + { + } + + private var _dataBadge:Number = 0; + + /** + * The current value of the Badge that appers inside the circle. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get dataBadge():Number + { + return _dataBadge; + } + public function set dataBadge(value:Number):void + { + _dataBadge = value; + } + + private var _noBackground:String = ""; + /** + * A boolean flag to activate "mdl-badge--no-background" effect selector. + * Applies open-circle effect to badge + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get noBackground():Boolean + { + return _noBackground; + } + public function set noBackground(value:Boolean):void + { + if(value) { + _noBackground = " mdl-badge--no-background"; + } else { + _noBackground = ""; + } + } + + private var _overlap:String = ""; + /** + * A boolean flag to activate "mdl-badge--overlap" effect selector. + * Make the badge overlap with its container + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get overlap():Boolean + { + return _overlap; + } + public function set overlap(value:Boolean):void + { + if(value) { + _overlap = " mdl-badge--overlap"; + } else { + _overlap = ""; + } + } + + 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 + * @flexjsignorecoercion org.apache.flex.mdl.TextInput; + */ + public function set strand(value:IStrand):void + { + _strand = value; + + COMPILE::JS + { + var host:UIBase = value as UIBase; + + if (host.element is HTMLSpanElement) + { + var span:HTMLSpanElement = host.element as HTMLSpanElement; + span.className = "mdl-badge " + _noBackground + _overlap; + span.setAttribute('data-badge', _dataBadge.toString()); + } else if (host.element is HTMLDivElement) + { + var div:HTMLDivElement = host.element as HTMLDivElement; + div.className = "mdl-badge " + _noBackground + _overlap; + div.setAttribute('data-badge', _dataBadge.toString()); + } else if (host.element is HTMLElement) + { + var a:HTMLElement = host.element as HTMLElement; + a.className = "mdl-badge " + _noBackground + _overlap; + a.setAttribute('data-badge', _dataBadge.toString()); + } else + { + throw new Error("Host component must be an MDL Host for Badges."); + } + } + } + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fe775c6c/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/BadgeEffect.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/BadgeEffect.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/BadgeEffect.as deleted file mode 100644 index 0cc62a8..0000000 --- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/BadgeEffect.as +++ /dev/null @@ -1,121 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// 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.IStrand; - import org.apache.flex.core.IBead; - import org.apache.flex.mdl.Badge; - - - /** - * The BadgeEffect class is a specialty bead that can be used with - * a MDL Badge control to apply some MDL complementary effect. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class BadgeEffect implements IBead - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function BadgeEffect() - { - } - - private var _noBackground:String = ""; - /** - * A boolean flag to activate "mdl-badge--no-background" effect selector. - * Applies open-circle effect to badge - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get noBackground():Boolean - { - return _noBackground; - } - public function set noBackground(value:Boolean):void - { - if(value) { - _noBackground = " mdl-badge--no-background"; - } else { - _noBackground = ""; - } - } - - private var _overlap:String = ""; - /** - * A boolean flag to activate "mdl-badge--overlap" effect selector. - * Make the badge overlap with its container - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get overlap():Boolean - { - return _overlap; - } - public function set overlap(value:Boolean):void - { - if(value) { - _overlap = " mdl-badge--overlap"; - } else { - _overlap = ""; - } - } - - 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 - * @flexjsignorecoercion org.apache.flex.mdl.TextInput; - */ - public function set strand(value:IStrand):void - { - _strand = value; - - COMPILE::JS - { - if (value is Badge) { - var badge:Badge = value as Badge; - badge.className = _noBackground + _overlap; - } else { - throw new Error("Host component must be an MDL Badge."); - } - } - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fe775c6c/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Disabled.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Disabled.as b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Disabled.as index fcec373..72861ba 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Disabled.as +++ b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/Disabled.as @@ -87,7 +87,7 @@ package org.apache.flex.mdl.beads //if (host.element is HTMLInputElement) //{ input = host.element as HTMLInputElement; - //input.disabled = _disabled ? "disabled" : ""; + input.disabled = "disabled"; //} else //{ // throw new Error("Host element component in not type input"); http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/fe775c6c/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 5fc8294..6ed3618 100644 --- a/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml +++ b/frameworks/projects/MaterialDesignLite/src/main/resources/mdl-manifest.xml @@ -31,8 +31,8 @@ - - + +