This is an automated email from the ASF dual-hosted git repository. carlosrovira pushed a commit to branch feature/themes in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 984fa7a9ef668a77bd9d2cad01be472dbc8de9a7 Author: Carlos Rovira <carlosrov...@apache.org> AuthorDate: Sat Feb 10 19:39:18 2018 +0100 change components to extend Basic and remove dead code --- .../royale/VividExample/src/main/royale/App.mxml | 3 +- .../src/main/royale/ButtonPlayGround.mxml | 3 +- .../projects/Vivid/src/main/resources/defaults.css | 24 +- .../Vivid/src/main/resources/vivid-manifest.xml | 5 +- .../projects/Vivid/src/main/royale/VividClasses.as | 6 +- .../royale/org/apache/royale/vivid/Application.as | 5 + .../main/royale/org/apache/royale/vivid/Button.as | 296 -------------------- .../main/royale/org/apache/royale/vivid/Slider.as | 130 +-------- .../royale/vivid/{Application.as => TextButton.as} | 64 +++-- .../royale/org/apache/royale/vivid/TextInput.as | 125 +-------- .../beads/controllers/HSliderMouseController.as | 307 --------------------- .../beads/controllers/VSliderMouseController.as | 291 ------------------- .../vivid/beads/layouts/HorizontalSliderLayout.as | 138 --------- .../vivid/beads/layouts/VerticalSliderLayout.as | 137 --------- 14 files changed, 63 insertions(+), 1471 deletions(-) diff --git a/examples/royale/VividExample/src/main/royale/App.mxml b/examples/royale/VividExample/src/main/royale/App.mxml index 5a1c3f3..dd98eaa 100644 --- a/examples/royale/VividExample/src/main/royale/App.mxml +++ b/examples/royale/VividExample/src/main/royale/App.mxml @@ -21,7 +21,7 @@ <v:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:v="library://ns.apache.org/royale/vivid" xmlns:js="library://ns.apache.org/royale/basic" - xmlns:local="*"> + xmlns:local="*"> <fx:Style source="../../main/resources/vivid-example-styles.css"/> @@ -35,7 +35,6 @@ </js:beads> <local:ButtonPlayGround/> <local:TextInputPlayGround/> - </js:View> </js:initialView> </v:Application> diff --git a/examples/royale/VividExample/src/main/royale/ButtonPlayGround.mxml b/examples/royale/VividExample/src/main/royale/ButtonPlayGround.mxml index 2384a99..1c95229 100644 --- a/examples/royale/VividExample/src/main/royale/ButtonPlayGround.mxml +++ b/examples/royale/VividExample/src/main/royale/ButtonPlayGround.mxml @@ -34,8 +34,7 @@ limitations under the License. <js:VerticalLayout/> </js:beads> - <v:Button id="button" text="Button" width="120" height="40"/> - <v:Button id="button2" text="Button2" width="120" height="40"/> + <v:TextButton id="button" text="Button" width="120" height="40"/> <v:Slider id="slider" width="250" value="120" minimum="50" maximum="250" valueChange="onValueChange(event)"/> diff --git a/frameworks/projects/Vivid/src/main/resources/defaults.css b/frameworks/projects/Vivid/src/main/resources/defaults.css index 334bcd6..fc0ee8c 100644 --- a/frameworks/projects/Vivid/src/main/resources/defaults.css +++ b/frameworks/projects/Vivid/src/main/resources/defaults.css @@ -24,35 +24,37 @@ * Vivid TextButton */ -Button { +TextButton { /* Background: */ - background: #D8D8D8; + background-color: #D8D8D8; border: 1px solid #979797; border-radius: 3px; /* TextField: */ - font-family: HelveticaNeue; - font-size: 12px; + font-family: 'Lato', sans-serif; + font-size: 13px; color: #646D7A; } -Button:hover { +TextButton:hover { background-color: #CFCFCF; vertical-align: middle; border: none; border-radius: 6px; } -Button:active { +TextButton:active { background-color: #77CEFF; color: #FFFFFF; } TextInput { - border: 1px solid #808080; - border-radius: 2px; - padding: 4px; + font-family: 'Lato', sans-serif; + font-size: 13px; + border: 1px solid #000; + border-radius: 0px; + padding: 0px; margin: 0px; } @@ -62,8 +64,8 @@ TextInput Slider { IBeadModel: ClassReference("org.apache.royale.html.beads.models.RangeModel"); IBeadView: ClassReference("org.apache.royale.vivid.beads.SliderView"); - IBeadLayout: ClassReference("org.apache.royale.vivid.beads.layouts.HorizontalSliderLayout"); - IBeadController: ClassReference("org.apache.royale.vivid.beads.controllers.HSliderMouseController"); + IBeadLayout: ClassReference("org.apache.royale.html.beads.layouts.HorizontalSliderLayout"); + IBeadController: ClassReference("org.apache.royale.html.beads.controllers.HSliderMouseController"); position: relative; } .SliderTrack { diff --git a/frameworks/projects/Vivid/src/main/resources/vivid-manifest.xml b/frameworks/projects/Vivid/src/main/resources/vivid-manifest.xml index 125542a..57d7e1c 100644 --- a/frameworks/projects/Vivid/src/main/resources/vivid-manifest.xml +++ b/frameworks/projects/Vivid/src/main/resources/vivid-manifest.xml @@ -22,11 +22,8 @@ <componentPackage> <component id="Application" class="org.apache.royale.vivid.Application"/> - <component id="Button" class="org.apache.royale.vivid.Button"/> + <component id="TextButton" class="org.apache.royale.vivid.TextButton"/> <component id="TextInput" class="org.apache.royale.vivid.TextInput"/> <component id="Slider" class="org.apache.royale.vivid.Slider"/> - <component id="VerticalSliderLayout" class="org.apache.royale.vivid.beads.layouts.VerticalSliderLayout" /> - <component id="HorizontalSliderLayout" class="org.apache.royale.vivid.beads.layouts.HorizontalSliderLayout" /> - </componentPackage> diff --git a/frameworks/projects/Vivid/src/main/royale/VividClasses.as b/frameworks/projects/Vivid/src/main/royale/VividClasses.as index 460187a..a069ba8 100644 --- a/frameworks/projects/Vivid/src/main/royale/VividClasses.as +++ b/frameworks/projects/Vivid/src/main/royale/VividClasses.as @@ -28,11 +28,7 @@ package internal class VividClasses { import org.apache.royale.vivid.beads.SliderView; SliderView; - import org.apache.royale.vivid.beads.layouts.HorizontalSliderLayout; HorizontalSliderLayout; - import org.apache.royale.vivid.beads.layouts.VerticalSliderLayout; VerticalSliderLayout; - import org.apache.royale.vivid.beads.controllers.HSliderMouseController; HSliderMouseController; - import org.apache.royale.vivid.beads.controllers.VSliderMouseController; VSliderMouseController; - + COMPILE::SWF { import org.apache.royale.vivid.beads.SliderThumbView; SliderThumbView; diff --git a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/Application.as b/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/Application.as index 4f13beb..6246c99 100644 --- a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/Application.as +++ b/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/Application.as @@ -27,6 +27,7 @@ package org.apache.royale.vivid * This class extends the standard Application and sets up the * SimpleCSSValuesImpl (implementation) for convenience. * + * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 @@ -37,6 +38,10 @@ package org.apache.royale.vivid /** * constructor. * + * <inject_html> + * <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet"> + * </inject_html> + * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 diff --git a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/Button.as b/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/Button.as deleted file mode 100644 index 1fdb61d..0000000 --- a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/Button.as +++ /dev/null @@ -1,296 +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.royale.vivid -{ - import org.apache.royale.html.TextButton; - - COMPILE::JS - { - import org.apache.royale.core.WrappedHTMLElement; - import org.apache.royale.html.util.addElementToWrapper; - } - - /** - * The Button class provides a Vivid Design Library UI-like appearance for - * a Button. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9.2 - */ - public class Button extends TextButton - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9.2 - */ - public function Button() - { - super(); - - className = ""; //set to empty string avoid 'undefined' output when no class selector is assigned by user; - } - - /** - * @private - * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement - */ - COMPILE::JS - override protected function createElement():WrappedHTMLElement - { - //typeNames = ""; - - return addElementToWrapper(this,'button'); - } - - //private var _materialIcon:IMaterialIcon; - /** - * A material icon to use with the button. - * Optional - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.8 - */ - /*public function get materialIcon():IMaterialIcon - { - return _materialIcon; - } - public function set materialIcon(value:IMaterialIcon):void - { - _materialIcon = value; - - COMPILE::JS - { - addElement(_materialIcon); - } - }*/ - - //private var _fab:Boolean = false; - /** - * A boolean flag to activate "mdl-button--fab" effect selector. - * Applies fab (circular) display effect. Mutually exclusive with raised, mini-fab, and icon. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.8 - */ - /*public function get fab():Boolean - { - return _fab; - } - public function set fab(value:Boolean):void - { - _fab = value; - - COMPILE::JS - { - element.classList.toggle("mdl-button--fab", _fab); - typeNames = element.className; - } - }*/ - - //private var _raised:Boolean = false; - /** - * A boolean flag to activate "mdl-button--raised" effect selector. - * Applies raised display effect. Mutually exclusive with fab, mini-fab, and icon. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.8 - */ - /*public function get raised():Boolean - { - return _raised; - } - public function set raised(value:Boolean):void - { - _raised = value; - - COMPILE::JS - { - element.classList.toggle("mdl-button--raised", _raised); - typeNames = element.className; - } - }*/ - - //private var _colored:Boolean = false; - /** - * A boolean flag to activate "mdl-button--colored" effect selector. - * Applies colored display effect (primary or accent color, depending on the type of button). - * Colors are defined in material.min.css - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.8 - */ - /*public function get colored():Boolean - { - return _colored; - } - public function set colored(value:Boolean):void - { - _colored = value; - - COMPILE::JS - { - element.classList.toggle("mdl-button--colored", _colored); - typeNames = element.className; - } - }*/ - - //private var _accent:Boolean = false; - /** - * A boolean flag to activate "mdl-button--accent" effect selector. - * Applies accent color display effect. - * Colors are defined in material.min.css. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.8 - */ - /*public function get accent():Boolean - { - return _accent; - } - public function set accent(value:Boolean):void - { - _accent = value; - - COMPILE::JS - { - element.classList.toggle("mdl-button--accent", _accent); - typeNames = element.className; - } - }*/ - - //private var _primary:Boolean = false; - /** - * A boolean flag to activate "mdl-button--primary" effect selector. - * Applies primary color display effect. - * Colors are defined in material.min.css - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.8 - */ - /*public function get primary():Boolean - { - return _primary; - } - public function set primary(value:Boolean):void - { - _primary = value; - - COMPILE::JS - { - element.classList.toggle("mdl-button--primary", _primary); - typeNames = element.className; - } - }*/ - - //private var _minifab:Boolean = false; - /** - * A boolean flag to activate "mdl-button--mini-fab" effect selector. - * Applies mini-fab (small fab circular) display effect. - * Mutually exclusive with raised, fab, and icon - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.8 - */ - /*public function get minifab():Boolean - { - return _minifab; - } - public function set minifab(value:Boolean):void - { - _minifab = value; - - COMPILE::JS - { - element.classList.toggle("mdl-button--mini-fab", _minifab); - typeNames = element.className; - } - }*/ - - //private var _icon:Boolean = false; - /** - * A boolean flag to activate "mdl-button--icon" effect selector. - * Applies icon (small plain circular) display effect. - * Mutually exclusive with raised, fab, and mini-fab - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.8 - */ - /*public function get icon():Boolean - { - return _icon; - } - public function set icon(value:Boolean):void - { - _icon = value; - - COMPILE::JS - { - element.classList.toggle("mdl-button--icon", _icon); - typeNames = element.className; - } - }*/ - - //protected var _ripple:Boolean = false; - /** - * A boolean flag to activate "mdl-js-ripple-effect" effect selector. - * Applies ripple click effect. May be used in combination with any other classes - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.8 - */ - /*public function get ripple():Boolean - { - return _ripple; - } - public function set ripple(value:Boolean):void - { - _ripple = value; - - COMPILE::JS - { - element.classList.toggle("mdl-js-ripple-effect", _ripple); - typeNames = element.className; - } - }*/ - } -} diff --git a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/Slider.as b/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/Slider.as index 858ad31..3b47dfa 100644 --- a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/Slider.as +++ b/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/Slider.as @@ -18,13 +18,11 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.royale.vivid { - import org.apache.royale.core.IRangeModel; - import org.apache.royale.core.UIBase; + import org.apache.royale.html.Slider; COMPILE::JS { import org.apache.royale.core.WrappedHTMLElement; - import org.apache.royale.html.util.addElementToWrapper; } [Event(name="valueChange", type="org.apache.royale.events.Event")] @@ -45,7 +43,7 @@ package org.apache.royale.vivid * @playerversion AIR 2.6 * @productversion Royale 0.9.2 */ - public class Slider extends UIBase + public class Slider extends org.apache.royale.html.Slider { /** * constructor. @@ -58,103 +56,9 @@ package org.apache.royale.vivid public function Slider() { super(); - - className = "Slider"; - - IRangeModel(model).value = 0; - IRangeModel(model).minimum = 0; - IRangeModel(model).maximum = 100; - IRangeModel(model).stepSize = 1; - IRangeModel(model).snapInterval = 1; - } - - /** - * The current value of the Slider. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.0 - */ - [Bindable("valueChange")] - public function get value():Number - { - return IRangeModel(model).value; - } - public function set value(newValue:Number):void - { - IRangeModel(model).value = newValue; } - /** - * The minimum value of the Slider. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.0 - */ - public function get minimum():Number - { - return IRangeModel(model).minimum; - } - public function set minimum(value:Number):void - { - IRangeModel(model).minimum = value; - } - - /** - * The maximum value of the Slider. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.0 - */ - public function get maximum():Number - { - return IRangeModel(model).maximum; - } - public function set maximum(value:Number):void - { - IRangeModel(model).maximum = value; - } - - /** - * The modulus of the Slider value. The thumb will be positioned - * at the nearest multiple of this value. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.0 - */ - public function get snapInterval():Number - { - return IRangeModel(model).snapInterval; - } - public function set snapInterval(value:Number):void - { - IRangeModel(model).snapInterval = value; - } - - /** - * The amount to move the thumb when the track is selected. This value is - * adjusted to fit the nearest snapInterval. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.0 - */ - public function get stepSize():Number - { - return IRangeModel(model).stepSize; - } - public function set stepSize(value:Number):void - { - IRangeModel(model).stepSize = value; - } + /** * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement @@ -162,33 +66,7 @@ package org.apache.royale.vivid COMPILE::JS override protected function createElement():WrappedHTMLElement { - addElementToWrapper(this,'div'); - - // just to give it some default values - element.style.width = '100px'; - element.style.height = '30px'; - className = 'Slider'; - return element; - } - - /** - * @private - */ - COMPILE::JS - public function snap(value:Number):Number - { - var si:Number = snapInterval; - var n:Number = Math.round((value - minimum) / si) * - si + minimum; - if (value > 0) - { - if (value - n < n + si - value) - return n; - return n + si; - } - if (value - n > n + si - value) - return n + si; - return n; + return super.createElement(); } } } diff --git a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/Application.as b/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/TextButton.as similarity index 53% copy from frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/Application.as copy to frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/TextButton.as index 4f13beb..723dbdf 100644 --- a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/Application.as +++ b/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/TextButton.as @@ -18,48 +18,46 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.royale.vivid { - import org.apache.royale.core.Application; - import org.apache.royale.core.SimpleCSSValuesImpl; - - /** - * Vivid Application holds specific Vivid need in a Royale Application. - * - * This class extends the standard Application and sets up the - * SimpleCSSValuesImpl (implementation) for convenience. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9.2 - */ - public class Application extends org.apache.royale.core.Application + import org.apache.royale.html.TextButton; + + COMPILE::JS + { + import org.apache.royale.core.WrappedHTMLElement; + import org.apache.royale.html.util.addElementToWrapper; + } + + /** + * The Button class provides a Vivid Design Library UI-like appearance for + * a Button. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion Royale 0.9.2 + */ + public class TextButton extends org.apache.royale.html.TextButton { - /** - * constructor. + /** + * Constructor. * * @langversion 3.0 * @playerversion Flash 10.2 * @playerversion AIR 2.6 * @productversion Royale 0.9.2 */ - public function Application() + public function TextButton() { super(); - - this.valuesImpl = new SimpleCSSValuesImpl(); - - // this a is temp solution until we get a better way to get a reference to Application - //topLevelApplication = this; } - - /** - * static reference to this application used mainly for dialog (Dialog class) - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9.2 - */ - //public static var topLevelApplication:Object; + + /** + * @private + * @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement + */ + COMPILE::JS + override protected function createElement():WrappedHTMLElement + { + return super.createElement(); + } } } diff --git a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/TextInput.as b/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/TextInput.as index f23a60c..0143608 100644 --- a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/TextInput.as +++ b/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/TextInput.as @@ -17,26 +17,13 @@ //////////////////////////////////////////////////////////////////////////////// package org.apache.royale.vivid { - import org.apache.royale.core.ITextModel; - import org.apache.royale.core.UIBase; - import org.apache.royale.events.Event; + import org.apache.royale.html.TextInput; + COMPILE::JS { - import goog.events; import org.apache.royale.core.WrappedHTMLElement; - import org.apache.royale.html.util.addElementToWrapper; } - /** - * Dispatched when the user changes the text. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.0 - */ - [Event(name="change", type="org.apache.royale.events.Event")] - /** * The TextInput class implements the basic control for * single-line text input. @@ -47,7 +34,7 @@ package org.apache.royale.vivid * @playerversion AIR 2.6 * @productversion Royale 0.0 */ - public class TextInput extends UIBase + public class TextInput extends org.apache.royale.html.TextInput { /** * Constructor. @@ -60,107 +47,6 @@ package org.apache.royale.vivid public function TextInput() { super(); - - COMPILE::SWF - { - model.addEventListener("textChange", textChangeHandler); - } - } - - /** - * @copy org.apache.royale.html.Label#text - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.0 - * @royaleignorecoercion HTMLInputElement - */ - [Bindable(event="change")] - public function get text():String - { - COMPILE::SWF - { - return ITextModel(model).text; - } - COMPILE::JS - { - return (element as HTMLInputElement).value; - } - } - - /** - * @private - * @royaleignorecoercion HTMLInputElement - */ - public function set text(value:String):void - { - COMPILE::SWF - { - inSetter = true; - ITextModel(model).text = value; - inSetter = false; - } - COMPILE::JS - { - (element as HTMLInputElement).value = value; - dispatchEvent(new Event('textChange')); - } - } - - /** - * @copy org.apache.royale.html.Label#html - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.0 - * @royaleignorecoercion HTMLInputElement - */ - [Bindable(event="change")] - public function get html():String - { - COMPILE::SWF - { - return ITextModel(model).html; - } - COMPILE::JS - { - return (element as HTMLInputElement).value; - } - } - - /** - * @private - * @royaleignorecoercion HTMLInputElement - */ - public function set html(value:String):void - { - COMPILE::SWF - { - ITextModel(model).html = value; - } - COMPILE::JS - { - (element as HTMLInputElement).value = value; - dispatchEvent(new Event('textChange')); - } - } - - private var inSetter:Boolean; - - /** - * dispatch change event in response to a textChange event - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.0 - */ - public function textChangeHandler(event:Event):void - { - if (!inSetter) - dispatchEvent(new Event(Event.CHANGE)); } /** @@ -169,7 +55,8 @@ package org.apache.royale.vivid COMPILE::JS override protected function createElement():WrappedHTMLElement { - addElementToWrapper(this,'input'); + return super.createElement(); + /*addElementToWrapper(this,'input'); element.setAttribute('type', 'text'); element.className = 'TextInput'; typeNames = 'TextInput'; @@ -177,7 +64,7 @@ package org.apache.royale.vivid //attach input handler to dispatch royale change event when user write in textinput //goog.events.listen(element, 'change', killChangeHandler); goog.events.listen(element, 'input', textChangeHandler); - return element; + return element;*/ } } diff --git a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/beads/controllers/HSliderMouseController.as b/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/beads/controllers/HSliderMouseController.as deleted file mode 100644 index fcd670a..0000000 --- a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/beads/controllers/HSliderMouseController.as +++ /dev/null @@ -1,307 +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.royale.vivid.beads.controllers -{ - import org.apache.royale.collections.parsers.JSONInputParser; - import org.apache.royale.core.IBead; - import org.apache.royale.core.IBeadController; - import org.apache.royale.core.IRangeModel; - import org.apache.royale.core.IStrand; - import org.apache.royale.core.UIBase; - import org.apache.royale.events.Event; - import org.apache.royale.events.IEventDispatcher; - import org.apache.royale.events.MouseEvent; - import org.apache.royale.events.ValueChangeEvent; - import org.apache.royale.geom.Point; - import org.apache.royale.html.beads.ISliderView; - - COMPILE::JS - { - import goog.events; - import goog.events.EventType; - import org.apache.royale.events.BrowserEvent; - import org.apache.royale.vivid.Slider; - } - - /** - * The HSliderMouseController class bead handles mouse events on the - * org.apache.royale.vivid.Slider's component parts (thumb and track) and - * dispatches change events on behalf of the Slider (as well as co-ordinating visual - * changes (such as moving the thumb when the track has been tapped or clicked). Use - * this controller for horizontally oriented Sliders. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.0 - */ - public class HSliderMouseController implements IBead, IBeadController - { - /** - * constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.0 - */ - public function HSliderMouseController() - { - } - - private var rangeModel:IRangeModel; - - private var _strand:IStrand; - - private var oldValue:Number; - - /** - * @copy org.apache.royale.core.IBead#strand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.0 - */ - public function set strand(value:IStrand):void - { - _strand = value; - - rangeModel = UIBase(value).model as IRangeModel; - - COMPILE::SWF - { - var sliderView:ISliderView = value.getBeadByType(ISliderView) as ISliderView; - sliderView.thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbDownHandler); - - // add handler to detect click on track - sliderView.track.addEventListener(MouseEvent.CLICK, trackClickHandler, false, 99999); - - } - COMPILE::JS - { - var sliderView:ISliderView = value.getBeadByType(ISliderView) as ISliderView; - track = sliderView.track as UIBase; - thumb = sliderView.thumb as UIBase; - - goog.events.listen(track.element, goog.events.EventType.CLICK, - handleTrackClick, false, this); - - goog.events.listen(thumb.element, goog.events.EventType.MOUSEDOWN, - handleThumbDown, false, this); - - } - } - - COMPILE::JS - private var track:UIBase; - - COMPILE::JS - private var thumb:UIBase; - - /** - * @private - */ - COMPILE::SWF - private function thumbDownHandler( event:MouseEvent ) : void - { - UIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_MOVE, thumbMoveHandler); - UIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_UP, thumbUpHandler); - - var sliderView:ISliderView = _strand.getBeadByType(ISliderView) as ISliderView; - - origin = new Point(event.screenX, event.screenY); - thumb = new Point(sliderView.thumb.x,sliderView.thumb.y); - oldValue = rangeModel.value; - } - - /** - * @private - */ - COMPILE::SWF - private function thumbUpHandler( event:MouseEvent ) : void - { - UIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMoveHandler); - UIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_UP, thumbUpHandler); - - var vce:ValueChangeEvent = ValueChangeEvent.createUpdateEvent(_strand, "value", oldValue, rangeModel.value); - IEventDispatcher(_strand).dispatchEvent(vce); - } - - COMPILE::SWF - private var origin:Point; - COMPILE::SWF - private var thumb:Point; - - /** - * @private - */ - COMPILE::SWF - private function thumbMoveHandler( event:MouseEvent ) : void - { - var sliderView:ISliderView = _strand.getBeadByType(ISliderView) as ISliderView; - - var deltaX:Number = event.screenX - origin.x; - var thumbW:Number = sliderView.thumb.width/2; - var newX:Number = thumb.x + deltaX; - - var p:Number = newX/sliderView.track.width; - var n:Number = p*(rangeModel.maximum - rangeModel.minimum) + rangeModel.minimum; - - var vce:ValueChangeEvent = ValueChangeEvent.createUpdateEvent(_strand, "value", rangeModel.value, n); - rangeModel.value = n; - - IEventDispatcher(_strand).dispatchEvent(vce); - } - - /** - * @private - */ - COMPILE::SWF - private function trackClickHandler( event:MouseEvent ) : void - { - event.stopImmediatePropagation(); - - var sliderView:ISliderView = _strand.getBeadByType(ISliderView) as ISliderView; - - var xloc:Number = event.localX; - var p:Number = xloc/sliderView.track.width; - var n:Number = p*(rangeModel.maximum - rangeModel.minimum) + rangeModel.minimum; - - var vce:ValueChangeEvent = ValueChangeEvent.createUpdateEvent(_strand, "value", rangeModel.value, n); - rangeModel.value = n; - - IEventDispatcher(_strand).dispatchEvent(vce); - } - - /** - * @royaleignorecoercion org.apache.royale.events.BrowserEvent - */ - COMPILE::JS - private function handleTrackClick(event:MouseEvent):void - { - var bevent:BrowserEvent = event["wrappedEvent"] as BrowserEvent; - var host:Slider = _strand as Slider; - var xloc:Number = bevent.offsetX; - var useWidth:Number = parseInt(track.element.style.width, 10) * 1.0; - var p:Number = xloc / useWidth; - var n:Number = p*(rangeModel.maximum - rangeModel.minimum) + rangeModel.minimum; - - var vce:ValueChangeEvent = ValueChangeEvent.createUpdateEvent(_strand, "value", rangeModel.value, n); - rangeModel.value = n; - - host.dispatchEvent(vce); - } - - - /** - * @royaleignorecoercion org.apache.royale.events.BrowserEvent - */ - COMPILE::JS - private function handleThumbDown(event:MouseEvent):void - { - var bevent:BrowserEvent = event["wrappedEvent"] as BrowserEvent; - var host:Slider = _strand as Slider; - goog.events.listen(host.element, goog.events.EventType.MOUSEUP, - handleThumbUp, false, this); - goog.events.listen(host.element, goog.events.EventType.MOUSEMOVE, - handleThumbMove, false, this); - goog.events.listen(host.element, goog.events.EventType.MOUSELEAVE, - handleThumbLeave, false, this); - - mouseOrigin = bevent.screenX; //.clientX; - thumbOrigin = parseInt(thumb.element.style.left, 10); - oldValue = rangeModel.value; - } - - COMPILE::JS - private var mouseOrigin:Number; - COMPILE::JS - private var thumbOrigin:int; - - /** - * @royaleignorecoercion org.apache.royale.events.BrowserEvent - */ - COMPILE::JS - private function handleThumbUp(event:MouseEvent):void - { - var bevent:BrowserEvent = event["wrappedEvent"] as BrowserEvent; - var host:Slider = _strand as Slider; - goog.events.unlisten(host.element, goog.events.EventType.MOUSEUP, - handleThumbUp, false, this); - goog.events.unlisten(host.element, goog.events.EventType.MOUSEMOVE, - handleThumbMove, false, this); - goog.events.unlisten(host.element, goog.events.EventType.MOUSELEAVE, - handleThumbLeave, false, this); - - calcValFromMousePosition(bevent, false); - var vce:ValueChangeEvent = ValueChangeEvent.createUpdateEvent(_strand, "value", oldValue, rangeModel.value); - - host.dispatchEvent(vce); - } - - - /** - * @royaleignorecoercion org.apache.royale.events.BrowserEvent - */ - COMPILE::JS - private function handleThumbMove(event:MouseEvent):void - { - var bevent:BrowserEvent = event["wrappedEvent"] as BrowserEvent; - var host:Slider = _strand as Slider; - var lastValue:Number = rangeModel.value; - calcValFromMousePosition(bevent, false); - - var vce:ValueChangeEvent = ValueChangeEvent.createUpdateEvent(_strand, "value", lastValue, rangeModel.value); - - host.dispatchEvent(vce); - } - - COMPILE::JS - private function handleThumbLeave(event:MouseEvent):void - { - var host:Slider = _strand as Slider; - goog.events.unlisten(host.element, goog.events.EventType.MOUSEUP, - handleThumbUp, false, this); - goog.events.unlisten(host.element, goog.events.EventType.MOUSEMOVE, - handleThumbMove, false, this); - goog.events.unlisten(host.element, goog.events.EventType.MOUSELEAVE, - handleThumbLeave, false, this); - } - - - /** - */ - COMPILE::JS - private function calcValFromMousePosition(event:BrowserEvent, useOffset:Boolean):void - { - var deltaX:Number = event.screenX - mouseOrigin; - if (deltaX == 0) return; - - var thumbW:int = parseInt(thumb.element.style.width, 10) / 2; - var newPointX:Number = thumbOrigin + deltaX; - - var useWidth:Number = parseInt(track.element.style.width,10) * 1.0; - var p:Number = newPointX / useWidth; - var n:Number = p*(rangeModel.maximum - rangeModel.minimum) + rangeModel.minimum; - - rangeModel.value = n; - } - } -} diff --git a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/beads/controllers/VSliderMouseController.as b/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/beads/controllers/VSliderMouseController.as deleted file mode 100644 index 23b8313..0000000 --- a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/beads/controllers/VSliderMouseController.as +++ /dev/null @@ -1,291 +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.royale.vivid.beads.controllers -{ - import org.apache.royale.collections.parsers.JSONInputParser; - import org.apache.royale.core.IBead; - import org.apache.royale.core.IBeadController; - import org.apache.royale.core.IRangeModel; - import org.apache.royale.core.IStrand; - import org.apache.royale.core.UIBase; - import org.apache.royale.events.Event; - import org.apache.royale.events.IEventDispatcher; - import org.apache.royale.events.MouseEvent; - import org.apache.royale.events.ValueChangeEvent; - import org.apache.royale.geom.Point; - import org.apache.royale.html.beads.ISliderView; - - COMPILE::JS - { - import goog.events; - import goog.events.EventType; - import org.apache.royale.events.BrowserEvent; - import org.apache.royale.html.Slider; - } - - /** - * The VSliderMouseController class bead handles mouse events on the - * org.apache.royale.html.Slider's component parts (thumb and track) and - * dispatches change events on behalf of the Slider (as well as co-ordinating visual - * changes (such as moving the thumb when the track has been tapped or clicked). Use - * this controller for vertically oriented Sliders. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9 - */ - public class VSliderMouseController implements IBead, IBeadController - { - /** - * Constructor - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9 - */ - public function VSliderMouseController() - { - } - - private var rangeModel:IRangeModel; - - private var _strand:IStrand; - - private var oldValue:Number; - - /** - * @copy org.apache.royale.core.IBead#strand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9 - */ - public function set strand(value:IStrand):void - { - _strand = value; - - rangeModel = UIBase(value).model as IRangeModel; - - COMPILE::SWF - { - var sliderView:ISliderView = value.getBeadByType(ISliderView) as ISliderView; - sliderView.thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbDownHandler); - - // add handler to detect click on track - sliderView.track.addEventListener(MouseEvent.CLICK, trackClickHandler, false, 99999); - - } - COMPILE::JS - { - var sliderView:ISliderView = value.getBeadByType(ISliderView) as ISliderView; - track = sliderView.track as UIBase; - thumb = sliderView.thumb as UIBase; - - goog.events.listen(track.element, goog.events.EventType.CLICK, - handleTrackClick, false, this); - - goog.events.listen(thumb.element, goog.events.EventType.MOUSEDOWN, - handleThumbDown, false, this); - - } - } - - - COMPILE::JS - private var track:UIBase; - - COMPILE::JS - private var thumb:UIBase; - - COMPILE::SWF - private function thumbDownHandler( event:MouseEvent ) : void - { - UIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_MOVE, thumbMoveHandler); - UIBase(_strand).topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_UP, thumbUpHandler); - - var sliderView:ISliderView = _strand.getBeadByType(ISliderView) as ISliderView; - - origin = new Point(event.screenX, event.screenY); - thumb = new Point(sliderView.thumb.x,sliderView.thumb.y); - oldValue = rangeModel.value; - } - - COMPILE::SWF - private function thumbUpHandler( event:MouseEvent ) : void - { - UIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_MOVE, thumbMoveHandler); - UIBase(_strand).topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_UP, thumbUpHandler); - - var vce:ValueChangeEvent = ValueChangeEvent.createUpdateEvent(_strand, "value", oldValue, rangeModel.value); - IEventDispatcher(_strand).dispatchEvent(vce); - } - - COMPILE::SWF - private var origin:Point; - COMPILE::SWF - private var thumb:Point; - - COMPILE::SWF - private function thumbMoveHandler( event:MouseEvent ) : void - { - var sliderView:ISliderView = _strand.getBeadByType(ISliderView) as ISliderView; - - var deltaY:Number = event.screenY - origin.y; - var thumbH:Number = sliderView.thumb.height/2; - var newY:Number = thumb.y + deltaY; - - var p:Number = newY/sliderView.track.height; - var n:Number = p*(rangeModel.maximum - rangeModel.minimum) + rangeModel.minimum; - - var vce:ValueChangeEvent = ValueChangeEvent.createUpdateEvent(_strand, "value", rangeModel.value, n); - rangeModel.value = n; - - IEventDispatcher(_strand).dispatchEvent(vce); - } - - COMPILE::SWF - private function trackClickHandler( event:MouseEvent ) : void - { - event.stopImmediatePropagation(); - - var sliderView:ISliderView = _strand.getBeadByType(ISliderView) as ISliderView; - - var yloc:Number = event.localY; - var p:Number = yloc/sliderView.track.height; - var n:Number = p*(rangeModel.maximum - rangeModel.minimum) + rangeModel.minimum; - - var vce:ValueChangeEvent = ValueChangeEvent.createUpdateEvent(_strand, "value", rangeModel.value, n); - rangeModel.value = n; - - IEventDispatcher(_strand).dispatchEvent(vce); - } - - /** - * @royaleignorecoercion org.apache.royale.events.BrowserEvent - */ - COMPILE::JS - private function handleTrackClick(event:MouseEvent):void - { - var bevent:BrowserEvent = event["wrappedEvent"] as BrowserEvent; - var host:Slider = _strand as Slider; - var yloc:Number = bevent.offsetY; - var useHeight:Number = parseInt(track.element.style.height, 10) * 1.0; - var p:Number = yloc / useHeight; - var n:Number = p*(rangeModel.maximum - rangeModel.minimum) + rangeModel.minimum; - - var vce:ValueChangeEvent = ValueChangeEvent.createUpdateEvent(_strand, "value", rangeModel.value, n); - rangeModel.value = n; - - host.dispatchEvent(vce); - } - - /** - * @royaleignorecoercion org.apache.royale.events.BrowserEvent - */ - COMPILE::JS - private function handleThumbDown(event:MouseEvent):void - { - var bevent:BrowserEvent = event["wrappedEvent"] as BrowserEvent; - var host:Slider = _strand as Slider; - goog.events.listen(host.element, goog.events.EventType.MOUSEUP, - handleThumbUp, false, this); - goog.events.listen(host.element, goog.events.EventType.MOUSEMOVE, - handleThumbMove, false, this); - goog.events.listen(host.element, goog.events.EventType.MOUSELEAVE, - handleThumbLeave, false, this); - - mouseOrigin = bevent.screenY; //.clientY; - thumbOrigin = parseInt(thumb.element.style.top, 10); - oldValue = rangeModel.value; - } - - COMPILE::JS - private var mouseOrigin:Number; - COMPILE::JS - private var thumbOrigin:int; - - /** - * @royaleignorecoercion org.apache.royale.events.BrowserEvent - */ - COMPILE::JS - private function handleThumbUp(event:MouseEvent):void - { - var bevent:BrowserEvent = event["wrappedEvent"] as BrowserEvent; - var host:Slider = _strand as Slider; - goog.events.unlisten(host.element, goog.events.EventType.MOUSEUP, - handleThumbUp, false, this); - goog.events.unlisten(host.element, goog.events.EventType.MOUSEMOVE, - handleThumbMove, false, this); - goog.events.unlisten(host.element, goog.events.EventType.MOUSELEAVE, - handleThumbLeave, false, this); - - calcValFromMousePosition(bevent, false); - var vce:ValueChangeEvent = ValueChangeEvent.createUpdateEvent(_strand, "value", oldValue, rangeModel.value); - - host.dispatchEvent(vce); - } - - /** - * @royaleignorecoercion org.apache.royale.events.BrowserEvent - */ - COMPILE::JS - private function handleThumbMove(event:MouseEvent):void - { - var bevent:BrowserEvent = event["wrappedEvent"] as BrowserEvent; - var host:Slider = _strand as Slider; - var lastValue:Number = rangeModel.value; - calcValFromMousePosition(bevent, false); - - var vce:ValueChangeEvent = ValueChangeEvent.createUpdateEvent(_strand, "value", lastValue, rangeModel.value); - - host.dispatchEvent(vce); - } - - COMPILE::JS - private function handleThumbLeave(event:MouseEvent):void - { - var host:Slider = _strand as Slider; - goog.events.unlisten(host.element, goog.events.EventType.MOUSEUP, - handleThumbUp, false, this); - goog.events.unlisten(host.element, goog.events.EventType.MOUSEMOVE, - handleThumbMove, false, this); - goog.events.unlisten(host.element, goog.events.EventType.MOUSELEAVE, - handleThumbLeave, false, this); - } - - COMPILE::JS - private function calcValFromMousePosition(event:BrowserEvent, useOffset:Boolean):void - { - var deltaY:Number = event.screenY - mouseOrigin; - if (deltaY == 0) return; - - var thumbH:int = parseInt(thumb.element.style.height, 10) / 2; - var newPointY:Number = thumbOrigin + deltaY; - - var useHeight:Number = parseInt(track.element.style.height,10) * 1.0; - var p:Number = newPointY / useHeight; - var n:Number = p*(rangeModel.maximum - rangeModel.minimum) + rangeModel.minimum; - - rangeModel.value = n; - } - } -} \ No newline at end of file diff --git a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/beads/layouts/HorizontalSliderLayout.as b/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/beads/layouts/HorizontalSliderLayout.as deleted file mode 100644 index 5e56f5d..0000000 --- a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/beads/layouts/HorizontalSliderLayout.as +++ /dev/null @@ -1,138 +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.royale.vivid.beads.layouts -{ - import org.apache.royale.core.IBeadLayout; - import org.apache.royale.core.IRangeModel; - import org.apache.royale.core.IStrand; - import org.apache.royale.core.IUIBase; - import org.apache.royale.core.UIBase; - import org.apache.royale.events.Event; - import org.apache.royale.events.IEventDispatcher; - import org.apache.royale.html.beads.ISliderView; - - /** - * Use the HorizontalSliderLayout with a Slider to orient the Slider - * horizontally. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9 - */ - public class HorizontalSliderLayout implements IBeadLayout - { - /** - * Constructor - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9 - */ - public function HorizontalSliderLayout() - { - } - - private var _strand:IStrand; - - /** - * @see org.apache.royale.core.IStrand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9 - */ - public function set strand(value:IStrand):void - { - _strand = value; - - host.addEventListener("layoutNeeded", performLayout); - - host.addEventListener("widthChanged",performLayout); - host.addEventListener("heightChanged",performLayout); - } - - /** - * @private - */ - private function performLayout(event:Event):void - { - layout(); - } - - /** - * @private - */ - public function get host():UIBase - { - return _strand as UIBase; - } - - /** - * Performs the layout (size and positioning) of the elements of the slider. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9 - */ - public function layout():Boolean - { - var viewBead:ISliderView = host.view as ISliderView; - if (viewBead == null) { - return false; - } - - var useWidth:Number = host.width; - if (isNaN(useWidth)) { - useWidth = 100; - } - var useHeight:Number = host.height; - if (isNaN(useHeight)) { - useHeight = 25; - } - var square:Number = Math.min(useWidth, useHeight); - var trackHeight:Number = useHeight / 3; - - var thumb:IUIBase = viewBead.thumb as IUIBase; - thumb.width = square; - thumb.height = square; - - var track:IUIBase = viewBead.track as IUIBase; - track.x = square/2; - track.y = trackHeight; // 1/3 of the totalHeight - track.width = useWidth - square; - track.height = trackHeight; - - // determine the thumb position from the model information - var model:IRangeModel = host.model as IRangeModel; - var value:Number = model.value; - if (value < model.minimum) value = model.minimum; - if (value > model.maximum) value = model.maximum; - var p:Number = (value-model.minimum)/(model.maximum-model.minimum); - var xloc:Number = p * (useWidth - square); - thumb.x = xloc; - thumb.y = 0; - - return true; - } - } -} \ No newline at end of file diff --git a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/beads/layouts/VerticalSliderLayout.as b/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/beads/layouts/VerticalSliderLayout.as deleted file mode 100644 index 3089cd1..0000000 --- a/frameworks/projects/Vivid/src/main/royale/org/apache/royale/vivid/beads/layouts/VerticalSliderLayout.as +++ /dev/null @@ -1,137 +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.royale.vivid.beads.layouts -{ - import org.apache.royale.core.IBeadLayout; - import org.apache.royale.core.IRangeModel; - import org.apache.royale.core.IStrand; - import org.apache.royale.core.IUIBase; - import org.apache.royale.core.UIBase; - import org.apache.royale.events.Event; - import org.apache.royale.html.beads.ISliderView; - - /** - * Use the VerticalSliderLayout with a Slider to orient the - * slider vertically. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9 - */ - public class VerticalSliderLayout implements IBeadLayout - { - /** - * Constructor - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9 - */ - public function VerticalSliderLayout() - { - } - - private var _strand:IStrand; - - /** - * @see org.apache.royale.core.IStrand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9 - */ - public function set strand(value:IStrand):void - { - _strand = value; - - host.addEventListener("layoutNeeded", performLayout); - - host.addEventListener("widthChanged",performLayout); - host.addEventListener("heightChanged",performLayout); - } - - /** - * @private - */ - private function performLayout(event:Event):void - { - layout(); - } - - /** - * @private - */ - public function get host():UIBase - { - return _strand as UIBase; - } - - /** - * Performs the layout (size and positioning) of the Slide elements. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion Royale 0.9 - */ - public function layout():Boolean - { - var viewBead:ISliderView = host.view as ISliderView; - if (viewBead == null) { - return false; - } - - var useWidth:Number = host.width; - if (isNaN(useWidth)) { - useWidth = 25; - } - var useHeight:Number = host.height; - if (isNaN(useHeight)) { - useHeight = 100; - } - var square:Number = Math.min(useWidth, useHeight); - var trackWidth:Number = useWidth / 3; - - var thumb:IUIBase = viewBead.thumb as IUIBase; - thumb.width = square; - thumb.height = square; - - var track:IUIBase = viewBead.track as IUIBase; - track.y = square/2; - track.x = trackWidth; // 1/3 of the totalWidth - track.height = useHeight - square; - track.width = trackWidth; - - // determine the thumb position from the model information - var model:IRangeModel = host.model as IRangeModel; - var value:Number = model.value; - if (value < model.minimum) value = model.minimum; - if (value > model.maximum) value = model.maximum; - var p:Number = (value-model.minimum)/(model.maximum-model.minimum); - var yloc:Number = p * (useHeight - square); - thumb.y = yloc; - thumb.x = 0; - - return true; - } - } -} \ No newline at end of file -- To stop receiving notification emails like this one, please contact carlosrov...@apache.org.