You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ah...@apache.org on 2018/03/08 09:22:01 UTC
[royale-asjs] 03/03: clean compile of UIComponent. Need to fix up
pom for Maven, then get it to run
This is an automated email from the ASF dual-hosted git repository.
aharui pushed a commit to branch feature/MXRoyale
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit 7227ffb4e68ed317848230d85a8ee0105a1c8cc0
Author: Alex Harui <ah...@apache.org>
AuthorDate: Thu Mar 8 01:21:36 2018 -0800
clean compile of UIComponent. Need to fix up pom for Maven, then get it to run
---
frameworks/js/projects/MXRoyaleJS/build.xml | 1 +
.../src/main/config/compile-js-config.xml | 4 +
frameworks/projects/MXRoyale/build.xml | 2 +
.../src/main/config/compile-swf-config.xml | 4 +
.../src/main/royale/mx/core/Application.as | 1569 +-------------------
.../src/main/royale/mx/core/FlexGlobals.as | 55 +
.../main/royale/mx/core/IDisplayObjectInterface.as | 183 +++
.../src/main/royale/mx/core/IFlexDisplayObject.as | 2 +-
.../src/main/royale/mx/core/IUIComponent.as | 35 +-
.../src/main/royale/mx/core/IVisualElement.as | 4 +-
.../src/main/royale/mx/core/UIComponent.as | 807 ++++++----
.../src/main/royale/mx/events/FlexEvent.as | 3 +-
.../src/main/royale/mx/managers/ISystemManager.as | 21 +
13 files changed, 789 insertions(+), 1901 deletions(-)
diff --git a/frameworks/js/projects/MXRoyaleJS/build.xml b/frameworks/js/projects/MXRoyaleJS/build.xml
index 3c96341..8c89e92 100644
--- a/frameworks/js/projects/MXRoyaleJS/build.xml
+++ b/frameworks/js/projects/MXRoyaleJS/build.xml
@@ -58,6 +58,7 @@
<jvmarg value="-Dsun.io.useCanonCaches=false" />
<jvmarg value="-Droyalelib=${ROYALE_HOME}/frameworks" />
<arg value="+royalelib=${ROYALE_HOME}/frameworks" />
+ <arg value="-compiler.define+=GOOG::DEBUG,goog.DEBUG" />
<arg value="-compiler.strict-xml=true" />
<arg value="-compiler.targets=SWF,JSRoyale" />
<arg value="-output=${basedir}/target/${target.name}" />
diff --git a/frameworks/js/projects/MXRoyaleJS/src/main/config/compile-js-config.xml b/frameworks/js/projects/MXRoyaleJS/src/main/config/compile-js-config.xml
index d28f20c..aa14cb0 100644
--- a/frameworks/js/projects/MXRoyaleJS/src/main/config/compile-js-config.xml
+++ b/frameworks/js/projects/MXRoyaleJS/src/main/config/compile-js-config.xml
@@ -35,6 +35,8 @@
<binding-value-change-event-kind>org.apache.royale.events.ValueChangeEvent</binding-value-change-event-kind>
<binding-value-change-event-type>valueChange</binding-value-change-event-type>
+ <allow-subclass-overrides>true</allow-subclass-overrides>
+
<define>
<name>COMPILE::SWF</name>
<value>false</value>
@@ -61,7 +63,9 @@
if these swcs are on the external-library-path then their requires
will not be listed -->
<path-element>../../../../../libs/CoreJS.swc</path-element>
+ <path-element>../../../../../libs/BindingJS.swc</path-element>
<path-element>../../../../../libs/BasicJS.swc</path-element>
+ <path-element>../../../../../libs/ExpressJS.swc</path-element>
</library-path>
<namespaces>
diff --git a/frameworks/projects/MXRoyale/build.xml b/frameworks/projects/MXRoyale/build.xml
index 4c12fd6..ad3c3b8 100644
--- a/frameworks/projects/MXRoyale/build.xml
+++ b/frameworks/projects/MXRoyale/build.xml
@@ -93,6 +93,8 @@
<arg value="-output=${basedir}/target/${target.name}" />
<arg value="-load-config=${basedir}/src/main/config/compile-swf-config.xml" />
<arg value="-js-compiler-define+=GOOG::DEBUG,goog.DEBUG" />
+ <arg value="-js-compiler-define+=COMPILE::SWF,false" />
+ <arg value="-js-compiler-define+=COMPILE::JS,true" />
<arg value="-js-load-config=${ROYALE_HOME}/frameworks/js-config.xml" />
<arg value="-js-load-config+=${basedir}/../../js/projects/${ant.project.name}JS/src/main/config/compile-js-config.xml" />
</java>
diff --git a/frameworks/projects/MXRoyale/src/main/config/compile-swf-config.xml b/frameworks/projects/MXRoyale/src/main/config/compile-swf-config.xml
index 25fca10..918c8ad 100644
--- a/frameworks/projects/MXRoyale/src/main/config/compile-swf-config.xml
+++ b/frameworks/projects/MXRoyale/src/main/config/compile-swf-config.xml
@@ -31,11 +31,15 @@
<external-library-path>
<path-element>${env.AIR_HOME}/frameworks/libs/air/airglobal.swc</path-element>
<path-element>../../../../../libs/Core.swc</path-element>
+ <path-element>../../../../../libs/Binding.swc</path-element>
<path-element>../../../../../libs/Basic.swc</path-element>
<path-element>../../../../../libs/Collections.swc</path-element>
<path-element>../../../../../libs/Graphics.swc</path-element>
+ <path-element>../../../../../libs/Express.swc</path-element>
</external-library-path>
+ <allow-subclass-overrides>true</allow-subclass-overrides>
+
<mxml>
<children-as-data>true</children-as-data>
</mxml>
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
index 9fe0e82..93ca558 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/Application.as
@@ -20,6 +20,7 @@
package mx.core
{
+/*
import flash.display.DisplayObject;
import flash.display.InteractiveObject;
import flash.events.ContextMenuEvent;
@@ -46,7 +47,9 @@ import mx.utils.LoaderUtil;
import mx.utils.Platform;
use namespace mx_internal;
-
+*/
+import org.apache.royale.express.Application;
+
//--------------------------------------
// Events
//--------------------------------------
@@ -76,68 +79,6 @@ use namespace mx_internal;
*/
[Event(name="error", type="flash.events.ErrorEvent")]
-//--------------------------------------
-// Styles
-//--------------------------------------
-
-include "../styles/metadata/ModalTransparencyStyles.as";
-
-/**
- * Specifies the alpha transparency values used for the background gradient fill of the application.
- * You should set this to an Array of two numbers.
- * Elements 0 and 1 specify the start and end values for an alpha gradient.
- *
- * @default [ 1.0, 1.0 ]
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="backgroundGradientAlphas", type="Array", arrayType="Number", inherit="no", theme="halo")]
-
-/**
- * Specifies the colors used to tint the background gradient fill of the application.
- * You should set this to an Array of two uint values that specify RGB colors.
- * Elements 0 and 1 specify the start and end values for a color gradient.
- * For a solid-color background, set the same color value for elements 0 and 1.
- * A value of <code>undefined</code> means background gradient is generated
- * based on the <code>backgroundColor</code> property.
- *
- * @default undefined
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="backgroundGradientColors", type="Array", arrayType="uint", format="Color", inherit="no", theme="halo")]
-
-/**
- * Number of pixels between the application's bottom border
- * and its content area.
- *
- * @default 24
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="paddingBottom", type="Number", format="Length", inherit="no")]
-
-/**
- * Number of pixels between the application's top border
- * and its content area.
- *
- * @default 24
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
-[Style(name="paddingTop", type="Number", format="Length", inherit="no")]
//--------------------------------------
// Excluded APIs
@@ -168,10 +109,6 @@ include "../styles/metadata/ModalTransparencyStyles.as";
*/
[Frame(factoryClass="mx.managers.SystemManager")]
-[ResourceBundle("core")]
-
-[Alternative(replacement="spark.components.Application", since="4.0")]
-
/**
* Flex defines a default, or Application, container that lets you start
* adding content to your application without explicitly defining
@@ -256,20 +193,8 @@ include "../styles/metadata/ModalTransparencyStyles.as";
* @playerversion AIR 1.1
* @productversion Flex 3
*/
-public class Application extends LayoutContainer
+public class Application extends org.apache.royale.express.Application
{
- include "../core/Version.as";
-
- //--------------------------------------------------------------------------
- //
- // Class variables
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- mx_internal static var useProgressiveLayout:Boolean = false;
//--------------------------------------------------------------------------
//
@@ -312,8 +237,6 @@ public class Application extends LayoutContainer
* Therefore we decided to dispense with strict typing for
* 'application'.
*/
- [Deprecated(replacement="FlexGlobals.topLevelApplication", since="4.0")]
-
public static function get application():Object
{
return FlexGlobals.topLevelApplication;
@@ -335,26 +258,11 @@ public class Application extends LayoutContainer
*/
public function Application()
{
- UIComponentGlobals.layoutManager = ILayoutManager(
- Singleton.getInstance("mx.managers::ILayoutManager"));
- UIComponentGlobals.layoutManager.usePhasedInstantiation = true;
-
if (!FlexGlobals.topLevelApplication)
FlexGlobals.topLevelApplication = this;
super();
- layoutObject = new ApplicationLayout();
- layoutObject.target = this;
- boxLayoutClass = ApplicationLayout;
-
- showInAutomationHierarchy = true;
- // Flex's auto-generated init() override has set the
- // documentDescriptor property for the application object.
- // We get the id and the creationPolicy, which we want to
- // set very early, from that descriptor.
-
- initResizeBehavior();
}
//--------------------------------------------------------------------------
@@ -366,1479 +274,20 @@ public class Application extends LayoutContainer
/**
* @private
*/
- private var resizeHandlerAdded:Boolean = false;
-
- /**
- * @private
- */
- private var percentBoundsChanged:Boolean;
-
- /**
- * @private
- * Placeholder for Preloader object reference.
- */
- private var preloadObj:Object;
-
- /**
- * @private
- * Used in progressive layout.
- */
- private var creationQueue:Array = [];
-
- /**
- * @private
- * Used in progressive layout.
- */
- private var processingCreationQueue:Boolean = false;
-
- /**
- * @private
- * The application's view metrics.
- */
- private var _applicationViewMetrics:EdgeMetrics;
-
- /**
- * @private
- * This flag indicates whether the width of the Application instance
- * can change or has been explicitly set by the developer.
- * When the stage is resized we use this flag to know whether the
- * width of the Application should be modified.
- */
- private var resizeWidth:Boolean = true;
-
- /**
- * @private
- * This flag indicates whether the height of the Application instance
- * can change or has been explicitly set by the developer.
- * When the stage is resized we use this flag to know whether the
- * height of the Application should be modified.
- */
- private var resizeHeight:Boolean = true;
-
- /**
- * @private
- */
- private var synchronousResize:Boolean = false;
-
- /**
- * @private
- * (Possibly null) reference to the View Source context menu item,
- * so that we can update it for runtime localization.
- */
- private var viewSourceCMI:ContextMenuItem;
-
- //--------------------------------------------------------------------------
- //
- // Compile-time pseudo-properties
- //
- //--------------------------------------------------------------------------
-
- // These declarations correspond to the MXML-compile-time attributes
- // allowed on the <mx:Application> tag. These attributes affect the MXML
- // compiler, but they aren't actually used in the runtime framework.
- // The declarations appear here in order to provide metadata about these
- // attributes for Flash Builder.
-
- //----------------------------------
- // frameRate
- //----------------------------------
-
- [Inspectable(defaultValue="24")]
-
- /**
- * Specifies the frame rate of the application.
- * <p>Note: This property cannot be set by ActionScript code; it must be set in MXML code.</p>
- *
- * @default 24
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public var frameRate:Number;
-
- //----------------------------------
- // pageTitle
- //----------------------------------
-
- /**
- * Specifies a string that appears in the title bar of the browser.
- * This property provides the same functionality as the
- * HTML <code><title></code> tag.
- *
- * <p>Note: This property cannot be set by ActionScript code; it must be set in MXML code.
- * The value set in MXML code is designed to be used by a tool to update the HTML templates
- * provided with the SDK.</p>
- *
- * @default ""
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public var pageTitle:String;
-
- //----------------------------------
- // preloader
- //----------------------------------
-
- [Inspectable(defaultValue="mx.preloaders.DownloadProgressBar")]
-
- /**
- * The application container supports an application preloader that
- * uses a download progress bar to show the download and initialization progress
- * of an application SWF file.
- * By default, the application preloader is enabled.
- * The preloader tracks how many bytes have been downloaded and continually
- * updates the progress bar.
- *
- * <p>Use this property to specify the path of a component that
- * defines a custom progress indicator.
- * To create a custom progress indicator, you typically create a subclass of the
- * DownloadProgressBar class, or create a subclass of
- * the flash.display.Sprite class that implements the
- * mx.preloaders.IPreloaderDisplay interface. </p>
- *
- * <p><b>Note:</b> This property cannot be set by ActionScript code; it must be set in MXML code.</p>
- *
- * @see mx.preloaders.DownloadProgressBar
- * @see flash.display.Sprite
- * @see mx.preloaders.IPreloaderDisplay
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public var preloader:Object;
-
- //----------------------------------
- // preloaderChromeColor
- //----------------------------------
-
- [Inspectable(defaultValue="0xCCCCCC", format="Color")]
-
- /**
- * Specifies the base color used by the default preloader component. This property
- * has the same effect as the <code>chromeColor</code> style used by the Spark skins.
- * Typically this property should be set to the same value as the <code>chromeColor</code>
- * style used by the application.
- *
- * <p>Note: This property cannot be set by ActionScript code; it must be set in MXML code.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 10
- * @playerversion AIR 1.5
- * @productversion Flex 4
- */
-
- /* This property is not directly read by the download progress bar (preloader)
- * component. It is here so that it gets picked up by the compiler and included
- * in the info() structure for the generated system manager. The download progress bar
- * grabs the value directly from the info() structure. */
- public var preloaderChromeColor:uint;
-
- //----------------------------------
- // scriptRecursionLimit
- //----------------------------------
-
- [Inspectable(defaultValue="1000")]
-
- /**
- * Specifies the maximum depth of Flash Player or AIR
- * call stack before the player stops.
- * This is essentially the stack overflow limit.
- * <p>Note: This property cannot be set by ActionScript code; it must be set in MXML code.</p>
- *
- * @default 1000
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public var scriptRecursionLimit:int;
-
- //----------------------------------
- // scriptTimeLimit
- //----------------------------------
-
- [Inspectable(defaultValue="60")]
-
- /**
- * Specifies the maximum duration, in seconds, that an ActionScript
- * event handler can execute before Flash Player or AIR assumes
- * that it is hung, and aborts it.
- * The maximum allowable value that you can set is 60 seconds.
- *
- * @default 60
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public var scriptTimeLimit:Number;
-
- //----------------------------------
- // usePreloader
- //----------------------------------
-
- [Inspectable(defaultValue="true")]
-
- /**
- * If <code>true</code>, specifies to display the application preloader.
- * <p>Note: This property cannot be set by ActionScript code; it must be set in MXML code.</p>
- *
- * @default true
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public var usePreloader:Boolean;
-
- //--------------------------------------------------------------------------
- //
- // Overridden properties (to block metadata from superclasses)
- //
- //--------------------------------------------------------------------------
-
- //----------------------------------
- // enabled
- //----------------------------------
-
- [Inspectable(category="General", enumeration="true,false", defaultValue="true")]
-
- /**
- * @private
- */
- override public function set enabled(value:Boolean):void
- {
- super.enabled = value;
-
- // controlBar must be enabled/disabled when this container is.
- if (controlBar)
- controlBar.enabled = value;
- }
-
- //----------------------------------
- // icon
- //----------------------------------
-
- [Inspectable(environment="none")]
-
- /**
- * @private
- */
- override public function set icon(value:Class):void
- {
- }
-
- //----------------------------------
- // id
- //----------------------------------
-
- [Inspectable(environment="none")]
-
- /**
- * @private
- */
- override public function get id():String
- {
- if (!super.id &&
- this == FlexGlobals.topLevelApplication &&
- ExternalInterface.available)
- {
- return ExternalInterface.objectID;
- }
-
- return super.id;
- }
-
- //----------------------------------
- // label
- //----------------------------------
-
- [Inspectable(environment="none")]
-
- /**
- * @private
- */
- override public function set label(value:String):void
- {
- }
-
- //----------------------------------
- // percentHeight
- //----------------------------------
-
- /**
- * @private
- */
- override public function set percentHeight(value:Number):void
+ override protected function initialize():void
{
- if (value != super.percentHeight)
- {
- super.percentHeight = value;
- percentBoundsChanged = true;
- invalidateProperties();
- }
+ initManagers();
}
- //----------------------------------
- // percentWidth
- //----------------------------------
-
- /**
- * @private
- */
- override public function set percentWidth(value:Number):void
- {
- if (value != super.percentWidth)
- {
- super.percentWidth = value;
- percentBoundsChanged = true;
- invalidateProperties();
- }
- }
-
- //----------------------------------
- // tabIndex
- //----------------------------------
-
- [Inspectable(environment="none")]
-
- /**
- * @private
- */
- override public function set tabIndex(value:int):void
- {
- }
-
- //----------------------------------
- // toolTip
- //----------------------------------
-
- [Inspectable(environment="none")]
-
- /**
- * @private
- */
- override public function set toolTip(value:String):void
- {
- }
-
- //----------------------------------
- // viewMetrics
- //----------------------------------
-
/**
* @private
- * Returns the thickness of the edges of the object, including
- * the border, title bar and scroll bars, if visible.
- *
- * @return EdgeMetrics object with left, right, top, and bottom
- * properties containing the edge thickness, in pixels.
*/
- override public function get viewMetrics():EdgeMetrics
+ private function initManagers():void
{
- // This function needs to return an object.
- // Rather than allocating a new one each time,
- // we'll allocate one once and then hold a reference to it.
- if (!_applicationViewMetrics)
- _applicationViewMetrics = new EdgeMetrics();
- var vm:EdgeMetrics = _applicationViewMetrics;
-
- var o:EdgeMetrics = super.viewMetrics;
-
- var thickness:Number = getStyle("borderThickness");
-
- vm.left = o.left;
- vm.top = o.top;
- vm.right = o.right;
- vm.bottom = o.bottom;
-
- if (controlBar && controlBar.includeInLayout)
- {
- vm.top -= thickness;
- vm.top += Math.max(controlBar.getExplicitOrMeasuredHeight(),
- thickness);
- }
-
- return vm;
+ // install FocusManager
}
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
-
- /**
- * The ApplicationControlBar for this Application.
- *
- * @see mx.containers.ApplicationControlBar
- * @default null
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public var controlBar:IUIComponent;
-
- //----------------------------------
- // historyManagementEnabled
- //----------------------------------
- [Inspectable(defaultValue="true")]
-
- /**
- * If <code>false</code>, the history manager will be disabled.
- * Setting to false is recommended when using the BrowserManager.
- *
- * @default true
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public var historyManagementEnabled:Boolean = true;
-
- //----------------------------------
- // parameters
- //----------------------------------
-
- /**
- * @private
- * Storage for the parameters property.
- * This variable is set in the initialize() method of SystemManager.
- */
- mx_internal var _parameters:Object;
-
- /**
- * The parameters property returns an Object containing name-value
- * pairs representing the parameters provided to this Application.
- *
- * <p>You can use a for-in loop to extract all the names and values
- * from the parameters Object.</p>
- *
- * <p>There are two sources of parameters: the query string of the
- * Application's URL, and the value of the FlashVars HTML parameter
- * (this affects only the main Application).</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function get parameters():Object
- {
- return _parameters;
- }
-
- //----------------------------------
- // resetHistory
- //----------------------------------
-
- [Inspectable(defaultValue="true")]
-
- /**
- * If <code>true</code>, the application's history state is reset
- * to its initial state whenever the application is reloaded.
- * Applications are reloaded when any of the following occurs:
- * <ul>
- * <li>The user clicks the browser's Refresh button.</li>
- * <li>The user navigates to another web page, and then clicks
- * the browser's Back button to return to the Flex application.</li>
- * <li>The user loads a Flex application from the browser's
- * Favorites or Bookmarks menu.</li>
- * </ul>
- *
- * @default true
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public var resetHistory:Boolean = true;
-
- //----------------------------------
- // unscaledHeight
- //----------------------------------
-
- /**
- * @private
- */
- override mx_internal function setUnscaledHeight(value:Number):void
- {
- // we invalidate so we can properly add/remove the resize
- // event handler (SDK-12664)
- invalidateProperties();
-
- super.setUnscaledHeight(value);
- }
-
- //----------------------------------
- // unscaledWidth
- //----------------------------------
-
- /**
- * @private
- */
- override mx_internal function setUnscaledWidth(value:Number):void
- {
- // we invalidate so we can properly add/remove the resize
- // event handler (SDK-12664)
- invalidateProperties();
-
- super.setUnscaledWidth(value);
- }
-
- //----------------------------------
- // url
- //----------------------------------
-
- /**
- * @private
- * Storage for the url property.
- * This variable is set in the initialize() method.
- */
- mx_internal var _url:String;
-
- /**
- * The URL from which this Application's SWF file was loaded.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function get url():String
- {
- return _url;
- }
-
- //----------------------------------
- // usePadding
- //----------------------------------
-
- /**
- * @private
- */
- override mx_internal function get usePadding():Boolean
- {
- // We use padding for all layouts except absolute.
- return layout != ContainerLayout.ABSOLUTE;
- }
-
- //----------------------------------
- // viewSourceURL
- //----------------------------------
-
- /**
- * @private
- * Storage for viewSourceURL property.
- */
- private var _viewSourceURL:String;
-
- /**
- * URL where the application's source can be viewed. Setting this
- * property inserts a "View Source" menu item into the application's
- * default context menu. Selecting the menu item opens the
- * <code>viewSourceURL</code> in a new window.
- *
- * <p>You must set the <code>viewSourceURL</code> property
- * using MXML, not using ActionScript, as the following example shows:</p>
- *
- * <pre>
- * <mx:Application viewSourceURL="http://path/to/source">
- * ...
- * </mx:Application></pre>
- *
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function get viewSourceURL():String
- {
- return _viewSourceURL;
- }
-
- /**
- * @private
- */
- public function set viewSourceURL(value:String):void
- {
- _viewSourceURL = value;
- }
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods: DisplayObjectContainer
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override public function getChildIndex(child:DisplayObject):int
- {
- // For control bar focus management, return -1 to indicate
- // "before the first child".
- if (controlBar && child == controlBar)
- return -1;
-
- return super.getChildIndex(child);
- }
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods: UIComponent
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override protected function invalidateParentSizeAndDisplayList():void
- {
- if (!includeInLayout)
- return;
-
- var p:IInvalidating = parent as IInvalidating;
- if (!p)
- {
- if (parent is ISystemManager)
- ISystemManager(parent).invalidateParentSizeAndDisplayList();
-
- return;
- }
-
- super.invalidateParentSizeAndDisplayList();
- }
-
- /**
- * @private
- */
- override public function initialize():void
- {
- // trace("app initialize app");
-
- var sm:ISystemManager = systemManager;
-
- _url = LoaderUtil.normalizeURL(sm.loaderInfo);
- _parameters = sm.loaderInfo.parameters;
-
- initManagers(sm);
- _descriptor = null;
-
- if (documentDescriptor)
- {
- creationPolicy = documentDescriptor.properties.creationPolicy;
- if (creationPolicy == null || creationPolicy.length == 0)
- creationPolicy = ContainerCreationPolicy.AUTO;
-
- var properties:Object = documentDescriptor.properties;
-
- if (properties.width != null)
- {
- width = properties.width;
- delete properties.width;
- }
- if (properties.height != null)
- {
- height = properties.height;
- delete properties.height;
- }
-
- // Flex auto-generated code has already set up events.
- documentDescriptor.events = null;
- }
-
- // Setup the default context menu here. This allows the application
- // developer to override it in the initialize event, if desired.
- initContextMenu();
-
- super.initialize();
-
- addEventListener(Event.ADDED, addedHandler);
-
- // Stick a timer here so that we will execute script every 1.5s
- // no matter what.
- // This is strictly for the debugger to be able to halt.
- // Note: isDebugger is true only with a Debugger Player.
- if (sm.isTopLevelRoot() && Capabilities.isDebugger == true)
- setInterval(debugTickler, 1500);
- }
-
- /**
- * @private
- */
- override protected function commitProperties():void
- {
- super.commitProperties();
-
- resizeWidth = isNaN(explicitWidth);
- resizeHeight = isNaN(explicitHeight);
-
- if (resizeWidth || resizeHeight)
- {
- resizeHandler(new Event(Event.RESIZE));
-
- if (!resizeHandlerAdded)
- {
- // weak reference
- systemManager.addEventListener(Event.RESIZE, resizeHandler, false, 0, true);
- resizeHandlerAdded = true;
- }
- }
- else
- {
- if (resizeHandlerAdded)
- {
- systemManager.removeEventListener(Event.RESIZE, resizeHandler);
- resizeHandlerAdded = false;
- }
- }
-
- if (percentBoundsChanged)
- {
- updateBounds();
- percentBoundsChanged = false;
- }
- }
-
- /**
- * @private
- * Calculates the preferred, mininum and maximum sizes of the
- * Application. See the <code>UIComponent.measure()</code> method for more
- * information.
- * <p>
- * The <code>measure()</code> method first calls
- * <code>Box.measure()</code> method, then makes sure the
- * <code>measuredWidth</code> and <code>measuredMinWidth</code>
- * are wide enough to display the application's control bar.
- */
- override protected function measure():void
- {
- super.measure();
-
- var bm:EdgeMetrics = borderMetrics;
-
- if (controlBar && controlBar.includeInLayout)
- {
- var controlWidth:Number = controlBar.getExplicitOrMeasuredWidth() +
- bm.left + bm.right;
-
- measuredWidth = Math.max(measuredWidth, controlWidth);
- measuredMinWidth = Math.max(measuredMinWidth, controlWidth);
- }
- }
-
- /**
- * @private
- */
- override protected function updateDisplayList(unscaledWidth:Number,
- unscaledHeight:Number):void
- {
- super.updateDisplayList(unscaledWidth, unscaledHeight);
-
- // Wait to layout the border after all the children
- // have been positioned.
- createBorder();
- }
-
- /**
- * @private
- */
- override public function styleChanged(styleProp:String):void
- {
- super.styleChanged(styleProp);
-
- if (styleProp == "backgroundColor" &&
- getStyle("backgroundImage") == getStyle("defaultBackgroundImage"))
- {
- clearStyle("backgroundImage");
- }
- }
-
- /**
- * @private
- * Prepare the Object for printing.
- *
- * @see mx.printing.FlexPrintJob
- */
- override public function prepareToPrint(target:IFlexDisplayObject):Object
- {
- var objData:Object = {};
-
- if (target == this)
- {
- objData.width = width;
- objData.height = height;
-
- objData.verticalScrollPosition = verticalScrollPosition;
- objData.horizontalScrollPosition = horizontalScrollPosition;
-
- objData.horizontalScrollBarVisible = (horizontalScrollBar != null);
- objData.verticalScrollBarVisible = (verticalScrollBar != null);
-
- objData.whiteBoxVisible = (whiteBox != null);
-
- setActualSize(measuredWidth, measuredHeight);
-
- horizontalScrollPosition = 0;
- verticalScrollPosition = 0;
-
- if (horizontalScrollBar)
- horizontalScrollBar.visible = false;
-
- if (verticalScrollBar)
- verticalScrollBar.visible = false;
-
- if (whiteBox)
- whiteBox.visible = false;
-
- updateDisplayList(unscaledWidth, unscaledHeight);
- }
-
- objData.scrollRect = super.prepareToPrint(target);
-
- return objData;
- }
-
- /**
- * @private
- * Should be called after printing is done for post-processing and clean up.
- *
- * @see mx.printing.FlexPrintJob
- */
- override public function finishPrint(obj:Object, target:IFlexDisplayObject):void
- {
- if (target == this)
- {
- setActualSize(obj.width, obj.height);
-
- if (horizontalScrollBar)
- horizontalScrollBar.visible = obj.horizontalScrollBarVisible;
- if (verticalScrollBar)
- verticalScrollBar.visible = obj.verticalScrollBarVisible;
-
- if (whiteBox)
- whiteBox.visible = obj.whiteBoxVisible;
-
- horizontalScrollPosition = obj.horizontalScrollPosition;
- verticalScrollPosition = obj.verticalScrollPosition;
-
- updateDisplayList(unscaledWidth, unscaledHeight);
- }
-
- // obj is the Object created in prepare to print above,
- // it just stores the scrollRect Rectangle object sent from Container
- // obj doesnt have to be DisplayObject
- super.finishPrint(obj.scrollRect, target);
- }
-
- /**
- * @private
- * Application also handles themeColor defined
- * on the global selector.
- */
- override mx_internal function initThemeColor():Boolean
- {
- if (FlexVersion.compatibilityVersion >= FlexVersion.VERSION_4_0)
- return true;
-
- var result:Boolean = super.initThemeColor();
-
- if (!result)
- {
- var tc:Object; // Can be number or string
- var rc:Number;
- var sc:Number;
- var globalSelector:CSSStyleDeclaration =
- styleManager.getMergedStyleDeclaration("global");
-
- if (globalSelector)
- {
- tc = globalSelector.getStyle("themeColor");
- rc = globalSelector.getStyle("rollOverColor");
- sc = globalSelector.getStyle("selectionColor");
- }
-
- if (tc && isNaN(rc) && isNaN(sc))
- {
- setThemeColor(tc);
- }
- result = true;
- }
-
- return result;
- }
-
- /**
- * @private
- */
- override protected function resourcesChanged():void
- {
- super.resourcesChanged();
-
- // "View Source" on the context menu
- if (viewSourceCMI)
- {
- viewSourceCMI.caption = resourceManager.getString("core", "viewSource");
- }
- }
-
- //--------------------------------------------------------------------------
- //
- // Overridden methods: Container
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- */
- override protected function layoutChrome(unscaledWidth:Number,
- unscaledHeight:Number):void
- {
- super.layoutChrome(unscaledWidth, unscaledHeight);
-
- // When Container.autoLayout is false, updateDisplayList()
- // is not called, but layoutChrome() is still called.
- // In that case, we still need to position the border.
- if (!doingLayout)
- createBorder();
-
- // Remove the borderThickness from the border metrics,
- // since the header and control bar overlap any solid border.
- var bm:EdgeMetrics = borderMetrics;
- var thickness:Number = getStyle("borderThickness");
-
- var em:EdgeMetrics = new EdgeMetrics();
-
- em.left = bm.left - thickness;
- em.top = bm.top - thickness;
- em.right = bm.right - thickness;
- em.bottom = bm.bottom - thickness;
-
- if (controlBar && controlBar.includeInLayout)
- {
- if (controlBar is IInvalidating)
- IInvalidating(controlBar).invalidateDisplayList();
- controlBar.setActualSize(width - (em.left + em.right),
- controlBar.getExplicitOrMeasuredHeight());
- controlBar.move(em.left, em.top);
- }
- }
-
- /**
- * @private
- *
- * Container implements addChild in terms of addChildAt.
- */
- override public function addChildAt(child:DisplayObject,
- index:int):DisplayObject
- {
- super.addChildAt(child, index);
- if (child == controlBar &&
- "dock" in child && child["dock"] &&
- "resetDock" in controlBar)
- {
- controlBar["resetDock"](true);
- }
-
- return child;
- }
-
- /**
- * @private
- *
- * Container implements removeChildAt in terms of removeChild.
- */
- override public function removeChild(child:DisplayObject):DisplayObject
- {
- if (child == controlBar &&
- "dock" in child && child["dock"])
- {
- dockControlBar(IUIComponent(child), false);
- }
-
- return super.removeChild(child);
- }
-
- //--------------------------------------------------------------------------
- //
- // Methods
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- * This is here so we get the this pointer set to Application.
- */
- private function debugTickler():void
- {
- // We need some bytes of code in order to have a place to break.
- var i:int = 0;
- }
-
- /**
- * @private
- */
- private function initManagers(sm:ISystemManager):void
- {
- if (sm.isTopLevel())
- {
- focusManager = new FocusManager(this);
- var awm:IActiveWindowManager =
- IActiveWindowManager(sm.getImplementation("mx.managers::IActiveWindowManager"));
- if (awm)
- awm.activate(this);
- else
- focusManager.activate();
- }
- }
-
- /**
- * @private
- * Disable all the built-in items except "Print...".
- */
- private function initContextMenu():void
- {
- // context menu already set
- // nothing to init
- if (flexContextMenu != null)
- {
- // make sure we set it back on systemManager b/c it may have been overridden by now
- if (systemManager is InteractiveObject)
- InteractiveObject(systemManager).contextMenu = contextMenu;
- return;
- }
-
- var defaultMenu:ContextMenu = new ContextMenu();
- defaultMenu.hideBuiltInItems();
- defaultMenu.builtInItems.print = true;
-
- if (_viewSourceURL)
- {
- // don't worry! this gets updated in resourcesChanged()
- const caption:String = resourceManager.getString("core", "viewSource");
-
- viewSourceCMI = new ContextMenuItem(caption, true);
- viewSourceCMI.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler);
-
- // Append custom option, validating customItems first as in the
- // mobile context this is null.
- if (defaultMenu.customItems)
- defaultMenu.customItems.push(viewSourceCMI);
- }
-
- contextMenu = defaultMenu;
-
- if (systemManager is InteractiveObject)
- InteractiveObject(systemManager).contextMenu = defaultMenu;
- }
-
- /**
- * Add a container to the Application's creation queue.
- *
- * <p>Use this mechanism to instantiate and draw the contents
- * of a container in an ordered manner.
- * The container should have the <code>creationPolicy</code> property
- * set to <code>"none"</code> prior to calling this function.</p>
- *
- * @param id The id of the container to add to the queue or a
- * pointer to the container itself
- *
- * @param preferredIndex (optional) A positive integer that determines
- * the container's position in the queue relative to the other
- * containers presently in the queue.
- *
- * @param callbackFunc This parameter is ignored.
- *
- * @param parent This parameter is ignored.
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function addToCreationQueue(id:Object, preferredIndex:int = -1,
- callbackFunc:Function = null,
- parent:IFlexDisplayObject = null):void
- {
- //trace("App.addToCreationQueue id",id,"index",preferredIndex,"parent",parent);
-
- var queueLength:int = creationQueue.length;
- var queueObj:Object = {};
- var insertedItem:Boolean = false;
-
- queueObj.id = id;
- queueObj.parent = parent;
- queueObj.callbackFunc = callbackFunc;
- queueObj.index = preferredIndex;
-
- //trace("addToCreationQueue id",id,"index",queueObj.index,"parent",queueObj.parent,"nestLevel",queueObj.parent.nestLevel,"initialized",initialized);
-
- var insertIndex:int;
- var pointerIndex:int;
- var pointerLevel:int;
-
- // Find out where to place this item
- for (var i:int = 0; i < queueLength; i++)
- {
- pointerIndex = creationQueue[i].index;
- pointerLevel = creationQueue[i].parent ? creationQueue[i].parent.nestLevel : 0;
-
- /*
- trace("addToCreationQueue queueItem",queueItemPointer.id,"queueItem.level",pointerLevel,"obj.level",queueObj.parent.nestLevel,
- "queueItem.index",pointerIndex,"obj.index",queueObj.index);
- */
- // If our new item has a preferredIndex
- if (queueObj.index != -1)
- {
- // Place at index i if the queued index is -1 or if the new item's index is before the queued index
- if (pointerIndex == -1 || queueObj.index < pointerIndex)
- {
- insertIndex = i;
- insertedItem = true;
- break;
- }
- }
- else
- {
- // Place at index i if queued index is -1 and the new item is deeper in the component tree
- // than the queued item. (Inner-most components should reveal first)
- var parentLevel:int = queueObj.parent ? queueObj.parent.nestLevel : 0;
- if (pointerIndex == -1 && pointerLevel < parentLevel)
- {
- insertIndex = i;
- insertedItem = true;
- break;
- }
- }
- }
-
- if (!insertedItem)
- {
- creationQueue.push(queueObj); // Just add it to the end of the queue
- insertedItem = true;
- }
- else
- {
- creationQueue.splice(insertIndex, 0, queueObj); // Insert into a specific place in the queue
- }
-
- //printCreationQueue();
-
- // Check if we need to trigger queue processing
- if (initialized && !processingCreationQueue)
- {
- //trace("App.addToCreationQueue KICKING the queue processer");
- doNextQueueItem();
- }
- }
-
- /**
- * @private
- */
- private function doNextQueueItem(event:FlexEvent = null):void
- {
- processingCreationQueue = true;
-
- Application.useProgressiveLayout = true;
-
- // The doNextQueueItem function is usually called
- // when a creationComplete event is dispatched.
- // Wait for other creationComplete listeners to fire
- // before we start processing the next item,
- // in case one of those listeners plays an effect.
- callLater(processNextQueueItem);
- }
-
- /**
- * @private
- */
- private function processNextQueueItem():void
- {
- if (EffectManager.effectsPlaying.length > 0)
- {
- // Wait for effects to finish playing before processing the
- // next item in the queue.
- callLater(processNextQueueItem);
- }
- else if (creationQueue.length > 0)
- {
- //trace("processNextQueueItem START length", creationQueue.length);
- //printCreationQueue();
-
- var queueItem:Object = creationQueue.shift();
- try
- {
- var nextChild:IUIComponent = (queueItem.id is String
- ? document[queueItem.id]
- : queueItem.id);
- if (nextChild is Container)
- Container(nextChild).createComponentsFromDescriptors(true);
- if (nextChild is Container &&
- Container(nextChild).creationPolicy == ContainerCreationPolicy.QUEUED)
- doNextQueueItem();
- else
- nextChild.addEventListener("childrenCreationComplete", doNextQueueItem);
- }
- catch(e:Error)
- {
- //trace("Exception in processNextQueue",e);
- // Can't find the id in the document. Just move on to the next item.
- processNextQueueItem();
- }
-
- //trace("processNextQueueItem id", queueItem. id, "index", queueItem. index);
- }
- else
- {
- processingCreationQueue = false;
- Application.useProgressiveLayout = false;
- }
- }
-
- /**
- * @private
- */
- private function printCreationQueue():void
- {
- var msg:String = "";
-
- var n:Number = creationQueue.length;
- for (var i:int = 0; i < n; i++)
- {
- var child:Object = creationQueue[i];
- msg += " [" + i + "] " + child.id + " " + child.index;
- }
-
- //trace("creationQueue =>" + msg);
- }
-
- /**
- * @private
- */
- private function setControlBar(newControlBar:IUIComponent):void
- {
- if (newControlBar == controlBar)
- return;
-
- if (controlBar && controlBar is IStyleClient)
- {
- IStyleClient(controlBar).clearStyle("cornerRadius");
- IStyleClient(controlBar).clearStyle("docked");
- }
-
- controlBar = newControlBar;
- if (controlBar && controlBar is IStyleClient)
- {
- IStyleClient(controlBar).setStyle("cornerRadius", 0);
- IStyleClient(controlBar).setStyle("docked", true);
- }
-
- invalidateSize();
- invalidateDisplayList();
- invalidateViewMetricsAndPadding();
- }
-
- /**
- * @private
- */
- mx_internal function dockControlBar(controlBar:IUIComponent,
- dock:Boolean):void
- {
- if (dock)
- {
- try
- {
- removeChild(DisplayObject(controlBar));
- }
- catch(e:Error)
- {
- return;
- }
-
- rawChildren.addChildAt(DisplayObject(controlBar), firstChildIndex);
- setControlBar(controlBar);
- }
- else // undock
- {
- try
- {
- rawChildren.removeChild(DisplayObject(controlBar));
- }
- catch(e:Error)
- {
- return;
- }
-
- setControlBar(null);
- addChildAt(DisplayObject(controlBar), 0);
- }
- }
-
- /**
- * @private
- * Check to see if we're able to synchronize our size with the stage
- * immediately rather than deferring (dependent on WATSON 2200950).
- */
- private function initResizeBehavior():void
- {
- var version:Array = Capabilities.version.split(' ')[1].split(',');
-
- synchronousResize = (parseFloat(version[0]) > 10 ||
- (parseFloat(version[0]) == 10 && parseFloat(version[1]) >= 1)) && !Platform.isAir;
- }
-
- //--------------------------------------------------------------------------
- //
- // Event handlers
- //
- //--------------------------------------------------------------------------
-
- /**
- * @private
- * Called after all children are drawn.
- */
- private function addedHandler(event:Event):void
- {
- //trace("creationComplete +++++++++ check if queue has any items", creationQueue.length, "initialized", initialized);
- if (event.target == this && creationQueue.length > 0)
- doNextQueueItem();
- }
-
- /**
- * @private
- * Triggered by a resize event of the stage.
- * Sets the new width and height.
- * After the SystemManager performs its function,
- * it is only necessary to notify the children of the change.
- */
- private function resizeHandler(event:Event):void
- {
- // If we're already due to update our bounds on the next
- // commitProperties pass, avoid the redundancy.
- if (!percentBoundsChanged)
- {
- updateBounds();
-
- // Update immediately when stage resizes so that we may appear
- // in synch with the stage rather than visually "catching up".
- if (synchronousResize)
- UIComponentGlobals.layoutManager.validateNow();
- }
- }
-
- /**
- * @private
- * Called when the "View Source" item in the application's context menu is
- * selected.
- */
- protected function menuItemSelectHandler(event:Event):void
- {
- navigateToURL(new URLRequest(_viewSourceURL), "_blank");
- }
-
- /**
- * @private
- * Sets the new width and height after the Stage has resized
- * or when percentHeight or percentWidth has changed.
- */
- private function updateBounds():void
- {
- // When user has not specified any width/height,
- // application assumes the size of the stage.
- // If developer has specified width/height,
- // the application will not resize.
- // If developer has specified percent width/height,
- // application will resize to the required value
- // based on the current SystemManager's width/height.
- // If developer has specified min/max values,
- // then application will not resize beyond those values.
-
- var w:Number;
- var h:Number
-
- if (resizeWidth)
- {
- if (isNaN(percentWidth))
- {
- w = DisplayObject(systemManager).width;
- }
- else
- {
- super.percentWidth = Math.max(percentWidth, 0);
- super.percentWidth = Math.min(percentWidth, 100);
-
- if (FlexVersion.compatibilityVersion >= FlexVersion.VERSION_4_0)
- w = percentWidth * DisplayObject(systemManager).width/100;
- else
- w = percentWidth * screen.width/100;
- }
-
- if (!isNaN(explicitMaxWidth))
- w = Math.min(w, explicitMaxWidth);
-
- if (!isNaN(explicitMinWidth))
- w = Math.max(w, explicitMinWidth);
- }
- else
- {
- w = width;
- }
-
- if (resizeHeight)
- {
- if (isNaN(percentHeight))
- {
- h = DisplayObject(systemManager).height;
- }
- else
- {
- super.percentHeight = Math.max(percentHeight, 0);
- super.percentHeight = Math.min(percentHeight, 100);
-
- if (FlexVersion.compatibilityVersion >= FlexVersion.VERSION_4_0)
- h = percentHeight * DisplayObject(systemManager).height/100;
- else
- h = percentHeight * screen.height/100;
- }
-
- if (!isNaN(explicitMaxHeight))
- h = Math.min(h, explicitMaxHeight);
-
- if (!isNaN(explicitMinHeight))
- h = Math.max(h, explicitMinHeight);
- }
- else
- {
- h = height;
- }
-
- if (w != width || h != height)
- {
- invalidateProperties();
- invalidateSize();
- }
-
- setActualSize(w, h);
-
- invalidateDisplayList();
- }
}
}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/FlexGlobals.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/FlexGlobals.as
new file mode 100644
index 0000000..b07a5d2
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/FlexGlobals.as
@@ -0,0 +1,55 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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
+{
+
+/**
+ * A class that contains variables that are global to all applications within
+ * the same ApplicationDomain.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ *
+ */
+public class FlexGlobals
+{
+ //--------------------------------------------------------------------------
+ //
+ // Class variables
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * The first application run in an ApplicationDomain is the top-level application.
+ * This property is set to a reference to the top-level application in the top-level
+ * application's constructor. Each ApplicationDomain will have its own
+ * <code>topLevelApplication</code>.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10
+ * @playerversion AIR 1.5
+ * @productversion Flex 4
+ */
+ public static var topLevelApplication:Object;
+}
+
+}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/IDisplayObjectInterface.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/IDisplayObjectInterface.as
new file mode 100644
index 0000000..05a63ef
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/IDisplayObjectInterface.as
@@ -0,0 +1,183 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+/*
+ * The methods here would normally just be in IDisplayObject,
+ * but for backward compatibility, they have to be included
+ * directly into IFlexDisplayObject, so they are kept in
+ * this separate include file.
+ */
+
+ /**
+ * @copy flash.display.DisplayObject#name
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function get name():String;
+ function set name(value:String):void;
+
+
+ /**
+ * @copy flash.display.DisplayObject#parent
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function get parent():IParent;
+
+ /**
+ * @copy flash.display.DisplayObject#visible
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function get visible():Boolean;
+ function set visible(value:Boolean):void;
+
+
+ /**
+ * @copy flash.display.DisplayObject#x
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function get x():Number;
+ function set x(value:Number):void;
+
+
+ /**
+ * @copy flash.display.DisplayObject#y
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function get y():Number;
+ function set y(value:Number):void;
+
+
+ /**
+ * @copy flash.display.DisplayObject#mouseX
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function get mouseX():Number; // note: no setter
+
+
+ /**
+ * @copy flash.display.DisplayObject#mouseY
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function get mouseY():Number; // note: no setter
+
+
+ /**
+ * @copy flash.display.DisplayObject#alpha
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function get alpha():Number;
+ function set alpha(value:Number):void;
+
+
+ /**
+ * @copy flash.display.DisplayObject#width
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function get width():Number;
+ function set width(value:Number):void;
+
+ /**
+ * @copy flash.display.DisplayObject#height
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function get height():Number;
+ function set height(value:Number):void;
+
+
+ /**
+ * @copy flash.display.DisplayObject#cacheAsBitmap
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function get cacheAsBitmap():Boolean;
+ function set cacheAsBitmap(value:Boolean):void;
+
+ /**
+ * @copy flash.display.DisplayObject#filters
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function get filters():Array;
+ function set filters(value:Array):void;
+
+ /**
+ * @copy flash.display.DisplayObject#globalToLocal()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function globalToLocal(point:Point):Point;
+
+ /**
+ * @copy flash.display.DisplayObject#localToGlobal()
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function localToGlobal(point:Point):Point;
+
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/IFlexDisplayObject.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/IFlexDisplayObject.as
index e7983f9..a6ff897 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/IFlexDisplayObject.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/IFlexDisplayObject.as
@@ -20,10 +20,10 @@
package mx.core
{
+import org.apache.royale.core.IParent;
import org.apache.royale.events.IEventDispatcher;
import org.apache.royale.geom.Rectangle;
import org.apache.royale.geom.Point;
-//import flash.geom.Transform;
/**
* The IFlexDisplayObject interface defines the interface for skin elements.
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/IUIComponent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/IUIComponent.as
index 9d375c4..9452830 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/IUIComponent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/IUIComponent.as
@@ -19,7 +19,7 @@
package mx.core
{
-
+import org.apache.royale.core.IChild;
import org.apache.royale.geom.Rectangle;
import mx.managers.ISystemManager;
@@ -32,34 +32,13 @@ import mx.managers.ISystemManager;
* @playerversion AIR 1.1
* @productversion Flex 3
*/
-public interface IUIComponent extends IFlexDisplayObject
+public interface IUIComponent extends IFlexDisplayObject, IChild
{
//--------------------------------------------------------------------------
//
// Properties
//
//--------------------------------------------------------------------------
-
- //----------------------------------
- // baselinePosition
- //----------------------------------
-
- /**
- * The y-coordinate of the baseline
- * of the first line of text of the component.
- *
- * <p>This property is used to implement
- * the <code>baseline</code> constraint style.
- * It is also used to align the label of a FormItem
- * with the controls in the FormItem.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- function get baselinePosition():Number;
-
//----------------------------------
// document
@@ -485,16 +464,6 @@ public interface IUIComponent extends IFlexDisplayObject
function getExplicitOrMeasuredHeight():Number;
/**
- * @copy mx.core.UIComponent#setVisible()
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- function setVisible(value:Boolean, noEvent:Boolean = false):void;
-
- /**
* @copy mx.core.UIComponent#owns()
*
* @langversion 3.0
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/IVisualElement.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/IVisualElement.as
index 0d2cee0..d2805ff 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/IVisualElement.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/IVisualElement.as
@@ -18,6 +18,8 @@
////////////////////////////////////////////////////////////////////////////////
package mx.core
{
+import org.apache.royale.core.IParent;
+
/**
* The IVisualElement interface defines the minimum properties and methods
* required for a visual element to be laid out and displayed in a Spark container.
@@ -70,7 +72,7 @@ public interface IVisualElement /* extends ILayoutElement, ILayoutDirectionEleme
* @playerversion AIR 1.5
* @productversion Flex 4
*/
- function get parent():IUIBase;
+ function get parent():IParent;
/**
* Controls the visibility of this visual element.
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
index 91b3486..04e691a 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/core/UIComponent.as
@@ -41,73 +41,18 @@ import flash.events.EventPhase;
import flash.events.FocusEvent;
import flash.events.IEventDispatcher;
*/
-import org.apache.royale.events.KeyboardEvent;
-/*
-import flash.geom.ColorTransform;
-import flash.geom.Matrix;
-import flash.geom.Matrix3D;
-import flash.geom.PerspectiveProjection;
-import flash.geom.Point;
-import flash.geom.Rectangle;
-import flash.geom.Transform;
-import flash.geom.Vector3D;
-import flash.system.ApplicationDomain;
-import flash.system.Capabilities;
-import flash.text.TextFormatAlign;
-import flash.text.TextLineMetrics;
-import flash.ui.Keyboard;
-import flash.utils.Dictionary;
-import flash.utils.getQualifiedClassName;
-*/
-import org.apache.royale.core.UIBase;
-/*
-import mx.automation.IAutomationObject;
-import mx.binding.Binding;
-import mx.binding.BindingManager;
-import mx.binding.FunctionReturnWatcher;
-import mx.binding.PropertyWatcher;
-import mx.binding.StaticPropertyWatcher;
-import mx.binding.Watcher;
-import mx.binding.XMLWatcher;
-import mx.controls.IFlexContextMenu;
-import mx.core.LayoutDirection;
-import mx.effects.EffectManager;
-import mx.effects.IEffect;
-import mx.effects.IEffectInstance;
-import mx.events.ChildExistenceChangedEvent;
-import mx.events.DynamicEvent;
-import mx.events.EffectEvent;
-*/
import mx.events.FlexEvent;
-/*
-import mx.events.MoveEvent;
-import mx.events.PropertyChangeEvent;
-import mx.events.ResizeEvent;
-import mx.events.StateChangeEvent;
-import mx.events.ValidationResultEvent;
-import mx.filters.BaseFilter;
-import mx.filters.IBitmapFilter;
-import mx.geom.RoundedRectangle;
-import mx.geom.Transform;
-import mx.geom.TransformOffsets;
-import mx.graphics.shaderClasses.ColorBurnShader;
-import mx.graphics.shaderClasses.ColorDodgeShader;
-import mx.graphics.shaderClasses.ColorShader;
-import mx.graphics.shaderClasses.ExclusionShader;
-import mx.graphics.shaderClasses.HueShader;
-import mx.graphics.shaderClasses.LuminosityShader;
-import mx.graphics.shaderClasses.SaturationShader;
-import mx.graphics.shaderClasses.SoftLightShader;
-import mx.managers.CursorManager;
-*/
import mx.managers.ICursorManager;
import mx.managers.IFocusManager;
-/*
-import mx.managers.IFocusManagerComponent;
-import mx.managers.IFocusManagerContainer;
-import mx.managers.ILayoutManagerClient;
-*/
import mx.managers.ISystemManager;
+
+import org.apache.royale.core.TextLineMetrics;
+import org.apache.royale.core.UIBase;
+import org.apache.royale.events.Event;
+import org.apache.royale.events.KeyboardEvent;
+import org.apache.royale.geom.Point;
+import org.apache.royale.geom.Rectangle;
+
/*
import mx.managers.IToolTipManagerClient;
import mx.managers.SystemManager;
@@ -204,14 +149,46 @@ public class UIComponent extends UIBase
IInvalidating,
IUIComponent, IVisualElement
{
+ //--------------------------------------------------------------------------
+ //
+ // Class constants
+ //
+ //--------------------------------------------------------------------------
+
+ /**
+ * The default value for the <code>maxWidth</code> property.
+ *
+ * @default 10000
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static const DEFAULT_MAX_WIDTH:Number = 10000;
+ // When changing this constant, make sure you change
+ // the constant with the same name in LayoutElementUIComponentUtils
+
+ /**
+ * The default value for the <code>maxHeight</code> property.
+ *
+ * @default 10000
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public static const DEFAULT_MAX_HEIGHT:Number = 10000;
+ // When changing this constant, make sure you change
+ // the constant with the same name in LayoutElementUIComponentUtils
//--------------------------------------------------------------------------
//
// Class properties
//
//--------------------------------------------------------------------------
-
-
+
//--------------------------------------------------------------------------
//
// Class methods
@@ -283,6 +260,37 @@ public class UIComponent extends UIBase
}
}
+ //----------------------------------
+ // name
+ //----------------------------------
+
+ /**
+ * @private
+ */
+ COMPILE::JS
+ private var _name:String;
+
+ /**
+ * @copy mx.core.IVisualElement#owner
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ * @royaleignorecoercion mx.core.IUIComponent
+ */
+ COMPILE::JS
+ public function get name():String
+ {
+ return _name;
+ }
+
+ COMPILE::JS
+ public function set name(value:String):void
+ {
+ _name = value;
+ }
+
//--------------------------------------------------------------------------
//
// Variables: Measurement
@@ -369,10 +377,11 @@ public class UIComponent extends UIBase
* @playerversion Flash 9
* @playerversion AIR 1.1
* @productversion Flex 3
+ * @royaleignorecoercion mx.core.IUIComponent
*/
public function get owner():IUIComponent
{
- return _owner ? _owner : parent;
+ return _owner ? _owner : parent as IUIComponent;
}
public function set owner(value:IUIComponent):void
@@ -384,8 +393,6 @@ public class UIComponent extends UIBase
// doubleClickEnabled
//----------------------------------
- [Inspectable(enumeration="true,false", defaultValue="true")]
-
/**
* Specifies whether the UIComponent object receives <code>doubleClick</code> events.
* The default value is <code>false</code>, which means that the UIComponent object
@@ -402,14 +409,8 @@ public class UIComponent extends UIBase
* @productversion Flex 3
*/
COMPILE::SWF
- override public function get doubleClickEnabled():Boolean
- {
- // TODO
- if (GOOG::DEBUG)
- trace("doubleClickEnabled not implemented");
- return false;
- }
- COMPILE::JS
+ { override }
+ [Inspectable(enumeration="true,false", defaultValue="true")]
public function get doubleClickEnabled():Boolean
{
// TODO
@@ -423,17 +424,13 @@ public class UIComponent extends UIBase
* Propagate to children.
*/
COMPILE::SWF
- override public function set doubleClickEnabled(value:Boolean):void
{
- // TODO
- if (goog.DEBUG)
- trace("doubleClickEnabled not implemented");
+ override
}
- COMPILE::JS
public function set doubleClickEnabled(value:Boolean):void
{
// TODO
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("doubleClickEnabled not implemented");
}
@@ -459,7 +456,7 @@ public class UIComponent extends UIBase
public function get enabled():Boolean
{
// TODO
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("enabled not implemented");
return _enabled;
}
@@ -470,7 +467,7 @@ public class UIComponent extends UIBase
public function set enabled(value:Boolean):void
{
// TODO
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("enabled not implemented");
_enabled = value;
}
@@ -479,13 +476,26 @@ public class UIComponent extends UIBase
// cacheAsBitmap
//----------------------------------
+ COMPILE::JS
+ public function get cacheAsBitmap():Boolean
+ {
+ // TODO
+ if (GOOG::DEBUG)
+ trace("cacheAsBitmap not implemented");
+ return false;
+ }
+
/**
* @private
*/
- override public function set cacheAsBitmap(value:Boolean):void
+ COMPILE::SWF
+ {
+ override
+ }
+ public function set cacheAsBitmap(value:Boolean):void
{
// TODO
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("cacheAsBitmap not implemented");
}
@@ -502,18 +512,26 @@ public class UIComponent extends UIBase
/**
* @private
*/
- override public function get filters():Array
+ COMPILE::SWF
+ {
+ override
+ }
+ public function get filters():Array
{
- return _filters ? _filters : super.filters;
+ return _filters;
}
/**
* @private
*/
- override public function set filters(value:Array):void
+ COMPILE::SWF
+ {
+ override
+ }
+ public function set filters(value:Array):void
{
// TODO
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("filters not implemented");
}
@@ -542,10 +560,10 @@ public class UIComponent extends UIBase
public function get cursorManager():ICursorManager
{
// TODO
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("cursorManager not implemented");
-
+ return null;
//return CursorManager.getInstance();
}
@@ -576,7 +594,7 @@ public class UIComponent extends UIBase
public function get focusManager():IFocusManager
{
// TODO
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("focusManager not implemented");
return null;
}
@@ -588,7 +606,7 @@ public class UIComponent extends UIBase
public function set focusManager(value:IFocusManager):void
{
// TODO
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("focusManager not implemented");
}
@@ -617,7 +635,7 @@ public class UIComponent extends UIBase
public function get systemManager():ISystemManager
{
// TODO
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("systemManager not implemented");
return _systemManager;
}
@@ -628,7 +646,7 @@ public class UIComponent extends UIBase
public function set systemManager(value:ISystemManager):void
{
// TODO
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("systemManager not implemented");
_systemManager = value;
}
@@ -640,6 +658,70 @@ public class UIComponent extends UIBase
//--------------------------------------------------------------------------
//----------------------------------
+ // document
+ //----------------------------------
+
+ /**
+ * @private
+ * Storage for the document property.
+ * This variable is initialized in the init() method.
+ * A document object (i.e., an Object at the top of the hierarchy
+ * of a Flex application, MXML component, or AS component) has an
+ * autogenerated override of initalize() which sets its _document to
+ * 'this', so that its 'document' property is a reference to itself.
+ * Other UIComponents set their _document to their parent's _document,
+ * so that their 'document' property refers to the document object
+ * that they are inside.
+ */
+ private var _document:Object;
+
+ [Inspectable(environment="none")]
+
+ /**
+ * A reference to the document object associated with this UIComponent.
+ * A document object is an Object at the top of the hierarchy of a
+ * Flex application, MXML component, or AS component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function get document():Object
+ {
+ return _document;
+ }
+
+ /**
+ * A reference to the document object associated with this UIComponent.
+ * A document object is an Object at the top of the hierarchy of a
+ * Flex application, MXML component, or AS component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function set document(value:Object):void
+ {
+ var n:int = numChildren;
+ for (var i:int = 0; i < n; i++)
+ {
+ var child:IUIComponent = getChildAt(i) as IUIComponent;
+ if (!child)
+ continue;
+
+ if (child.document == _document ||
+ child.document == FlexGlobals.topLevelApplication)
+ {
+ child.document = value;
+ }
+ }
+
+ _document = value;
+ }
+
+ //----------------------------------
// parentApplication
//----------------------------------
@@ -936,7 +1018,7 @@ public class UIComponent extends UIBase
* @playerversion AIR 1.1
* @productversion Flex 3
*/
- public function get percentWidth():Number
+ override public function get percentWidth():Number
{
return _percentWidth;
}
@@ -944,7 +1026,7 @@ public class UIComponent extends UIBase
/**
* @private
*/
- public function set percentWidth(value:Number):void
+ override public function set percentWidth(value:Number):void
{
if (_percentWidth == value)
return;
@@ -992,7 +1074,7 @@ public class UIComponent extends UIBase
* @playerversion AIR 1.1
* @productversion Flex 3
*/
- public function get percentHeight():Number
+ override public function get percentHeight():Number
{
return _percentHeight;
}
@@ -1000,7 +1082,7 @@ public class UIComponent extends UIBase
/**
* @private
*/
- public function set percentHeight(value:Number):void
+ override public function set percentHeight(value:Number):void
{
if (_percentHeight == value)
return;
@@ -1524,130 +1606,6 @@ public class UIComponent extends UIBase
dispatchEvent(new Event("explicitMaxHeightChanged"));
}
- //----------------------------------
- // explicitWidth
- //----------------------------------
-
- /**
- * @private
- * Storage for the explicitWidth property.
- */
- private var _explicitWidth:Number;
-
- [Bindable("explicitWidthChanged")]
- [Inspectable(environment="none")]
-
- /**
- * Number that specifies the explicit width of the component,
- * in pixels, in the component's coordinates.
- *
- * <p>This value is used by the container in calculating
- * the size and position of the component.
- * It is not used by the component itself in determining
- * its default size.
- * Thus this property may not have any effect if parented by
- * Container, or containers that don't factor in
- * this property.
- * Because the value is in component coordinates,
- * the true <code>explicitWidth</code> with respect to its parent
- * is affected by the <code>scaleX</code> property.</p>
- * <p>Setting the <code>width</code> property also sets this property to
- * the specified width value.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function get explicitWidth():Number
- {
- return _explicitWidth;
- }
-
- /**
- * @private
- */
- public function set explicitWidth(value:Number):void
- {
- if (_explicitWidth == value)
- return;
-
- // width can be pixel or percent not both
- if (!isNaN(value))
- _percentWidth = NaN;
-
- _explicitWidth = value;
-
- // We invalidate size because locking in width
- // may change the measured height in flow-based components.
- invalidateSize();
- invalidateParentSizeAndDisplayList();
-
- dispatchEvent(new Event("explicitWidthChanged"));
- }
-
- //----------------------------------
- // explicitHeight
- //----------------------------------
-
- /**
- * @private
- * Storage for the explicitHeight property.
- */
- private var _explicitHeight:Number;
-
- [Bindable("explicitHeightChanged")]
- [Inspectable(environment="none")]
-
- /**
- * Number that specifies the explicit height of the component,
- * in pixels, in the component's coordinates.
- *
- * <p>This value is used by the container in calculating
- * the size and position of the component.
- * It is not used by the component itself in determining
- * its default size.
- * Thus this property may not have any effect if parented by
- * Container, or containers that don't factor in
- * this property.
- * Because the value is in component coordinates,
- * the true <code>explicitHeight</code> with respect to its parent
- * is affected by the <code>scaleY</code> property.</p>
- * <p>Setting the <code>height</code> property also sets this property to
- * the specified height value.</p>
- *
- * @langversion 3.0
- * @playerversion Flash 9
- * @playerversion AIR 1.1
- * @productversion Flex 3
- */
- public function get explicitHeight():Number
- {
- return _explicitHeight;
- }
-
- /**
- * @private
- */
- public function set explicitHeight(value:Number):void
- {
- if (_explicitHeight == value)
- return;
-
- // height can be pixel or percent, not both
- if (!isNaN(value))
- _percentHeight = NaN;
-
- _explicitHeight = value;
-
- // We invalidate size because locking in height
- // may change the measured width in flow-based components.
- invalidateSize();
- invalidateParentSizeAndDisplayList();
-
- dispatchEvent(new Event("explicitHeightChanged"));
- }
-
//----------------------------------
// includeInLayout
@@ -1769,45 +1727,13 @@ public class UIComponent extends UIBase
*/
public function set currentState(value:String):void
{
- // We have a deferred state change currently queued up, let's override
- // the originally requested state with the newly requested. Otherwise
- // we'll synchronously assign our new state.
- if (_currentStateDeferred != null)
- _currentStateDeferred = value;
- else
- setCurrentState(value, true);
- }
-
- /**
- * @private
- * Backing variable for currentStateDeferred property
- */
- private var _currentStateDeferred:String;
-
- /**
- * @private
- * Version of currentState property that defers setting currentState
- * until commitProperties() time. This is used by SetProperty.remove()
- * to avoid causing state transitions when currentState is being rolled
- * back in a state change operation just to be set immediately after to the
- * actual new currentState value. This avoids unnecessary, and sometimes
- * incorrect, use of transitions based on this transient state of currentState.
- */
- private function get currentStateDeferred():String
- {
- return (_currentStateDeferred != null) ? _currentStateDeferred : currentState;
+ // TODO
+ if (GOOG::DEBUG)
+ trace("currentState not implemented");
+
+ _currentState = value;
}
- /**
- * @private
- */
- private function set currentStateDeferred(value:String):void
- {
- _currentStateDeferred = value;
- if (value != null)
- invalidateProperties();
- }
-
//----------------------------------
// states
@@ -1840,6 +1766,9 @@ public class UIComponent extends UIBase
public function set states(value:Array):void
{
_states = value;
+ // TODO
+ if (GOOG::DEBUG)
+ trace("states not implemented");
}
//----------------------------------
@@ -1928,7 +1857,7 @@ public class UIComponent extends UIBase
_styleName = value;
// TODO
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("styleName not implemented");
}
@@ -1969,7 +1898,7 @@ public class UIComponent extends UIBase
_toolTip = value;
// TODO
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("toolTip not implemented");
dispatchEvent(new Event("toolTipChanged"));
@@ -2020,10 +1949,13 @@ public class UIComponent extends UIBase
/**
* @private
*/
- override public function addChild(child:IUIComponent):IUIComponent
+ COMPILE::SWF
+ { override }
+ [SWFOverride(returns="flash.display.DisplayObject",params="flash.display.DisplayObject",altparams="org.apache.royale.core.IUIComponent")]
+ public function addChild(child:IUIComponent):IUIComponent
{
// TODO
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("addChild not implemented");
@@ -2033,11 +1965,16 @@ public class UIComponent extends UIBase
/**
* @private
*/
- override public function addChildAt(child:IUIComponent,
+ COMPILE::SWF
+ {
+ override
+ }
+ [SWFOverride(returns="flash.display.DisplayObject",params="flash.display.DisplayObject",altparams="org.apache.royale.core.IUIComponent")]
+ public function addChildAt(child:IUIComponent,
index:int):IUIComponent
{
// TODO
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("addChildAt not implemented");
return child;
@@ -2046,10 +1983,15 @@ public class UIComponent extends UIBase
/**
* @private
*/
- override public function removeChild(child:IUIComponent):IUIComponent
+ [SWFOverride(returns="flash.display.DisplayObject",params="flash.display.DisplayObject",altparams="org.apache.royale.core.IUIComponent")]
+ COMPILE::SWF
+ {
+ override
+ }
+ public function removeChild(child:IUIComponent):IUIComponent
{
// TODO
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("removeChild not implemented");
return child;
@@ -2059,10 +2001,15 @@ public class UIComponent extends UIBase
/**
* @private
*/
- override public function removeChildAt(index:int):IUIComponent
+ [SWFOverride(returns="flash.display.DisplayObject")]
+ COMPILE::SWF
+ {
+ override
+ }
+ public function removeChildAt(index:int):IUIComponent
{
// TODO
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("removeChildAt not implemented");
var child:IUIComponent = getChildAt(index);
@@ -2070,20 +2017,94 @@ public class UIComponent extends UIBase
return child;
}
-
/**
* @private
+ * @royaleignorecoercion mx.core.IUIComponent
*/
+ [SWFOverride(returns="flash.display.DisplayObject")]
COMPILE::SWF
- override public function startDrag():void
{
- if (goog.DEBUG)
- trace("startDrag not implemented");
+ override
+ }
+ public function getChildAt(index:int):IUIComponent
+ {
+ COMPILE::SWF
+ {
+ return super.getChildAt(index) as IUIComponent;
+ }
+ COMPILE::JS
+ {
+ return getElementAt(index) as IUIComponent;
+ }
}
+
+ /**
+ * @private
+ */
COMPILE::JS
- public function startDrag():void
+ public function get numChildren():int
{
- if (goog.DEBUG)
+ return numElements;
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ { override }
+ [SWFOverride(params="flash.display.DisplayObject",altparams="org.apache.royale.core.IUIComponent")]
+ public function setChildIndex(child:IUIComponent, index:int):void
+ {
+ if (GOOG::DEBUG)
+ trace("setChildIndex not implemented");
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ { override }
+ [SWFOverride(params="flash.display.DisplayObject",altparams="org.apache.royale.core.IUIComponent")]
+ public function getChildIndex(child:IUIComponent):int
+ {
+ return getElementIndex(child);
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ { override }
+ [SWFOverride(returns="flash.display.DisplayObject")]
+ public function getChildByName(name:String):IUIComponent
+ {
+ if (GOOG::DEBUG)
+ trace("getChildByName not implemented");
+ return null;
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ { override }
+ [SWFOverride(params="flash.display.DisplayObject",altparams="org.apache.royale.core.IUIComponent")]
+ public function contains(child:IUIComponent):Boolean
+ {
+ if (GOOG::DEBUG)
+ trace("contains not implemented");
+ return true;
+ }
+
+ /**
+ * @private
+ */
+ COMPILE::SWF
+ { override }
+ [SWFOverride(params="flash.geom.Rectangle",altparams="org.apache.royale.geom.Rectangle")]
+ public function startDrag(lockCenter:Boolean = false, bounds:Rectangle = null):void
+ {
+ if (GOOG::DEBUG)
trace("startDrag not implemented");
}
@@ -2091,20 +2112,119 @@ public class UIComponent extends UIBase
* @private
*/
COMPILE::SWF
- override public function stopDrag():void
{
- if (goog.DEBUG)
- trace("stopDrag not implemented");
+ override
}
- COMPILE::JS
public function stopDrag():void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("stopDrag not implemented");
}
+ /**
+ * Initializes the internal structure of this component.
+ *
+ * <p>Initializing a UIComponent is the fourth step in the creation
+ * of a visual component instance, and happens automatically
+ * the first time that the instance is added to a parent.
+ * Therefore, you do not generally need to call
+ * <code>initialize()</code>; the Flex framework calls it for you
+ * from UIComponent's override of the <code>addChild()</code>
+ * and <code>addChildAt()</code> methods.</p>
+ *
+ * <p>The first step in the creation of a visual component instance
+ * is construction, with the <code>new</code> operator:</p>
+ *
+ * <pre>
+ * var okButton:Button = new Button();</pre>
+ *
+ * <p>After construction, the new Button instance is a solitary
+ * DisplayObject; it does not yet have a UITextField as a child
+ * to display its label, and it doesn't have a parent.</p>
+ *
+ * <p>The second step is configuring the newly-constructed instance
+ * with the appropriate properties, styles, and event handlers:</p>
+ *
+ * <pre>
+ * okButton.label = "OK";
+ * okButton.setStyle("cornerRadius", 0);
+ * okButton.addEventListener(MouseEvent.CLICK, clickHandler);</pre>
+ *
+ * <p>The third step is adding the instance to a parent:</p>
+ *
+ * <pre>
+ * someContainer.addChild(okButton);</pre>
+ *
+ * <p>A side effect of calling <code>addChild()</code>
+ * or <code>addChildAt()</code>, when adding a component to a parent
+ * for the first time, is that <code>initialize</code> gets
+ * automatically called.</p>
+ *
+ * <p>This method first dispatches a <code>preinitialize</code> event,
+ * giving developers using this component a chance to affect it
+ * before its internal structure has been created.
+ * Next it calls the <code>createChildren()</code> method
+ * to create the component's internal structure; for a Button,
+ * this method creates and adds the UITextField for the label.
+ * Then it dispatches an <code>initialize</code> event,
+ * giving developers a chance to affect the component
+ * after its internal structure has been created.</p>
+ *
+ * <p>Note that it is the act of attaching a component to a parent
+ * for the first time that triggers the creation of its internal structure.
+ * If its internal structure includes other UIComponents, then this is a
+ * recursive process in which the tree of DisplayObjects grows by one leaf
+ * node at a time.</p>
+ *
+ * <p>If you are writing a component, you do not need
+ * to override this method.</p>
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ public function initialize():void
+ {
+ if (initialized)
+ return;
+
+ // The "preinitialize" event gets dispatched after everything about this
+ // DisplayObject has been initialized, and it has been attached to
+ // its parent, but before any of its children have been created.
+ // This allows a "preinitialize" event handler to set properties which
+ // affect child creation.
+ // Note that this implies that "preinitialize" handlers are called
+ // top-down; i.e., parents before children.
+ dispatchEvent(new FlexEvent(FlexEvent.PREINITIALIZE));
+
+ createChildren();
+
+ // This should always be the last thing that initialize() calls.
+ initializationComplete();
+ }
/**
+ * Finalizes the initialization of this component.
+ *
+ * <p>This method is the last code that executes when you add a component
+ * to a parent for the first time using <code>addChild()</code>
+ * or <code>addChildAt()</code>.
+ * It handles some housekeeping related to dispatching
+ * the <code>initialize</code> event.
+ * If you are writing a component, you do not need
+ * to override this method.</p>
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ protected function initializationComplete():void
+ {
+ }
+
+ /**
* Create child objects of the component.
* This is an advanced method that you might override
* when creating a subclass of UIComponent.
@@ -2129,7 +2249,7 @@ public class UIComponent extends UIBase
*/
protected function createChildren():void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("createChildren not implemented");
}
@@ -2164,6 +2284,8 @@ public class UIComponent extends UIBase
*/
public function invalidateProperties():void
{
+ if (GOOG::DEBUG)
+ trace("invalidateProperties not implemented");
}
/**
@@ -2190,6 +2312,8 @@ public class UIComponent extends UIBase
*/
public function invalidateSize():void
{
+ if (GOOG::DEBUG)
+ trace("invalidateSize not implemented");
}
/**
@@ -2203,6 +2327,8 @@ public class UIComponent extends UIBase
*/
protected function invalidateParentSizeAndDisplayList():void
{
+ if (GOOG::DEBUG)
+ trace("invalidateParentSizeAndDisplayList not implemented");
}
/**
@@ -2229,9 +2355,79 @@ public class UIComponent extends UIBase
*/
public function invalidateDisplayList():void
{
+ if (GOOG::DEBUG)
+ trace("invalidateDisplayList not implemented");
}
/**
+ * localToGlobal
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ COMPILE::SWF
+ { override }
+ [SWFOverride(returns="flash.geom.Point",params="flash.geom.Point",altparams="org.apache.royale.geom.Point")]
+ public function localToGlobal(value:Point):Point
+ {
+ if (GOOG::DEBUG)
+ trace("localToGlobal not implemented");
+ return value;
+ }
+
+ /**
+ * globalToLocal
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ COMPILE::SWF
+ { override }
+ [SWFOverride(returns="flash.geom.Point",params="flash.geom.Point",altparams="org.apache.royale.geom.Point")]
+ public function globalToLocal(value:Point):Point
+ {
+ if (GOOG::DEBUG)
+ trace("globalToLocal not implemented");
+ return value;
+ }
+
+ /**
+ * mouseX
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ COMPILE::JS
+ public function get mouseX():Number
+ {
+ if (GOOG::DEBUG)
+ trace("mouseX not implemented");
+ return 0;
+ }
+
+ /**
+ * mouseY
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ COMPILE::JS
+ public function get mouseY():Number
+ {
+ if (GOOG::DEBUG)
+ trace("mouseX not implemented");
+ return 0;
+ }
+
+ /**
* Detects changes to style properties. When any style property is set,
* Flex calls the <code>styleChanged()</code> method,
* passing to it the name of the style being set.
@@ -2258,7 +2454,7 @@ public class UIComponent extends UIBase
*/
public function styleChanged(styleProp:String):void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("styleChanged not implemented");
}
@@ -2308,7 +2504,7 @@ public class UIComponent extends UIBase
public function callLater(method:Function,
args:Array /* of Object */ = null):void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("callLater not implemented");
}
@@ -2333,7 +2529,7 @@ public class UIComponent extends UIBase
*/
public function validateProperties():void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("validateProperties not implemented");
}
@@ -2364,7 +2560,7 @@ public class UIComponent extends UIBase
*/
protected function commitProperties():void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("commitProperties not implemented");
}
@@ -2384,7 +2580,7 @@ public class UIComponent extends UIBase
*/
public function validateSize(recursive:Boolean = false):void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("validateSize not implemented");
}
@@ -2549,8 +2745,9 @@ public class UIComponent extends UIBase
*/
public function measureText(text:String):TextLineMetrics
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("measureText not implemented");
+ return null;
}
//--------------------------------------------------------------------------
@@ -2579,7 +2776,7 @@ public class UIComponent extends UIBase
*/
public function validateDisplayList():void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("validateDisplayList not implemented");
}
@@ -2627,7 +2824,7 @@ public class UIComponent extends UIBase
protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("updateDisplayList not implemented");
}
@@ -2654,13 +2851,13 @@ public class UIComponent extends UIBase
*/
public function get left():Object
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("left not implemented");
return 0;
}
public function set left(value:Object):void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("left not implemented");
}
@@ -2686,13 +2883,13 @@ public class UIComponent extends UIBase
*/
public function get right():Object
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("right not implemented");
return 0;
}
public function set right(value:Object):void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("right not implemented");
}
@@ -2718,13 +2915,13 @@ public class UIComponent extends UIBase
*/
public function get top():Object
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("top not implemented");
return 0;
}
public function set top(value:Object):void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("top not implemented");
}
@@ -2750,13 +2947,13 @@ public class UIComponent extends UIBase
*/
public function get bottom():Object
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("bottom not implemented");
return 0;
}
public function set bottom(value:Object):void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("bottom not implemented");
}
@@ -2794,7 +2991,7 @@ public class UIComponent extends UIBase
*/
public function move(x:Number, y:Number):void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("move not implemented");
}
@@ -2820,7 +3017,7 @@ public class UIComponent extends UIBase
*/
public function setActualSize(w:Number, h:Number):void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("setActualSize not implemented");
}
@@ -2840,7 +3037,7 @@ public class UIComponent extends UIBase
*/
public function setFocus():void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("setFocus not implemented");
}
@@ -2888,7 +3085,7 @@ public class UIComponent extends UIBase
*/
public function getStyle(styleProp:String):*
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("getStyle not implemented");
return 0;
@@ -2913,7 +3110,7 @@ public class UIComponent extends UIBase
*/
public function setStyle(styleProp:String, newValue:*):void
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("setStyle not implemented");
}
@@ -2979,7 +3176,7 @@ public class UIComponent extends UIBase
*/
public function owns(child:IUIComponent):Boolean
{
- if (goog.DEBUG)
+ if (GOOG::DEBUG)
trace("owns not implemented");
return true;
}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/events/FlexEvent.as b/frameworks/projects/MXRoyale/src/main/royale/mx/events/FlexEvent.as
index 74c0b7f..de760cc 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/events/FlexEvent.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/events/FlexEvent.as
@@ -21,6 +21,7 @@ package mx.events
{
import org.apache.royale.events.Event;
+import org.apache.royale.events.IRoyaleEvent;
/**
* The FlexEvent class represents the event object passed to
@@ -1465,7 +1466,7 @@ public class FlexEvent extends Event
/**
* @private
*/
- override public function clone():Event
+ override public function cloneEvent():IRoyaleEvent
{
return new FlexEvent(type, bubbles, cancelable);
}
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/ISystemManager.as b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/ISystemManager.as
index 0db0f07..7aa7892 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/managers/ISystemManager.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/managers/ISystemManager.as
@@ -80,6 +80,27 @@ public interface ISystemManager extends IEventDispatcher, IChildList /*, IFlexMo
//
//--------------------------------------------------------------------------
+ //----------------------------------
+ // document
+ //----------------------------------
+
+ /**
+ * A reference to the document object.
+ * A document object is an Object at the top of the hierarchy of a
+ * Flex application, MXML component, or AS component.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 9
+ * @playerversion AIR 1.1
+ * @productversion Flex 3
+ */
+ function get document():Object;
+
+ /**
+ * @private
+ */
+ function set document(value:Object):void;
+
//--------------------------------------------------------------------------
//
// Methods
--
To stop receiving notification emails like this one, please contact
aharui@apache.org.