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 4FC09200BB3 for ; Wed, 2 Nov 2016 16:15:10 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 4E6B5160AFB; Wed, 2 Nov 2016 15:15:10 +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 26A85160B0C for ; Wed, 2 Nov 2016 16:15:08 +0100 (CET) Received: (qmail 31885 invoked by uid 500); 2 Nov 2016 15:15:03 -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 30236 invoked by uid 99); 2 Nov 2016 15:15:01 -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; Wed, 02 Nov 2016 15:15:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 32ADEE1772; Wed, 2 Nov 2016 15:15:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: aharui@apache.org To: commits@flex.apache.org Date: Wed, 02 Nov 2016 15:15:26 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [27/50] [abbrv] git commit: [flex-asjs] [refs/heads/develop] - move implementation classes to HTML so variants can exist in other SWCs archived-at: Wed, 02 Nov 2016 15:15:10 -0000 move implementation classes to HTML so variants can exist in other SWCs Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/efd9dcad Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/efd9dcad Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/efd9dcad Branch: refs/heads/develop Commit: efd9dcad4ca87c3050f4ee84810f08577f0e4118 Parents: 21c9340 Author: Alex Harui Authored: Thu Oct 27 15:48:16 2016 -0700 Committer: Alex Harui Committed: Tue Nov 1 07:46:52 2016 -0700 ---------------------------------------------------------------------- .../flex/org/apache/flex/core/Application.as | 560 ------------------- .../org/apache/flex/core/ApplicationBase.as | 109 ---- .../flex/org/apache/flex/core/ContainerBase.as | 453 --------------- .../flex/core/ContainerBaseStrandChildren.as | 99 ---- .../org/apache/flex/core/FilledRectangle.as | 125 ----- .../main/flex/org/apache/flex/core/ListBase.as | 126 ----- .../apache/flex/core/ListBaseStrandChildren.as | 100 ---- .../src/main/flex/org/apache/flex/core/View.as | 34 -- .../main/flex/org/apache/flex/core/ViewBase.as | 97 ---- .../flex/org/apache/flex/core/Application.as | 560 +++++++++++++++++++ .../org/apache/flex/core/ApplicationBase.as | 109 ++++ .../flex/org/apache/flex/core/ContainerBase.as | 453 +++++++++++++++ .../flex/core/ContainerBaseStrandChildren.as | 99 ++++ .../org/apache/flex/core/FilledRectangle.as | 125 +++++ .../main/flex/org/apache/flex/core/ListBase.as | 126 +++++ .../apache/flex/core/ListBaseStrandChildren.as | 100 ++++ .../src/main/flex/org/apache/flex/core/View.as | 34 ++ .../main/flex/org/apache/flex/core/ViewBase.as | 97 ++++ 18 files changed, 1703 insertions(+), 1703 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.as deleted file mode 100644 index 0a9c69a..0000000 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/Application.as +++ /dev/null @@ -1,560 +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.core -{ - import org.apache.flex.events.Event; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.events.MouseEvent; - import org.apache.flex.events.utils.MouseEventConverter; - import org.apache.flex.utils.MXMLDataInterpreter; - import org.apache.flex.utils.Timer; - - COMPILE::SWF { - import flash.display.DisplayObject; - import flash.display.Graphics; - import flash.display.Sprite; - import flash.events.Event; - import flash.system.ApplicationDomain; - import flash.utils.getQualifiedClassName; - } - - //-------------------------------------- - // Events - //-------------------------------------- - - /** - * Dispatched at startup. Attributes and sub-instances of - * the MXML document have been created and assigned. - * The component lifecycle is different - * than the Flex SDK. There is no creationComplete event. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - [Event(name="initialize", type="org.apache.flex.events.Event")] - - /** - * Dispatched at startup before the instances get created. - * Beads can call preventDefault and defer initialization. - * This event will be dispatched on every frame until no - * listeners call preventDefault(), then the initialize() - * method will be called. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - [Event(name="preinitialize", type="org.apache.flex.events.Event")] - - /** - * Dispatched at startup after the initial view has been - * put on the display list. This event is sent before - * applicationComplete is dispatched. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - [Event(name="viewChanged", type="org.apache.flex.events.Event")] - - /** - * Dispatched at startup after the initial view has been - * put on the display list. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - [Event(name="applicationComplete", type="org.apache.flex.events.Event")] - - /** - * A SWF application must be bootstrapped by a Flash Sprite. - * The factory class is the default bootstrap. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - [Frame(factoryClass="org.apache.flex.core.ApplicationFactory")] - - /** - * The Application class is the main class and entry point for a FlexJS - * application. This Application class is different than the - * Flex SDK's mx:Application or spark:Application in that it does not contain - * user interface elements. Those UI elements go in the views (ViewBase). This - * Application class expects there to be a main model, a controller, and - * an initial view. - * - * @see ViewBase - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class Application extends ApplicationBase implements IStrand, IParent, IEventDispatcher, ISWFApplication, IPopUpHost, IRenderedObject - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function Application() - { - super(); - } - - /** - * Application wraps the root object. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - COMPILE::SWF - public function setRoot(r:WrappedMovieClip):void - { - element = r; - element.flexjs_wrapper = this; - MouseEventConverter.setupAllConverters(r.stage); - MouseEventConverter.setupAllConverters(r.stage, false); - initHandler(); - } - - COMPILE::SWF - private function initHandler():void - { - if (model is IBead) addBead(model as IBead); - if (controller is IBead) addBead(controller as IBead); - - for each (var bead:IBead in beads) - addBead(bead); - - dispatchEvent(new org.apache.flex.events.Event("beadsAdded")); - - if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true))) - initialize(); - else - addEventListener(flash.events.Event.ENTER_FRAME, enterFrameHandler); - - } - - COMPILE::SWF - private function enterFrameHandler(event:flash.events.Event):void - { - if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true))) - { - removeEventListener(flash.events.Event.ENTER_FRAME, enterFrameHandler); - initialize(); - } - } - - /** - * This method gets called when all preinitialize handlers - * no longer call preventDefault(); - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * @flexjsignorecoercion org.apache.flex.core.IBead - */ - protected function initialize():void - { - MXMLDataInterpreter.generateMXMLInstances(this, null, MXMLDescriptor); - - dispatchEvent(new org.apache.flex.events.Event("initialize")); - - if (initialView) - { - initialView.applicationModel = model; - this.addElement(initialView); - - COMPILE::SWF - { - // if someone has installed a resize listener, fake an event to run it now - if ($displayObject.stage.hasEventListener("resize")) - $displayObject.stage.dispatchEvent(new flash.events.Event("resize")); - else if (initialView is ILayoutChild) - { - var ilc:ILayoutChild = initialView as ILayoutChild; - // otherwise, size once like this - if (!isNaN(ilc.percentWidth) && !isNaN(ilc.percentHeight)) - ilc.setWidthAndHeight($displayObject.stage.stageWidth, $displayObject.stage.stageHeight, true); - else if (!isNaN(ilc.percentWidth)) - ilc.setWidth($displayObject.stage.stageWidth); - else if (!isNaN(ilc.percentHeight)) - ilc.setHeight($displayObject.stage.stageHeight); - } - } - COMPILE::JS - { - var baseView:UIBase = initialView as UIBase; - if (!isNaN(baseView.percentWidth) || !isNaN(baseView.percentHeight)) { - this.element.style.height = window.innerHeight + 'px'; - this.element.style.width = window.innerWidth + 'px'; - this.initialView.dispatchEvent('sizeChanged'); // kick off layout if % sizes - } - } - COMPILE::SWF - { - var bgColor:Object = ValuesManager.valuesImpl.getValue(this, "background-color"); - if (bgColor != null) - { - var backgroundColor:uint = ValuesManager.valuesImpl.convertColor(bgColor); - var graphics:Graphics = Sprite($displayObject).graphics; - graphics.beginFill(backgroundColor); - graphics.drawRect(0, 0, initialView.width, initialView.height); - graphics.endFill(); - } - } - dispatchEvent(new org.apache.flex.events.Event("viewChanged")); - } - dispatchEvent(new org.apache.flex.events.Event("applicationComplete")); - } - - /** - * The org.apache.flex.core.IValuesImpl that will - * determine the default values and other values - * for the application. The most common choice - * is org.apache.flex.core.SimpleCSSValuesImpl. - * - * @see org.apache.flex.core.SimpleCSSValuesImpl - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function set valuesImpl(value:IValuesImpl):void - { - ValuesManager.valuesImpl = value; - ValuesManager.valuesImpl.init(this); - } - - /** - * The initial view. - * - * @see org.apache.flex.core.ViewBase - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - [Bindable("__NoChangeEvent__")] - public var initialView:IApplicationView; - - /** - * The controller. The controller typically watches - * the UI for events and updates the model accordingly. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public var controller:Object; - - /** - * An array of data that describes the MXML attributes - * and tags in an MXML document. This data is usually - * decoded by an MXMLDataInterpreter - * - * @see org.apache.flex.utils.MXMLDataInterpreter - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get MXMLDescriptor():Array - { - return null; - } - - /** - * An method called by the compiler's generated - * code to kick off the setting of MXML attribute - * values and instantiation of child tags. - * - * The call has to be made in the generated code - * in order to ensure that the constructors have - * completed first. - * - * @param data The encoded data representing the - * MXML attributes. - * - * @see org.apache.flex.utils.MXMLDataInterpreter - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function generateMXMLAttributes(data:Array):void - { - MXMLDataInterpreter.generateMXMLProperties(this, data); - } - - /** - * The array property that is used to add additional - * beads to an MXML tag. From ActionScript, just - * call addBead directly. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public var beads:Array; - - private var _elements:Array; - - /** - * @copy org.apache.flex.core.IParent#addElement() - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * @flexjsignorecoercion org.apache.flex.core.IUIBase - * @flexjsignorecoercion HTMLElement - */ - public function addElement(c:IChild, dispatchEvent:Boolean = true):void - { - COMPILE::SWF - { - if(_elements == null) - _elements = []; - _elements[_elements.length] = c; - $displayObjectContainer.addChild(c.$displayObject); - if (c is IUIBase) - { - IUIBase(c).addedToParent(); - } - } - COMPILE::JS { - this.element.appendChild(c.element as HTMLElement); - (c as IUIBase).addedToParent(); - } - } - - /** - * @copy org.apache.flex.core.IParent#addElementAt() - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * @flexjsignorecoercion org.apache.flex.core.IUIBase - */ - public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void - { - COMPILE::SWF - { - if(_elements == null) - _elements = []; - _elements.splice(index,0,c); - - $displayObjectContainer.addChildAt(c.$displayObject,index); - - if (c is IUIBase) - { - IUIBase(c).addedToParent(); - } - } - COMPILE::JS { - var children:NodeList = internalChildren(); - if (index >= children.length) - addElement(c); - else - { - element.insertBefore(c.positioner, - children[index]); - (c as IUIBase).addedToParent(); - } - - } - } - - /** - * @copy org.apache.flex.core.IParent#getElementAt() - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function getElementAt(index:int):IChild - { - COMPILE::SWF - { - if(_elements == null) - return null; - return _elements[index]; - } - COMPILE::JS - { - var children:NodeList = internalChildren(); - return children[index].flexjs_wrapper; - } - } - - /** - * @copy org.apache.flex.core.IParent#getElementIndex() - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function getElementIndex(c:IChild):int - { - COMPILE::SWF - { - if(_elements == null) - return -1; - return _elements.indexOf(c); - } - COMPILE::JS { - var children:NodeList = internalChildren(); - var n:int = children.length; - for (var i:int = 0; i < n; i++) - { - if (children[i] == c.element) - return i; - } - return -1; - } - } - - /** - * @copy org.apache.flex.core.IParent#removeElement() - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - * @flexjsignorecoercion HTMLElement - */ - public function removeElement(c:IChild, dispatchEvent:Boolean = true):void - { - COMPILE::SWF - { - if(_elements) - { - var idx:int = _elements.indexOf(c); - if(idx>=0) - _elements.splice(idx,1); - } - $displayObjectContainer.removeChild(c.$displayObject as DisplayObject); - } - COMPILE::JS - { - element.removeChild(c.element as HTMLElement); - } - } - - /** - * @copy org.apache.flex.core.IParent#numElements - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get numElements():int - { - COMPILE::SWF - { - return _elements ? _elements.length : 0; - } - COMPILE::JS - { - var children:NodeList = internalChildren(); - return children.length; - } - } - - /** - * @return {Object} The array of children. - */ - COMPILE::JS - protected function internalChildren():NodeList - { - return element.childNodes; - }; - - COMPILE::JS - protected var startupTimer:Timer; - - /** - * @flexjsignorecoercion org.apache.flex.core.IBead - */ - COMPILE::JS - public function start():void - { - element = document.getElementsByTagName('body')[0]; - element.flexjs_wrapper = this; - element.className = 'Application'; - positioner = element; - - if (model is IBead) addBead(model as IBead); - if (controller is IBead) addBead(controller as IBead); - - for (var index:int in beads) { - addBead(beads[index]); - } - - dispatchEvent(new org.apache.flex.events.Event("beadsAdded")); - - if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true))) - initialize(); - else { - startupTimer = new Timer(34, 0); - startupTimer.addEventListener("timer", handleStartupTimer); - startupTimer.start(); - } - } - - /** - * @private - */ - COMPILE::JS - protected function handleStartupTimer(event:Event):void - { - if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true))) - { - startupTimer.stop(); - initialize(); - } - } - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ApplicationBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ApplicationBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ApplicationBase.as deleted file mode 100644 index 0fe63ba..0000000 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ApplicationBase.as +++ /dev/null @@ -1,109 +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.core -{ - COMPILE::SWF { - import flash.system.ApplicationDomain; - import flash.utils.getQualifiedClassName; - } - - /** - * This is a platform-dependent base class - * for Application - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - COMPILE::SWF - public class ApplicationBase extends UIHTMLElementWrapper implements IFlexInfo - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function ApplicationBase() - { - super(); - } - - private var _info:Object; - - /** - * An Object containing information generated - * by the compiler that is useful at startup time. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function info():Object - { - if (!_info) - { - var mainClassName:String = getQualifiedClassName(this); - var initClassName:String = "_" + mainClassName + "_FlexInit"; - var c:Class = ApplicationDomain.currentDomain.getDefinition(initClassName) as Class; - _info = c.info(); - } - return _info; - } - } - - COMPILE::JS - public class ApplicationBase extends UIHTMLElementWrapper implements IFlexInfo - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function ApplicationBase() - { - super(); - } - - private var _info:Object; - - /** - * An Object containing information generated - * by the compiler that is useful at startup time. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function info():Object - { - return _info; - } - - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ContainerBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ContainerBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ContainerBase.as deleted file mode 100644 index 047b635..0000000 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ContainerBase.as +++ /dev/null @@ -1,453 +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.core -{ - import org.apache.flex.core.IMXMLDocument; - import org.apache.flex.core.ValuesManager; - import org.apache.flex.events.Event; - import org.apache.flex.events.ValueChangeEvent; - import org.apache.flex.states.State; - import org.apache.flex.utils.MXMLDataInterpreter; - - /** - * Indicates that the state change has completed. All properties - * that need to change have been changed, and all transitinos - * that need to run have completed. However, any deferred work - * may not be completed, and the screen may not be updated until - * code stops executing. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - [Event(name="stateChangeComplete", type="org.apache.flex.events.Event")] - - /** - * Indicates that the initialization of the container is complete. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - [Event(name="initComplete", type="org.apache.flex.events.Event")] - - /** - * Indicates that the children of the container is have been added. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - [Event(name="childrenAdded", type="org.apache.flex.events.Event")] - - [DefaultProperty("mxmlContent")] - - /** - * The ContainerBase class is the base class for most containers - * in FlexJS. It is usable as the root tag of MXML - * documents and UI controls and containers are added to it. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class ContainerBase extends UIBase implements IMXMLDocument, IStatesObject, IContainer, IContentViewHost - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function ContainerBase() - { - super(); - - _strandChildren = new ContainerBaseStrandChildren(this); - } - - private var _strandChildren:ContainerBaseStrandChildren; - - /** - * @private - */ - public function get strandChildren():IParent - { - return _strandChildren; - } - - /** - * @copy org.apache.flex.core.IParent#getElementAt() - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - override public function getElementAt(index:int):IChild - { - var contentView:IParent = view as IParent; - if (contentView != null) { - return contentView.getElementAt(index); - } else { - return super.getElementAt(index); - } - } - - /** - * @private - */ - override public function getElementIndex(c:IChild):int - { - var contentView:IParent = view as IParent; - if (contentView != null) { - return contentView.getElementIndex(c); - } else { - return super.getElementIndex(c); - } - } - - /** - * @private - */ - override public function addElement(c:IChild, dispatchEvent:Boolean = true):void - { - var contentView:IParent = view as IParent; - if (contentView != null) { - contentView.addElement(c, dispatchEvent); - if (dispatchEvent) - this.dispatchEvent(new Event("childrenAdded")); - } - else { - super.addElement(c); - } - } - - /** - * @private - */ - override public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void - { - var contentView:IParent = view as IParent; - if (contentView != null) { - contentView.addElementAt(c, index, dispatchEvent); - if (dispatchEvent) - this.dispatchEvent(new Event("childrenAdded")); - } - else { - super.addElementAt(c, index); - } - } - - /** - * @private - */ - override public function removeElement(c:IChild, dispatchEvent:Boolean = true):void - { - var contentView:IParent = view as IParent; - if (contentView != null) { - contentView.removeElement(c, dispatchEvent); - if (dispatchEvent) - this.dispatchEvent(new Event("childrenRemoved")); - } - else { - super.removeElement(c); - } - } - - /** - * @private - */ - public function childrenAdded():void - { - dispatchEvent(new Event("childrenAdded")); - } - - /** - * A ContainerBase doesn't create its children until it is added to - * a parent. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - override public function addedToParent():void - { - if (!_initialized) - { - // each MXML file can also have styles in fx:Style block - ValuesManager.valuesImpl.init(this); - } - - super.addedToParent(); - - if (!_initialized) - { - MXMLDataInterpreter.generateMXMLInstances(_mxmlDocument, this, MXMLDescriptor); - - dispatchEvent(new Event("initBindings")); - dispatchEvent(new Event("initComplete")); - _initialized = true; - } - } - - /** - * @private - */ - override public function get numElements():int - { - var contentView:IParent = view as IParent; - return contentView != null ? contentView.numElements : super.numElements; - } - - - /** - * @private - * @suppress {undefinedNames} - * Support strandChildren. - */ - public function $numElements():int - { - return super.numElements(); - } - - /** - * @private - * @suppress {undefinedNames} - * Support strandChildren. - */ - public function $addElement(c:IChild, dispatchEvent:Boolean = true):void - { - super.addElement(c, dispatchEvent); - } - - /** - * @private - * @suppress {undefinedNames} - * Support strandChildren. - */ - public function $addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void - { - super.addElementAt(c, index, dispatchEvent); - } - - /** - * @private - * @suppress {undefinedNames} - * Support strandChildren. - */ - public function $removeElement(c:IChild, dispatchEvent:Boolean = true):void - { - super.removeElement(c, dispatchEvent); - } - - /** - * @private - * @suppress {undefinedNames} - * Support strandChildren. - */ - public function $getElementIndex(c:IChild):int - { - return super.getElementIndex(c); - } - - /** - * @private - * @suppress {undefinedNames} - * Support strandChildren. - */ - public function $getElementAt(index:int):IChild - { - return super.getElementAt(index); - } - - private var _mxmlDescriptor:Array; - private var _mxmlDocument:Object = this; - private var _initialized:Boolean; - - /** - * @copy org.apache.flex.core.Application#MXMLDescriptor - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get MXMLDescriptor():Array - { - return _mxmlDescriptor; - } - - /** - * @private - */ - public function setMXMLDescriptor(document:Object, value:Array):void - { - _mxmlDocument = document; - _mxmlDescriptor = value; - } - - /** - * @copy org.apache.flex.core.Application#generateMXMLAttributes() - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function generateMXMLAttributes(data:Array):void - { - MXMLDataInterpreter.generateMXMLProperties(this, data); - } - - /** - * @copy org.apache.flex.core.ItemRendererClassFactory#mxmlContent - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public var mxmlContent:Array; - - private var _states:Array; - - /** - * The array of view states. These should - * be instances of org.apache.flex.states.State. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get states():Array - { - return _states; - } - - /** - * @private - * @flexjsignorecoercion Class - * @flexjsignorecoercion org.apache.flex.core.IBead - */ - public function set states(value:Array):void - { - _states = value; - _currentState = _states[0].name; - - try{ - if (getBeadByType(IStatesImpl) == null) - { - var c:Class = ValuesManager.valuesImpl.getValue(this, "iStatesImpl") as Class; - var b:Object = new c(); - addBead(b as IBead); - } - } - //TODO: Need to handle this case more gracefully - catch(e:Error) - { - COMPILE::SWF - { - trace(e.message); - } - } - - } - - /** - * true if the array of states - * contains a state with this name. - * - * @param state The state namem. - * @return True if state in state array - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function hasState(state:String):Boolean - { - for each (var s:State in _states) - { - if (s.name == state) - return true; - } - return false; - } - - private var _currentState:String; - - [Bindable("currentStateChange")] - /** - * The name of the current state. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get currentState():String - { - return _currentState; - } - - /** - * @private - */ - public function set currentState(value:String):void - { - var event:ValueChangeEvent = new ValueChangeEvent("currentStateChange", false, false, _currentState, value) - _currentState = value; - dispatchEvent(event); - } - - private var _transitions:Array; - - /** - * The array of transitions. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get transitions():Array - { - return _transitions; - } - - /** - * @private - */ - public function set transitions(value:Array):void - { - _transitions = value; - } - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as deleted file mode 100644 index e961c1f..0000000 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ContainerBaseStrandChildren.as +++ /dev/null @@ -1,99 +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.core -{ - /** - * The ContainerBaseStrandChildren class the provides a way for advanced - * components to place children directly into the strand unlike the - * addElement() APIs on the Container which place children into the contentView. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class ContainerBaseStrandChildren implements IParent - { - /** - * Constructor. - * - * @flexjsignorecoercion org.apache.flex.core.ContainerBase - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function ContainerBaseStrandChildren(owner:IParent) - { - super(); - - this.owner = owner as ContainerBase; - } - - public var owner:ContainerBase; - - /** - * @private - */ - public function get numElements():int - { - return owner.$numElements(); - } - - /** - * @private - */ - public function addElement(c:IChild, dispatchEvent:Boolean = true):void - { - owner.$addElement(c, dispatchEvent); - } - - /** - * @private - */ - public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void - { - owner.$addElementAt(c, index, dispatchEvent); - } - - /** - * @private - */ - public function removeElement(c:IChild, dispatchEvent:Boolean = true):void - { - owner.$removeElement(c, dispatchEvent); - } - - /** - * @private - */ - public function getElementIndex(c:IChild):int - { - return owner.$getElementIndex(c); - } - - /** - * @private - */ - public function getElementAt(index:int):IChild - { - return owner.$getElementAt(index); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/FilledRectangle.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/FilledRectangle.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/FilledRectangle.as deleted file mode 100644 index 5888a94..0000000 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/FilledRectangle.as +++ /dev/null @@ -1,125 +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.core -{ - COMPILE::SWF - { - import flash.display.Shape; - } - - import org.apache.flex.core.UIBase; - - /** - * The FilledRectangle class draws a simple filled - * rectangle without a border and with square corners. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class FilledRectangle extends UIBase - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function FilledRectangle() - { - super(); - - COMPILE::SWF - { - _shape = new flash.display.Shape(); - $displayObjectContainer.addChild(_shape); - } - } - - COMPILE::SWF - private var _shape:flash.display.Shape; - - private var _fillColor:uint = 0x000000; - - /** - * The color of the rectangle. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get fillColor():uint - { - return _fillColor; - } - - /** - * @private - */ - public function set fillColor(value:uint):void - { - _fillColor = value; - } - - /** - * @private - */ - override public function addedToParent():void - { - super.addedToParent(); - drawRect(0, 0, this.width, this.height); - } - - /** - * Draw the rectangle. - * @param x The x position of the top-left corner of the rectangle. - * @param y The y position of the top-left corner. - * @param width The width of the rectangle. - * @param height The height of the rectangle. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function drawRect(x:Number, y:Number, width:Number, height:Number):void - { - COMPILE::SWF - { - _shape.graphics.clear(); - _shape.graphics.beginFill(_fillColor); - _shape.graphics.drawRect(x, y, width, height); - _shape.graphics.endFill(); - } - COMPILE::JS - { - element.style.position = 'absolute'; - element.style.backgroundColor = '#' + _fillColor.toString(16); - if (!isNaN(x)) this.x = x; - if (!isNaN(y)) this.y = y; - if (!isNaN(width)) this.width = width; - if (!isNaN(height)) this.height = height; - } - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as deleted file mode 100644 index f9c0aaa..0000000 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBase.as +++ /dev/null @@ -1,126 +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.core -{ - import org.apache.flex.core.IMXMLDocument; - import org.apache.flex.core.ValuesManager; - import org.apache.flex.events.Event; - import org.apache.flex.events.ValueChangeEvent; - import org.apache.flex.states.State; - import org.apache.flex.utils.MXMLDataInterpreter; - - /** - * The ListBase class is the base class for most lists - * in FlexJS. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class ListBase extends UIBase implements IContentViewHost - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function ListBase() - { - super(); - - _strandChildren = new ListBaseStrandChildren(this); - } - - private var _strandChildren:ListBaseStrandChildren; - - /** - * @private - */ - public function get strandChildren():IParent - { - return _strandChildren; - } - - /** - * @private - * @suppress {undefinedNames} - * Support strandChildren. - */ - public function $numElements():int - { - return super.numElements(); - } - - - /** - * @private - * @suppress {undefinedNames} - * Support strandChildren. - */ - public function $addElement(c:IChild, dispatchEvent:Boolean = true):void - { - super.addElement(c, dispatchEvent); - } - - /** - * @private - * @suppress {undefinedNames} - * Support strandChildren. - */ - public function $addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void - { - super.addElementAt(c, index, dispatchEvent); - } - - /** - * @private - * @suppress {undefinedNames} - * Support strandChildren. - */ - public function $removeElement(c:IChild, dispatchEvent:Boolean = true):void - { - super.removeElement(c, dispatchEvent); - } - - /** - * @private - * @suppress {undefinedNames} - * Support strandChildren. - */ - public function $getElementIndex(c:IChild):int - { - return super.getElementIndex(c); - } - - /** - * @private - * @suppress {undefinedNames} - * Support strandChildren. - */ - public function $getElementAt(index:int):IChild - { - return super.getElementAt(index); - } - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as deleted file mode 100644 index b1748f9..0000000 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ListBaseStrandChildren.as +++ /dev/null @@ -1,100 +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.core -{ - - - /** - * The ListBaseStrandChildren exists so that Lists are compatible with - * the ListView/ContainerView beads. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class ListBaseStrandChildren implements IParent - { - /** - * Constructor. - * - * @flexjsignorecoercion org.apache.flex.core.ListBase - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function ListBaseStrandChildren(owner:IParent) - { - super(); - - this.owner = owner as ListBase; - } - - public var owner:ListBase; - - /** - * @private - */ - public function get numElements():int - { - return owner.$numElements(); - } - - /** - * @private - */ - public function addElement(c:IChild, dispatchEvent:Boolean = true):void - { - owner.$addElement(c, dispatchEvent); - } - - /** - * @private - */ - public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void - { - owner.$addElementAt(c, index, dispatchEvent); - } - - /** - * @private - */ - public function removeElement(c:IChild, dispatchEvent:Boolean = true):void - { - owner.$removeElement(c, dispatchEvent); - } - - /** - * @private - */ - public function getElementIndex(c:IChild):int - { - return owner.$getElementIndex(c); - } - - /** - * @private - */ - public function getElementAt(index:int):IChild - { - return owner.$getElementAt(index); - } - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/View.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/View.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/View.as deleted file mode 100644 index 2d0f2c4..0000000 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/View.as +++ /dev/null @@ -1,34 +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.core -{ - /** - * The View class is the class for most views in a FlexJS - * application. It is generally used as the root tag of MXML - * documents and UI controls and containers are added to it. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class View extends ViewBase - { - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as b/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as deleted file mode 100644 index 7e4b65e..0000000 --- a/frameworks/projects/Core/src/main/flex/org/apache/flex/core/ViewBase.as +++ /dev/null @@ -1,97 +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.core -{ - import org.apache.flex.events.Event; - - //-------------------------------------- - // Events - //-------------------------------------- - - /** - * Dispatched at startup. Attributes and sub-instances of - * the MXML document have been created and assigned. - * The component lifecycle is different - * than the Flex SDK. There is no creationComplete event. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - [Event(name="initComplete", type="org.apache.flex.events.Event")] - - [DefaultProperty("mxmlContent")] - - /** - * The ViewBase class is the base class for most views in a FlexJS - * application. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class ViewBase extends ContainerBase implements IPopUpHost, IApplicationView - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function ViewBase() - { - super(); - - className = "flexjs"; - } - - private var _applicationModel:Object; - - [Bindable("modelChanged")] - - /** - * A reference to the Application's model. Usually, - * a view is displaying the main model for an - * application. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function get applicationModel():Object - { - return _applicationModel; - } - - /** - * @private - */ - public function set applicationModel(value:Object):void - { - _applicationModel = value; - dispatchEvent(new Event("modelChanged")); - } - - } -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as new file mode 100644 index 0000000..0a9c69a --- /dev/null +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/Application.as @@ -0,0 +1,560 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.core +{ + import org.apache.flex.events.Event; + import org.apache.flex.events.IEventDispatcher; + import org.apache.flex.events.MouseEvent; + import org.apache.flex.events.utils.MouseEventConverter; + import org.apache.flex.utils.MXMLDataInterpreter; + import org.apache.flex.utils.Timer; + + COMPILE::SWF { + import flash.display.DisplayObject; + import flash.display.Graphics; + import flash.display.Sprite; + import flash.events.Event; + import flash.system.ApplicationDomain; + import flash.utils.getQualifiedClassName; + } + + //-------------------------------------- + // Events + //-------------------------------------- + + /** + * Dispatched at startup. Attributes and sub-instances of + * the MXML document have been created and assigned. + * The component lifecycle is different + * than the Flex SDK. There is no creationComplete event. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Event(name="initialize", type="org.apache.flex.events.Event")] + + /** + * Dispatched at startup before the instances get created. + * Beads can call preventDefault and defer initialization. + * This event will be dispatched on every frame until no + * listeners call preventDefault(), then the initialize() + * method will be called. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Event(name="preinitialize", type="org.apache.flex.events.Event")] + + /** + * Dispatched at startup after the initial view has been + * put on the display list. This event is sent before + * applicationComplete is dispatched. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Event(name="viewChanged", type="org.apache.flex.events.Event")] + + /** + * Dispatched at startup after the initial view has been + * put on the display list. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Event(name="applicationComplete", type="org.apache.flex.events.Event")] + + /** + * A SWF application must be bootstrapped by a Flash Sprite. + * The factory class is the default bootstrap. + * + * @langversion 3.0 + * @playerversion Flash 9 + * @playerversion AIR 1.1 + * @productversion Flex 3 + */ + [Frame(factoryClass="org.apache.flex.core.ApplicationFactory")] + + /** + * The Application class is the main class and entry point for a FlexJS + * application. This Application class is different than the + * Flex SDK's mx:Application or spark:Application in that it does not contain + * user interface elements. Those UI elements go in the views (ViewBase). This + * Application class expects there to be a main model, a controller, and + * an initial view. + * + * @see ViewBase + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public class Application extends ApplicationBase implements IStrand, IParent, IEventDispatcher, ISWFApplication, IPopUpHost, IRenderedObject + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function Application() + { + super(); + } + + /** + * Application wraps the root object. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + COMPILE::SWF + public function setRoot(r:WrappedMovieClip):void + { + element = r; + element.flexjs_wrapper = this; + MouseEventConverter.setupAllConverters(r.stage); + MouseEventConverter.setupAllConverters(r.stage, false); + initHandler(); + } + + COMPILE::SWF + private function initHandler():void + { + if (model is IBead) addBead(model as IBead); + if (controller is IBead) addBead(controller as IBead); + + for each (var bead:IBead in beads) + addBead(bead); + + dispatchEvent(new org.apache.flex.events.Event("beadsAdded")); + + if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true))) + initialize(); + else + addEventListener(flash.events.Event.ENTER_FRAME, enterFrameHandler); + + } + + COMPILE::SWF + private function enterFrameHandler(event:flash.events.Event):void + { + if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true))) + { + removeEventListener(flash.events.Event.ENTER_FRAME, enterFrameHandler); + initialize(); + } + } + + /** + * This method gets called when all preinitialize handlers + * no longer call preventDefault(); + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + * @flexjsignorecoercion org.apache.flex.core.IBead + */ + protected function initialize():void + { + MXMLDataInterpreter.generateMXMLInstances(this, null, MXMLDescriptor); + + dispatchEvent(new org.apache.flex.events.Event("initialize")); + + if (initialView) + { + initialView.applicationModel = model; + this.addElement(initialView); + + COMPILE::SWF + { + // if someone has installed a resize listener, fake an event to run it now + if ($displayObject.stage.hasEventListener("resize")) + $displayObject.stage.dispatchEvent(new flash.events.Event("resize")); + else if (initialView is ILayoutChild) + { + var ilc:ILayoutChild = initialView as ILayoutChild; + // otherwise, size once like this + if (!isNaN(ilc.percentWidth) && !isNaN(ilc.percentHeight)) + ilc.setWidthAndHeight($displayObject.stage.stageWidth, $displayObject.stage.stageHeight, true); + else if (!isNaN(ilc.percentWidth)) + ilc.setWidth($displayObject.stage.stageWidth); + else if (!isNaN(ilc.percentHeight)) + ilc.setHeight($displayObject.stage.stageHeight); + } + } + COMPILE::JS + { + var baseView:UIBase = initialView as UIBase; + if (!isNaN(baseView.percentWidth) || !isNaN(baseView.percentHeight)) { + this.element.style.height = window.innerHeight + 'px'; + this.element.style.width = window.innerWidth + 'px'; + this.initialView.dispatchEvent('sizeChanged'); // kick off layout if % sizes + } + } + COMPILE::SWF + { + var bgColor:Object = ValuesManager.valuesImpl.getValue(this, "background-color"); + if (bgColor != null) + { + var backgroundColor:uint = ValuesManager.valuesImpl.convertColor(bgColor); + var graphics:Graphics = Sprite($displayObject).graphics; + graphics.beginFill(backgroundColor); + graphics.drawRect(0, 0, initialView.width, initialView.height); + graphics.endFill(); + } + } + dispatchEvent(new org.apache.flex.events.Event("viewChanged")); + } + dispatchEvent(new org.apache.flex.events.Event("applicationComplete")); + } + + /** + * The org.apache.flex.core.IValuesImpl that will + * determine the default values and other values + * for the application. The most common choice + * is org.apache.flex.core.SimpleCSSValuesImpl. + * + * @see org.apache.flex.core.SimpleCSSValuesImpl + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function set valuesImpl(value:IValuesImpl):void + { + ValuesManager.valuesImpl = value; + ValuesManager.valuesImpl.init(this); + } + + /** + * The initial view. + * + * @see org.apache.flex.core.ViewBase + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + [Bindable("__NoChangeEvent__")] + public var initialView:IApplicationView; + + /** + * The controller. The controller typically watches + * the UI for events and updates the model accordingly. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public var controller:Object; + + /** + * An array of data that describes the MXML attributes + * and tags in an MXML document. This data is usually + * decoded by an MXMLDataInterpreter + * + * @see org.apache.flex.utils.MXMLDataInterpreter + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get MXMLDescriptor():Array + { + return null; + } + + /** + * An method called by the compiler's generated + * code to kick off the setting of MXML attribute + * values and instantiation of child tags. + * + * The call has to be made in the generated code + * in order to ensure that the constructors have + * completed first. + * + * @param data The encoded data representing the + * MXML attributes. + * + * @see org.apache.flex.utils.MXMLDataInterpreter + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function generateMXMLAttributes(data:Array):void + { + MXMLDataInterpreter.generateMXMLProperties(this, data); + } + + /** + * The array property that is used to add additional + * beads to an MXML tag. From ActionScript, just + * call addBead directly. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public var beads:Array; + + private var _elements:Array; + + /** + * @copy org.apache.flex.core.IParent#addElement() + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + * @flexjsignorecoercion org.apache.flex.core.IUIBase + * @flexjsignorecoercion HTMLElement + */ + public function addElement(c:IChild, dispatchEvent:Boolean = true):void + { + COMPILE::SWF + { + if(_elements == null) + _elements = []; + _elements[_elements.length] = c; + $displayObjectContainer.addChild(c.$displayObject); + if (c is IUIBase) + { + IUIBase(c).addedToParent(); + } + } + COMPILE::JS { + this.element.appendChild(c.element as HTMLElement); + (c as IUIBase).addedToParent(); + } + } + + /** + * @copy org.apache.flex.core.IParent#addElementAt() + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + * @flexjsignorecoercion org.apache.flex.core.IUIBase + */ + public function addElementAt(c:IChild, index:int, dispatchEvent:Boolean = true):void + { + COMPILE::SWF + { + if(_elements == null) + _elements = []; + _elements.splice(index,0,c); + + $displayObjectContainer.addChildAt(c.$displayObject,index); + + if (c is IUIBase) + { + IUIBase(c).addedToParent(); + } + } + COMPILE::JS { + var children:NodeList = internalChildren(); + if (index >= children.length) + addElement(c); + else + { + element.insertBefore(c.positioner, + children[index]); + (c as IUIBase).addedToParent(); + } + + } + } + + /** + * @copy org.apache.flex.core.IParent#getElementAt() + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function getElementAt(index:int):IChild + { + COMPILE::SWF + { + if(_elements == null) + return null; + return _elements[index]; + } + COMPILE::JS + { + var children:NodeList = internalChildren(); + return children[index].flexjs_wrapper; + } + } + + /** + * @copy org.apache.flex.core.IParent#getElementIndex() + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function getElementIndex(c:IChild):int + { + COMPILE::SWF + { + if(_elements == null) + return -1; + return _elements.indexOf(c); + } + COMPILE::JS { + var children:NodeList = internalChildren(); + var n:int = children.length; + for (var i:int = 0; i < n; i++) + { + if (children[i] == c.element) + return i; + } + return -1; + } + } + + /** + * @copy org.apache.flex.core.IParent#removeElement() + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + * @flexjsignorecoercion HTMLElement + */ + public function removeElement(c:IChild, dispatchEvent:Boolean = true):void + { + COMPILE::SWF + { + if(_elements) + { + var idx:int = _elements.indexOf(c); + if(idx>=0) + _elements.splice(idx,1); + } + $displayObjectContainer.removeChild(c.$displayObject as DisplayObject); + } + COMPILE::JS + { + element.removeChild(c.element as HTMLElement); + } + } + + /** + * @copy org.apache.flex.core.IParent#numElements + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function get numElements():int + { + COMPILE::SWF + { + return _elements ? _elements.length : 0; + } + COMPILE::JS + { + var children:NodeList = internalChildren(); + return children.length; + } + } + + /** + * @return {Object} The array of children. + */ + COMPILE::JS + protected function internalChildren():NodeList + { + return element.childNodes; + }; + + COMPILE::JS + protected var startupTimer:Timer; + + /** + * @flexjsignorecoercion org.apache.flex.core.IBead + */ + COMPILE::JS + public function start():void + { + element = document.getElementsByTagName('body')[0]; + element.flexjs_wrapper = this; + element.className = 'Application'; + positioner = element; + + if (model is IBead) addBead(model as IBead); + if (controller is IBead) addBead(controller as IBead); + + for (var index:int in beads) { + addBead(beads[index]); + } + + dispatchEvent(new org.apache.flex.events.Event("beadsAdded")); + + if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true))) + initialize(); + else { + startupTimer = new Timer(34, 0); + startupTimer.addEventListener("timer", handleStartupTimer); + startupTimer.start(); + } + } + + /** + * @private + */ + COMPILE::JS + protected function handleStartupTimer(event:Event):void + { + if (dispatchEvent(new org.apache.flex.events.Event("preinitialize", false, true))) + { + startupTimer.stop(); + initialize(); + } + } + + } +} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/efd9dcad/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ApplicationBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ApplicationBase.as b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ApplicationBase.as new file mode 100644 index 0000000..0fe63ba --- /dev/null +++ b/frameworks/projects/HTML/src/main/flex/org/apache/flex/core/ApplicationBase.as @@ -0,0 +1,109 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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.core +{ + COMPILE::SWF { + import flash.system.ApplicationDomain; + import flash.utils.getQualifiedClassName; + } + + /** + * This is a platform-dependent base class + * for Application + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + COMPILE::SWF + public class ApplicationBase extends UIHTMLElementWrapper implements IFlexInfo + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ApplicationBase() + { + super(); + } + + private var _info:Object; + + /** + * An Object containing information generated + * by the compiler that is useful at startup time. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function info():Object + { + if (!_info) + { + var mainClassName:String = getQualifiedClassName(this); + var initClassName:String = "_" + mainClassName + "_FlexInit"; + var c:Class = ApplicationDomain.currentDomain.getDefinition(initClassName) as Class; + _info = c.info(); + } + return _info; + } + } + + COMPILE::JS + public class ApplicationBase extends UIHTMLElementWrapper implements IFlexInfo + { + /** + * Constructor. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function ApplicationBase() + { + super(); + } + + private var _info:Object; + + /** + * An Object containing information generated + * by the compiler that is useful at startup time. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + public function info():Object + { + return _info; + } + + + } +}