This is an automated email from the ASF dual-hosted git repository. pushminakazi pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 45d0e4401c89914b377f99e4f439d63c6dba171e Author: pashminakazi <[email protected]> AuthorDate: Tue Sep 14 09:09:07 2021 -0700 Added some files and changes in existing files --- .../main/royale/org/apache/royale/events/Event.as | 17 ++ .../src/main/resources/mx-royale-manifest.xml | 1 + .../MXRoyale/src/main/royale/MXRoyaleClasses.as | 3 + .../src/main/royale/mx/containers/HDividedBox.as | 30 ++- .../src/main/royale/mx/core/ByteArrayAsset.as | 103 +++++++++ .../MXRoyale/src/main/royale/mx/core/Container.as | 54 +++++ .../royale/mx/core/ContainerRawChildrenList.as | 237 +++++++++++++++++++++ .../royale/mx/messaging/events/ChannelEvent.as | 2 +- .../royale/mx/messaging/events/MessageEvent.as | 2 +- .../mx/messaging/events/MessageFaultEvent.as | 2 +- .../src/main/royale/mx/rpc/events/XMLLoadEvent.as | 2 +- .../src/main/royale/mx/system/Capabilities.as | 5 + .../MXRoyale/src/main/royale/mx/utils/ByteArray.as | 8 + 13 files changed, 460 insertions(+), 6 deletions(-) diff --git a/frameworks/projects/Core/src/main/royale/org/apache/royale/events/Event.as b/frameworks/projects/Core/src/main/royale/org/apache/royale/events/Event.as index e776b73..19907d7 100644 --- a/frameworks/projects/Core/src/main/royale/org/apache/royale/events/Event.as +++ b/frameworks/projects/Core/src/main/royale/org/apache/royale/events/Event.as @@ -61,6 +61,8 @@ package org.apache.royale.events public static const CONNECT:String = "connect"; public static const REMOVED_FROM_STAGE:String = "removedFromStage"; public static const ADDED_TO_STAGE:String = "addedToStage"; + public static const MOUSE_LEAVE:String = "mouseLeave"; + public static const ENTER_FRAME:String = "enterFrame"; //-------------------------------------- // Constructor @@ -177,6 +179,8 @@ package org.apache.royale.events public static const CONNECT:String = "connect"; public static const REMOVED_FROM_STAGE:String = "removedFromStage"; public static const ADDED_TO_STAGE:String = "addedToStage"; + public static const MOUSE_LEAVE:String = "mouseLeave"; + public static const ENTER_FRAME:String = "enterFrame"; public function Event(type:String, bubbles:Boolean = false, cancelable:Boolean = false) { super(type); @@ -234,6 +238,19 @@ package org.apache.royale.events return true; return false; } + + public function get eventPhase():uint { + return 0; + } + + COMPILE::JS { + public function formatToString(className:String, ... arguments):String { + for each (var s:String in arguments) + className += " " + s; + + return className; + } + } } } diff --git a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml index b14ee7a..aec4b95 100644 --- a/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml +++ b/frameworks/projects/MXRoyale/src/main/resources/mx-royale-manifest.xml @@ -234,5 +234,6 @@ <component id="NavBar" class="mx.controls.NavBar" /> <component id="ApplicationControlBar" class="mx.containers.ApplicationControlBar" /> <component id="MultiSelectionList" class="mx.controls.MultiSelectionList"/> + <component id="CurrencyFormatter" class="mx.formatters.CurrencyFormatter"/> </componentPackage> diff --git a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as index e790057..b3216fb 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as +++ b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as @@ -404,6 +404,9 @@ internal class MXRoyaleClasses import mx.utils.Endian; Endian; import mx.text.Font; Font; import mx.net.LocalConnection; LocalConnection; + import mx.net.ObjectEncoding; ObjectEncoding; + import mx.core.ByteArrayAsset; ByteArrayAsset; + import mx.core.ContainerRawChildrenList; ContainerRawChildrenList; } diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/HDividedBox.as b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/HDividedBox.as index 42279ef..f29b851 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/containers/HDividedBox.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/containers/HDividedBox.as @@ -78,6 +78,7 @@ public class HDividedBox extends DividedBox // Constructor // //-------------------------------------------------------------------------- + import org.apache.royale.events.MouseEvent; /** * Constructor. @@ -92,9 +93,34 @@ public class HDividedBox extends DividedBox super(); typeNames = "HDividedBox"; - super.direction = BoxDirection.HORIZONTAL; + super.direction = BoxDirection.HORIZONTAL; + addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); + + } + protected function mouseDownHandler(event:MouseEvent):void + { + if (event.target != this) + { + return; + } + addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + topMostEventDispatcher.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); + } + protected function mouseUpHandler(event:MouseEvent):void + { + removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); + topMostEventDispatcher.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } + protected function mouseMoveHandler(event:MouseEvent):void + { + var w1:int = Math.floor(100 * event.localX / width); + w1 = Math.min(w1, 95); + w1 = Math.max(w1, 5); + getChildAt(0).percentWidth = w1; + getChildAt(1).percentWidth = 100 - w1; + _layout.layout(); + } //-------------------------------------------------------------------------- // // Overridden properties @@ -116,4 +142,4 @@ public class HDividedBox extends DividedBox } } -} +} \ No newline at end of file diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/ByteArrayAsset.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/ByteArrayAsset.as new file mode 100644 index 0000000..d48c881 --- /dev/null +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/ByteArrayAsset.as @@ -0,0 +1,103 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 mx.core +{ + +import mx.utils.ByteArray; + +/** + * ByteArrayAsset is a subclass of the flash.utils.ByteArray class + * which represents an arbitrary sequence of byte data that you embed + * in a Flex application. + * + * <p>The byte data that you are embedding can be in any kind of file, + * and the entire file is always embedded. + * You cannot embed the bytes of a particular asset that is in a SWF file, + * although you can embed an entire SWF file.</p> + * + * <p>The MXML compiler autogenerates a class that extends ByteArrayAsset + * to represent the embedded data.</p> + * + * <p>To embed an arbitrary file, you declare a variable of type Class, + * and put <code>[Embed]</code> metadata on it, using the MIME type + * <code>application/octet-stream</code>. + * For example, you embed a text file like this:</p> + * + * <pre> + * [Bindable] + * [Embed(source="Story.txt", mimeType="application/octet-stream")] + * private var storyClass:Class; + * </pre> + * + * <p>The compiler autogenerates a subclass of the ByteArrayAsset class + * and sets your variable to be a reference to this autogenerated class. + * You can then use this class reference to create instances of the + * ByteArrayAsset using the <code>new</code> operator, and you can extract + * information from the byte array using methods of the ByteArray class:</p> + * + * <pre> + * var storyByteArray:ByteArrayAsset = ByteArrayAsset(new storyClass()); + * var story:String = storyByteArray.readUTFBytes(storyByteArray.length); + * </pre> + * + * <p>You must specify that the MIME type for the embedding is + * <code>application/octet-stream</code>, which causes the byte data + * to be embedded "as is", with no interpretation. + * It also causes the autogenerated class to extend ByteArrayAsset + * rather than another asset class.</p> + * + * <p>For example, if you embed a PNG file without specifying this + * MIME type, the PNG data will be automatically transcoded + * into the bitmap format used by the player, and a subclass + * of BitmapAsset will be autogenerated to represent it. + * But if you specify the MIME type as <code>application/octet-stream</code>, + * then no transcoding will occur, the PNG data will be embedded + * as is, and the autogenerated class will extend ByteArrayAsset.</p> + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ +public class ByteArrayAsset extends ByteArray /* implements IFlexAsset */ +{ + //include "../core/Version.as"; + + //-------------------------------------------------------------------------- + // + // Constructor + // + //-------------------------------------------------------------------------- + + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function ByteArrayAsset() + { + super(); + } +} + +} diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as index 819ded5..3218b6e 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Container.as @@ -1755,6 +1755,60 @@ public class Container extends UIComponent */ return super.contentMouseY; } + + + //---------------------------------- + // rawChildren + //---------------------------------- + + /** + * @private + * The single IChildList object that's always returned + * from the rawChildren property, below. + */ + private var _rawChildren:ContainerRawChildrenList; + + /** + * A container typically contains child components, which can be enumerated + * using the <code>Container.getChildAt()</code> method and + * <code>Container.numChildren</code> property. In addition, the container + * may contain style elements and skins, such as the border and background. + * Flash Player and AIR do not draw any distinction between child components + * and skins. They are all accessible using the player's + * <code>getChildAt()</code> method and + * <code>numChildren</code> property. + * However, the Container class overrides the <code>getChildAt()</code> method + * and <code>numChildren</code> property (and several other methods) + * to create the illusion that + * the container's children are the only child components. + * + * <p>If you need to access all of the children of the container (both the + * content children and the skins), then use the methods and properties + * on the <code>rawChildren</code> property instead of the regular Container methods. + * For example, use the <code>Container.rawChildren.getChildAt())</code> method. + * However, if a container creates a ContentPane Sprite object for its children, + * the <code>rawChildren</code> property value only counts the ContentPane, not the + * container's children. + * It is not always possible to determine when a container will have a ContentPane.</p> + * + * <p><b>Note:</b>If you call the <code>addChild</code> or + * <code>addChildAt</code> method of the <code>rawChildren</code> object, + * set <code>tabFocusEnabled = false</code> on the component that you have added. + * Doing so prevents users from tabbing to the visual-only component + * that you have added.</p> + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + public function get rawChildren():IChildList + { + if (!_rawChildren) + _rawChildren = new ContainerRawChildrenList(this); + + return _rawChildren; + } } diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/ContainerRawChildrenList.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/ContainerRawChildrenList.as new file mode 100644 index 0000000..df1f405 --- /dev/null +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/ContainerRawChildrenList.as @@ -0,0 +1,237 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 mx.core +{ + +import mx.core.UIComponent; +import org.apache.royale.geom.Point; + +use namespace mx_internal; + +//[ExcludeClass] + +/** + * @private + * Helper class for the rawChildren property of the Container class. + * For descriptions of the properties and methods, + * see the IChildList interface. + * + * @see mx.core.Container + */ +public class ContainerRawChildrenList implements IChildList +{ + //include "../core/Version.as"; + + //-------------------------------------------------------------------------- + // + // Notes + // + //-------------------------------------------------------------------------- + + /* + + Although at the level of a Flash UIComponentContainer, all + children are equal, in a Flex Container some children are "more + equal than others". (George Orwell, "Animal Farm") + + In particular, Flex distinguishes between content children and + non-content (or "chrome") children. Content children are the kind + that can be specified in MXML. If you put several controls + into a VBox, those are its content children. Non-content children + are the other ones that you get automatically, such as a + background/border, scrollbars, the titlebar of a Panel, + AccordionHeaders, etc. + + Most application developers are uninterested in non-content children, + so Container overrides APIs such as numChildren and getChildAt() + to deal only with content children. For example, Container, keeps + its own _numChildren counter. + + However, developers of custom containers need to be able to deal + with both content and non-content children, so they require similar + APIs that operate on all children. + + For the public API, it would be ugly to have double APIs on Container + such as getChildAt() and all_getChildAt(). Instead, Container has + a public rawChildren property which lets you access APIs which + operate on all the children, in the same way that the + UIComponentContainer APIs do. For example, getChildAt(0) returns + the first content child, while rawChildren.getChildAt(0) returns + the first child (either content or non-content). + + This ContainerRawChildrenList class implements the rawChildren + property. Note that it simply calls a second set of parallel + mx_internal APIs in Container. (They're named, for example, + _getChildAt() instead of all_getChildAt()). + + Many of the all-children APIs in Container such as _getChildAt() + simply call super.getChildAt() in order to get the implementation + in UIComponentContainer. It would be nice if we could eliminate + _getChildAt() in Container and simply implement the all-children + version in this class by calling the UIComponentContainer method. + But once Container overrides getChildAt(), there is no way + to call the supermethod through an instance. + + */ + + //-------------------------------------------------------------------------- + // + // Constructor + // + //-------------------------------------------------------------------------- + + /** + * @private + * Constructor. + */ + public function ContainerRawChildrenList(owner:Container) + { + super(); + + this.owner = owner; + } + + //-------------------------------------------------------------------------- + // + // Variables + // + //-------------------------------------------------------------------------- + + /** + * @private + */ + private var owner:Container; + + //-------------------------------------------------------------------------- + // + // Properties + // + //-------------------------------------------------------------------------- + + //---------------------------------- + // numChildren + //---------------------------------- + + /** + * @private + */ + public function get numChildren():int + { + // return owner.$numChildren; + return null; + } + + //-------------------------------------------------------------------------- + // + // Methods + // + //-------------------------------------------------------------------------- + + /** + * @private + */ + public function addChild(child:UIComponent):UIComponent + { + // return owner.rawChildren_addChild(child); + return null; + } + + /** + * @private + */ + public function addChildAt(child:UIComponent, index:int):UIComponent + { + // return owner.rawChildren_addChildAt(child, index); + return null; + } + + /** + * @private + */ + public function removeChild(child:UIComponent):UIComponent + { + // return owner.rawChildren_removeChild(child); + return null; + } + + /** + * @private + */ + public function removeChildAt(index:int):UIComponent + { + // return owner.rawChildren_removeChildAt(index); + return null; + } + + /** + * @private + */ + public function getChildAt(index:int):UIComponent + { + // return owner.rawChildren_getChildAt(index); + return null; + } + + /** + * @private + */ + public function getChildByName(name:String):UIComponent + { + // return owner.rawChildren_getChildByName(name); + return null; + } + + /** + * @private + */ + public function getChildIndex(child:UIComponent):int + { + // return owner.rawChildren_getChildIndex(child); + return null; + } + + /** + * @private + */ + public function setChildIndex(child:UIComponent, newIndex:int):void + { + // owner.rawChildren_setChildIndex(child, newIndex); + } + + /** + * @private + */ + public function getObjectsUnderPoint(point:Point):Array + { + // return owner.rawChildren_getObjectsUnderPoint(point); + return null; + } + + /** + * @private + */ + public function contains(child:UIComponent):Boolean + { + // return owner.rawChildren_contains(child); + return null; + } +} + +} diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/messaging/events/ChannelEvent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/messaging/events/ChannelEvent.as index 0a53c42..08cbf0b 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/messaging/events/ChannelEvent.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/messaging/events/ChannelEvent.as @@ -315,7 +315,7 @@ public class ChannelEvent extends Event } COMPILE::JS - public function formatToString(className:String, ... args):String + override public function formatToString(className:String, ... args):String { for each (var s:String in args) className += " " + s; diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/messaging/events/MessageEvent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/messaging/events/MessageEvent.as index f6f529b..53aeea1 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/messaging/events/MessageEvent.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/messaging/events/MessageEvent.as @@ -246,7 +246,7 @@ public class MessageEvent extends Event } COMPILE::JS - public function formatToString(className:String, ... args):String + override public function formatToString(className:String, ... args):String { for each (var s:String in args) className += " " + s; diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/messaging/events/MessageFaultEvent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/messaging/events/MessageFaultEvent.as index 1d7d7c6..47849a3 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/messaging/events/MessageFaultEvent.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/messaging/events/MessageFaultEvent.as @@ -299,7 +299,7 @@ public class MessageFaultEvent extends Event } COMPILE::JS - public function formatToString(className:String, ... args):String + override public function formatToString(className:String, ... args):String { for each (var s:String in args) className += " " + s; diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/rpc/events/XMLLoadEvent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/rpc/events/XMLLoadEvent.as index 323bfcd..f1dad51 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/rpc/events/XMLLoadEvent.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/rpc/events/XMLLoadEvent.as @@ -116,7 +116,7 @@ public class XMLLoadEvent extends Event } COMPILE::JS - public function formatToString(className:String, ... rest):String + override public function formatToString(className:String, ... rest):String { if (rest) { diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/system/Capabilities.as b/frameworks/projects/MXRoyale/src/main/royale/mx/system/Capabilities.as index 521b291..688a6fd 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/system/Capabilities.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/system/Capabilities.as @@ -64,5 +64,10 @@ package mx.system trace("serverString in Capabilities is not implemented"); return ""; } + + public static function get version():String { + trace("version in Capabilities is not implemented"); + return ""; + } } } diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/utils/ByteArray.as b/frameworks/projects/MXRoyale/src/main/royale/mx/utils/ByteArray.as index 76f9389..764733b 100644 --- a/frameworks/projects/MXRoyale/src/main/royale/mx/utils/ByteArray.as +++ b/frameworks/projects/MXRoyale/src/main/royale/mx/utils/ByteArray.as @@ -60,6 +60,14 @@ COMPILE::JS{ public function writeObject(object:*):void { } + + public var _objectEncoding:uint = 0; + public function get objectEncoding():uint { + return _objectEncoding; + } + public function set objectEncoding(value:uint):void { + _objectEncoding = value; + } } }
