Refactor to ButtonBase to avoid carry CSS styles
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/ba5187ae Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/ba5187ae Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/ba5187ae Branch: refs/heads/refactor-sprite Commit: ba5187ae183746882d2617f1c91ac148b08274bc Parents: 533016f Author: Carlos Rovira <carlosrov...@apache.org> Authored: Wed Oct 19 10:30:15 2016 +0200 Committer: Carlos Rovira <carlosrov...@apache.org> Committed: Wed Oct 19 10:30:15 2016 +0200 ---------------------------------------------------------------------- .../main/flex/org/apache/flex/html/Button.as | 29 +----- .../flex/org/apache/flex/html/ButtonBase.as | 101 +++++++++++++++++++ .../flex/org/apache/flex/html/TextButton.as | 2 +- 3 files changed, 103 insertions(+), 29 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ba5187ae/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Button.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Button.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Button.as index f6d13ea..6057919 100644 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Button.as +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/Button.as @@ -66,8 +66,7 @@ package org.apache.flex.html * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - COMPILE::SWF - public class Button extends UIButtonBase implements IStrand, IEventDispatcher, IUIBase + public class Button extends ButtonBase { /** * Constructor. @@ -83,30 +82,4 @@ package org.apache.flex.html } } - COMPILE::JS - public class Button extends UIBase implements IStrand, IEventDispatcher, IUIBase - { - /** - * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement - */ - override protected function createElement():WrappedHTMLElement - { - element = document.createElement('button') as WrappedHTMLElement; - element.setAttribute('type', 'button'); - - positioner = element; - positioner.style.position = 'relative'; - element.flexjs_wrapper = this; - - /* AJH comment out until we figure out why it is needed - if (org.apache.flex.core.ValuesManager.valuesImpl.getValue) { - var impl:Object = org.apache.flex.core.ValuesManager.valuesImpl. - getValue(this, 'iStatesImpl'); - }*/ - - return element; - } - - } - } http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ba5187ae/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ButtonBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ButtonBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ButtonBase.as new file mode 100644 index 0000000..a30f0cf --- /dev/null +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/ButtonBase.as @@ -0,0 +1,101 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +{ + import org.apache.flex.core.IStrand; + import org.apache.flex.core.IUIBase; + COMPILE::SWF + { + import org.apache.flex.core.UIButtonBase; + } + COMPILE::JS + { + import org.apache.flex.core.UIBase; + import org.apache.flex.core.WrappedHTMLElement; + } + import org.apache.flex.core.ValuesManager; + import org.apache.flex.events.IEventDispatcher; + + + //-------------------------------------- + // Events + //-------------------------------------- + + /** + * Dispatched when the user clicks on a button. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Event(name="click", type="org.apache.flex.events.MouseEvent")] + + /** + * The ButtonBase class is the base class for Button. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + COMPILE::SWF + public class ButtonBase extends UIButtonBase implements IStrand, IEventDispatcher, IUIBase + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ButtonBase() + { + super(); + } + } + + COMPILE::JS + public class ButtonBase extends UIBase implements IStrand, IEventDispatcher, IUIBase + { + /** + * @flexjsignorecoercion org.apache.flex.core.WrappedHTMLElement + */ + override protected function createElement():WrappedHTMLElement + { + element = document.createElement('button') as WrappedHTMLElement; + element.setAttribute('type', 'button'); + + positioner = element; + positioner.style.position = 'relative'; + element.flexjs_wrapper = this; + + /* AJH comment out until we figure out why it is needed + if (org.apache.flex.core.ValuesManager.valuesImpl.getValue) { + var impl:Object = org.apache.flex.core.ValuesManager.valuesImpl. + getValue(this, 'iStatesImpl'); + }*/ + + return element; + } + + } + +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/ba5187ae/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TextButton.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TextButton.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TextButton.as index b2997c2..a08c9b3 100644 --- a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TextButton.as +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/TextButton.as @@ -35,7 +35,7 @@ package org.apache.flex.html * @playerversion AIR 2.6 * @productversion FlexJS 0.0 */ - public class TextButton extends Button + public class TextButton extends ButtonBase { /** * Constructor.