Reverted changes to PasswordInputBead and added subclass
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/115194ec Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/115194ec Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/115194ec Branch: refs/heads/tlf Commit: 115194ec247e73ffdc635b47efb6e491935afc3d Parents: d78243e Author: Harbs <ha...@in-tools.com> Authored: Thu Jun 8 09:25:05 2017 +0300 Committer: Harbs <ha...@in-tools.com> Committed: Thu Jun 8 09:25:05 2017 +0300 ---------------------------------------------------------------------- .../flex/html/accessories/PasswordInputBead.as | 22 ++---- .../accessories/PasswordInputRemovableBead.as | 75 ++++++++++++++++++++ 2 files changed, 81 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/115194ec/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/PasswordInputBead.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/PasswordInputBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/PasswordInputBead.as index 8e47222..7bbaf8d 100644 --- a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/PasswordInputBead.as +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/PasswordInputBead.as @@ -56,7 +56,7 @@ package org.apache.flex.html.accessories { } - private var _strand:IStrand; + protected var _strand:IStrand; /** * @copy org.apache.flex.core.IBead#strand @@ -68,27 +68,17 @@ package org.apache.flex.html.accessories */ public function set strand(value:IStrand):void { + _strand = value; + COMPILE::SWF { - _strand = value; IEventDispatcher(value).addEventListener("viewChanged",viewChangeHandler); } COMPILE::JS { - var host:UIBase; - var e:HTMLInputElement; - - if (value !== null) { - host = value as UIBase; - e = host.element as HTMLInputElement; - e.type = 'password'; - } - else { - host = _strand as UIBase; - e = host.element as HTMLInputElement; - e.type = 'text'; - } - _strand = value; + var host:UIBase = value as UIBase; + var e:HTMLInputElement = host.element as HTMLInputElement; + e.type = 'password'; } } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/115194ec/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/PasswordInputRemovableBead.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/PasswordInputRemovableBead.as b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/PasswordInputRemovableBead.as new file mode 100644 index 0000000..de191d3 --- /dev/null +++ b/frameworks/projects/Basic/src/main/flex/org/apache/flex/html/accessories/PasswordInputRemovableBead.as @@ -0,0 +1,75 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.html.accessories +{ + import org.apache.flex.core.IStrand; + import org.apache.flex.core.UIBase; + import org.apache.flex.events.Event; + import org.apache.flex.events.IEventDispatcher; + + /** + * The PasswordInput class is a specialty bead that can be used with + * any TextInput control. The bead secures the text input area by masking + * the input as it is typed. + * PasswordInputRemovableBead adds the ability to remove the functionality at runtime. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class PasswordInputRemovableBead extends PasswordInputBead + { + /** + * constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function PasswordInputRemovableBead() + { + } + + /** + * @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.core.UIBase + * @flexjsignorecoercion HTMLInputElement + */ + COMPILE::JS + override public function set strand(value:IStrand):void + { + if(value) + super.strand = value; + else + { + var host:UIBase = _strand as UIBase; + var e:HTMLInputElement = host.element as HTMLInputElement; + e.type = 'text'; + _strand = value; + } + } + } +}